Search in sources :

Example 36 with PluginId

use of com.intellij.openapi.extensions.PluginId 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 37 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.

the class UninstallPluginAction method uninstallPlugin.

private static void uninstallPlugin(IdeaPluginDescriptorImpl descriptor, PluginManagerMain host) {
    PluginId pluginId = descriptor.getPluginId();
    descriptor.setDeleted(true);
    try {
        PluginInstaller.prepareToUninstall(pluginId);
        host.setRequireShutdown(descriptor.isEnabled());
    } catch (IOException e1) {
        PluginManagerMain.LOG.error(e1);
    }
}
Also used : IOException(java.io.IOException) PluginId(com.intellij.openapi.extensions.PluginId)

Example 38 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.

the class InstallPluginAction method update.

@Override
public void update(AnActionEvent e) {
    Presentation presentation = e.getPresentation();
    IdeaPluginDescriptor[] selection = getPluginTable().getSelectedObjects();
    boolean enabled = (selection != null);
    if (enabled) {
        for (IdeaPluginDescriptor descr : selection) {
            presentation.setText(IdeBundle.message("action.download.and.install.plugin"));
            presentation.setDescription(IdeBundle.message("action.download.and.install.plugin"));
            enabled &= !ourInstallingNodes.contains(descr);
            if (descr instanceof PluginNode) {
                enabled &= !PluginManagerColumnInfo.isDownloaded((PluginNode) descr);
                if (((PluginNode) descr).getStatus() == PluginNode.STATUS_INSTALLED) {
                    presentation.setText(IdeBundle.message("action.update.plugin"));
                    presentation.setDescription(IdeBundle.message("action.update.plugin"));
                    enabled &= ourState.hasNewerVersion(descr.getPluginId());
                }
            } else if (descr instanceof IdeaPluginDescriptorImpl) {
                presentation.setText(IdeBundle.message("action.update.plugin"));
                presentation.setDescription(IdeBundle.message("action.update.plugin"));
                PluginId id = descr.getPluginId();
                enabled = enabled && ourState.hasNewerVersion(id);
            }
        }
    }
    presentation.setEnabled(enabled);
}
Also used : Presentation(com.intellij.openapi.actionSystem.Presentation) PluginId(com.intellij.openapi.extensions.PluginId)

Example 39 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.

the class InstalledPluginsManagerMain method canApply.

@Override
protected String canApply() {
    final Map<PluginId, Set<PluginId>> dependentToRequiredListMap = new HashMap<>(((InstalledPluginsTableModel) pluginsModel).getDependentToRequiredListMap());
    for (Iterator<PluginId> iterator = dependentToRequiredListMap.keySet().iterator(); iterator.hasNext(); ) {
        final PluginId id = iterator.next();
        boolean hasNonModuleDeps = false;
        for (PluginId pluginId : dependentToRequiredListMap.get(id)) {
            if (!PluginManagerCore.isModuleDependency(pluginId)) {
                hasNonModuleDeps = true;
                break;
            }
        }
        if (!hasNonModuleDeps) {
            iterator.remove();
        }
    }
    if (!dependentToRequiredListMap.isEmpty()) {
        return "<html><body style=\"padding: 5px;\">Unable to apply changes: plugin" + (dependentToRequiredListMap.size() == 1 ? " " : "s ") + StringUtil.join(dependentToRequiredListMap.keySet(), pluginId -> {
            final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
            return "\"" + (ideaPluginDescriptor != null ? ideaPluginDescriptor.getName() : pluginId.getIdString()) + "\"";
        }, ", ") + " won't be able to load.</body></html>";
    }
    return super.canApply();
}
Also used : PluginId(com.intellij.openapi.extensions.PluginId)

Example 40 with PluginId

use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.

the class InstalledPluginsState method onDescriptorDownload.

/**
   * Should be called whenever a list of plugins is loaded from a repository to check if there is an updated version.
   */
public void onDescriptorDownload(@NotNull IdeaPluginDescriptor descriptor) {
    PluginId id = descriptor.getPluginId();
    IdeaPluginDescriptor existing = PluginManager.getPlugin(id);
    if (existing == null || (existing.isBundled() && !existing.allowBundledUpdate()) || wasUpdated(id)) {
        return;
    }
    boolean supersedes = PluginManagerCore.isCompatible(descriptor) && PluginDownloader.compareVersionsSkipBrokenAndIncompatible(existing, descriptor.getVersion()) > 0;
    String idString = id.getIdString();
    synchronized (myLock) {
        if (supersedes) {
            myOutdatedPlugins.add(idString);
        } else {
            myOutdatedPlugins.remove(idString);
        }
    }
}
Also used : PluginId(com.intellij.openapi.extensions.PluginId)

Aggregations

PluginId (com.intellij.openapi.extensions.PluginId)54 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)25 NotNull (org.jetbrains.annotations.NotNull)10 IOException (java.io.IOException)8 IdeaLoggingEvent (com.intellij.openapi.diagnostic.IdeaLoggingEvent)6 Project (com.intellij.openapi.project.Project)6 Nullable (org.jetbrains.annotations.Nullable)6 SubmittedReportInfo (com.intellij.openapi.diagnostic.SubmittedReportInfo)5 PluginException (com.intellij.diagnostic.PluginException)4 DataContext (com.intellij.openapi.actionSystem.DataContext)4 NonNls (org.jetbrains.annotations.NonNls)4 ErrorBean (com.intellij.errorreport.bean.ErrorBean)3 EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)3 PluginDownloader (com.intellij.openapi.updateSettings.impl.PluginDownloader)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 File (java.io.File)3 AbstractMessage (com.intellij.diagnostic.AbstractMessage)2 LogMessageEx (com.intellij.diagnostic.LogMessageEx)2 CantRunException (com.intellij.execution.CantRunException)2 DataManager (com.intellij.ide.DataManager)2