com.intellij.openapi.extensions.PluginId Java Examples

The following examples show how to use com.intellij.openapi.extensions.PluginId. 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: WakaTime.java    From jetbrains-wakatime with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void initComponent() {
    VERSION = PluginManager.getPlugin(PluginId.getId("com.wakatime.intellij.plugin")).getVersion();
    log.info("Initializing WakaTime plugin v" + VERSION + " (https://wakatime.com/)");
    //System.out.println("Initializing WakaTime plugin v" + VERSION + " (https://wakatime.com/)");

    // Set runtime constants
    IDE_NAME = PlatformUtils.getPlatformPrefix();
    IDE_VERSION = ApplicationInfo.getInstance().getFullVersion();

    setupDebugging();
    setLoggingLevel();
    Dependencies.configureProxy();
    checkApiKey();
    checkCli();
    setupEventListeners();
    setupQueueProcessor();
    checkDebug();
    log.info("Finished initializing WakaTime plugin");
}
 
Example #3
Source File: KPXStartupNotification.java    From IntelliJ-Key-Promoter-X with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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 vote down vote up
@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 vote down vote up
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: SpringFormatComponent.java    From spring-javaformat with Apache License 2.0 6 votes vote down vote up
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 #7
Source File: PantsClasspathRunConfigurationExtension.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * Filter out all jars imported to the project with the exception of
 * jars on the JDK path, IntelliJ installation paths, and plugin installation path,
 * because Pants is already exporting all the runtime classpath in manifest.jar.
 *
 * Exception applies during unit test of this plugin because "JUnit" and "com.intellij"
 * plugin lives under somewhere under ivy, whereas during normal usage, they are covered
 * by `homePath`.
 *
 *
 * @param params JavaParameters
 * @return a set of paths that should be allowed to passed to the test runner.
 */
@NotNull
private Set<String> calculatePathsAllowed(JavaParameters params) {

  String homePath = PathManager.getHomePath();
  String pluginPath = PathManager.getPluginsPath();

  Set<String> pathsAllowed = Sets.newHashSet(homePath, pluginPath);

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    // /Users/yic/.ivy2/pants/com.intellij.sdk.community/idea_rt/jars/idea_rt-latest.jar ->
    // /Users/yic/.ivy2/pants/com.intellij.sdk.community/
    Optional.ofNullable(PluginManagerCore.getPlugin(PluginId.getId("com.intellij")))
      .map(s -> s.getPath().getParentFile().getParentFile().getParentFile().getAbsolutePath())
      .ifPresent(pathsAllowed::add);

    // At this point we know junit plugin is already enabled.
    // //Users/yic/.ivy2/pants/com.intellij.junit-plugin/junit-rt/jars/junit-rt-latest.jar ->
    // /Users/yic/.ivy2/pants/com.intellij.junit-plugin/
    Optional.ofNullable(PluginManagerCore.getPlugin(PluginId.getId("JUnit")))
      .map(s -> s.getPath().getParentFile().getParentFile().getParentFile().getAbsolutePath())
      .ifPresent(pathsAllowed::add);
  }
  return pathsAllowed;
}
 
Example #8
Source File: PantsIntegrationTestCase.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@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 #9
Source File: SymfonyInstallerUtil.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
@Nullable
public static String getDownloadVersions() {

    String userAgent = String.format("%s / %s / Symfony Plugin %s",
        ApplicationInfo.getInstance().getVersionName(),
        ApplicationInfo.getInstance().getBuild(),
        PluginManager.getPlugin(PluginId.getId("fr.adrienbrault.idea.symfony2plugin")).getVersion()
    );

    try {

        // @TODO: PhpStorm9:
        // simple replacement for: com.intellij.util.io.HttpRequests
        URL url = new URL("https://symfony.com/versions.json");
        URLConnection conn = url.openConnection();
        conn.setRequestProperty("User-Agent", userAgent);
        conn.connect();

        BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));

        String content = "";
        String line;
        while ((line = in.readLine()) != null) {
            content += line;
        }

        in.close();

        return content;
    } catch (IOException e) {
        return null;
    }

}
 
Example #10
Source File: Utils.java    From tabnine-intellij with MIT License 5 votes vote down vote up
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 #11
Source File: OpenTerminalAction.java    From MavenHelper with Apache License 2.0 5 votes vote down vote up
private boolean isPluginEnabled() {
	IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("org.jetbrains.plugins.terminal"));
	if (plugin != null) {
		return plugin.isEnabled();
	}
	return false;
}
 
Example #12
Source File: AbstractFluidTest.java    From idea-php-typo3-plugin with MIT License 5 votes vote down vote up
@Override
public void setUp() throws Exception {
    super.setUp();

    final boolean pluginInstalled = PluginManager.isPluginInstalled(PluginId.getId("com.jetbrains.php"));
    if (pluginInstalled) {

    }
}
 
