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


Java LineMarkerInfo.LineMarkerGutterIconRenderer方法代码示例

本文整理汇总了Java中com.intellij.codeInsight.daemon.LineMarkerInfo.LineMarkerGutterIconRenderer方法的典型用法代码示例。如果您正苦于以下问题:Java LineMarkerInfo.LineMarkerGutterIconRenderer方法的具体用法?Java LineMarkerInfo.LineMarkerGutterIconRenderer怎么用?Java LineMarkerInfo.LineMarkerGutterIconRenderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.codeInsight.daemon.LineMarkerInfo的用法示例。


在下文中一共展示了LineMarkerInfo.LineMarkerGutterIconRenderer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCamelGutterForVariableAndConstant

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
public void testCamelGutterForVariableAndConstant() {
    myFixture.configureByFiles("JavaCamelRouteLineMarkerProviderFromVariableTestData.java");
    List<GutterMark> gutters = myFixture.findAllGutters();
    assertNotNull(gutters);

    //remove first element since it is navigate to super implementation gutter icon
    gutters.remove(0);

    assertEquals("Should contain 2 Camel gutters", 2, gutters.size());

    assertGuttersHasCamelIcon(gutters);

    LineMarkerInfo.LineMarkerGutterIconRenderer firstGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(0);
    assertTrue(firstGutter.getLineMarkerInfo().getElement() instanceof PsiIdentifier);
    assertEquals("The navigation start element doesn't match", "uriVar",
        firstGutter.getLineMarkerInfo().getElement().getText());

    List<GotoRelatedItem> firstGutterTargets = getGutterNavigationDestinationElements(firstGutter);
    assertEquals("Navigation should have two targets", 2, firstGutterTargets.size());
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:21,代码来源:JavaCamelRouteLineMarkerProviderTestIT.java

示例2: testCamelGutterForMethodCallFrom

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
public void testCamelGutterForMethodCallFrom() {
    myFixture.configureByFiles("JavaCamelRouteLineMarkerProviderFromMethodCallTestData.java");
    List<GutterMark> gutters = myFixture.findAllGutters();
    assertNotNull(gutters);

    //remove first element since it is navigate to super implementation gutter icon
    gutters.remove(0);
    // remove last element since it is from method returning route uri
    gutters.remove(gutters.size() - 1);

    assertEquals("Should contain 1 Camel gutters", 1, gutters.size());

    assertGuttersHasCamelIcon(gutters);

    LineMarkerInfo.LineMarkerGutterIconRenderer firstGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(0);
    assertTrue(firstGutter.getLineMarkerInfo().getElement() instanceof PsiIdentifier);
    assertEquals("The navigation start element doesn't match", "calcEndpoint",
        firstGutter.getLineMarkerInfo().getElement().getText());

    List<GotoRelatedItem> firstGutterTargets = getGutterNavigationDestinationElements(firstGutter);
    assertEquals("Navigation should have two targets", 2, firstGutterTargets.size());
    assertEquals("The navigation variable target element doesn't match", "calcEndpoint",
        getGuttersWithMethodTarget(firstGutterTargets).get(0).getName());
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:25,代码来源:JavaCamelRouteLineMarkerProviderTestIT.java

示例3: testCamelGutterForToD

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
public void testCamelGutterForToD() {
    myFixture.configureByFiles("XmlCamelRouteLineMarkerProviderToDTestData.xml");
    List<GutterMark> gutters = myFixture.findAllGutters();
    assertNotNull(gutters);

    assertEquals("Should contain 1 Camel gutter", 1, gutters.size());

    assertSame("Gutter should have the Camel icon", ServiceManager.getService(CamelPreferenceService.class).getCamelIcon(), gutters.get(0).getIcon());
    assertEquals("Camel route", gutters.get(0).getTooltipText());

    LineMarkerInfo.LineMarkerGutterIconRenderer gutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(0);

    assertTrue(gutter.getLineMarkerInfo().getElement() instanceof XmlToken);
    assertEquals("The navigation start element doesn't match", "file:inbox",
            PsiTreeUtil.getParentOfType(gutter.getLineMarkerInfo().getElement(), XmlTag.class).getAttribute("uri").getValue());

    List<GotoRelatedItem> gutterTargets = getGutterNavigationDestinationElements(gutter);
    assertEquals("Navigation should have one target", 1, gutterTargets.size());
    assertEquals("The navigation target route doesn't match", "file:inbox", gutterTargets.get(0).getElement().getText());
    assertEquals("The navigation target tag name doesn't match", "toD",
            getGuttersWithXMLTarget(gutterTargets).get(0).getLocalName());

}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:24,代码来源:XmlCamelRouteLineMarkerProviderTestIT.java

示例4: getGutterNavigationDestinationElements

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
static List<GotoRelatedItem> getGutterNavigationDestinationElements(LineMarkerInfo.LineMarkerGutterIconRenderer gutter) {
    LineMarkerProvider lineMarkerProvider1 = LineMarkersPass.getMarkerProviders(JavaLanguage.INSTANCE, gutter
        .getLineMarkerInfo()
        .getElement().getProject())
        .stream()
        .filter(lineMarkerProvider -> lineMarkerProvider instanceof CamelRouteLineMarkerProvider).findAny()
        .get();
    List<RelatedItemLineMarkerInfo> result = new ArrayList<>();
    ((CamelRouteLineMarkerProvider) lineMarkerProvider1).collectNavigationMarkers(gutter.getLineMarkerInfo().getElement(), result);
    return (List<GotoRelatedItem>) result.get(0).createGotoRelatedItems();
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:12,代码来源:GutterTestUtil.java

示例5: testCamelGutter

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
public void testCamelGutter() {
    myFixture.configureByFiles("JavaCamelRouteLineMarkerProviderTestData.java");
    List<GutterMark> gutters = myFixture.findAllGutters();
    assertNotNull(gutters);

    //remove first element since it is navigate to super implementation gutter icon
    gutters.remove(0);

    assertEquals("Should contain 2 Camel gutters", 2, gutters.size());

    assertGuttersHasCamelIcon(gutters);

    LineMarkerInfo.LineMarkerGutterIconRenderer firstGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(0);

    assertTrue(firstGutter.getLineMarkerInfo().getElement() instanceof PsiLiteralExpression);
    assertEquals("The navigation start element doesn't match", "file:inbox",
        ((PsiLiteralExpression) firstGutter.getLineMarkerInfo().getElement()).getValue());


    List<GotoRelatedItem> firstGutterTargets = getGutterNavigationDestinationElements(firstGutter);
    assertEquals("Navigation should have one target", 1, firstGutterTargets.size());
    assertEquals("The navigation target element doesn't match", "from(\"file:outbox\")",
        getGuttersWithJavaTarget(firstGutterTargets).get(0).getMethodExpression().getQualifierExpression().getText());


    LineMarkerInfo.LineMarkerGutterIconRenderer secondGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(1);

    assertTrue(secondGutter.getLineMarkerInfo().getElement() instanceof PsiLiteralExpression);
    assertEquals("The navigation start element doesn't match", "file:outbox",
        ((PsiLiteralExpression) secondGutter.getLineMarkerInfo().getElement()).getValue());

    List<GotoRelatedItem> secondGutterTargets = getGutterNavigationDestinationElements(secondGutter);
    assertEquals("Navigation should have one target", 1, secondGutterTargets.size());
    assertEquals("The navigation target element doesn't match", "from(\"file:inbox\")",
        getGuttersWithJavaTarget(secondGutterTargets).get(0).getMethodExpression().getQualifierExpression().getText());
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:37,代码来源:JavaCamelRouteLineMarkerProviderTestIT.java

示例6: testCamelGutterForToDAndToF

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
public void testCamelGutterForToDAndToF() {
    myFixture.configureByFiles("JavaCamelRouteLineMarkerProviderAlternateToTestData.java");
    List<GutterMark> gutters = myFixture.findAllGutters();
    assertNotNull(gutters);

    //remove first element since it is navigate to super implementation gutter icon
    gutters.remove(0);

    assertEquals("Should contain 2 Camel gutters", 2, gutters.size());

    assertGuttersHasCamelIcon(gutters);

    LineMarkerInfo.LineMarkerGutterIconRenderer firstGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(0);

    assertTrue(firstGutter.getLineMarkerInfo().getElement() instanceof PsiLiteralExpression);
    assertEquals("The navigation start element doesn't match", "file:test",
        ((PsiLiteralExpression) firstGutter.getLineMarkerInfo().getElement()).getValue());


    List<GotoRelatedItem> firstGutterTargets = getGutterNavigationDestinationElements(firstGutter);
    assertEquals("Navigation should have one target", 1, firstGutterTargets.size());
    assertEquals("The navigation target element doesn't match", "from(\"file:test\")",
        getGuttersWithJavaTarget(firstGutterTargets).get(0).getMethodExpression().getQualifierExpression().getText());


    LineMarkerInfo.LineMarkerGutterIconRenderer secondGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(1);

    assertTrue(secondGutter.getLineMarkerInfo().getElement() instanceof PsiLiteralExpression);
    assertEquals("The navigation start element doesn't match", "file:test",
        ((PsiLiteralExpression) secondGutter.getLineMarkerInfo().getElement()).getValue());

    List<GotoRelatedItem> secondGutterTargets = getGutterNavigationDestinationElements(secondGutter);
    assertEquals("Navigation should have one target", 1, secondGutterTargets.size());
    assertEquals("The navigation target element doesn't match", "from(\"file:test\")",
        getGuttersWithJavaTarget(secondGutterTargets).get(0).getMethodExpression().getQualifierExpression().getText());
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:37,代码来源:JavaCamelRouteLineMarkerProviderTestIT.java

示例7: testCamelGutter

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
public void testCamelGutter() {
    myFixture.configureByFiles("XmlCamelRouteLineMarkerProviderTestData.xml");
    List<GutterMark> gutters = myFixture.findAllGutters();
    assertNotNull(gutters);

    assertEquals("Should contain 2 Camel gutters", 2, gutters.size());

    Icon defaultIcon = ServiceManager.getService(CamelPreferenceService.class).getCamelIcon();
    gutters.forEach(gutterMark -> {
        assertSame("Gutter should have the Camel icon", defaultIcon, gutterMark.getIcon());
        assertEquals("Camel route", gutterMark.getTooltipText());
    });

    LineMarkerInfo.LineMarkerGutterIconRenderer firstGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(0);

    assertTrue(firstGutter.getLineMarkerInfo().getElement() instanceof XmlToken);
    assertEquals("The navigation start element doesn't match", "file:inbox",
            PsiTreeUtil.getParentOfType(firstGutter.getLineMarkerInfo().getElement(), XmlTag.class).getAttribute("uri").getValue());

    List<GotoRelatedItem> firstGutterTargets = getGutterNavigationDestinationElements(firstGutter);
    assertEquals("Navigation should have one target", 1, firstGutterTargets.size());
    assertEquals("The navigation target route doesn't match", "file:inbox", firstGutterTargets.get(0).getElement().getText());
    assertEquals("The navigation target tag name doesn't match", "to",
            getGuttersWithXMLTarget(firstGutterTargets).get(0).getLocalName());

    LineMarkerInfo.LineMarkerGutterIconRenderer secondGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(1);

    assertTrue(secondGutter.getLineMarkerInfo().getElement() instanceof XmlToken);
    assertEquals("The navigation start element doesn't match", "file:outbox",
            PsiTreeUtil.getParentOfType(secondGutter.getLineMarkerInfo().getElement(), XmlTag.class).getAttribute("uri").getValue());

    List<GotoRelatedItem> secondGutterTargets = getGutterNavigationDestinationElements(secondGutter);
    assertEquals("Navigation should have one target", 1, secondGutterTargets.size());
    assertEquals("The navigation target route doesn't match", "file:outbox", secondGutterTargets.get(0).getElement().getText());
    assertEquals("The navigation target tag name doesn't match", "to",
            getGuttersWithXMLTarget(secondGutterTargets).get(0).getLocalName());
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:38,代码来源:XmlCamelRouteLineMarkerProviderTestIT.java

示例8: testCamelGutterForJavaAndXMLRoutes

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
public void testCamelGutterForJavaAndXMLRoutes() {
    myFixture.configureByFiles("XmlCamelRouteLineMarkerProviderTestData.xml", "JavaCamelRouteLineMarkerProviderTestData.java");
    List<GutterMark> javaGutters = myFixture.findAllGutters("JavaCamelRouteLineMarkerProviderTestData.java");
    assertNotNull(javaGutters);

    List<GutterMark> xmlGutters = myFixture.findAllGutters("XmlCamelRouteLineMarkerProviderTestData.xml");
    assertNotNull(xmlGutters);

    //remove first element since it is navigate to super implementation gutter icon
    javaGutters.remove(0);

    assertEquals("Should contain 2 Java Camel gutters", 2, javaGutters.size());
    assertEquals("Should contain 2 XML Camel gutters", 2, xmlGutters.size());

    //from Java to XML
    LineMarkerInfo.LineMarkerGutterIconRenderer firstJavaGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) javaGutters.get(0);
    assertTrue(firstJavaGutter.getLineMarkerInfo().getElement() instanceof PsiLiteralExpression);
    assertEquals("The navigation start element doesn't match", "file:inbox",
            ((PsiLiteralExpression) firstJavaGutter.getLineMarkerInfo().getElement()).getValue());


    List<GotoRelatedItem> firstJavaGutterTargets = GutterTestUtil.getGutterNavigationDestinationElements(firstJavaGutter);
    assertEquals("Navigation should have two targets", 2, firstJavaGutterTargets.size());
    assertEquals("The navigation target XML tag name doesn't match", "to", getGuttersWithXMLTarget(firstJavaGutterTargets).get(0).getLocalName());
    assertEquals("The navigation Java target element doesn't match", "from(\"file:outbox\")",
            getGuttersWithJavaTarget(firstJavaGutterTargets).get(0).getMethodExpression().getQualifierExpression().getText());

    //from XML to Java
    LineMarkerInfo.LineMarkerGutterIconRenderer firstXmlGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) xmlGutters.get(0);
    assertTrue(firstXmlGutter.getLineMarkerInfo().getElement() instanceof XmlToken);
    assertEquals("The navigation start element doesn't match", "file:inbox",
            ((PsiLiteralExpression) firstJavaGutter.getLineMarkerInfo().getElement()).getValue());


    List<GotoRelatedItem> firstXmlGutterTargets = GutterTestUtil.getGutterNavigationDestinationElements(firstXmlGutter);
    assertEquals("Navigation should have two targets", 2, firstXmlGutterTargets.size());
    assertEquals("The navigation target XML tag name doesn't match", "to", getGuttersWithXMLTarget(firstXmlGutterTargets).get(0).getLocalName());
    assertEquals("The navigation Java target element doesn't match", "from(\"file:outbox\")",
            getGuttersWithJavaTarget(firstXmlGutterTargets).get(0).getMethodExpression().getQualifierExpression().getText());
}
 
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:41,代码来源:MultiLanguageCamelRouteLineMarkerProviderTestIT.java

示例9: checkGutterTargets

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
public static void checkGutterTargets(final GutterMark gutterMark,
                                      final String tooltip,
                                      final Icon icon,
                                      final String... expectedTargets) {
  assertNotNull(gutterMark);
  assertEquals(tooltip, gutterMark.getTooltipText());
  assertEquals(icon, gutterMark.getIcon());

  final Collection<PsiElement> targetElements;
  if (gutterMark instanceof LineMarkerInfo.LineMarkerGutterIconRenderer) {
    final LineMarkerInfo.LineMarkerGutterIconRenderer renderer =
      UsefulTestCase.assertInstanceOf(gutterMark, LineMarkerInfo.LineMarkerGutterIconRenderer.class);
    final LineMarkerInfo lineMarkerInfo = renderer.getLineMarkerInfo();
    GutterIconNavigationHandler handler = lineMarkerInfo.getNavigationHandler();

    if (handler instanceof NavigationGutterIconRenderer) {
      targetElements = ((NavigationGutterIconRenderer)handler).getTargetElements();
    }
    else {
      throw new IllegalArgumentException(handler + ": handler not supported");
    }
  }
  else {
    throw new IllegalArgumentException(gutterMark.getClass() + ": gutter not supported");
  }

  UsefulTestCase.assertSameElements(ContainerUtil.map(targetElements, new Function<PsiElement, String>() {
    @Override
    public String fun(PsiElement element) {
      return SymbolPresentationUtil.getSymbolPresentableText(element);
    }
  }), expectedTargets);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:DevKitGutterTargetsChecker.java

示例10: createOrReuseLineMarker

import com.intellij.codeInsight.daemon.LineMarkerInfo; //导入方法依赖的package包/类
@Nonnull
private static RangeHighlighter createOrReuseLineMarker(@Nonnull LineMarkerInfo info,
                                                        @Nonnull MarkupModel markupModel,
                                                        @Nullable HighlightersRecycler toReuse) {
  RangeHighlighter highlighter = toReuse == null ? null : toReuse.pickupHighlighterFromGarbageBin(info.startOffset, info.endOffset, HighlighterLayer.ADDITIONAL_SYNTAX);
  if (highlighter == null) {
    highlighter = markupModel.addRangeHighlighter(info.startOffset, info.endOffset, HighlighterLayer.ADDITIONAL_SYNTAX, null, HighlighterTargetArea.LINES_IN_RANGE);
  }
  highlighter.putUserData(LINE_MARKER_INFO, info);
  LineMarkerInfo.LineMarkerGutterIconRenderer newRenderer = (LineMarkerInfo.LineMarkerGutterIconRenderer)info.createGutterRenderer();
  LineMarkerInfo.LineMarkerGutterIconRenderer oldRenderer = highlighter.getGutterIconRenderer() instanceof LineMarkerInfo.LineMarkerGutterIconRenderer ? (LineMarkerInfo.LineMarkerGutterIconRenderer)highlighter.getGutterIconRenderer() : null;
  boolean rendererChanged = oldRenderer == null || newRenderer == null || !newRenderer.equals(oldRenderer);
  boolean lineSeparatorColorChanged = !Comparing.equal(highlighter.getLineSeparatorColor(), info.separatorColor);
  boolean lineSeparatorPlacementChanged = !Comparing.equal(highlighter.getLineSeparatorPlacement(), info.separatorPlacement);

  if (rendererChanged || lineSeparatorColorChanged || lineSeparatorPlacementChanged) {
    ((MarkupModelEx)markupModel).changeAttributesInBatch((RangeHighlighterEx)highlighter, markerEx -> {
      if (rendererChanged) {
        markerEx.setGutterIconRenderer(newRenderer);
      }
      if (lineSeparatorColorChanged) {
        markerEx.setLineSeparatorColor(info.separatorColor);
      }
      if (lineSeparatorPlacementChanged) {
        markerEx.setLineSeparatorPlacement(info.separatorPlacement);
      }
    });
  }
  info.highlighter = highlighter;
  return highlighter;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:32,代码来源:LineMarkersUtil.java


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