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


Java Pass类代码示例

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


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

示例1: doHighlighting

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
@NotNull
protected List<HighlightInfo> doHighlighting() {
  PsiDocumentManager.getInstance(getProject()).commitAllDocuments();

  TIntArrayList toIgnoreList = new TIntArrayList();
  if (!doFolding()) {
    toIgnoreList.add(Pass.UPDATE_FOLDING);
  }
  if (!doInspections()) {
    toIgnoreList.add(Pass.LOCAL_INSPECTIONS);
    toIgnoreList.add(Pass.WHOLE_FILE_LOCAL_INSPECTIONS);
  }
  int[] toIgnore = toIgnoreList.isEmpty() ? ArrayUtil.EMPTY_INT_ARRAY : toIgnoreList.toNativeArray();
  Editor editor = getEditor();
  PsiFile file = getFile();
  if (editor instanceof EditorWindow) {
    editor = ((EditorWindow)editor).getDelegate();
    file = InjectedLanguageManager.getInstance(file.getProject()).getTopLevelFile(file);
  }

  return CodeInsightTestFixtureImpl.instantiateAndRun(file, editor, toIgnore, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LightDaemonAnalyzerTestCase.java

示例2: createIconLineMarker

import com.intellij.codeHighlighting.Pass; //导入依赖的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: collectSiblingInheritedMethods

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
private static void collectSiblingInheritedMethods(@NotNull final Collection<PsiMethod> methods,
                                                   @NotNull Collection<LineMarkerInfo> result,
                                                   @NotNull Map<PsiClass, PsiClass> subClassCache) {
  for (PsiMethod method : methods) {
    ProgressManager.checkCanceled();
    PsiClass aClass = method.getContainingClass();
    if (aClass == null || aClass.hasModifierProperty(PsiModifier.FINAL) || aClass.isInterface()) continue;

    boolean canHaveSiblingSuper = !method.hasModifierProperty(PsiModifier.ABSTRACT) && !method.hasModifierProperty(PsiModifier.STATIC) && method.hasModifierProperty(PsiModifier.PUBLIC)&& !method.hasModifierProperty(PsiModifier.FINAL)&& !method.hasModifierProperty(PsiModifier.NATIVE);
    if (!canHaveSiblingSuper) continue;

    PsiMethod siblingInheritedViaSubClass = Pair.getFirst(FindSuperElementsHelper.getSiblingInheritedViaSubClass(method, subClassCache));
    if (siblingInheritedViaSubClass == null) {
      continue;
    }
    PsiElement range = getMethodRange(method);
    ArrowUpLineMarkerInfo upInfo = new ArrowUpLineMarkerInfo(range, AllIcons.Gutter.ImplementingMethod, MarkerType.SIBLING_OVERRIDING_METHOD,
                                                            Pass.UPDATE_OVERRIDEN_MARKERS);
    LineMarkerInfo info = NavigateAction.setNavigateAction(upInfo, "Go to super method", IdeActions.ACTION_GOTO_SUPER);
    result.add(info);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JavaLineMarkerProvider.java

示例4: collectInheritingClasses

import com.intellij.codeHighlighting.Pass; //导入依赖的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

示例5: testFoldingIsNotBlinkingOnNavigationToSingleLineMethod

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
public void testFoldingIsNotBlinkingOnNavigationToSingleLineMethod() {
  VirtualFile file = getFile("/src/Bar.java");
  PsiJavaFile psiFile = (PsiJavaFile)getPsiManager().findFile(file);
  assertNotNull(psiFile);
  PsiMethod method = psiFile.getClasses()[0].getMethods()[0];
  method.navigate(true);

  FileEditor[] editors = myManager.getEditors(file);
  assertEquals(1, editors.length);
  Editor editor = ((TextEditor)editors[0]).getEditor();
  FoldRegion[] regions = editor.getFoldingModel().getAllFoldRegions();
  assertEquals(2, regions.length);
  assertTrue(regions[0].isExpanded());
  assertTrue(regions[1].isExpanded());

  CodeInsightTestFixtureImpl.instantiateAndRun(psiFile, editor, new int[]{Pass.UPDATE_ALL, Pass.LOCAL_INSPECTIONS}, false);

  regions = editor.getFoldingModel().getAllFoldRegions();
  assertEquals(2, regions.length);
  assertTrue(regions[0].isExpanded());
  assertTrue(regions[1].isExpanded());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JavaFileEditorManagerTest.java

示例6: markFileUpToDate

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
public void markFileUpToDate(@NotNull Document document, int passId) {
  synchronized(myDocumentToStatusMap){
    FileStatus status = myDocumentToStatusMap.get(document);
    if (status == null){
      status = new FileStatus(myProject);
      myDocumentToStatusMap.put(document, status);
    }
    status.defensivelyMarked=false;
    if (passId == Pass.WOLF) {
      status.wolfPassFinished = true;
    }
    else if (status.dirtyScopes.containsKey(passId)) {
      status.setDirtyScope(passId, null);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FileStatusMap.java

示例7: createMethodSeparatorLineMarker

import com.intellij.codeHighlighting.Pass; //导入依赖的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: getMethodMarker

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
@Nullable
private static LineMarkerInfo<PsiElement> getMethodMarker(final PsiElement element, final PyFunction function) {
  if (PyNames.INIT.equals(function.getName())) {
    return null;
  }
  final TypeEvalContext context = TypeEvalContext.codeAnalysis(element.getProject(), null);
  final PsiElement superMethod = PySuperMethodsSearch.search(function, context).findFirst();
  if (superMethod != null) {
    PyClass superClass = null;
    if (superMethod instanceof PyFunction) {
      superClass = ((PyFunction)superMethod).getContainingClass();
    }
    // TODO: show "implementing" instead of "overriding" icon for Python implementations of Java interface methods
    return new LineMarkerInfo<PsiElement>(element, element.getTextRange().getStartOffset(), AllIcons.Gutter.OverridingMethod,
                                          Pass.UPDATE_ALL,
                                          superClass == null ? null : new TooltipProvider("Overrides method in " + superClass.getName()),
                                          ourSuperMethodNavigator);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyLineMarkerProvider.java

示例9: getAttributeMarker

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
@Nullable
private static LineMarkerInfo<PsiElement> getAttributeMarker(PyTargetExpression element) {
  final String name = element.getReferencedName();
  if (name == null) {
    return null;
  }
  PyClass containingClass = PsiTreeUtil.getParentOfType(element, PyClass.class);
  if (containingClass == null) return null;
  for (PyClass ancestor : containingClass
    .getAncestorClasses(TypeEvalContext.codeAnalysis(element.getProject(), element.getContainingFile()))) {
    final PyTargetExpression ancestorAttr = ancestor.findClassAttribute(name, false);
    if (ancestorAttr != null) {
      return new LineMarkerInfo<PsiElement>(element, element.getTextRange().getStartOffset(),
                                            AllIcons.Gutter.OverridingMethod, Pass.UPDATE_ALL,
                                            new TooltipProvider("Overrides attribute in " + ancestor.getName()),
                                            ourSuperAttributeNavigator);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyLineMarkerProvider.java

示例10: doHighlighting

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
@NotNull
protected Collection<HighlightInfo> doHighlighting(final Boolean externalToolPass) {
  final Project project = myTestFixture.getProject();
  PsiDocumentManager.getInstance(project).commitAllDocuments();
  final Editor editor = myTestFixture.getEditor();

  int[] ignore = externalToolPass == null || externalToolPass ? new int[]{
    Pass.LINE_MARKERS,
    Pass.LOCAL_INSPECTIONS,
    Pass.POPUP_HINTS,
    Pass.UPDATE_ALL,
    Pass.UPDATE_FOLDING,
    Pass.UPDATE_OVERRIDEN_MARKERS,
    Pass.VISIBLE_LINE_MARKERS,
  } : new int[]{Pass.EXTERNAL_TOOLS};
  return CodeInsightTestFixtureImpl.instantiateAndRun(myTestFixture.getFile(), editor, ignore, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HighlightingTestBase.java

示例11: createMarker

import com.intellij.codeHighlighting.Pass; //导入依赖的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

示例12: doHighlighting

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
@NotNull
protected List<HighlightInfo> doHighlighting() {
  PsiDocumentManager.getInstance(getProject()).commitAllDocuments();

  TIntArrayList toIgnoreList = new TIntArrayList();
  if (!doFolding()) {
    toIgnoreList.add(Pass.UPDATE_FOLDING);
  }
  if (!doInspections()) {
    toIgnoreList.add(Pass.LOCAL_INSPECTIONS);
  }
  int[] toIgnore = toIgnoreList.isEmpty() ? ArrayUtil.EMPTY_INT_ARRAY : toIgnoreList.toNativeArray();
  Editor editor = getEditor();
  PsiFile file = getFile();
  if (editor instanceof EditorWindow) {
    editor = ((EditorWindow)editor).getDelegate();
    file = InjectedLanguageManager.getInstance(file.getProject()).getTopLevelFile(file);
  }

  return CodeInsightTestFixtureImpl.instantiateAndRun(file, editor, toIgnore, false);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:LightDaemonAnalyzerTestCase.java

示例13: collectInheritingClasses

import com.intellij.codeHighlighting.Pass; //导入依赖的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

示例14: markFileUpToDate

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
public void markFileUpToDate(@NotNull Document document, int passId) {
  synchronized(myDocumentToStatusMap){
    FileStatus status = myDocumentToStatusMap.get(document);
    if (status == null){
      status = new FileStatus(myProject);
      myDocumentToStatusMap.put(document, status);
    }
    status.defensivelyMarked=false;
    if (passId == Pass.WOLF) {
      status.wolfPassFinished = true;
    }
    else if (status.dirtyScopes.containsKey(passId)) {
      RangeMarker marker = status.dirtyScopes.get(passId);
      if (marker != null) {
        marker.dispose();
        status.dirtyScopes.put(passId, null);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:FileStatusMap.java

示例15: markFileScopeDirty

import com.intellij.codeHighlighting.Pass; //导入依赖的package包/类
public void markFileScopeDirty(@NotNull Document document, int passId) {
  assertAllowModifications();
  synchronized(myDocumentToStatusMap) {
    FileStatus status = myDocumentToStatusMap.get(document);
    if (status == null){
      return;
    }
    if (passId == Pass.WOLF) {
      status.wolfPassFinished = false;
    }
    else {
      LOG.assertTrue(status.dirtyScopes.containsKey(passId));
      RangeMarker marker = status.dirtyScopes.get(passId);
      if (marker != null) {
        marker.dispose();
      }
      status.dirtyScopes.put(passId, WHOLE_FILE_DIRTY_MARKER);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:FileStatusMap.java


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