use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.
the class UpdatePluginsFromCustomRepositoryTest method testOnlyCompatiblePluginsAreChecked.
@Test
public void testOnlyCompatiblePluginsAreChecked() throws Exception {
Map<PluginId, PluginDownloader> toUpdate = new LinkedHashMap<>();
IdeaPluginDescriptor[] descriptors = new IdeaPluginDescriptor[] { loadDescriptor("plugin1.xml"), loadDescriptor("plugin2.xml") };
BuildNumber currentBuildNumber = BuildNumber.fromString("IU-142.100");
for (IdeaPluginDescriptor descriptor : descriptors) {
PluginDownloader downloader = PluginDownloader.createDownloader(descriptor, null, currentBuildNumber);
UpdateChecker.checkAndPrepareToInstall(downloader, new InstalledPluginsState(), toUpdate, new ArrayList<>(), null);
}
assertEquals("Found: " + toUpdate.size(), 1, toUpdate.size());
PluginDownloader downloader = toUpdate.values().iterator().next();
assertNotNull(downloader);
assertEquals("0.1", downloader.getPluginVersion());
}
use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.
the class GitConfig method read.
/**
* Creates an instance of GitConfig by reading information from the specified {@code .git/config} file.
* <p/>
* If some section is invalid, it is skipped, and a warning is reported.
*/
@NotNull
static GitConfig read(@NotNull File configFile) {
GitConfig emptyConfig = new GitConfig(Collections.<Remote>emptyList(), Collections.<Url>emptyList(), Collections.<BranchConfig>emptyList());
if (!configFile.exists()) {
LOG.info("No .git/config file at " + configFile.getPath());
return emptyConfig;
}
Ini ini = new Ini();
// duplicate keys (e.g. url in [remote])
ini.getConfig().setMultiOption(true);
// don't need tree structure: it corrupts url in section name (e.g. [url "http://github.com/"]
ini.getConfig().setTree(false);
try {
ini.load(configFile);
} catch (IOException e) {
LOG.warn("Couldn't load .git/config file at " + configFile.getPath(), e);
return emptyConfig;
}
IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginManagerCore.getPluginByClassName(GitConfig.class.getName()));
ClassLoader classLoader = plugin == null ? // null e.g. if IDEA is started from IDEA
GitConfig.class.getClassLoader() : plugin.getPluginClassLoader();
Pair<Collection<Remote>, Collection<Url>> remotesAndUrls = parseRemotes(ini, classLoader);
Collection<BranchConfig> trackedInfos = parseTrackedInfos(ini, classLoader);
return new GitConfig(remotesAndUrls.getFirst(), remotesAndUrls.getSecond(), trackedInfos);
}
use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-elixir by KronicDeth.
the class Submitter method errorBean.
@NotNull
private static ErrorBean errorBean(@NotNull IdeaLoggingEvent[] events, String additionalInfo) {
IdeaLoggingEvent event = events[0];
ErrorBean bean = new ErrorBean(event.getThrowable(), IdeaLogger.ourLastActionId);
bean.setDescription(additionalInfo);
bean.setMessage(event.getMessage());
Throwable throwable = event.getThrowable();
if (throwable != null) {
final PluginId pluginId = IdeErrorsDialog.findPluginId(throwable);
if (pluginId != null) {
final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId);
if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) {
bean.setPluginName(ideaPluginDescriptor.getName());
bean.setPluginVersion(ideaPluginDescriptor.getVersion());
}
}
}
Object data = event.getData();
if (data instanceof LogMessageEx) {
bean.setAttachments(includedAttachments((LogMessageEx) data));
}
return bean;
}
use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.
the class ExtensionsRootType method getPluginResourcesRootName.
@Nullable
private String getPluginResourcesRootName(VirtualFile resourcesDir) throws IOException {
PluginId ownerPluginId = getOwner(resourcesDir);
if (ownerPluginId == null)
return null;
if (PluginManagerCore.CORE_PLUGIN_ID.equals(ownerPluginId.getIdString())) {
return PlatformUtils.getPlatformPrefix();
}
IdeaPluginDescriptor plugin = PluginManager.getPlugin(ownerPluginId);
if (plugin != null) {
return plugin.getName();
}
return null;
}
use of com.intellij.ide.plugins.IdeaPluginDescriptor in project intellij-community by JetBrains.
the class GutterIconsConfigurable method createUIComponents.
private void createUIComponents() {
myList = new CheckBoxList<GutterIconDescriptor>() {
@Override
protected JComponent adjustRendering(JComponent rootComponent, JCheckBox checkBox, int index, boolean selected, boolean hasFocus) {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder());
GutterIconDescriptor descriptor = myList.getItemAt(index);
Icon icon = descriptor == null ? null : descriptor.getIcon();
JLabel label = new JLabel(icon == null ? EmptyIcon.ICON_16 : icon);
label.setOpaque(true);
label.setPreferredSize(new Dimension(25, -1));
label.setHorizontalAlignment(SwingConstants.CENTER);
panel.add(label, BorderLayout.WEST);
panel.add(checkBox, BorderLayout.CENTER);
panel.setBackground(getBackground(false));
label.setBackground(getBackground(selected));
if (!checkBox.isOpaque()) {
checkBox.setOpaque(true);
}
checkBox.setBorder(null);
PluginDescriptor pluginDescriptor = myFirstDescriptors.get(descriptor);
if (pluginDescriptor instanceof IdeaPluginDescriptor) {
SeparatorWithText separator = new SeparatorWithText();
String name = ((IdeaPluginDescriptor) pluginDescriptor).getName();
separator.setCaption("IDEA CORE".equals(name) ? "Common" : name);
panel.add(separator, BorderLayout.NORTH);
}
return panel;
}
@Nullable
@Override
protected Point findPointRelativeToCheckBox(int x, int y, @NotNull JCheckBox checkBox, int index) {
return super.findPointRelativeToCheckBoxWithAdjustedRendering(x, y, checkBox, index);
}
};
myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
myList.setBorder(BorderFactory.createEmptyBorder());
}
Aggregations