Example #13
Source File: RollbarErrorReportSubmitter.java    From bamboo-soy with Apache License 2.0 5 votes vote down vote up
private static String getPluginVersion() {
  IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(PLUGIN_ID));
  if (plugin == null) {
    return "unknown";
  }
  return plugin.getVersion();
}
 
Example #14
Source File: PanelDialog.java    From GitCommitMessage with Apache License 2.0 5 votes vote down vote up
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 #15
Source File: ANTLRv4PluginController.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 #16
Source File: SentryBugReporter.java    From protobuf-jetbrains-plugin with Apache License 2.0 5 votes vote down vote up
private static String getPluginVersion() {
    IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(PLUGIN_ID));
    if (plugin == null) {
        return "unknown";
    }
    return plugin.getVersion();
}
 
Example #17
Source File: BundledProtobufRootsProvider.java    From protobuf-jetbrains-plugin with Apache License 2.0 5 votes vote down vote up
private Optional<VirtualFile> tryPluginLibFolder() {
    IdeaPluginDescriptor plugin = Objects.requireNonNull(PluginManager.getPlugin(PluginId.getId(PLUGIN_ID)));
    return ((IdeaPluginDescriptorImpl) plugin).getClassPath().stream()
            .filter(entry -> entry.getName().contains(PREFIX))
            .filter(entry -> entry.getName().contains(SUFFIX))
            .findAny()
            .map(protobufSourcesJarUrl -> {
                JarFileSystem instance = JarFileSystem.getInstance();
                return instance.findLocalVirtualFileByPath(protobufSourcesJarUrl.getPath());
            });
}
 
Example #18
Source File: HaxeDebugRunner.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
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 #19
Source File: ShortcutStartupActivity.java    From StringManipulation with Apache License 2.0 5 votes vote down vote up
protected static void registerAction(ActionManager actionManager, DefaultActionGroup group, CustomActionModel customActionModel) {
		if (StringUtils.isNotBlank(customActionModel.getId()) && StringUtils.isNotBlank(customActionModel.getName())) {
			CustomAction action = new CustomAction(customActionModel);
			LOG.info("Registering " + action + " id:" + customActionModel.getId());
			actionManager.registerAction(customActionModel.getId(), action, PluginId.getId("String Manipulation"));
			group.add(action, Constraints.FIRST);


			CustomActionModel reverse = customActionModel.reverse();
			CustomAction reverseAction = new CustomAction(reverse);
			LOG.info("Registering " + reverseAction + " id:" + reverse.getId());
			actionManager.registerAction(reverse.getId(), reverseAction, PluginId.getId("String Manipulation"));
//			group.add(reverseAction, Constraints.FIRST);
		}
	}
 
Example #20
Source File: PluginErrorReportSubmitter.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
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: NonBlazeProducerSuppressor.java    From intellij with Apache License 2.0 5 votes vote down vote up
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 #22
Source File: GaugeExceptionHandler.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
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 #23
Source File: PantsCodeInsightFixtureTestCase.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@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 #24
Source File: GraphQLPsiSearchHelper.java    From js-graphql-intellij-plugin with MIT License 5 votes vote down vote up
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 #25
Source File: PantsUtil.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
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 #26
Source File: AboutForm.java    From netbeans-mmd-plugin with Apache License 2.0 5 votes vote down vote up
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 #27
Source File: ShopwareInstallerUtil.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
@Nullable
public static String getDownloadVersions() {

    String userAgent = String.format("%s / %s / Shopware Plugin %s",
        ApplicationInfo.getInstance().getVersionName(),
        ApplicationInfo.getInstance().getBuild(),
        PluginManager.getPlugin(PluginId.getId("de.espend.idea.shopware")).getVersion()
    );

    try {

        // @TODO: PhpStorm9:
        // simple replacement for: com.intellij.util.io.HttpRequests
        URL url = new URL("http://update-api.shopware.com/v1/releases/install?major=6");
        URLConnection conn = url.openConnection();
        conn.setRequestProperty("User-Agent", userAgent);
        conn.connect();

        BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));

        StringBuilder content = new StringBuilder();
        String line;
        while ((line = in.readLine()) != null) {
            content.append(line);
        }

        in.close();

        return content.toString();
    } catch (IOException e) {
        return null;
    }

}
 
Example #28
Source File: MainWindowBase.java    From KodeBeagle with Apache License 2.0 5 votes vote down vote up
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 #29
Source File: SamplePluginController.java    From jetbrains-plugin-sample with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@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 #30
Source File: MainWindow.java    From KodeBeagle with Apache License 2.0 5 votes vote down vote up
public static boolean scalaPluginInstalledAndEnabled() {
    if (PLUGIN_AVAILABLE) {
        IdeaPluginDescriptor descriptor =
                PluginManager.getPlugin(PluginId.getId(SCALA_PLUGIN_ID));
        return descriptor != null && descriptor.isEnabled();
    } else {
        return false;
    }
}