diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java index 2e0d33398975..f2297167207c 100644 --- a/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java +++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java @@ -32,13 +32,17 @@ public class ApplicationRunLineMarkerProvider extends RunLineMarkerContributor { @Nullable @Override public Info getInfo(PsiElement e) { - if (e instanceof PsiIdentifier) { + if (isIdentifier(e)) { PsiElement element = e.getParent(); if (element instanceof PsiClass && PsiMethodUtil.findMainInClass((PsiClass)element) != null) - return new Info(ApplicationConfigurationType.getInstance().getIcon(), null, ExecutorAction.ACTIONS(0)); + return new Info(ApplicationConfigurationType.getInstance().getIcon(), null, ExecutorAction.getActions(0)); if (element instanceof PsiMethod && "main".equals(((PsiMethod)element).getName()) && PsiMethodUtil.isMainMethod((PsiMethod)element)) - return new Info(ApplicationConfigurationType.getInstance().getIcon(), null, ExecutorAction.ACTIONS(0)); + return new Info(ApplicationConfigurationType.getInstance().getIcon(), null, ExecutorAction.getActions(0)); } return null; } + + protected boolean isIdentifier(PsiElement e) { + return e instanceof PsiIdentifier; + } } diff --git a/java/java-impl/src/com/intellij/testIntegration/TestRunLineMarkerProvider.java b/java/java-impl/src/com/intellij/testIntegration/TestRunLineMarkerProvider.java index eb6301a2d508..9e7de4d561fa 100644 --- a/java/java-impl/src/com/intellij/testIntegration/TestRunLineMarkerProvider.java +++ b/java/java-impl/src/com/intellij/testIntegration/TestRunLineMarkerProvider.java @@ -41,12 +41,12 @@ public class TestRunLineMarkerProvider extends RunLineMarkerContributor { @Nullable @Override public Info getInfo(PsiElement e) { - if (e instanceof PsiIdentifier) { + if (isIdentifier(e)) { PsiElement element = e.getParent(); if (element instanceof PsiClass) { TestFramework framework = TestFrameworks.detectFramework((PsiClass)element); if (framework != null && framework.isTestClass(element)) { - return new Info(framework.getIcon(), TOOLTIP_PROVIDER, ExecutorAction.ACTIONS(1)); + return new Info(framework.getIcon(), TOOLTIP_PROVIDER, ExecutorAction.getActions(1)); } } if (element instanceof PsiMethod) { @@ -54,10 +54,14 @@ public class TestRunLineMarkerProvider extends RunLineMarkerContributor { TestFramework framework = TestFrameworks.detectFramework(psiClass); if (psiClass != null && framework != null && framework.isTestMethod(element)) { // String url = "java:test://" + psiClass.getQualifiedName() + "." + ((PsiMethod)element).getName(); - return new Info(framework.getIcon(), TOOLTIP_PROVIDER, ExecutorAction.ACTIONS(1)); + return new Info(framework.getIcon(), TOOLTIP_PROVIDER, ExecutorAction.getActions(1)); } } } return null; } + + protected boolean isIdentifier(PsiElement e) { + return e instanceof PsiIdentifier; + } } diff --git a/platform/lang-impl/src/com/intellij/execution/lineMarker/ExecutorAction.java b/platform/lang-impl/src/com/intellij/execution/lineMarker/ExecutorAction.java index 6f347b9ab2c4..4026879a23de 100644 --- a/platform/lang-impl/src/com/intellij/execution/lineMarker/ExecutorAction.java +++ b/platform/lang-impl/src/com/intellij/execution/lineMarker/ExecutorAction.java @@ -38,7 +38,7 @@ import java.util.List; */ public class ExecutorAction extends AnAction { - public static AnAction[] ACTIONS(final int order) { + public static AnAction[] getActions(final int order) { return ContainerUtil.map2Array(ExecutorRegistry.getInstance().getRegisteredExecutors(), AnAction.class, new Function() { @Override public AnAction fun(Executor executor) { diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index d882f9231da4..a0eca29d9115 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -935,7 +935,7 @@ - + diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index f85a99e7e2f9..7643dcbe98c5 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -252,6 +252,8 @@ + + diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/testIntegration/GroovyAppLineMarkerContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/testIntegration/GroovyAppLineMarkerContributor.java new file mode 100644 index 000000000000..ed94d7927773 --- /dev/null +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/testIntegration/GroovyAppLineMarkerContributor.java @@ -0,0 +1,31 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.plugins.groovy.testIntegration; + +import com.intellij.execution.application.ApplicationRunLineMarkerProvider; +import com.intellij.psi.PsiElement; +import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; + +/** + * @author Dmitry Avdeev + */ +public class GroovyAppLineMarkerContributor extends ApplicationRunLineMarkerProvider { + + @Override + protected boolean isIdentifier(PsiElement e) { + return e.getNode().getElementType() == GroovyTokenTypes.mIDENT; + } +} diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/testIntegration/GroovyTestLineMarkerContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/testIntegration/GroovyTestLineMarkerContributor.java new file mode 100644 index 000000000000..03cf7b571709 --- /dev/null +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/testIntegration/GroovyTestLineMarkerContributor.java @@ -0,0 +1,30 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.plugins.groovy.testIntegration; + +import com.intellij.psi.PsiElement; +import com.intellij.testIntegration.TestRunLineMarkerProvider; +import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; + +/** + * @author Dmitry Avdeev + */ +public class GroovyTestLineMarkerContributor extends TestRunLineMarkerProvider { + @Override + protected boolean isIdentifier(PsiElement e) { + return e.getNode().getElementType() == GroovyTokenTypes.mIDENT; + } +}