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

The following examples show how to use com.intellij.ide.plugins.IdeaPluginDescriptor#getVersion() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
Source File: IntellijVersionProvider.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 9
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();
}