File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/internal/core/providers Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1616import java .util .Collections ;
1717import java .util .List ;
1818
19+ import com .intellij .ide .plugins .PluginManager ;
20+ import com .intellij .openapi .extensions .PluginId ;
1921import com .intellij .openapi .externalSystem .util .ExternalSystemApiUtil ;
2022import com .intellij .openapi .module .Module ;
2123import com .redhat .devtools .intellij .lsp4mp4ij .psi .core .IProjectLabelProvider ;
3133public class GradleProjectLabelProvider implements IProjectLabelProvider {
3234
3335 public static final String GRADLE_LABEL = "gradle" ;
36+ private static final PluginManager instance = PluginManager .getInstance ();
37+ private static final PluginId gradlePluginId = PluginId .findId ("com.intellij.gradle" );
3438 private static final String GRADLE_NATURE_ID = "org.eclipse.buildship.core.gradleprojectnature" ;
3539
3640 @ Override
3741 public List <String > getProjectLabels (Module project ) {
38- if (GradleProjectLabelProvider .isGradleProject (project )) {
42+ // The IntelliJ Gradle plugin is declared as "optional" in plugin.xml. Don't try
43+ // to access any IntelliJ Gradle plugin classes unless it is actually enabled.
44+ if (gradlePluginId != null &&
45+ instance .findEnabledPlugin (gradlePluginId ) != null &&
46+ GradleProjectLabelProvider .isGradleProject (project )) {
3947 return Collections .singletonList (GRADLE_LABEL );
4048 }
4149 return Collections .emptyList ();
You can’t perform that action at this time.
0 commit comments