mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
mark "main" method only
This commit is contained in:
+1
-1
@@ -38,7 +38,7 @@ public class ApplicationRunLineMarkerProvider implements LineMarkerProvider {
|
||||
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
|
||||
if (element instanceof PsiClass && PsiMethodUtil.findMainInClass((PsiClass)element) != null)
|
||||
return new RunLineMarkerInfo(element, ApplicationConfigurationType.getInstance().getIcon(), null);
|
||||
if (element instanceof PsiMethod && PsiMethodUtil.isMainMethod((PsiMethod)element))
|
||||
if (element instanceof PsiMethod && "main".equals(((PsiMethod)element).getName()) && PsiMethodUtil.isMainMethod((PsiMethod)element))
|
||||
return new RunLineMarkerInfo(element, ApplicationConfigurationType.getInstance().getIcon(), null);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 com.intellij.codeInsight.navigation;
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class RunLineMarkerTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testRunLineMarker() throws Exception {
|
||||
myFixture.configureByText("MainTest.java", "public class MainTest {\n" +
|
||||
" public static void fo<caret>o(String[] args) {\n" +
|
||||
" }\n " +
|
||||
" public static void main(String[] args) {\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
assertEquals(0, myFixture.findGuttersAtCaret().size());
|
||||
assertEquals(2, myFixture.findAllGutters().size());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user