use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.
the class InstalledPluginsTableModel method updatePluginDependencies.
protected void updatePluginDependencies() {
myDependentToRequiredListMap.clear();
final int rowCount = getRowCount();
for (int i = 0; i < rowCount; i++) {
final IdeaPluginDescriptor descriptor = getObjectAt(i);
final PluginId pluginId = descriptor.getPluginId();
myDependentToRequiredListMap.remove(pluginId);
if (descriptor instanceof IdeaPluginDescriptorImpl && ((IdeaPluginDescriptorImpl) descriptor).isDeleted())
continue;
final Boolean enabled = myEnabled.get(pluginId);
if (enabled == null || enabled.booleanValue()) {
PluginManagerCore.checkDependants(descriptor, pluginId1 -> PluginManager.getPlugin(pluginId1), dependantPluginId -> {
final Boolean enabled1 = myEnabled.get(dependantPluginId);
if ((enabled1 == null && !ourState.wasUpdated(dependantPluginId)) || (enabled1 != null && !enabled1.booleanValue())) {
Set<PluginId> required = myDependentToRequiredListMap.get(pluginId);
if (required == null) {
required = new HashSet<>();
myDependentToRequiredListMap.put(pluginId, required);
}
required.add(dependantPluginId);
}
return true;
});
if (enabled == null && !myDependentToRequiredListMap.containsKey(pluginId) && PluginManagerCore.isCompatible(descriptor)) {
myEnabled.put(pluginId, true);
}
}
}
}
use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.
the class PluginDownloader method createDownloader.
@NotNull
public static PluginDownloader createDownloader(@NotNull IdeaPluginDescriptor descriptor, @Nullable String host, @Nullable BuildNumber buildNumber, boolean forceHttps) throws IOException {
try {
String url = getUrl(descriptor, host, buildNumber);
String id = descriptor.getPluginId().getIdString();
PluginDownloader downloader = new PluginDownloader(id, url, descriptor.getName(), descriptor.getVersion(), buildNumber, forceHttps);
downloader.setDescriptor(descriptor);
downloader.setDescription(descriptor.getDescription());
List<PluginId> depends;
if (descriptor instanceof PluginNode) {
depends = ((PluginNode) descriptor).getDepends();
} else {
depends = new ArrayList<>(Arrays.asList(descriptor.getDependentPluginIds()));
}
downloader.setDepends(depends);
return downloader;
} catch (URISyntaxException e) {
throw new IOException(e);
}
}
use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.
the class IdeaPluginDescriptorImpl method readExternal.
// used in upsource
protected void readExternal(@NotNull Element element) {
final PluginBean pluginBean = XmlSerializer.deserialize(element, PluginBean.class);
url = pluginBean.url;
myName = pluginBean.name;
String idString = pluginBean.id;
if (idString == null || idString.isEmpty()) {
idString = myName;
}
myId = idString == null ? null : PluginId.getId(idString);
String internalVersionString = pluginBean.formatVersion;
if (internalVersionString != null) {
try {
//noinspection ResultOfMethodCallIgnored
Integer.parseInt(internalVersionString);
} catch (NumberFormatException e) {
LOG.error(new PluginException("Invalid value in plugin.xml format version: '" + internalVersionString + "'", e, myId));
}
}
myUseIdeaClassLoader = pluginBean.useIdeaClassLoader;
myAllowBundledUpdate = pluginBean.allowBundledUpdate;
if (pluginBean.ideaVersion != null) {
mySinceBuild = pluginBean.ideaVersion.sinceBuild;
myUntilBuild = convertExplicitBigNumberInUntilBuildToStar(pluginBean.ideaVersion.untilBuild);
}
myResourceBundleBaseName = pluginBean.resourceBundle;
myDescriptionChildText = pluginBean.description;
myChangeNotes = pluginBean.changeNotes;
myVersion = pluginBean.pluginVersion;
if (myVersion == null) {
myVersion = PluginManagerCore.getBuildNumber().asStringWithoutProductCode();
}
myCategory = pluginBean.category;
if (pluginBean.vendor != null) {
myVendor = pluginBean.vendor.name;
myVendorEmail = pluginBean.vendor.email;
myVendorUrl = pluginBean.vendor.url;
myVendorLogoPath = pluginBean.vendor.logo;
}
// preserve items order as specified in xml (filterBadPlugins will not fail if module comes first)
Set<PluginId> dependentPlugins = new LinkedHashSet<>();
Set<PluginId> optionalDependentPlugins = new LinkedHashSet<>();
if (pluginBean.dependencies != null) {
myOptionalConfigs = new THashMap<>();
for (PluginDependency dependency : pluginBean.dependencies) {
String text = dependency.pluginId;
if (!StringUtil.isEmpty(text)) {
PluginId id = PluginId.getId(text);
dependentPlugins.add(id);
if (dependency.optional) {
optionalDependentPlugins.add(id);
if (!StringUtil.isEmpty(dependency.configFile)) {
myOptionalConfigs.put(id, dependency.configFile);
}
}
}
}
}
myDependencies = dependentPlugins.isEmpty() ? PluginId.EMPTY_ARRAY : dependentPlugins.toArray(new PluginId[dependentPlugins.size()]);
myOptionalDependencies = optionalDependentPlugins.isEmpty() ? PluginId.EMPTY_ARRAY : optionalDependentPlugins.toArray(new PluginId[optionalDependentPlugins.size()]);
if (pluginBean.helpSets == null || pluginBean.helpSets.length == 0) {
myHelpSets = HelpSetPath.EMPTY;
} else {
myHelpSets = new HelpSetPath[pluginBean.helpSets.length];
PluginHelpSet[] sets = pluginBean.helpSets;
for (int i = 0, n = sets.length; i < n; i++) {
PluginHelpSet pluginHelpSet = sets[i];
myHelpSets[i] = new HelpSetPath(pluginHelpSet.file, pluginHelpSet.path);
}
}
myAppComponents = pluginBean.applicationComponents;
myProjectComponents = pluginBean.projectComponents;
myModuleComponents = pluginBean.moduleComponents;
if (myAppComponents == null)
myAppComponents = ComponentConfig.EMPTY_ARRAY;
if (myProjectComponents == null)
myProjectComponents = ComponentConfig.EMPTY_ARRAY;
if (myModuleComponents == null)
myModuleComponents = ComponentConfig.EMPTY_ARRAY;
StringInterner interner = new StringInterner();
List<Element> extensions = copyElements(pluginBean.extensions, interner);
if (extensions != null) {
myExtensions = MultiMap.createSmart();
for (Element extension : extensions) {
myExtensions.putValue(ExtensionsAreaImpl.extractEPName(extension), extension);
}
}
List<Element> extensionPoints = copyElements(pluginBean.extensionPoints, interner);
if (extensionPoints != null) {
myExtensionsPoints = MultiMap.createSmart();
for (Element extensionPoint : extensionPoints) {
myExtensionsPoints.putValue(StringUtil.notNullize(extensionPoint.getAttributeValue(ExtensionsAreaImpl.ATTRIBUTE_AREA)), extensionPoint);
}
}
myActionsElements = copyElements(pluginBean.actions, interner);
if (pluginBean.modules != null && !pluginBean.modules.isEmpty()) {
myModules = pluginBean.modules;
}
}
use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.
the class PluginClassCache method dumpPluginClassStatistics.
public void dumpPluginClassStatistics() {
if (!Boolean.valueOf(System.getProperty("idea.is.internal")).booleanValue())
return;
List<PluginId> counters;
synchronized (ourLock) {
//noinspection unchecked
counters = new ArrayList(Arrays.asList(myClassCounts.keys()));
}
counters.sort((o1, o2) -> myClassCounts.get(o2) - myClassCounts.get(o1));
for (PluginId id : counters) {
PluginManagerCore.getLogger().info(id + " loaded " + myClassCounts.get(id) + " classes");
}
}
use of com.intellij.openapi.extensions.PluginId in project intellij-community by JetBrains.
the class IntentionDescriptionPanel method setupPoweredByPanel.
private void setupPoweredByPanel(final IntentionActionMetaData actionMetaData) {
PluginId pluginId = actionMetaData == null ? null : actionMetaData.getPluginId();
JComponent owner;
if (pluginId == null) {
@NonNls String label = XmlStringUtil.wrapInHtml("<b>" + ApplicationNamesInfo.getInstance().getFullProductName() + "</b>");
owner = new JLabel(label);
} else {
final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(pluginId);
HyperlinkLabel label = new HyperlinkLabel(CodeInsightBundle.message("powered.by.plugin", pluginDescriptor.getName()));
label.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
final PluginManagerConfigurable pluginConfigurable = new PluginManagerConfigurable(PluginManagerUISettings.getInstance());
final Project project = ProjectManager.getInstance().getDefaultProject();
util.editConfigurable(project, pluginConfigurable, () -> pluginConfigurable.select(pluginDescriptor));
}
});
owner = label;
}
//myPoweredByContainer.setVisible(true);
myPoweredByPanel.removeAll();
myPoweredByPanel.add(owner, BorderLayout.CENTER);
}
Aggregations