com.intellij.ide.plugins.IdeaPluginDescriptor Java Examples
The following examples show how to use
com.intellij.ide.plugins.IdeaPluginDescriptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageManagerImpl.java From ycy-intellij-plugin with GNU General Public License v3.0 | 6 votes |
/** * 从插件 jar 中获取默认图片列表 * * <p>默认图片地址是 "jar:file://{@code ${pluginPath}}/ycy-intellij-plugin.jar!/images/1.jpg"</p> */ private List<URL> init() { PluginId pluginId = PluginId.getId(GlobalConfig.PLUGIN_ID); IdeaPluginDescriptor plugin = PluginManager.getPlugin(pluginId); if (plugin == null) { LOG.error("fail to get plugin \"" + GlobalConfig.PLUGIN_ID + "\""); throw new NullPointerException("fail to get plugin \"" + GlobalConfig.PLUGIN_ID + "\""); } File pluginPath = plugin.getPath(); try { List<URL> defaultImageUrlList = new ArrayList<>(10); for (int i = 1; i <= 10; i++) { final String imageUrlPath = "jar:" + pluginPath.toURI().toURL().toString() + "!/images/" + i + ".jpg"; URL imageUrl = new URL(imageUrlPath); defaultImageUrlList.add(imageUrl); } return defaultImageUrlList; } catch (MalformedURLException e) { LOG.error("fail to get the default image url list", e); throw new RuntimeException("fail to get the default imageUrl", e); } }
Example #2
Source File: ServiceHelperCompat.java From intellij with Apache License 2.0 | 6 votes |
public static <T> void registerService( ComponentManager componentManager, Class<T> key, T implementation, Disposable parentDisposable) { @SuppressWarnings({"rawtypes", "unchecked"}) // #api193: wildcard generics added in 2020.1 List<? extends IdeaPluginDescriptor> loadedPlugins = (List) PluginManager.getLoadedPlugins(); Optional<? extends IdeaPluginDescriptor> platformPlugin = loadedPlugins.stream() .filter(descriptor -> descriptor.getName().startsWith("IDEA CORE")) .findAny(); Verify.verify(platformPlugin.isPresent()); ((ComponentManagerImpl) componentManager) .registerServiceInstance(key, implementation, platformPlugin.get()); }
Example #3
Source File: KPXStartupNotification.java From IntelliJ-Key-Promoter-X with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void runActivity(@NotNull Project project) { if (ApplicationManager.getApplication().isUnitTestMode()) return; final Application application = ApplicationManager.getApplication(); final KeyPromoterSettings settings = ServiceManager.getService(KeyPromoterSettings.class); final String installedVersion = settings.getInstalledVersion(); final IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(PluginId.getId("Key Promoter X")); if (installedVersion != null && plugin != null) { final int compare = VersionComparatorUtil.compare(installedVersion, plugin.getVersion()); // if (true) { // TODO: Don't forget to remove that! For proofreading. if (compare < 0) { application.invokeLater(() -> KPXStartupDialog.showStartupDialog(project)); settings.setInstalledVersion(plugin.getVersion()); } } }
Example #4
Source File: TYPO3DetectionListener.java From idea-php-typo3-plugin with MIT License | 6 votes |
@Override public void projectOpened(@NotNull Project project) { this.checkProject(project); TYPO3CMSSettings instance = TYPO3CMSSettings.getInstance(project); IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("com.cedricziel.idea.typo3")); if (plugin == null) { return; } String version = instance.getVersion(); if (version == null || !plugin.getVersion().equals(version)) { instance.setVersion(plugin.getVersion()); FileBasedIndex index = FileBasedIndex.getInstance(); index.scheduleRebuild(CoreServiceMapStubIndex.KEY, new Throwable()); index.scheduleRebuild(ExtensionNameStubIndex.KEY, new Throwable()); index.scheduleRebuild(IconIndex.KEY, new Throwable()); index.scheduleRebuild(ResourcePathIndex.KEY, new Throwable()); index.scheduleRebuild(RouteIndex.KEY, new Throwable()); index.scheduleRebuild(TablenameFileIndex.KEY, new Throwable()); index.scheduleRebuild(LegacyClassesForIDEIndex.KEY, new Throwable()); index.scheduleRebuild(MethodArgumentDroppedIndex.KEY, new Throwable()); index.scheduleRebuild(ControllerActionIndex.KEY, new Throwable()); } }
Example #5
Source File: RestUtils.java From SmartIM4IntelliJ with Apache License 2.0 | 6 votes |
public static String getWelcome(String im) { try { final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.findId("cn.ieclipse.smartqq.intellij")); Request.Builder builder = new Request.Builder().url(String.format(welcome_format, "intellij", im, descriptor.getVersion())).get(); Request request = builder.build(); Call call = new OkHttpClient().newCall(request); Response response = call.execute(); String json = response.body().string(); if (response.code() == 200) { return json; } } catch (Exception e) { } return null; }
Example #6
Source File: BlazeIntellijPluginDeployer.java From intellij with Apache License 2.0 | 6 votes |
@Nullable private static String readPluginIdFromJar(String buildNumber, File jar) throws ExecutionException { IdeaPluginDescriptor pluginDescriptor = PluginManagerCore.loadDescriptor(jar, "plugin.xml"); if (pluginDescriptor == null) { return null; } if (PluginManagerCore.isIncompatible(pluginDescriptor, BuildNumber.fromString(buildNumber))) { throw new ExecutionException( String.format( "Plugin SDK version '%s' is incompatible with this plugin " + "(since: '%s', until: '%s')", buildNumber, pluginDescriptor.getSinceBuild(), pluginDescriptor.getUntilBuild())); } return pluginDescriptor.getPluginId().getIdString(); }
Example #7
Source File: SpringFormatComponent.java From spring-javaformat with Apache License 2.0 | 6 votes |
private void registerCodeStyleManager(CodeStyleManager manager) { if (ApplicationInfo.getInstance().getBuild().getBaselineVersion() >= 193) { IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(PluginId.getId("spring-javaformat")); try { ((ComponentManagerImpl) this.project).registerServiceInstance(CodeStyleManager.class, manager, plugin); } catch (NoSuchMethodError ex) { Method method = findRegisterServiceInstanceMethod(this.project.getClass()); invokeRegisterServiceInstanceMethod(manager, plugin, method); } } else { MutablePicoContainer container = (MutablePicoContainer) this.project.getPicoContainer(); container.unregisterComponent(CODE_STYLE_MANAGER_KEY); container.registerComponentInstance(CODE_STYLE_MANAGER_KEY, manager); } }
Example #8
Source File: CrashDump.java From floobits-intellij with Apache License 2.0 | 6 votes |
private void addContextInfo(HashMap<String, String> message) { IdeaPluginDescriptor p = getPlugin(); if (p != null) { message.put("floobits_plugin_version", p.getVersion()); } else { message.put("floobits_plugin_version", "No version information."); } message.put("sendingAt", String.format("%s", new Date().getTime())); Properties props = System.getProperties(); message.put("OS", String.format("name: %s arch: %s version: %s", props.getProperty("os.name"), props.getProperty("os.arch"), props.getProperty("os.version"))); message.put("cwd", props.getProperty("user.dir")); message.put("file_separator", props.getProperty("file.separator")); message.put("path_separator", props.getProperty("path.separator")); message.put("line_separator", props.getProperty("line.separator")); message.put("java_version", props.getProperty("java.version")); message.put("java_vendor", props.getProperty("java.vendor")); }
Example #9
Source File: PanelDialog.java From GitCommitMessage with Apache License 2.0 | 5 votes |
PanelDialog(@Nullable Project project) { super(project); panel = new Panel(project); IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(PluginId.getId("git-commit-message-plugin")); String version = ""; if (pluginDescriptor != null) { version = pluginDescriptor.getVersion(); } setTitle("Git / Hg Mercurial Commit Message Plugin. Version: " + version); setOKButtonText("OK"); setSize(300, 200); init(); }
Example #10
Source File: DartPlugin.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @return the version of the currently installed Dart Plugin */ public Version getVersion() { if (myVersion == null) { final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.getId("Dart")); assert (descriptor != null); myVersion = Version.parseVersion(descriptor.getVersion()); } return myVersion; }
Example #11
Source File: ProtostuffPluginController.java From protobuf-jetbrains-plugin with Apache License 2.0 | 5 votes |
private void askUserToDisablePlugins(Collection<IdeaPluginDescriptor> conflictingPlugins) { final String text = formatMessage(conflictingPlugins); NotificationGroup ng = NotificationGroup.balloonGroup("Conflicting Plugins"); ng.createNotification(PLUGIN_NAME, text, NotificationType.WARNING, (notification, event) -> { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { for (IdeaPluginDescriptor foreignPlugin : conflictingPlugins) { PluginManager.disablePlugin(foreignPlugin.getPluginId().toString()); } Application application = ApplicationManager.getApplication(); application.restart(); } }).notify(project); }
Example #12
Source File: FastBuildCompilerFactoryImpl.java From intellij with Apache License 2.0 | 5 votes |
private static File findFastBuildJavacJar() { IdeaPluginDescriptor blazePlugin = PluginManager.getPlugin( PluginManager.getPluginByClassName(FastBuildCompilerFactoryImpl.class.getName())); return Paths.get(blazePlugin.getPath().getAbsolutePath()) .resolve(FAST_BUILD_JAVAC_JAR) .toFile(); }
Example #13
Source File: NonBlazeProducerSuppressor.java From intellij with Apache License 2.0 | 5 votes |
private static Collection<Class<? extends RunConfigurationProducer<?>>> getProducers( String pluginId, Collection<String> qualifiedClassNames) { // rather than compiling against additional plugins, and including a switch in the our // plugin.xml, just get the classes manually via the plugin class loader. IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(pluginId)); if (plugin == null || !plugin.isEnabled()) { return ImmutableList.of(); } ClassLoader loader = plugin.getPluginClassLoader(); return qualifiedClassNames .stream() .map((qualifiedName) -> loadClass(loader, qualifiedName)) .filter(Objects::nonNull) .collect(Collectors.toList()); }
Example #14
Source File: ServiceHelperCompat.java From intellij with Apache License 2.0 | 5 votes |
public static <T> void registerService( ComponentManager componentManager, Class<T> key, T implementation, Disposable parentDisposable) { Optional<IdeaPluginDescriptor> platformPlugin = PluginManager.getLoadedPlugins().stream() .filter(descriptor -> descriptor.getName().startsWith("IDEA CORE")) .findAny(); Verify.verify(platformPlugin.isPresent()); ((PlatformComponentManagerImpl) componentManager) .registerServiceInstance(key, implementation, platformPlugin.get()); }
Example #15
Source File: Utils.java From tabnine-intellij with MIT License | 5 votes |
public static String getPluginVersion() { PluginId pluginId = getPluginId(); String pluginVersion = UNKNOWN; if (pluginId != null) { for (IdeaPluginDescriptor plugin : PluginManager.getPlugins()) { if (pluginId == plugin.getPluginId()) { pluginVersion = plugin.getVersion(); break; } } } return pluginVersion; }
Example #16
Source File: ProtostuffPluginController.java From protobuf-jetbrains-plugin with Apache License 2.0 | 5 votes |
private void checkConflictingPlugins() { FileTypeUtil fileTypeUtil = new FileTypeUtil(); Collection<IdeaPluginDescriptor> conflictingPlugins = fileTypeUtil.getPluginsForFile("file.proto"); if (!conflictingPlugins.isEmpty()) { askUserToDisablePlugins(conflictingPlugins); } }
Example #17
Source File: AboutForm.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
public AboutForm() { final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.getId("nb-mind-map-idea")); this.htmlLabelText.setText(BUNDLE.getString("AboutText").replace("${version}", descriptor == null ? "<unknown>" : descriptor.getVersion())); this.htmlLabelText.addLinkListener(new JHtmlLabel.LinkListener() { @Override public void onLinkActivated(final JHtmlLabel source, final String link) { try { IdeaUtils.browseURI(URI.create(link), false); } catch (Exception ex) { ex.printStackTrace(); } } }); this.mainPanel.setPreferredSize(new Dimension(600, 345)); }
Example #18
Source File: MainWindowBase.java From KodeBeagle with Apache License 2.0 | 5 votes |
private void initSystemInfo() { windowObjects.setOptionalDependencyPresent(checkOptionalDependency()); windowObjects.setOsInfo(System.getProperty(OS_NAME) + "/" + System.getProperty(OS_VERSION)); windowObjects.setApplicationVersion(ApplicationInfo.getInstance().getVersionName() + "/" + ApplicationInfo.getInstance().getBuild().toString()); IdeaPluginDescriptor kodeBeagleVersion = PluginManager.getPlugin(PluginId.getId(PLUGIN_ID)); if (kodeBeagleVersion != null) { windowObjects.setPluginVersion(IDEA_PLUGIN + "/" + kodeBeagleVersion.getVersion()); } }
Example #19
Source File: MainWindow.java From KodeBeagle with Apache License 2.0 | 5 votes |
public static boolean scalaPluginInstalledAndEnabled() { if (PLUGIN_AVAILABLE) { IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.getId(SCALA_PLUGIN_ID)); return descriptor != null && descriptor.isEnabled(); } else { return false; } }
Example #20
Source File: PluginErrorReportSubmitter.java From BashSupport with Apache License 2.0 | 5 votes |
private void queryPluginDescriptor(@NotNull PluginDescriptor pluginDescriptor, @NotNull Properties properties) { PluginId descPluginId = pluginDescriptor.getPluginId(); if (descPluginId != null) { String pluginIdString = descPluginId.getIdString(); if (!StringUtil.isEmptyOrSpaces(pluginIdString)) { properties.put(PLUGIN_ID_PROPERTY_KEY, pluginIdString); } } if (pluginDescriptor instanceof IdeaPluginDescriptor) { IdeaPluginDescriptor ideaPluginDescriptor = (IdeaPluginDescriptor) pluginDescriptor; String descName = ideaPluginDescriptor.getName(); if (!StringUtil.isEmptyOrSpaces(descName)) { properties.put(PLUGIN_NAME_PROPERTY_KEY, descName); } String descVersion = ideaPluginDescriptor.getVersion(); if (!StringUtil.isEmptyOrSpaces(descVersion)) { properties.put(PLUGIN_VERSION_PROPERTY_KEY, descVersion); } String descEmail = ideaPluginDescriptor.getVendorEmail(); if (!StringUtil.isEmptyOrSpaces(descEmail)) { properties.put(EMAIL_TO_PROPERTY_KEY, descEmail); } } }
Example #21
Source File: SamplePluginController.java From jetbrains-plugin-sample with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void projectOpened() { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(PLUGIN_ID)); String version = "unknown"; if ( plugin!=null ) { version = plugin.getVersion(); } LOG.info("Sample Plugin version "+version+", Java version "+ SystemInfo.JAVA_VERSION); }
Example #22
Source File: PantsCodeInsightFixtureTestCase.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Override protected void setUp() throws Exception { super.setUp(); getModule().setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, PantsConstants.SYSTEM_ID.getId()); final String pyPluginId = "PythonCore"; final IdeaPluginDescriptor pyPlugin = PluginManagerCore.getPlugin(PluginId.getId(pyPluginId)); assertNotNull( "Python Community Edition plugin should be in classpath for tests\n" + "You need to include jars from ~/Library/Application Support/IdeaIC14/python/lib/", pyPlugin ); if (!pyPlugin.isEnabled()) { assertTrue("Failed to enable Python plugin!", PluginManagerCore.enablePlugin(pyPluginId)); } final String testUserHome = VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(PantsTestUtils.BASE_TEST_DATA_PATH + "/userHome")); final Optional<VirtualFile> folderWithPex = PantsUtil.findFolderWithPex(Optional.ofNullable(VirtualFileManager.getInstance().findFileByUrl(testUserHome))); assertTrue("Folder with pex files should be configured", folderWithPex.isPresent()); final VirtualFile[] pexFiles = folderWithPex.get().getChildren(); assertTrue("There should be only one pex file!", pexFiles.length == 1); ApplicationManager.getApplication().runWriteAction(() -> configurePantsLibrary(myFixture.getProject(), pexFiles[0])); assertNotNull( "Pants lib not configured!", LibraryTablesRegistrar.getInstance().getLibraryTable(myFixture.getProject()).getLibraryByName(PantsConstants.PANTS_LIBRARY_NAME) ); }
Example #23
Source File: PantsIntegrationTestCase.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { cleanProjectIdeaDir(); super.setUp(); VfsRootAccess.allowRootAccess(myProject, "/"); for (String pluginId : getRequiredPluginIds()) { IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(PluginId.getId(pluginId)); assertNotNull(pluginId + " plugin should be in classpath for integration tests!", plugin); assertTrue(pluginId + " is not enabled!", plugin.isEnabled()); } myProjectSettings = new PantsProjectSettings(); myCompilerTester = null; }
Example #24
Source File: PantsUtil.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
public static boolean isPythonAvailable() { for (String pluginId : PYTHON_PLUGIN_IDS) { final IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(PluginId.getId(pluginId)); if (plugin != null && plugin.isEnabled()) { return true; } } return false; }
Example #25
Source File: GaugeExceptionHandler.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
private Notification createNotification(String stacktrace, int exitValue) { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.findId("com.thoughtworks.gauge")); String pluginVersion = plugin == null ? "" : plugin.getVersion(); String apiVersion = ApplicationInfo.getInstance().getApiVersion(); String ideaVersion = ApplicationInfo.getInstance().getFullVersion(); String gaugeVersion = GaugeVersion.getVersion(false).version; String body = String.format(ISSUE_TEMPLATE, exitValue,stacktrace, ideaVersion, apiVersion, pluginVersion, gaugeVersion); String content = String.format(NOTIFICATION_TEMPLATE, LINE_BREAK, body); return new Notification("Gauge Exception", NOTIFICATION_TITLE, content, NotificationType.ERROR, NotificationListener.URL_OPENING_LISTENER); }
Example #26
Source File: HaxeDebugRunner.java From intellij-haxe with Apache License 2.0 | 5 votes |
private RunContentDescriptor runFlash(final Module module, final HaxeModuleSettings settings, final ExecutionEnvironment env, final Executor executor, final String launchPath) throws ExecutionException { final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("com.intellij.flex")); if (plugin == null) { throw new ExecutionException (HaxeBundle.message("install.flex.plugin")); } if (!plugin.isEnabled()) { throw new ExecutionException (HaxeBundle.message("enable.flex.plugin")); } String flexSdkName = settings.getFlexSdkName(); if (StringUtil.isEmpty(flexSdkName)) { throw new ExecutionException (HaxeBundle.message("flex.sdk.not.specified")); } if (settings.isUseNmmlToBuild()) { return HaxeFlashDebuggingUtil.getNMEDescriptor (this, module, env, executor, flexSdkName); } else if (settings.isUseOpenFLToBuild()) { return HaxeFlashDebuggingUtil.getOpenFLDescriptor (this, module, env, executor, flexSdkName); } else { return HaxeFlashDebuggingUtil.getDescriptor (module, env, launchPath, flexSdkName); } }
Example #27
Source File: WebDeploymentUtil.java From idea-php-symfony2-plugin with MIT License | 5 votes |
public static boolean isEnabled(@Nullable Project project) { if(!Symfony2ProjectComponent.isEnabled(project)) { return false; } if(PLUGIN_ENABLED == null) { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("com.jetbrains.plugins.webDeployment")); PLUGIN_ENABLED = plugin != null && plugin.isEnabled(); } return PLUGIN_ENABLED; }
Example #28
Source File: IntellijVersionProvider.java From saros with GNU General Public License v2.0 | 5 votes |
/** * Returns the version number of the used Saros plugin. * * @return the version number of the used Saros plugin */ public static String getPluginVersion() { IdeaPluginDescriptor sarosPluginDescriptor = PluginManager.getPlugin(PluginId.getId(SarosComponent.PLUGIN_ID)); if (sarosPluginDescriptor == null) { throw new IllegalStateException( "No plugin with the id \"" + SarosComponent.PLUGIN_ID + "\" was found"); } return sarosPluginDescriptor.getVersion(); }
Example #29
Source File: ANTLRv4PluginController.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void projectOpened() { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(PLUGIN_ID)); String version = "unknown"; if ( plugin!=null ) { version = plugin.getVersion(); } LOG.info("ANTLR 4 Plugin version "+version+", Java version "+ SystemInfo.JAVA_VERSION); // make sure the tool windows are created early createToolWindows(); installListeners(); }
Example #30
Source File: OpenTerminalAction.java From MavenHelper with Apache License 2.0 | 5 votes |
private boolean isPluginEnabled() { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("org.jetbrains.plugins.terminal")); if (plugin != null) { return plugin.isEnabled(); } return false; }