Search in sources :

Example 31 with IdeaPluginDescriptor

use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.

the class PluginGroups method getNonOptionalDependencies.

private List<String> getNonOptionalDependencies(final String id) {
    List<String> result = new ArrayList<>();
    IdeaPluginDescriptor descriptor = findPlugin(id);
    if (descriptor != null) {
        for (PluginId pluginId : descriptor.getDependentPluginIds()) {
            if (pluginId.getIdString().equals("com.intellij"))
                continue;
            if (!ArrayUtil.contains(pluginId, descriptor.getOptionalDependentPluginIds())) {
                result.add(pluginId.getIdString());
            }
        }
    }
    return result;
}
Also used : IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) PluginId(com.intellij.openapi.extensions.PluginId)

Example 32 with IdeaPluginDescriptor

use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.

the class SelectPluginsStep method onNext.

@Override
public WizardStep onNext(final StartupWizardModel model) {
    final WizardStep next = super.onNext(model);
    if (next instanceof SelectPluginsStep) {
        final SelectPluginsStep selectPluginsStep = (SelectPluginsStep) next;
        final String id = selectPluginsStep.getRequirePlugin();
        if (id != null && model.getDisabledPluginIds().contains(id) && !model.isLast(next)) {
            for (IdeaPluginDescriptor descriptor : selectPluginsStep.getPlugins()) {
                model.getDisabledPluginIds().add(descriptor.getPluginId().getIdString());
            }
            return model.getNextFor(next);
        }
    }
    return next;
}
Also used : WizardStep(com.intellij.ui.wizard.WizardStep) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor)

Example 33 with IdeaPluginDescriptor

use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.

the class StartupWizardModel method getDependentsOnEarlierPages.

public List<IdeaPluginDescriptor> getDependentsOnEarlierPages(IdeaPluginDescriptor descriptor, boolean includeSamePage) {
    List<IdeaPluginDescriptor> dependents = new ArrayList<>();
    int thisStep = getPluginStepIndex(descriptor);
    for (IdeaPluginDescriptor dependent : myBackwardDependencies.get(descriptor)) {
        if (!myDisabledPluginIds.contains(dependent.getPluginId().toString())) {
            int index = getPluginStepIndex(dependent);
            if (index < thisStep || (includeSamePage && index == thisStep && getDependentsOnEarlierPages(dependent, true).size() > 0)) {
                dependents.add(dependent);
            }
        }
    }
    return dependents;
}
Also used : IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor)

Example 34 with IdeaPluginDescriptor

use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.

the class PluginAdvertiserEditorNotificationProvider method createPanel.

@Nullable
private EditorNotificationPanel createPanel(final String extension, final Set<PluginsAdvertiser.Plugin> plugins) {
    final EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.setText("Plugins supporting " + extension + " files found.");
    final IdeaPluginDescriptor disabledPlugin = PluginsAdvertiser.getDisabledPlugin(plugins);
    if (disabledPlugin != null) {
        panel.createActionLabel("Enable " + disabledPlugin.getName() + " plugin", () -> {
            myEnabledExtensions.add(extension);
            myNotifications.updateAllNotifications();
            PluginsAdvertiser.enablePlugins(myProject, Collections.singletonList(disabledPlugin));
        });
    } else if (hasNonBundledPlugin(plugins)) {
        panel.createActionLabel("Install plugins", () -> {
            Set<String> pluginIds = new HashSet<>();
            for (PluginsAdvertiser.Plugin plugin : plugins) {
                pluginIds.add(plugin.myPluginId);
            }
            PluginsAdvertiser.installAndEnablePlugins(pluginIds, () -> {
                myEnabledExtensions.add(extension);
                myNotifications.updateAllNotifications();
            });
        });
    } else if (PluginsAdvertiser.hasBundledPluginToInstall(plugins) != null) {
        if (PropertiesComponent.getInstance().isTrueValue(PluginsAdvertiser.IGNORE_ULTIMATE_EDITION)) {
            return null;
        }
        panel.setText(extension + " files are supported by " + PluginsAdvertiser.IDEA_ULTIMATE_EDITION);
        panel.createActionLabel(PluginsAdvertiser.CHECK_ULTIMATE_EDITION_TITLE, () -> {
            myEnabledExtensions.add(extension);
            PluginsAdvertiser.openDownloadPage();
        });
        panel.createActionLabel(PluginsAdvertiser.ULTIMATE_EDITION_SUGGESTION, () -> {
            PropertiesComponent.getInstance().setValue(PluginsAdvertiser.IGNORE_ULTIMATE_EDITION, "true");
            myNotifications.updateAllNotifications();
        });
    } else {
        return null;
    }
    panel.createActionLabel("Ignore extension", () -> {
        UnknownFeaturesCollector.getInstance(myProject).ignoreFeature(createExtensionFeature(extension));
        myNotifications.updateAllNotifications();
    });
    return panel;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) Nullable(org.jetbrains.annotations.Nullable)

Example 35 with IdeaPluginDescriptor

use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.

the class BadPluginTest method testBadPlugin.

public void testBadPlugin() throws Exception {
    IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(COM_YOUR_COMPANY_UNIQUE_PLUGIN_ID));
    if (plugin == null)
        return;
    List<String> disabledPlugins = new ArrayList<>();
    PluginManagerCore.loadDisabledPlugins(PathManager.getConfigPath(), disabledPlugins);
    assertEquals(1, disabledPlugins.size());
    assertEquals(COM_YOUR_COMPANY_UNIQUE_PLUGIN_ID, disabledPlugins.get(0));
}
Also used : ArrayList(java.util.ArrayList) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor)

Aggregations

IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)41 PluginId (com.intellij.openapi.extensions.PluginId)19 NotNull (org.jetbrains.annotations.NotNull)11 Nullable (org.jetbrains.annotations.Nullable)8 Project (com.intellij.openapi.project.Project)4 File (java.io.File)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 ErrorBean (com.intellij.errorreport.bean.ErrorBean)3 ApplicationInfoEx (com.intellij.openapi.application.ex.ApplicationInfoEx)3 IdeaLoggingEvent (com.intellij.openapi.diagnostic.IdeaLoggingEvent)3 URL (java.net.URL)3 LogMessageEx (com.intellij.diagnostic.LogMessageEx)2 CantRunException (com.intellij.execution.CantRunException)2 PluginClassLoader (com.intellij.ide.plugins.cl.PluginClassLoader)2 DataContext (com.intellij.openapi.actionSystem.DataContext)2 SubmittedReportInfo (com.intellij.openapi.diagnostic.SubmittedReportInfo)2 PluginDescriptor (com.intellij.openapi.extensions.PluginDescriptor)2 ShowSettingsUtil (com.intellij.openapi.options.ShowSettingsUtil)2 Sdk (com.intellij.openapi.projectRoots.Sdk)2