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


Java TextAttributes.setEffectColor方法代碼示例

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


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

示例1: highlightUsages

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private void highlightUsages() {
  if (mySearchResults.getEditor() == null) return;
  if (mySearchResults.getMatchesCount() >= mySearchResults.getMatchesLimit())
    return;
  for (FindResult range : mySearchResults.getOccurrences()) {
    if (range.getEndOffset() > mySearchResults.getEditor().getDocument().getTextLength()) continue;
    TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
    if (range.getLength() == 0) {
      attributes = attributes.clone();
      attributes.setEffectType(EffectType.BOXED);
      attributes.setEffectColor(attributes.getBackgroundColor());
    }
    if (mySearchResults.isExcluded(range)) {
      highlightRange(range, strikeout(), myHighlighters);
    } else {
      highlightRange(range, attributes, myHighlighters);
    }
  }
  updateInSelectionHighlighters();
  if (!myListeningSelection) {
    mySearchResults.getEditor().getSelectionModel().addSelectionListener(this);
    myListeningSelection = true;
  }

}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:LivePreview.java

示例2: getGrayedHyperlinkAttributes

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Nullable
private static TextAttributes getGrayedHyperlinkAttributes(@NotNull TextAttributesKey normalHyperlinkAttrsKey) {
  EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
  TextAttributes grayedHyperlinkAttrs = GRAYED_BY_NORMAL_CACHE.get(normalHyperlinkAttrsKey);
  if (grayedHyperlinkAttrs == null) {
    TextAttributes normalHyperlinkAttrs = globalScheme.getAttributes(normalHyperlinkAttrsKey);
    if (normalHyperlinkAttrs != null) {
      grayedHyperlinkAttrs = normalHyperlinkAttrs.clone();
      grayedHyperlinkAttrs.setForegroundColor(UIUtil.getInactiveTextColor());
      grayedHyperlinkAttrs.setEffectColor(UIUtil.getInactiveTextColor());
      GRAYED_BY_NORMAL_CACHE.put(normalHyperlinkAttrsKey, grayedHyperlinkAttrs);
    }
  }
  return grayedHyperlinkAttrs;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:Filter.java

示例3: patchAttributesColor

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
/**
 * Patches attributes to be visible under debugger active line
 */
@SuppressWarnings("UseJBColor")
public static TextAttributes patchAttributesColor(TextAttributes attributes, @NotNull TextRange range, @NotNull Editor editor) {
  MarkupModel model = DocumentMarkupModel.forDocument(editor.getDocument(), editor.getProject(), false);
  if (model != null) {
    if (!((MarkupModelEx)model).processRangeHighlightersOverlappingWith(range.getStartOffset(), range.getEndOffset(),
         new Processor<RangeHighlighterEx>() {
           @Override
           public boolean process(RangeHighlighterEx highlighter) {
             if (highlighter.isValid() && highlighter.getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE) {
               TextAttributes textAttributes = highlighter.getTextAttributes();
               if (textAttributes != null) {
                 Color color = textAttributes.getBackgroundColor();
                 return !(color != null && color.getBlue() > 128 && color.getRed() < 128 && color.getGreen() < 128);
               }
             }
             return true;
           }
         })) {
      TextAttributes clone = attributes.clone();
      clone.setForegroundColor(Color.orange);
      clone.setEffectColor(Color.orange);
      return clone;
    }
  }
  return attributes;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:NavigationUtil.java

示例4: setInheritedAttributes

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private void setInheritedAttributes(@NotNull TextAttributes attributes) {
  attributes.setFontType(myFallbackAttributes.getFontType());
  attributes.setForegroundColor(myFallbackAttributes.getForegroundColor());
  attributes.setBackgroundColor(myFallbackAttributes.getBackgroundColor());
  attributes.setErrorStripeColor(myFallbackAttributes.getErrorStripeColor());
  attributes.setEffectColor(myFallbackAttributes.getEffectColor());
  attributes.setEffectType(myFallbackAttributes.getEffectType());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:ColorAndFontOptions.java

示例5: createCompilationErrorAttr

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static TextAttributes createCompilationErrorAttr() {
  TextAttributes attr = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES).clone();
  attr.setForegroundColor(JBColor.RED);
  attr.setEffectColor(JBColor.RED);
  attr.setEffectType(EffectType.LINE_UNDERSCORE);
  attr.setFontType(Font.PLAIN);
  return attr;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:AbstractMavenConsoleFilter.java

示例6: apply

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Override
public void apply(@NotNull TextAttributes ta) {
    int fontType = Font.PLAIN;
    if (myCbBold.isSelected()) {
        fontType |= Font.BOLD;
    }
    if (myCbItalic.isSelected()) {
        fontType |= Font.ITALIC;
    }

    ta.setFontType(fontType);

    if (myCbForeground.isSelected()) {
        ta.setForegroundColor(myForegroundChooser.getSelectedColor());
    } else {
        ta.setForegroundColor(null);
    }

    if (myCbBackground.isSelected()) {
        ta.setBackgroundColor(myBackgroundChooser.getSelectedColor());
    } else {
        ta.setBackgroundColor(null);
    }

    if (myCbErrorStripe.isSelected()) {
        ta.setErrorStripeColor(myErrorStripeColorChooser.getSelectedColor());
    } else {
        ta.setErrorStripeColor(null);
    }

    if (myCbEffects.isSelected()) {
        Color effectColor = myEffectsColorChooser.getSelectedColor();
        ta.setEffectColor(effectColor);
        //noinspection SuspiciousMethodCalls
        if (effectColor == null) {
            ta.setEffectType(null);
        } else {
            //noinspection SuspiciousMethodCalls
            ta.setEffectType(myEffectsMap.get(myEffectsCombo.getModel().getSelectedItem()));
        }
    } else {
        ta.setEffectColor(null);
        ta.setEffectType(null);
    }
}
 
開發者ID:huoguangjin,項目名稱:MultiHighlight,代碼行數:46,代碼來源:ColorChooserPanel.java

示例7: execute

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的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

示例8: getTextAttributesForAdd

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static TextAttributes getTextAttributesForAdd() {
  final TextAttributes textAttributes = new TextAttributes();
  textAttributes.setEffectType(EffectType.ROUNDED_BOX);
  textAttributes.setEffectColor(JBColor.RED);
  return textAttributes;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:InplaceIntroduceParameterPopup.java

示例9: getTestAttributesForRemoval

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static TextAttributes getTestAttributesForRemoval() {
  final TextAttributes textAttributes = new TextAttributes();
  textAttributes.setEffectType(EffectType.STRIKEOUT);
  textAttributes.setEffectColor(Color.BLACK);
  return textAttributes;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:InplaceIntroduceParameterPopup.java

示例10: addErrorHighlighting

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static SimpleTextAttributes addErrorHighlighting(boolean error, SimpleTextAttributes attributes) {
  final TextAttributes textAttributes = attributes.toTextAttributes();
  textAttributes.setEffectType(EffectType.WAVE_UNDERSCORE);
  textAttributes.setEffectColor(error ? JBColor.RED : JBColor.GRAY);
  return SimpleTextAttributes.fromTextAttributes(textAttributes);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:PackagingElementNode.java

示例11: getOutputKey

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@NotNull
public Key getOutputKey(@NonNls String attribute) {
  final String completeAttribute = attribute;
  if (attribute.startsWith("\u001B[")) {
    attribute = attribute.substring(2);
  }
  else if (attribute.startsWith("[")) {
    attribute = attribute.substring(1);
  }
  if (attribute.endsWith("m")) {
    attribute = attribute.substring(0, attribute.length() - 1);
  }
  if (attribute.equals("0")) {
    return ProcessOutputTypes.STDOUT;
  }
  TextAttributes attrs = new TextAttributes();
  final String[] strings = attribute.split(";");
  for (String string : strings) {
    int value;
    try {
      value = Integer.parseInt(string);
    }
    catch (NumberFormatException e) {
      continue;
    }
    if (value == 1) {
      attrs.setFontType(Font.BOLD);
    }
    else if (value == 4) {
      attrs.setEffectType(EffectType.LINE_UNDERSCORE);
    }
    else if (value == 22) {
      attrs.setFontType(Font.PLAIN);
    }
    else if (value == 24) {  //not underlined
      attrs.setEffectType(null);
    }
    else if (value >= 30 && value <= 37) {
      attrs.setForegroundColor(getAnsiColor(value - 30));
    }
    else if (value == 38) {
      //TODO: 256 colors foreground
    }
    else if (value == 39) {
      attrs.setForegroundColor(getColorByKey(ConsoleViewContentType.NORMAL_OUTPUT_KEY));
    }
    else if (value >= 40 && value <= 47) {
      attrs.setBackgroundColor(getAnsiColor(value - 40));
    }
    else if (value == 48) {
      //TODO: 256 colors background
    }
    else if (value == 49) {
      attrs.setBackgroundColor(getColorByKey(ConsoleViewContentType.NORMAL_OUTPUT_KEY));
    }
    else if (value >= 90 && value <= 97) {
      attrs.setForegroundColor(
        getAnsiColor(value - 82));
    }
    else if (value >= 100 && value <= 107) {
      attrs.setBackgroundColor(
        getAnsiColor(value - 92));
    }
  }
  if (attrs.getEffectType() == EffectType.LINE_UNDERSCORE) {
    attrs.setEffectColor(attrs.getForegroundColor());
  }
  Key newKey = new Key(completeAttribute);
  ConsoleViewContentType contentType = new ConsoleViewContentType(completeAttribute, attrs);
  ConsoleViewContentType.registerNewConsoleViewType(newKey, contentType);
  return newKey;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:73,代碼來源:ColoredOutputTypeRegistry.java

示例12: customizeCellRenderer

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Override
public void customizeCellRenderer(JTree tree,
                                  Object value,
                                  boolean selected,
                                  boolean expanded,
                                  boolean leaf,
                                  int row,
                                  boolean hasFocus) {
  if (value instanceof PackageDependenciesNode) {
    PackageDependenciesNode node = (PackageDependenciesNode)value;
    try {
      setIcon(node.getIcon());
    }
    catch (IndexNotReadyException ignore) {
    }
    final SimpleTextAttributes regularAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
    TextAttributes textAttributes = regularAttributes.toTextAttributes();
    if (node instanceof BasePsiNode && ((BasePsiNode)node).isDeprecated()) {
      textAttributes =
          EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES).clone();
    }
    final PsiElement psiElement = node.getPsiElement();
    textAttributes.setForegroundColor(CopyPasteManager.getInstance().isCutElement(psiElement) ? CopyPasteManager.CUT_COLOR : node.getColor());
    if (getCurrentScope() != DefaultScopesProvider.getInstance(myProject).getProblemsScope()) {
      final PsiFile containingFile = psiElement != null ? psiElement.getContainingFile() : null;
      final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(psiElement);
      boolean isProblem;
      if (containingFile != null) {
        isProblem = myWolfTheProblemSolver.isProblemFile(virtualFile);
      }
      else if (virtualFile != null) {
        isProblem = myWolfTheProblemSolver.hasProblemFilesBeneath(new Condition<VirtualFile>() {
          @Override
          public boolean value(VirtualFile file) {
            return VfsUtilCore.isAncestor(virtualFile, file, false);
          }
        });
      }
      else {
        final Module module =  node instanceof ModuleNode ? ((ModuleNode)node).getModule() : null;
        isProblem = module != null && myWolfTheProblemSolver.hasProblemFilesBeneath(module);
      }
      if (isProblem) {
        textAttributes.setEffectColor(JBColor.RED);
        textAttributes.setEffectType(EffectType.WAVE_UNDERSCORE);
      }
    }
    append(node.toString(), SimpleTextAttributes.fromTextAttributes(textAttributes));

    String oldToString = toString();
    if (!myProject.isDisposed()) {
      for(ProjectViewNodeDecorator decorator: Extensions.getExtensions(ProjectViewNodeDecorator.EP_NAME, myProject)) {
        decorator.decorate(node, this);
      }
    }
    if (toString().equals(oldToString)) {   // nothing was decorated
      final String locationString = node.getComment();
      if (locationString != null && locationString.length() > 0) {
        append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:64,代碼來源:ScopeTreeViewPanel.java

示例13: getTestAttributesForRemoval

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static TextAttributes getTestAttributesForRemoval() {
  final TextAttributes textAttributes = new TextAttributes();
  textAttributes.setEffectType(EffectType.STRIKEOUT);
  textAttributes.setEffectColor(JBColor.BLACK);
  return textAttributes;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:GrInplaceParameterIntroducer.java


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