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;
}
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);
}
}
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);
}
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();
}
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);
}
}
}
Aggregations