本文整理汇总了Java中com.intellij.openapi.editor.markup.EffectType.LINE_UNDERSCORE属性的典型用法代码示例。如果您正苦于以下问题:Java EffectType.LINE_UNDERSCORE属性的具体用法?Java EffectType.LINE_UNDERSCORE怎么用?Java EffectType.LINE_UNDERSCORE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.editor.markup.EffectType
的用法示例。
在下文中一共展示了EffectType.LINE_UNDERSCORE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customizeCellRenderer
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof FileInfo) {
Project project = mySwitcherPanel.project;
VirtualFile virtualFile = ((FileInfo)value).getFirst();
String renderedName = ((FileInfo)value).getNameForRendering();
setIcon(IconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, project));
FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(virtualFile);
open = FileEditorManager.getInstance(project).isFileOpen(virtualFile);
TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
append(renderedName, SimpleTextAttributes.fromTextAttributes(attributes));
// calc color the same way editor tabs do this, i.e. including EPs
Color color = EditorTabbedContainer.calcTabColor(project, virtualFile);
if (!selected && color != null) {
setBackground(color);
}
SpeedSearchUtil.applySpeedSearchHighlighting(mySwitcherPanel, this, false, selected);
}
}
示例2: customizeCellRenderer
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof VirtualFile) {
VirtualFile virtualFile = (VirtualFile)value;
String name = virtualFile.getPresentableName();
setIcon(IconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, myProject));
FileStatus fileStatus = FileStatusManager.getInstance(myProject).getStatus(virtualFile);
TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null , null, EffectType.LINE_UNDERSCORE,
Font.PLAIN);
append(name, SimpleTextAttributes.fromTextAttributes(attributes));
if (!selected && FileEditorManager.getInstance(myProject).isFileOpen(virtualFile)) {
setBackground(LightColors.SLIGHTLY_GREEN);
}
}
}
示例3: customizeCellRenderer
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof FileInfo) {
VirtualFile virtualFile = ((FileInfo)value).getFirst();
String name = virtualFile instanceof VirtualFilePathWrapper
? ((VirtualFilePathWrapper)virtualFile).getPresentablePath()
: UISettings.getInstance().SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES
? UniqueVFilePathBuilder.getInstance().getUniqueVirtualFilePath(myProject, virtualFile)
: virtualFile.getName();
setIcon(IconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, myProject));
FileStatus fileStatus = FileStatusManager.getInstance(myProject).getStatus(virtualFile);
open = FileEditorManager.getInstance(myProject).isFileOpen(virtualFile);
TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null , null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
append(name, SimpleTextAttributes.fromTextAttributes(attributes));
// calc color the same way editor tabs do this, i.e. including extensions
Color color = EditorTabbedContainer.calcTabColor(myProject, virtualFile);
if (!selected && color != null) {
setBackground(color);
}
}
}
示例4: customizeCellRenderer
@Override
protected void customizeCellRenderer(@Nonnull JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof FileInfo) {
Project project = mySwitcherPanel.project;
VirtualFile virtualFile = ((FileInfo)value).getFirst();
String renderedName = ((FileInfo)value).getNameForRendering();
setIcon(VfsIconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, project));
FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(virtualFile);
open = FileEditorManager.getInstance(project).isFileOpen(virtualFile);
TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
append(renderedName, SimpleTextAttributes.fromTextAttributes(attributes));
// calc color the same way editor tabs do this, i.e. including EPs
Color color = EditorTabbedContainer.calcTabColor(project, virtualFile);
if (!selected && color != null) {
setBackground(color);
}
SpeedSearchUtil.applySpeedSearchHighlighting(mySwitcherPanel, this, false, selected);
}
}
示例5: HyperlinkLabel
public HyperlinkLabel(String text, final Color textForegroundColor, final Color textBackgroundColor, final Color textEffectColor) {
myAnchorAttributes =
new TextAttributes(textForegroundColor, textBackgroundColor, textEffectColor, EffectType.LINE_UNDERSCORE, Font.PLAIN);
enforceBackgroundOutsideText(textBackgroundColor);
setHyperlinkText(text);
enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
setOpaque(false);
}
示例6: fromTextAttributes
@NotNull
public static SimpleTextAttributes fromTextAttributes(TextAttributes attributes) {
if (attributes == null) return REGULAR_ATTRIBUTES;
Color foregroundColor = attributes.getForegroundColor();
if (foregroundColor == null) foregroundColor = REGULAR_ATTRIBUTES.getFgColor();
int style = attributes.getFontType();
if (attributes.getEffectColor() != null) {
EffectType effectType = attributes.getEffectType();
if (effectType == EffectType.STRIKEOUT) {
style |= STYLE_STRIKEOUT;
}
else if (effectType == EffectType.WAVE_UNDERSCORE) {
style |= STYLE_WAVED;
}
else if (effectType == EffectType.LINE_UNDERSCORE ||
effectType == EffectType.BOLD_LINE_UNDERSCORE ||
effectType == EffectType.BOLD_DOTTED_LINE) {
style |= STYLE_UNDERLINE;
}
else if (effectType == EffectType.SEARCH_MATCH) {
style |= STYLE_SEARCH_MATCH;
}
else {
// not supported
}
}
return new SimpleTextAttributes(attributes.getBackgroundColor(), foregroundColor, attributes.getEffectColor(), style);
}
示例7: toTextAttributes
public TextAttributes toTextAttributes() {
Color effectColor;
EffectType effectType;
if (isWaved()) {
effectColor = myWaveColor;
effectType = EffectType.WAVE_UNDERSCORE;
}
else if (isStrikeout()) {
effectColor = myWaveColor;
effectType = EffectType.STRIKEOUT;
}
else if (isUnderline()) {
effectColor = myWaveColor;
effectType = EffectType.LINE_UNDERSCORE;
}
else if (isBoldDottedLine()) {
effectColor = myWaveColor;
effectType = EffectType.BOLD_DOTTED_LINE;
}
else if (isSearchMatch()) {
effectColor = myWaveColor;
effectType = EffectType.SEARCH_MATCH;
}
else {
effectColor = null;
effectType = null;
}
return new TextAttributes(myFgColor, null, effectColor, effectType, myStyle & FONT_MASK);
}
示例8: setupRenderer
public static void setupRenderer(SimpleColoredComponent renderer, Project project, Bookmark bookmark, boolean selected) {
VirtualFile file = bookmark.getFile();
if (!file.isValid()) {
return;
}
PsiManager psiManager = PsiManager.getInstance(project);
PsiElement fileOrDir = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
if (fileOrDir != null) {
renderer.setIcon(fileOrDir.getIcon(0));
}
String description = bookmark.getDescription();
if (description != null) {
renderer.append(description + " ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
renderer.append(file.getName(), SimpleTextAttributes.fromTextAttributes(attributes));
if (bookmark.getLine() >= 0) {
renderer.append(":", SimpleTextAttributes.GRAYED_ATTRIBUTES);
renderer.append(String.valueOf(bookmark.getLine() + 1), SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
if (!selected) {
FileColorManager colorManager = FileColorManager.getInstance(project);
if (fileOrDir instanceof PsiFile) {
Color color = colorManager.getRendererBackground((PsiFile)fileOrDir);
if (color != null) {
renderer.setBackground(color);
}
}
}
}
示例9: HyperlinkLabel
public HyperlinkLabel(String text, final Color textForegroundColor, final Color textBackgroundColor, final Color textEffectColor) {
myAnchorAttributes =
new TextAttributes(textForegroundColor, textBackgroundColor, textEffectColor, EffectType.LINE_UNDERSCORE, Font.PLAIN);
enforceBackgroundOutsideText(textBackgroundColor);
setHyperlinkText(text);
enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
}
示例10: fromTextAttributes
@Nonnull
public static SimpleTextAttributes fromTextAttributes(TextAttributes attributes) {
if (attributes == null) return REGULAR_ATTRIBUTES;
Color foregroundColor = attributes.getForegroundColor();
if (foregroundColor == null) foregroundColor = REGULAR_ATTRIBUTES.getFgColor();
int style = attributes.getFontType();
if (attributes.getEffectColor() != null) {
EffectType effectType = attributes.getEffectType();
if (effectType == EffectType.STRIKEOUT) {
style |= STYLE_STRIKEOUT;
}
else if (effectType == EffectType.WAVE_UNDERSCORE) {
style |= STYLE_WAVED;
}
else if (effectType == EffectType.LINE_UNDERSCORE ||
effectType == EffectType.BOLD_LINE_UNDERSCORE ||
effectType == EffectType.BOLD_DOTTED_LINE) {
style |= STYLE_UNDERLINE;
}
else if (effectType == EffectType.SEARCH_MATCH) {
style |= STYLE_SEARCH_MATCH;
}
else {
// not supported
}
}
return new SimpleTextAttributes(attributes.getBackgroundColor(), foregroundColor, attributes.getEffectColor(), style);
}
示例11: getEffectPainter
protected EffectPainter getEffectPainter(EffectType type) {
if (type == EffectType.STRIKEOUT) return EffectPainter.STRIKE_THROUGH;
if (type == EffectType.WAVE_UNDERSCORE) return EffectPainter.WAVE_UNDERSCORE;
if (type == EffectType.LINE_UNDERSCORE) return EffectPainter.LINE_UNDERSCORE;
if (type == EffectType.BOLD_LINE_UNDERSCORE) return EffectPainter.BOLD_LINE_UNDERSCORE;
if (type == EffectType.BOLD_DOTTED_LINE) return EffectPainter.BOLD_DOTTED_UNDERSCORE;
return null;
}
示例12: setupRenderer
public static void setupRenderer(SimpleColoredComponent renderer, Project project, Bookmark bookmark, boolean selected) {
VirtualFile file = bookmark.getFile();
if (!file.isValid()) {
return;
}
PsiManager psiManager = PsiManager.getInstance(project);
PsiElement fileOrDir = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
if (fileOrDir != null) {
renderer.setIcon(IconDescriptorUpdaters.getIcon(fileOrDir, 0));
}
String description = bookmark.getDescription();
if (description != null) {
renderer.append(description + " ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
renderer.append(file.getName(), SimpleTextAttributes.fromTextAttributes(attributes));
if (bookmark.getLine() >= 0) {
renderer.append(":", SimpleTextAttributes.GRAYED_ATTRIBUTES);
renderer.append(String.valueOf(bookmark.getLine() + 1), SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
if (!selected) {
FileColorManager colorManager = FileColorManager.getInstance(project);
if (fileOrDir instanceof PsiFile) {
Color color = colorManager.getRendererBackground((PsiFile)fileOrDir);
if (color != null) {
renderer.setBackground(color);
}
}
}
}
示例13: getOutputKey
@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;
}
示例14: getExternalEffectType
@NotNull
@Override
public EffectType getExternalEffectType() {
return EffectType.LINE_UNDERSCORE;
}
示例15: getOutputKey
public Key getOutputKey(@NonNls String attribute) {
final Key key = myRegisteredKeys.get(attribute);
if (key != null) {
return key;
}
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 == 4) {
attrs.setEffectType(EffectType.LINE_UNDERSCORE);
}
else if (value == 1) {
attrs.setFontType(Font.BOLD);
}
else if (value >= 30 && value <= 37) {
attrs.setForegroundColor(getAnsiColor(value - 30));
}
else if (value >= 40 && value <= 47) {
attrs.setBackgroundColor(getAnsiColor(value - 40));
}
else if (value == 90) {
// black, high intensity
attrs.setForegroundColor(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(ConsoleHighlighter.GRAY).getForegroundColor());
}
else if (value >= 91 && value < 96) {
// TODO separate colors for high intensity?
attrs.setForegroundColor(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(myAnsiColorKeys [value-90]).getForegroundColor());
}
}
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);
myRegisteredKeys.put(completeAttribute, newKey);
return newKey;
}