當前位置: 首頁>>代碼示例>>Java>>正文


Java UIUtil.getInactiveTextColor方法代碼示例

本文整理匯總了Java中com.intellij.util.ui.UIUtil.getInactiveTextColor方法的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil.getInactiveTextColor方法的具體用法?Java UIUtil.getInactiveTextColor怎麽用?Java UIUtil.getInactiveTextColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.ui.UIUtil的用法示例。


在下文中一共展示了UIUtil.getInactiveTextColor方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public void execute(final String line, final int textEndOffset) {
  myResult = null;
  myInfo = parseExceptionLine(line);
  if (myInfo == null) {
    return;
  }

  myMethod = myInfo.getSecond().substring(line);

  final int lparenthIndex = myInfo.third.getStartOffset();
  final int rparenthIndex = myInfo.third.getEndOffset();
  final String fileAndLine = line.substring(lparenthIndex + 1, rparenthIndex).trim();

  final int colonIndex = fileAndLine.lastIndexOf(':');
  if (colonIndex < 0) return;

  final int lineNumber = getLineNumber(fileAndLine.substring(colonIndex + 1));
  if (lineNumber < 0) return;

  Pair<PsiClass[], PsiFile[]> pair = myCache.resolveClass(myInfo.first.substring(line).trim());
  myClasses = pair.first;
  myFiles = pair.second;
  if (myFiles.length == 0) {
    // try find the file with the required name
    //todo[nik] it would be better to use FilenameIndex here to honor the scope by it isn't accessible in Open API
    myFiles = PsiShortNamesCache.getInstance(myProject).getFilesByName(fileAndLine.substring(0, colonIndex).trim());
  }
  if (myFiles.length == 0) return;

  /*
   IDEADEV-4976: Some scramblers put something like SourceFile mock instead of real class name.
  final String filePath = fileAndLine.substring(0, colonIndex).replace('/', File.separatorChar);
  final int slashIndex = filePath.lastIndexOf(File.separatorChar);
  final String shortFileName = slashIndex < 0 ? filePath : filePath.substring(slashIndex + 1);
  if (!file.getName().equalsIgnoreCase(shortFileName)) return null;
  */

  final int textStartOffset = textEndOffset - line.length();

  final int highlightStartOffset = textStartOffset + lparenthIndex + 1;
  final int highlightEndOffset = textStartOffset + rparenthIndex;

  ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
  List<VirtualFile> virtualFilesInLibraries = new ArrayList<VirtualFile>();
  List<VirtualFile> virtualFilesInContent = new ArrayList<VirtualFile>();
  for (PsiFile file : myFiles) {
    VirtualFile virtualFile = file.getVirtualFile();
    if (index.isInContent(virtualFile)) {
      virtualFilesInContent.add(virtualFile);
    }
    else {
      virtualFilesInLibraries.add(virtualFile);
    }
  }

  List<VirtualFile> virtualFiles;
  TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES);
  if (virtualFilesInContent.isEmpty()) {
    Color libTextColor = UIUtil.getInactiveTextColor();
    attributes = attributes.clone();
    attributes.setForegroundColor(libTextColor);
    attributes.setEffectColor(libTextColor);

    virtualFiles = virtualFilesInLibraries;
  }
  else {
    virtualFiles = virtualFilesInContent;
  }
  HyperlinkInfo linkInfo = HyperlinkInfoFactory.getInstance().createMultipleFilesHyperlinkInfo(virtualFiles, lineNumber - 1, myProject);
  myResult = new Filter.Result(highlightStartOffset, highlightEndOffset, linkInfo, attributes);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:72,代碼來源:ExceptionWorker.java

