本文整理匯總了Java中com.intellij.ui.SimpleTextAttributes.getStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleTextAttributes.getStyle方法的具體用法?Java SimpleTextAttributes.getStyle怎麽用?Java SimpleTextAttributes.getStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.ui.SimpleTextAttributes
的用法示例。
在下文中一共展示了SimpleTextAttributes.getStyle方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: appendFragmentsForSpeedSearch
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
public static void appendFragmentsForSpeedSearch(@NotNull JComponent speedSearchEnabledComponent,
@NotNull String text,
@NotNull SimpleTextAttributes attributes,
boolean selected,
@NotNull SimpleColoredComponent simpleColoredComponent) {
final SpeedSearchSupply speedSearch = SpeedSearchSupply.getSupply(speedSearchEnabledComponent);
if (speedSearch != null) {
final Iterable<TextRange> fragments = speedSearch.matchingFragments(text);
if (fragments != null) {
final Color fg = attributes.getFgColor();
final Color bg = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(bg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(simpleColoredComponent, text, fragments, plain, highlighted);
return;
}
}
simpleColoredComponent.append(text, attributes);
}
示例2: appendColoredFragmentForMatcher
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
public static void appendColoredFragmentForMatcher(@NotNull String text,
SimpleColoredComponent component,
@NotNull final SimpleTextAttributes attributes,
Matcher matcher,
Color selectedBg,
boolean selected) {
if (!(matcher instanceof MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) {
component.append(text, attributes);
return;
}
final Iterable<TextRange> iterable = ((MinusculeMatcher)matcher).matchingFragments(text);
if (iterable != null) {
final Color fg = attributes.getFgColor();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(selectedBg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(component, text, iterable, plain, highlighted);
}
else {
component.append(text, attributes);
}
}
示例3: getPlainAttributes
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
@Override
protected SimpleTextAttributes getPlainAttributes() {
SimpleTextAttributes original = super.getPlainAttributes();
int style = original.getStyle();
Color color = original.getFgColor();
boolean custom = false;
if ("test".equals(myGoal) && MavenRunner.getInstance(myProject).getSettings().isSkipTests()) {
color = SimpleTextAttributes.GRAYED_ATTRIBUTES.getFgColor();
style |= SimpleTextAttributes.STYLE_STRIKEOUT;
custom = true;
}
if (myGoal.equals(myMavenProject.getDefaultGoal())) {
style |= SimpleTextAttributes.STYLE_BOLD;
custom = true;
}
if (custom) return original.derive(style, color, null, null);
return original;
}
示例4: prepareAttributes
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
private SimpleTextAttributes prepareAttributes(SimpleTextAttributes from) {
ErrorLevel level = getTotalErrorLevel();
Color waveColor = level == ErrorLevel.NONE ? null : JBColor.RED;
int style = from.getStyle();
if (waveColor != null) style |= SimpleTextAttributes.STYLE_WAVED;
return new SimpleTextAttributes(from.getBgColor(), from.getFgColor(), waveColor, style);
}
示例5: prepareAttributes
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
private SimpleTextAttributes prepareAttributes(SimpleTextAttributes from) {
ExternalProjectsStructure.ErrorLevel level = getTotalErrorLevel();
Color waveColor = level == ExternalProjectsStructure.ErrorLevel.NONE ? null : JBColor.RED;
int style = from.getStyle();
if (waveColor != null) style |= SimpleTextAttributes.STYLE_WAVED;
return new SimpleTextAttributes(from.getBgColor(), from.getFgColor(), waveColor, style);
}
示例6: addTransparencyIfNeeded
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
public static SimpleTextAttributes addTransparencyIfNeeded(@NotNull final SimpleTextAttributes baseStyle, boolean isActive) {
if (isActive) return baseStyle;
Color color = baseStyle.getFgColor();
if (color == null) {
color = JBColor.black;
}
//noinspection UseJBColor
return new SimpleTextAttributes(baseStyle.getStyle(),
new Color(color.getRed(), color.getGreen(), color.getBlue(), 85));
}
示例7: prepareAttributes
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
private SimpleTextAttributes prepareAttributes(SimpleTextAttributes from) {
ErrorLevel level = getTotalErrorLevel();
Color waveColor = level == ErrorLevel.NONE ? null : JBColor.RED;
int style = from.getStyle();
if (waveColor != null) style |= SimpleTextAttributes.STYLE_WAVED;
return new SimpleTextAttributes(from.getBgColor(), from.getFgColor(), waveColor, style);
}
示例8: makeStrikeout
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
private static SimpleTextAttributes makeStrikeout(SimpleTextAttributes nameAttributes) {
return new SimpleTextAttributes(nameAttributes.getStyle() | SimpleTextAttributes.STYLE_STRIKEOUT, nameAttributes.getFgColor());
}
示例9: applySpeedSearchHighlighting
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
public static void applySpeedSearchHighlighting(@NotNull JComponent speedSearchEnabledComponent,
@NotNull SimpleColoredComponent coloredComponent,
boolean mainTextOnly,
boolean selected) {
SpeedSearchSupply speedSearch = SpeedSearchSupply.getSupply(speedSearchEnabledComponent);
// The bad thing is that SpeedSearch model is decoupled from UI presentation so we don't know the real matched text.
// Our best guess is to get strgin from the ColoredComponent. We can only provide main-text-only option.
Iterable<TextRange> ranges = speedSearch == null ? null : speedSearch.matchingFragments(coloredComponent.getCharSequence(mainTextOnly).toString());
Iterator<TextRange> rangesIterator = ranges != null ? ranges.iterator() : null;
if (rangesIterator == null || !rangesIterator.hasNext()) return;
Color bg = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
SimpleColoredComponent.ColoredIterator coloredIterator = coloredComponent.iterator();
TextRange range = rangesIterator.next();
main: while (coloredIterator.hasNext()) {
coloredIterator.next();
int offset = coloredIterator.getOffset();
int endOffset = coloredIterator.getEndOffset();
if (!range.intersectsStrict(offset, endOffset)) continue;
SimpleTextAttributes attributes = coloredIterator.getTextAttributes();
SimpleTextAttributes highlighted = new SimpleTextAttributes(bg, attributes.getFgColor(), null, attributes.getStyle() | SimpleTextAttributes.STYLE_SEARCH_MATCH);
if (range.getStartOffset() > offset) {
offset = coloredIterator.split(range.getStartOffset() - offset, attributes);
}
do {
if (range.getEndOffset() <= endOffset) {
offset = coloredIterator.split(range.getEndOffset() - offset, highlighted);
if (rangesIterator.hasNext()) {
range = rangesIterator.next();
}
else {
break main;
}
}
else {
coloredIterator.split(endOffset - offset, highlighted);
continue main;
}
}
while (range.intersectsStrict(offset, endOffset));
}
}
示例10: getLinkAttributes
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
private static SimpleTextAttributes getLinkAttributes(final SimpleTextAttributes baseStyle) {
Color color = baseStyle.getFgColor();
int alpha = color != null ? color.getAlpha() : 255;
@SuppressWarnings("UseJBColor") Color resultColor = new Color(blue.getRed(), blue.getGreen(), blue.getBlue(), alpha);
return new SimpleTextAttributes(baseStyle.getStyle() | SimpleTextAttributes.STYLE_UNDERLINE, resultColor);
}
示例11: patchAttr
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
public static SimpleTextAttributes patchAttr(InspectionTreeNode node, SimpleTextAttributes attributes) {
if (node.isResolved()) {
return new SimpleTextAttributes(attributes.getBgColor(), attributes.getFgColor(), attributes.getWaveColor(), attributes.getStyle() | SimpleTextAttributes.STYLE_STRIKEOUT);
}
return attributes;
}
示例12: getGrayAttributes
import com.intellij.ui.SimpleTextAttributes; //導入方法依賴的package包/類
protected static SimpleTextAttributes getGrayAttributes(SimpleTextAttributes attributes) {
return (attributes.getStyle() & SimpleTextAttributes.STYLE_ITALIC) != 0
? SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES;
}