当前位置: 首页>>代码示例>>Java>>正文


Java GutterIconRenderer类代码示例

本文整理汇总了Java中com.intellij.openapi.editor.markup.GutterIconRenderer的典型用法代码示例。如果您正苦于以下问题:Java GutterIconRenderer类的具体用法?Java GutterIconRenderer怎么用?Java GutterIconRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GutterIconRenderer类属于com.intellij.openapi.editor.markup包,在下文中一共展示了GutterIconRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: editBreakpoint

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
public void editBreakpoint(final Breakpoint breakpoint, final Editor editor) {
  DebuggerInvocationUtil.swingInvokeLater(myProject, new Runnable() {
    @Override
    public void run() {
      XBreakpoint xBreakpoint = breakpoint.myXBreakpoint;
      if (xBreakpoint instanceof XLineBreakpointImpl) {
        RangeHighlighter highlighter = ((XLineBreakpointImpl)xBreakpoint).getHighlighter();
        if (highlighter != null) {
          GutterIconRenderer renderer = highlighter.getGutterIconRenderer();
          if (renderer != null) {
            DebuggerSupport.getDebuggerSupport(JavaDebuggerSupport.class).getEditBreakpointAction().editBreakpoint(
              myProject, editor, breakpoint.myXBreakpoint, renderer
            );
          }
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:BreakpointManager.java

示例2: createIconLineMarker

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
@Nullable
private static LineMarkerInfo<PsiElement> createIconLineMarker(PsiType type,
                                                               @Nullable PsiExpression initializer,
                                                               PsiElement bindingElement) {
  if (initializer == null) return null;

  final Project project = initializer.getProject();

  final VirtualFile file = ProjectIconsAccessor.getInstance(project).resolveIconFile(type, initializer);
  if (file == null) return null;

  final Icon icon = ProjectIconsAccessor.getInstance(project).getIcon(file);
  if (icon == null) return null;

  final GutterIconNavigationHandler<PsiElement> navHandler = new GutterIconNavigationHandler<PsiElement>() {
    @Override
    public void navigate(MouseEvent e, PsiElement elt) {
      FileEditorManager.getInstance(project).openFile(file, true);
    }
  };

  return new LineMarkerInfo<PsiElement>(bindingElement, bindingElement.getTextRange(), icon,
                                        Pass.UPDATE_ALL, null, navHandler,
                                        GutterIconRenderer.Alignment.LEFT);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:IconLineMarkerProvider.java

示例3: collectInheritingClasses

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
public static void collectInheritingClasses(@NotNull PsiClass aClass,
                                            @NotNull Collection<LineMarkerInfo> result,
                                            @NotNull Map<PsiClass, PsiClass> subClassCache) {
  if (aClass.hasModifierProperty(PsiModifier.FINAL)) {
    return;
  }
  if (CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) return; // It's useless to have overridden markers for object.

  PsiClass subClass = subClassCache.get(aClass);
  if (subClass != null || FunctionalExpressionSearch.search(aClass).findFirst() != null) {
    final Icon icon = aClass.isInterface() ? AllIcons.Gutter.ImplementedMethod : AllIcons.Gutter.OverridenMethod;
    PsiElement range = aClass.getNameIdentifier();
    if (range == null) {
      range = aClass;
    }
    MarkerType type = MarkerType.SUBCLASSED_CLASS;
    LineMarkerInfo info = new LineMarkerInfo<PsiElement>(range, range.getTextRange(),
                                                         icon, Pass.UPDATE_OVERRIDEN_MARKERS, type.getTooltip(),
                                                         type.getNavigationHandler(),
                                                         GutterIconRenderer.Alignment.RIGHT);
    NavigateAction.setNavigateAction(info, aClass.isInterface() ? "Go to implementation(s)" : "Go to subclass(es)", IdeActions.ACTION_GOTO_IMPLEMENTATION);
    result.add(info);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaLineMarkerProvider.java

示例4: testTestClassWithMain

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
public void testTestClassWithMain() throws Exception {
  myFixture.addClass("package junit.framework; public class TestCase {}");
  myFixture.configureByText("MainTest.java", "public class <caret>MainTest extends junit.framework.TestCase {\n" +
                                             "    public static void main(String[] args) {\n" +
                                             "    }\n" +
                                             "    public void testFoo() {\n" +
                                             "    }\n" +
                                             "}");
  List<GutterMark> marks = myFixture.findGuttersAtCaret();
  assertEquals(1, marks.size());
  GutterIconRenderer mark = (GutterIconRenderer)marks.get(0);
  ActionGroup group = mark.getPopupMenuActions();
  assertNotNull(group);
  TestActionEvent event = new TestActionEvent();
  List<AnAction> list = ContainerUtil.findAll(group.getChildren(event), action -> {
    TestActionEvent actionEvent = new TestActionEvent();
    action.update(actionEvent);
    String text = actionEvent.getPresentation().getText();
    return text != null && text.startsWith("Run ") && text.endsWith("'");
  });
  assertEquals(list.toString(), 2, list.size());
  list.get(0).update(event);
  assertEquals("Run 'MainTest.main()'", event.getPresentation().getText());
  list.get(1).update(event);
  assertEquals("Run 'MainTest'", event.getPresentation().getText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:RunLineMarkerTest.java

示例5: LineMarkerInfo

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
public LineMarkerInfo(@NotNull T element,
                      @NotNull TextRange range,
                      Icon icon,
                      int updatePass,
                      @Nullable Function<? super T, String> tooltipProvider,
                      @Nullable GutterIconNavigationHandler<T> navHandler,
                      @NotNull GutterIconRenderer.Alignment alignment) {
  myIcon = icon;
  myTooltipProvider = tooltipProvider;
  myIconAlignment = alignment;
  elementRef = new WeakReference<T>(element);
  myNavigationHandler = navHandler;
  startOffset = range.getStartOffset();
  this.updatePass = updatePass;

  endOffset = range.getEndOffset();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LineMarkerInfo.java

示例6: findSelectedBreakpoint

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
@NotNull
public static Pair<GutterIconRenderer, Object> findSelectedBreakpoint(@NotNull final Project project, @NotNull final Editor editor) {
  int offset = editor.getCaretModel().getOffset();
  Document editorDocument = editor.getDocument();

  DebuggerSupport[] debuggerSupports = DebuggerSupport.getDebuggerSupports();
  for (DebuggerSupport debuggerSupport : debuggerSupports) {
    final BreakpointPanelProvider<?> provider = debuggerSupport.getBreakpointPanelProvider();

    final int textLength = editor.getDocument().getTextLength();
    if (offset > textLength) {
      offset = textLength;
    }

    Object breakpoint = provider.findBreakpoint(project, editorDocument, offset);
    if (breakpoint != null) {
      final GutterIconRenderer iconRenderer = provider.getBreakpointGutterIconRenderer(breakpoint);
      return Pair.create(iconRenderer, breakpoint);
    }
  }
  return Pair.create(null, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:XBreakpointUtil.java

示例7: createMethodSeparatorLineMarker

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
@NotNull
public static LineMarkerInfo createMethodSeparatorLineMarker(@NotNull PsiElement startFrom, @NotNull EditorColorsManager colorsManager) {
  LineMarkerInfo info = new LineMarkerInfo<PsiElement>(
    startFrom, 
    startFrom.getTextRange(), 
    null, 
    Pass.UPDATE_ALL, 
    FunctionUtil.<Object, String>nullConstant(),
    null, 
    GutterIconRenderer.Alignment.RIGHT
  );
  EditorColorsScheme scheme = colorsManager.getGlobalScheme();
  info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
  info.separatorPlacement = SeparatorPlacement.TOP;
  return info;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LineMarkersPass.java

示例8: getRelatedPopover

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
@NotNull
private LineMarkerInfo getRelatedPopover(@NotNull String singleItemTitle, @NotNull String singleItemTooltipPrefix, @NotNull PsiElement lineMarkerTarget, @NotNull Collection<GotoRelatedItem> gotoRelatedItems, @NotNull Icon icon) {
    // single item has no popup
    String title = singleItemTitle;
    if(gotoRelatedItems.size() == 1) {
        String customName = gotoRelatedItems.iterator().next().getCustomName();
        if(customName != null) {
            title = String.format(singleItemTooltipPrefix, customName);
        }
    }

    return new LineMarkerInfo<>(
        lineMarkerTarget,
        lineMarkerTarget.getTextRange(),
        icon,
        6,
        new ConstantFunction<>(title),
        new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
        GutterIconRenderer.Alignment.RIGHT
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:22,代码来源:TemplateLineMarker.java

示例9: getRelatedPopover

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
private LineMarkerInfo getRelatedPopover(String singleItemTitle, String singleItemTooltipPrefix, PsiElement lineMarkerTarget, List<GotoRelatedItem> gotoRelatedItems) {

        // single item has no popup
        String title = singleItemTitle;
        if(gotoRelatedItems.size() == 1) {
            String customName = gotoRelatedItems.get(0).getCustomName();
            if(customName != null) {
                title = String.format(singleItemTooltipPrefix, customName);
            }
        }

        return new LineMarkerInfo<>(
            lineMarkerTarget,
            lineMarkerTarget.getTextRange(),
            ShopwarePluginIcons.SHOPWARE_LINEMARKER,
            6,
            new ConstantFunction<>(title),
            new fr.adrienbrault.idea.symfony2plugin.dic.RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
            GutterIconRenderer.Alignment.RIGHT
        );
    }
 
开发者ID:Haehnchen,项目名称:idea-php-shopware-plugin,代码行数:22,代码来源:SmartyTemplateLineMarkerProvider.java

示例10: createMarker

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
@Nullable
@RequiredReadAction
private static LineMarkerInfo createMarker(final PsiElement element)
{
	CSharpMethodDeclaration methodDeclaration = CSharpLineMarkerUtil.getNameIdentifierAs(element, CSharpMethodDeclaration.class);
	if(methodDeclaration != null)
	{
		Unity3dModuleExtension extension = ModuleUtilCore.getExtension(element, Unity3dModuleExtension.class);
		if(extension == null)
		{
			return null;
		}

		UnityFunctionManager.FunctionInfo magicMethod = findMagicMethod(methodDeclaration);
		if(magicMethod != null)
		{
			return new LineMarkerInfo<>(element, element.getTextRange(), Unity3dIcons.EventMethod, Pass.LINE_MARKERS, new ConstantFunction<>(magicMethod.getDescription()), null,
					GutterIconRenderer.Alignment.LEFT);
		}
	}

	return null;
}
 
开发者ID:consulo,项目名称:consulo-unity3d,代码行数:24,代码来源:UnityEventCSharpMethodLineMarkerProvider.java

示例11: collectInheritingClasses

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
private static void collectInheritingClasses(PsiClass aClass, Collection<LineMarkerInfo> result) {
  if (aClass.hasModifierProperty(PsiModifier.FINAL)) {
    return;
  }
  if (CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) return; // It's useless to have overridden markers for object.

  PsiClass inheritor = ClassInheritorsSearch.search(aClass, false).findFirst();
  if (inheritor != null) {
    final Icon icon = aClass.isInterface() ? AllIcons.Gutter.ImplementedMethod : AllIcons.Gutter.OverridenMethod;
    PsiElement range = aClass.getNameIdentifier();
    if (range == null) range = aClass;
    MarkerType type = MarkerType.SUBCLASSED_CLASS;
    LineMarkerInfo info = new LineMarkerInfo<PsiElement>(range, range.getTextRange(),
                                                         icon, Pass.UPDATE_OVERRIDEN_MARKERS, type.getTooltip(),
                                                         type.getNavigationHandler(),
                                                         GutterIconRenderer.Alignment.RIGHT);
    result.add(info);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:JavaLineMarkerProvider.java

示例12: LineMarkerInfo

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
public LineMarkerInfo(@NotNull T element,
                      @NotNull TextRange range,
                      Icon icon,
                      int updatePass,
                      @Nullable Function<? super T, String> tooltipProvider,
                      @Nullable GutterIconNavigationHandler<T> navHandler,
                      GutterIconRenderer.Alignment alignment) {
  myIcon = icon;
  myTooltipProvider = tooltipProvider;
  myIconAlignment = alignment;
  elementRef = new WeakReference<T>(element);
  myNavigationHandler = navHandler;
  startOffset = range.getStartOffset();
  this.updatePass = updatePass;

  endOffset = range.getEndOffset();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:LineMarkerInfo.java

示例13: collect

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
@RequiredReadAction
@Override
public void collect(PsiElement psiElement, @NotNull Consumer<LineMarkerInfo> consumer)
{
	if(psiElement.getNode().getElementType() == CSharpTokens.IDENTIFIER && psiElement.getParent() instanceof CSharpReferenceExpression &&
			psiElement.getParent().getParent() instanceof CSharpMethodCallExpressionImpl)
	{
		PsiElement resolvedElement = ((CSharpReferenceExpression) psiElement.getParent()).resolve();
		if(resolvedElement instanceof CSharpMethodDeclaration)
		{
			CSharpMethodDeclaration methodDeclaration = PsiTreeUtil.getParentOfType(psiElement, CSharpMethodDeclaration.class);
			if(resolvedElement.isEquivalentTo(methodDeclaration))
			{
				LineMarkerInfo<PsiElement> lineMarkerInfo = new LineMarkerInfo<PsiElement>(psiElement, psiElement.getTextRange(), AllIcons.Gutter.RecursiveMethod, Pass.LINE_MARKERS,
						FunctionUtil.constant("Recursive call"), null, GutterIconRenderer.Alignment.CENTER);
				consumer.consume(lineMarkerInfo);
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:21,代码来源:RecursiveCallCollector.java

示例14: getLineMarkerInfo

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element)
{
	if(myDaemonSettings.SHOW_METHOD_SEPARATORS)
	{
		if(element instanceof LuaDocComment)
		{
			LuaDocCommentOwner owner = ((LuaDocComment) element).getOwner();

			if(owner instanceof LuaFunctionDefinition)
			{
				TextRange range = new TextRange(element.getTextOffset(), owner.getTextRange().getEndOffset());
				LineMarkerInfo<PsiElement> info = new LineMarkerInfo<>(element, range, null, Pass.UPDATE_ALL, NullableFunction.NULL, null, GutterIconRenderer.Alignment.RIGHT);
				EditorColorsScheme scheme = myColorsManager.getGlobalScheme();
				info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
				info.separatorPlacement = SeparatorPlacement.TOP;
				return info;
			}
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-lua,代码行数:25,代码来源:LuaMethodSeparatorMarkerProvider.java

示例15: getRelatedPopover

import com.intellij.openapi.editor.markup.GutterIconRenderer; //导入依赖的package包/类
private LineMarkerInfo getRelatedPopover(String singleItemTitle, String singleItemTooltipPrefix, PsiElement lineMarkerTarget, List<GotoRelatedItem> gotoRelatedItems, Icon icon) {

        // single item has no popup
        String title = singleItemTitle;
        if(gotoRelatedItems.size() == 1) {
            String customName = gotoRelatedItems.get(0).getCustomName();
            if(customName != null) {
                title = String.format(singleItemTooltipPrefix, customName);
            }
        }

        return new LineMarkerInfo<>(
            lineMarkerTarget,
            lineMarkerTarget.getTextRange(),
            icon,
            6,
            new ConstantFunction<>(title),
            new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
            GutterIconRenderer.Alignment.RIGHT
        );
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:22,代码来源:TwigLineMarkerProvider.java


注:本文中的com.intellij.openapi.editor.markup.GutterIconRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。