Alternative for StartupActivity interface for IntelliJ Platform 2025.x

Hello,

I used the StartupActivity interface (with uding runActivity() method) to run my plugin on CLion 2023.x, but I notice that this interface is currently obsolete when we want to run the plugin on CLion v2025.x, what is the alternative of this interface that could be deployed on the current version of CLion ?

This is the context of the method inside the plugin :

/**
 * Executed at CLion startup.
 * - Initializes the project context
 * - Resets all previous parsing state
 * - Loads all currently opened JSON files with their dependencies
 * - Subscribes to file open events in the IDE
 */
@Override
public void runActivity(@NotNull Project project) {
    JsonNavController service = project.getService(JsonNavController.class);
    JsonNavController controller = project.getService(JsonNavController.class);

    controller.resetAll();
    controller.initPlugin(project);

    // Listen for user opening files in the editor
    project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
        @Override
        public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
            if (file.getName().endsWith(DOT_JSON)) {
                try {
                    // Refresh parsing when a JSON file is opened
                    controller.refreshJsonFile(file.getPath());
                } catch (JsonNavFatalException e) {
                    notifierInterface.notify("Parsing aborted for " + file + ": " + e.getMessage());
                    service.getNotifier().notify("Parsing aborted for " + file + ": " + e.getMessage());
                }
            }
        }
    });
}

Thanks in advance for the help ! :slight_smile:

Hi, as IJ SDK says

Using Kotlin coroutines, implement ProjectActivity and register in com.intellij.postStartupActivity extension point.

Implementation in Kotlin is required though because Java doesn’t support suspending functions.

You had better use declarative listeners in plugin.xml if possible instead of programmatic registration.

You can easily create one via a template from File - New - Startup Activity:

And pick Immediate Activity here:

import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.ProjectActivity

internal class MyStartupActivity : ProjectActivity {
    override suspend fun execute(project: Project) {

    }
}