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


Java TextAttributes.setEffectType方法代码示例

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


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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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.setEffectType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。