Search in sources :

Example 1 with PluginStateListener

use of com.intellij.ide.plugins.PluginStateListener in project azure-tools-for-java by Microsoft.

the class AzurePlugin method runActivity.

@Override
public void runActivity(@NotNull Project project) {
    this.azureSettings = AzureSettings.getSafeInstance(project);
    initializeAIRegistry(project);
    // Showing dialog needs to be run in UI thread
    initializeWhatsNew(project);
    if (!IS_ANDROID_STUDIO) {
        LOG.info("Starting Azure Plugin");
        firstInstallationByVersion = isFirstInstallationByVersion();
        try {
            // this code is for copying componentset.xml in plugins folder
            copyPluginComponents();
            if (pluginStateListener == null) {
                pluginStateListener = new PluginStateListener() {

                    @Override
                    public void install(@NotNull IdeaPluginDescriptor ideaPluginDescriptor) {
                    }

                    @Override
                    public void uninstall(@NotNull IdeaPluginDescriptor ideaPluginDescriptor) {
                        String pluginId = ideaPluginDescriptor.getPluginId().toString();
                        if (pluginId.equalsIgnoreCase(CommonConst.PLUGIN_ID)) {
                            EventUtil.logEvent(EventType.info, SYSTEM, PLUGIN_UNINSTALL, null, null);
                        }
                    }
                };
                PluginInstaller.addStateListener(pluginStateListener);
            }
            clearTempDirectory();
            loadWebappsSettings(project);
            afterInitialization(project);
        } catch (ProcessCanceledException e) {
            throw e;
        } catch (Exception e) {
            /* This is not a user initiated task
                   So user should not get any exception prompt.*/
            LOG.error(AzureBundle.message("expErlStrtUp"), e);
        }
    }
}
Also used : PluginStateListener(com.intellij.ide.plugins.PluginStateListener) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) FileNotFoundException(java.io.FileNotFoundException) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) IOException(java.io.IOException) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Aggregations

IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)1 PluginStateListener (com.intellij.ide.plugins.PluginStateListener)1 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1