Java Code Examples for com.intellij.ide.plugins.IdeaPluginDescriptor#getPath()

The following examples show how to use com.intellij.ide.plugins.IdeaPluginDescriptor#getPath() . 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 vote down vote up
/**
 * 从插件 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: QuarkusServer.java    From intellij-quarkus with Eclipse Public License 2.0 4 votes vote down vote up
public QuarkusServer() {
    IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.getId("com.redhat.devtools.intellij.quarkus"));
    File serverPath = new File(descriptor.getPath(), "lib/server/com.redhat.microprofile.ls-0.7.0-SNAPSHOT-uber.jar");
    String javaHome = System.getProperty("java.home");
    setCommands(Arrays.asList(javaHome + File.separator + "bin" + File.separator + "java", "-jar", serverPath.getAbsolutePath().toString()));
}
 
Example 3
Source File: Platform.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
@Nullable
public static File getPluginLocation() {
    IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("reasonml"));
    return plugin == null ? null : plugin.getPath();
}
 
Example 4
Source File: AspectStrategyBazel.java    From intellij with Apache License 2.0 4 votes vote down vote up
private static File findAspectDirectory() {
  IdeaPluginDescriptor plugin =
      PluginManager.getPlugin(PluginManager.getPluginByClassName(AspectStrategy.class.getName()));
  return new File(plugin.getPath(), "aspect");
}
 
Example 5
Source File: BazelFastBuildAspectStrategy.java    From intellij with Apache License 2.0 4 votes vote down vote up
private static File findAspectDirectory() {
  IdeaPluginDescriptor plugin =
      PluginManager.getPlugin(PluginManager.getPluginByClassName(AspectStrategy.class.getName()));
  return new File(plugin.getPath(), "aspect");
}
 
Example 6
Source File: JavaClasspathAspectStrategy.java    From intellij with Apache License 2.0 4 votes vote down vote up
private static File findAspectDirectory() {
  IdeaPluginDescriptor plugin =
      PluginManager.getPlugin(
          PluginManager.getPluginByClassName(AspectStrategy.class.getName()));
  return new File(plugin.getPath(), "aspect");
}
 
Example 7
Source File: XQueryRunnerClasspathEntryGenerator.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
File getPluginPath() {
    final PluginId pluginId = PluginManager.getPluginByClassName(getClass().getName());
    final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(pluginId);
    return descriptor.getPath();
}