示例2: applyHeavyFilter

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void applyHeavyFilter(final Document copiedFragment,
                             final int startOffset,
                             int startLineNumber,
                             final Consumer<AdditionalHighlight> consumer) {
  Map<String, Trinity<TextRange, TextRange, TextRange>> visited = new THashMap<String, Trinity<TextRange, TextRange, TextRange>>();
  final Trinity<TextRange, TextRange, TextRange> emptyInfo = Trinity.create(null, null, null);

  final ExceptionWorker worker = new ExceptionWorker(myCache);
  for (int i = 0; i < copiedFragment.getLineCount(); i++) {
    final int lineStartOffset = copiedFragment.getLineStartOffset(i);
    final int lineEndOffset = copiedFragment.getLineEndOffset(i);

    String text = copiedFragment.getText(new TextRange(lineStartOffset, lineEndOffset));
    if (!text.contains(".java:")) continue;
    Trinity<TextRange, TextRange, TextRange> info = visited.get(text);
    if (info == emptyInfo) continue;

    if (info == null) {
      info = emptyInfo;
      AccessToken token = ApplicationManager.getApplication().acquireReadActionLock();
      try {
        worker.execute(text, lineEndOffset);
        Result result = worker.getResult();
        if (result == null) continue;
        HyperlinkInfo hyperlinkInfo = result.getHyperlinkInfo();
        if (!(hyperlinkInfo instanceof FileHyperlinkInfo)) continue;

        OpenFileDescriptor descriptor = ((FileHyperlinkInfo)hyperlinkInfo).getDescriptor();
        if (descriptor == null) continue;

        int offset = descriptor.getOffset();
        PsiFile psiFile = worker.getFile();
        if (offset <= 0 || psiFile == null) continue;

        PsiElement element = psiFile.findElementAt(offset);
        PsiTryStatement parent = PsiTreeUtil.getParentOfType(element, PsiTryStatement.class, true, PsiClass.class);
        PsiCodeBlock tryBlock = parent != null? parent.getTryBlock() : null;
        if (tryBlock == null || !tryBlock.getTextRange().contains(offset)) continue;
        info = worker.getInfo();
      }
      finally {
        token.finish();
        visited.put(text, info);
      }
    }
    int off = startOffset + lineStartOffset;
    final Color color = UIUtil.getInactiveTextColor();
    consumer.consume(new AdditionalHighlight(off + info.first.getStartOffset(), off + info.second.getEndOffset()) {
      @Override
      public TextAttributes getTextAttributes(@Nullable TextAttributes source) {
        return new TextAttributes(null, null, color, EffectType.BOLD_DOTTED_LINE, Font.PLAIN);
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:57,代碼來源:ExceptionExFilterFactory.java

示例3: customizeCellRenderer

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  if (value instanceof MasterDetailsComponent.MyNode) {
    final MasterDetailsComponent.MyNode node = (MasterDetailsComponent.MyNode)value;

    final NamedConfigurable namedConfigurable = node.getConfigurable();
    if (namedConfigurable == null) {
      return;
    }

    final String displayName = node.getDisplayName();
    final Icon icon = namedConfigurable.getIcon(expanded);
    setIcon(icon);
    setToolTipText(null);
    setFont(UIUtil.getTreeFont());

    SimpleTextAttributes textAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
    if (node.isDisplayInBold()) {
      textAttributes = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
    }
    else if (namedConfigurable instanceof ProjectStructureElementConfigurable) {
      final ProjectStructureElement projectStructureElement =
        ((ProjectStructureElementConfigurable)namedConfigurable).getProjectStructureElement();
      if (projectStructureElement != null) {
        final ProjectStructureDaemonAnalyzer daemonAnalyzer = myContext.getDaemonAnalyzer();
        final ProjectStructureProblemsHolderImpl problemsHolder = daemonAnalyzer.getProblemsHolder(projectStructureElement);
        if (problemsHolder != null && problemsHolder.containsProblems()) {
          final boolean isUnused = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.UNUSED);
          final boolean haveWarnings = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.WARNING);
          final boolean haveErrors = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.ERROR);
          Color foreground = isUnused ? UIUtil.getInactiveTextColor() : null;
          final int style = haveWarnings || haveErrors ? SimpleTextAttributes.STYLE_WAVED : -1;
          final Color waveColor = haveErrors ? JBColor.RED : haveWarnings ? JBColor.GRAY : null;
          textAttributes = textAttributes.derive(style, foreground, null, waveColor);
          setToolTipText(problemsHolder.composeTooltipMessage());
        }

        append(displayName, textAttributes);
        String description = projectStructureElement.getDescription();
        if (description != null) {
          append(" (" + description + ")", SimpleTextAttributes.GRAY_ATTRIBUTES, false);
        }
        return;
      }
    }
    append(displayName, textAttributes);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:49,代碼來源:ProjectStructureElementRenderer.java

示例4: getInactiveTextColor

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
public Color getInactiveTextColor() {
  return UIUtil.getInactiveTextColor();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:ActionButtonWithText.java

示例5: getForeground

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Nullable
@Override
public Color getForeground(boolean selected, boolean focused, boolean inactive) {
  return (selected && focused) ? UIUtil.getListSelectionForeground()
                               : inactive ? UIUtil.getInactiveTextColor() : null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:AbstractNavBarUI.java

示例6: defaultActionForeground

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
protected static Color defaultActionForeground(boolean isSelected, @Nullable Presentation presentation) {
  if (isSelected) return UIUtil.getListSelectionForeground();
  if (presentation != null && (!presentation.isEnabled() || !presentation.isVisible())) return UIUtil.getInactiveTextColor();
  return UIUtil.getListForeground();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:GotoActionModel.java


注:本文中的com.intellij.util.ui.UIUtil.getInactiveTextColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。