Java Code Examples for com.intellij.ide.plugins.PluginManager#getPlugin()
The following examples show how to use
com.intellij.ide.plugins.PluginManager#getPlugin() .
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: 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 3
Source File: PluginAdvertiserEditorNotificationProvider.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private static PluginDescriptor getDisabledPlugin(Set<String> plugins) { final List<String> disabledPlugins = new ArrayList<>(PluginManagerCore.getDisabledPlugins()); disabledPlugins.retainAll(plugins); if (disabledPlugins.size() == 1) { return PluginManager.getPlugin(PluginId.getId(disabledPlugins.get(0))); } return null; }
Example 4
Source File: GraphQLPsiSearchHelper.java From js-graphql-intellij-plugin with MIT License | 5 votes |
public GraphQLPsiSearchHelper(@NotNull final Project project) { myProject = project; mySettings = GraphQLSettings.getSettings(project); psiManager = PsiManager.getInstance(myProject); graphQLInjectionSearchHelper = ServiceManager.getService(GraphQLInjectionSearchHelper.class); injectedLanguageManager = InjectedLanguageManager.getInstance(myProject); graphQLConfigManager = GraphQLConfigManager.getService(myProject); pluginDescriptor = PluginManager.getPlugin(PluginId.getId("com.intellij.lang.jsgraphql")); final PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(myProject); defaultProjectFile = (GraphQLFile) psiFileFactory.createFileFromText("Default schema file", GraphQLLanguage.INSTANCE, ""); GlobalSearchScope defaultProjectFileScope = GlobalSearchScope.fileScope(defaultProjectFile); GlobalSearchScope builtInSchemaScope = GlobalSearchScope.fileScope(project, getBuiltInSchema().getVirtualFile()); GlobalSearchScope builtInRelaySchemaScope = GlobalSearchScope.fileScope(project, getRelayModernDirectivesSchema().getVirtualFile()); allBuiltInSchemaScopes = builtInSchemaScope .union(new ConditionalGlobalSearchScope(builtInRelaySchemaScope, mySettings::isEnableRelayModernFrameworkSupport)) .union(defaultProjectFileScope) ; final FileType[] searchScopeFileTypes = GraphQLFindUsagesUtil.getService().getIncludedFileTypes().toArray(FileType.EMPTY_ARRAY); searchScope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(myProject), searchScopeFileTypes).union(allBuiltInSchemaScopes); project.getMessageBus().connect().subscribe(PsiManagerImpl.ANY_PSI_CHANGE_TOPIC, new AnyPsiChangeListener.Adapter() { @Override public void beforePsiChanged(boolean isPhysical) { // clear the cache on each PSI change fileNameToSchemaScope.clear(); } }); }
Example 5
Source File: SentryBugReporter.java From protobuf-jetbrains-plugin with Apache License 2.0 | 5 votes |
private static String getPluginVersion() { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(PLUGIN_ID)); if (plugin == null) { return "unknown"; } return plugin.getVersion(); }
Example 6
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 7
Source File: PluginDownloader.java From consulo with Apache License 2.0 | 5 votes |
public boolean prepareToInstall(ProgressIndicator pi) throws IOException { PluginDescriptor descriptor = null; if (!Boolean.getBoolean(StartupActionScriptManager.STARTUP_WIZARD_MODE) && PluginManager.isPluginInstalled(myPluginId)) { //store old plugins file descriptor = PluginManager.getPlugin(myPluginId); myOldFile = descriptor.getPath(); } // download plugin String errorMessage = IdeBundle.message("unknown.error"); try { myFile = downloadPlugin(pi); } catch (IOException ex) { myFile = null; errorMessage = ex.getMessage(); } if (myFile == null) { final String text = IdeBundle.message("error.plugin.was.not.installed", getPluginName(), errorMessage); final String title = IdeBundle.message("title.failed.to.download"); ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(text, title)); return false; } return !InstalledPluginsTableModel.wasUpdated(myDescriptor.getPluginId()); }
Example 8
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 9
Source File: GraphQLConfigManager.java From js-graphql-intellij-plugin with MIT License | 4 votes |
public GraphQLConfigManager(Project myProject) { this.myProject = myProject; this.projectScope = GlobalSearchScope.projectScope(myProject); this.graphQLConfigGlobMatcher = ServiceManager.getService(myProject, GraphQLConfigGlobMatcher.class); this.pluginDescriptor = PluginManager.getPlugin(PluginId.getId("com.intellij.lang.jsgraphql")); }
Example 10
Source File: XQueryRunnerClasspathEntryGenerator.java From intellij-xquery with Apache License 2.0 | 4 votes |
File getPluginPath() { final PluginId pluginId = PluginManager.getPluginByClassName(getClass().getName()); final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(pluginId); return descriptor.getPath(); }
Example 11
Source File: VerifyRequiredPluginsEnabled.java From intellij with Apache License 2.0 | 4 votes |
private static boolean pluginInstalled(String pluginId) { return PluginManager.getPlugin(PluginId.getId(pluginId)) != null; }
Example 12
Source File: Plugin.java From GitLink with MIT License | 4 votes |
public Plugin() { this.pluginDescriptor = PluginManager.getPlugin(PluginId.getId("uk.co.ben-gibson.remote.repository.mapper")); }
Example 13
Source File: HttpZallyService.java From intellij-swagger with MIT License | 4 votes |
public HttpZallyService() { this(PluginManager.getPlugin(PluginId.findId(PLUGIN_ID))); }
Example 14
Source File: BazelFastBuildAspectStrategy.java From intellij with Apache License 2.0 | 4 votes |
private static File findAspectDirectory() { IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginManager.getPluginByClassName(AspectStrategy.class.getName())); return new File(plugin.getPath(), "aspect"); }
Example 15
Source File: CrashDump.java From floobits-intellij with Apache License 2.0 | 4 votes |
private IdeaPluginDescriptor getPlugin() { return PluginManager.getPlugin(PluginId.getId("com.floobits.unique.plugin.id")); }
Example 16
Source File: PropertyIdeaUtils.java From camel-idea-plugin with Apache License 2.0 | 4 votes |
@Override public boolean isExtensionEnabled() { final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("com.intellij.properties")); return plugin != null && plugin.isEnabled(); }
Example 17
Source File: PluginUtil.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 4 votes |
private static IdeaPluginDescriptor plugin() { if (plugin == null) { plugin = PluginManager.getPlugin(PluginId.getId(GraphConstants.PLUGIN_ID)); } return plugin; }
Example 18
Source File: PluginUtils.java From intellij with Apache License 2.0 | 4 votes |
private static IdeaPluginDescriptor getPluginDescriptor(String pluginId) { return PluginManager.getPlugin(PluginId.getId(pluginId)); }
Example 19
Source File: FileGitHubIssueAction.java From intellij with Apache License 2.0 | 4 votes |
/** * Constructs a GitHub URL with query parameters containing pre-filled information about a user's * IDE installation and system. * * @param project The Bazel project instance. * @return an URL containing pre-filled instructions and information about a user's system. */ @Nullable protected static URL getGitHubTemplateURL(Project project) { // q?body=<param value> // https://help.github.com/en/articles/about-automation-for-issues-and-pull-requests-with-query-parameters#supported-query-parameters StringBuilder bodyParam = new StringBuilder(); bodyParam.append("#### Description of the issue. Please be specific.\n"); bodyParam.append("\n"); bodyParam.append("#### What's the simplest set of steps to reproduce this issue? "); bodyParam.append("Please provide an example project, if possible.\n"); bodyParam.append("\n"); bodyParam.append("#### Version information\n"); // Get the IDE version. // e.g. IdeaCommunity: 2019.1.2 bodyParam.append( String.format("%s: %s\n", getProductId(), ApplicationInfo.getInstance().getFullVersion())); // Get information about the operating system. // e.g. Platform: Linux 4.19.37-amd64 bodyParam.append(String.format("Platform: %s %s\n", SystemInfo.OS_NAME, SystemInfo.OS_VERSION)); // Get the plugin version. // e.g. Bazel plugin: 2019.07.23.0.3 IdeaPluginDescriptor plugin = PluginManager.getPlugin( PluginManager.getPluginByClassName(FileGitHubIssueAction.class.getName())); if (plugin != null) { bodyParam.append( String.format( "%s plugin: %s%s\n", plugin.getName(), plugin.getVersion(), plugin.isEnabled() ? "" : " (disabled)")); } // Get the Bazel version. // e.g. Bazel: 0.28.1 BlazeProjectData projectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData(); if (projectData != null) { bodyParam.append(String.format("Bazel: %s\n", projectData.getBlazeVersionData())); } try { return new URL(BASE_URL + "?body=" + URLEncoder.encode(bodyParam.toString(), "UTF-8")); } catch (UnsupportedEncodingException | MalformedURLException ex) { // If we can't manage to parse the body for some reason (e.g. weird SystemInfo // OS_NAME or OS_VERSION), just proceed and open up an empty GitHub issue form. logger.error(ex); return null; } }
Example 20
Source File: Utils.java From idea-latex with MIT License | 2 votes |
/** * Returns Gitignore plugin information. * * @return {@link IdeaPluginDescriptor} */ public static IdeaPluginDescriptor getPlugin() { return PluginManager.getPlugin(PluginId.getId(LatexBundle.PLUGIN_ID)); }