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

The following examples show how to use com.intellij.ide.plugins.IdeaPluginDescriptor#isEnabled() . 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: PluginHelper.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
public static boolean isLSPPluginInstalledAndNotUsed() {
    int users = 0;
    IdeaPluginDescriptor lspDescriptor = getLSPPluginDescriptor();
    if (lspDescriptor != null && lspDescriptor.isEnabled()) {
        for(IdeaPluginDescriptor descriptor : PluginManager.getPlugins()) {
            if (descriptor.isEnabled()) {
                users += Stream.of(descriptor.getDependentPluginIds()).filter(id -> id.equals(PluginId.getId(QuarkusConstants.LSP_PLUGIN_ID))).count();
                users += Stream.of(descriptor.getOptionalDependentPluginIds()).filter(id -> id.equals(PluginId.getId(QuarkusConstants.LSP_PLUGIN_ID))).count();
            }
        }
    } else {
        users = -1;
    }
    return users == 0;
}
 
Example 2
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 3
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;
    }
}
 
Example 4
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 5
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 6
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 7
Source File: WebDeploymentUtil.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
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 8
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 9
Source File: YamlIdeaUtils.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isExtensionEnabled() {
    final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("org.jetbrains.plugins.yaml"));
    return plugin != null && plugin.isEnabled();
}
 
Example 10
Source File: PropertyIdeaUtils.java    From camel-idea-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isExtensionEnabled() {
    final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("com.intellij.properties"));
    return plugin != null && plugin.isEnabled();
}
 
Example 11
Source File: PluginUtils.java    From intellij with Apache License 2.0 4 votes vote down vote up
public static boolean isPluginEnabled(String pluginId) {
  IdeaPluginDescriptor descriptor = getPluginDescriptor(pluginId);
  return descriptor != null && descriptor.isEnabled();
}
 
Example 12
Source File: VerifyRequiredPluginsEnabled.java    From intellij with Apache License 2.0 4 votes vote down vote up
private static boolean pluginEnabled(String pluginId) {
  IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.getId(pluginId));
  return descriptor != null && descriptor.isEnabled();
}
 
Example 13
Source File: Utils.java    From idea-gitignore with MIT License 2 votes vote down vote up
/**
 * Checks if specified plugin is enabled.
 *
 * @param id plugin id
 * @return plugin is enabled
 */
private static boolean isPluginEnabled(@NotNull final String id) {
    IdeaPluginDescriptor p = PluginManager.getPlugin(PluginId.getId(id));
    return p instanceof IdeaPluginDescriptorImpl && p.isEnabled();
}