本文整理汇总了Java中com.intellij.openapi.editor.colors.EditorColorsScheme.getColor方法的典型用法代码示例。如果您正苦于以下问题:Java EditorColorsScheme.getColor方法的具体用法?Java EditorColorsScheme.getColor怎么用?Java EditorColorsScheme.getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.colors.EditorColorsScheme
的用法示例。
在下文中一共展示了EditorColorsScheme.getColor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMethodSeparatorLineMarker
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@NotNull
public static LineMarkerInfo createMethodSeparatorLineMarker(@NotNull PsiElement startFrom, @NotNull EditorColorsManager colorsManager) {
LineMarkerInfo info = new LineMarkerInfo<PsiElement>(
startFrom,
startFrom.getTextRange(),
null,
Pass.UPDATE_ALL,
FunctionUtil.<Object, String>nullConstant(),
null,
GutterIconRenderer.Alignment.RIGHT
);
EditorColorsScheme scheme = colorsManager.getGlobalScheme();
info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
info.separatorPlacement = SeparatorPlacement.TOP;
return info;
}
示例2: drawAnswerPlaceholderFromPrevStep
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public static void drawAnswerPlaceholderFromPrevStep(@NotNull Editor editor, int start, int end) {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
Color color = scheme.getColor(EditorColors.TEARLINE_COLOR);
SimpleTextAttributes attributes = SimpleTextAttributes.GRAY_ATTRIBUTES;
final TextAttributes textAttributes = new TextAttributes(attributes.getFgColor(), color, null,
null, attributes.getFontStyle());
drawAnswerPlaceholder(editor, start, end, textAttributes, HighlighterLayer.LAST);
}
示例3: getLineMarkerInfo
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Override
public LineMarkerInfo getLineMarkerInfo(final PsiElement element) {
if (element instanceof LuaReturnStatement && LuaApplicationSettings.getInstance().SHOW_TAIL_CALLS_IN_GUTTER) {
LuaReturnStatement e = (LuaReturnStatement) element;
if (e.isTailCall())
return new LineMarkerInfo<PsiElement>(element, element.getTextRange(),
LuaIcons.TAIL_RECURSION, Pass.UPDATE_ALL,
tailCallTooltip, null,
GutterIconRenderer.Alignment.LEFT);
}
if (myDaemonSettings.SHOW_METHOD_SEPARATORS) {
if (element instanceof LuaDocComment) {
LuaDocCommentOwner owner = ((LuaDocComment) element).getOwner();
if (owner instanceof LuaFunctionDefinition) {
TextRange range = new TextRange(element.getTextOffset(), owner.getTextRange().getEndOffset());
LineMarkerInfo<PsiElement> info =
new LineMarkerInfo<PsiElement>(element, range, null, Pass.UPDATE_ALL,
NullableFunction.NULL, null, GutterIconRenderer.Alignment.RIGHT);
EditorColorsScheme scheme = myColorsManager.getGlobalScheme();
info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
info.separatorPlacement = SeparatorPlacement.TOP;
return info;
}
}
}
return null;
}
示例4: getDividerColorFromScheme
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@NotNull
public static Color getDividerColorFromScheme(@NotNull EditorColorsScheme scheme) {
Color gutterBackground = scheme.getColor(EditorColors.GUTTER_BACKGROUND);
if (gutterBackground == null) {
gutterBackground = EditorColors.GUTTER_BACKGROUND.getDefaultColor();
}
return gutterBackground;
}
示例5: getTopBorderColor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Nullable
private static Color getTopBorderColor(int i, int lineHeight, @NotNull EditorColorsScheme scheme) {
int border = Math.max(lineHeight / 4, 1);
double ratio = (double)i / border;
if (ratio > 1) return null;
Color top = scheme.getColor(TOP_BORDER);
if (top == null) return null;
Color background = getBackgroundColor(scheme);
return ColorUtil.mix(top, background, ratio);
}
示例6: getBottomBorderColor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Nullable
private static Color getBottomBorderColor(int i, int lineHeight, @NotNull EditorColorsScheme scheme) {
int height = getHeight(lineHeight);
int border = Math.max(lineHeight / 12, 1);
int index = (height - i - 1);
double ratio = (double)index / border;
if (ratio > 1) return null;
Color bottom = scheme.getColor(BOTTOM_BORDER);
if (bottom == null) return null;
Color background = getBackgroundColor(scheme);
return ColorUtil.mix(bottom, background, ratio);
}
示例7: getBackgroundColor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
public static Color getBackgroundColor(Editor editor, boolean useCaretRowBackground){
EditorColorsScheme colorsScheme = editor.getColorsScheme();
Color color = colorsScheme.getColor(EditorColors.CARET_ROW_COLOR);
if (!useCaretRowBackground || color == null){
color = colorsScheme.getDefaultBackground();
}
return color;
}
示例8: setUp
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
DEFAULT_BACKGROUND = colorsScheme.getDefaultBackground();
CARET_ROW_BACKGROUND = colorsScheme.getColor(EditorColors.CARET_ROW_COLOR);
SELECTION_BACKGROUND = colorsScheme.getColor(EditorColors.SELECTION_BACKGROUND_COLOR);
assertEquals(3, new HashSet<Color>(Arrays.asList(DEFAULT_BACKGROUND, CARET_ROW_BACKGROUND, SELECTION_BACKGROUND)).size());
}
示例9: getBaseColors
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
static Color[] getBaseColors() {
final ColorKey[] colorKeys = XmlTagTreeHighlightingColors.getColorKeys();
final Color[] colors = new Color[colorKeys.length];
final EditorColorsScheme colorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
for (int i = 0; i < colors.length; i++) {
colors[i] = colorsScheme.getColor(colorKeys[i]);
}
return colors;
}
示例10: updatePopup
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
private void updatePopup(@NotNull JPopupMenu popupMenu, @NotNull String typedStr) {
popupMenu.removeAll();
Collection<ActionInfo> foundActions = ActionFinder.findActions(typedStr);
EditorColorsScheme currScheme = EditorColorsManager.getInstance().getGlobalScheme();
Color backgroundColor = currScheme.getColor(EditorColors.NOTIFICATION_BACKGROUND);
Color foregroundColor = currScheme.getDefaultForeground();
if (backgroundColor == null) backgroundColor = currScheme.getDefaultBackground();
Color shortcutColor = getShortcutColor(backgroundColor, foregroundColor);
String shortcutStyle = "color:#" + GuiUtils.colorToHex(shortcutColor);
String abbrStyle = "font-family:" + currScheme.getConsoleFontName() + ";font-style:oblique;";
for (ActionInfo actionInfo: foundActions) {
AnAction action = actionInfo.getAction();
if (action != null) {
Presentation presentation = actionInfo.getAction().getTemplatePresentation();
StringBuilder sb = new StringBuilder();
sb
.append("<html><span style='").append(abbrStyle).append("'>")
.append(fillString(actionInfo.getAbbreviation(), ABBR_FIELD_SIZE))
.append("</span>");
String desc = presentation.getDescription();
if (desc != null && !desc.isEmpty()) {
sb.append(desc);
} else {
String text = presentation.getText();
if (text != null && !text.isEmpty()) {
sb.append(text);
}
}
Shortcut[] shortcuts = action.getShortcutSet().getShortcuts();
if (shortcuts.length > 0) {
sb.append(" <i style='").append(shortcutStyle).append("'>");
for (Shortcut shortcut : action.getShortcutSet().getShortcuts()) {
if (shortcut != shortcuts[0]) {
sb.append(", ");
}
sb.append(KeymapUtil.getShortcutText(shortcut));
}
sb.append("</i>");
}
sb.append("</html>");
JMenuItem menuItem = new JMenuItem(sb.toString());
menuItem.setForeground(foregroundColor);
menuItem.setBackground(backgroundColor);
popupMenu.add(menuItem);
}
}
}
示例11: getLineMarkerInfo
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Override
@Nullable
public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
PsiElement parent;
if (element instanceof PsiIdentifier && (parent = element.getParent()) instanceof PsiMethod) {
PsiMethod method = (PsiMethod)parent;
MethodSignatureBackedByPsiMethod superSignature = SuperMethodsSearch.search(method, null, true, false).findFirst();
if (superSignature != null) {
boolean overrides =
method.hasModifierProperty(PsiModifier.ABSTRACT) == superSignature.getMethod().hasModifierProperty(PsiModifier.ABSTRACT);
final Icon icon = overrides ? AllIcons.Gutter.OverridingMethod : AllIcons.Gutter.ImplementingMethod;
return createSuperMethodLineMarkerInfo(element, icon, Pass.UPDATE_ALL);
}
}
final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(element);
final PsiElement firstChild = element.getFirstChild();
if (interfaceMethod != null && firstChild != null) {
return createSuperMethodLineMarkerInfo(firstChild, AllIcons.Gutter.ImplementingFunctional, Pass.UPDATE_ALL);
}
if (myDaemonSettings.SHOW_METHOD_SEPARATORS && firstChild == null) {
PsiElement element1 = element;
boolean isMember = false;
while (element1 != null && !(element1 instanceof PsiFile) && element1.getPrevSibling() == null) {
element1 = element1.getParent();
if (element1 instanceof PsiMember) {
isMember = true;
break;
}
}
if (isMember && !(element1 instanceof PsiAnonymousClass || element1.getParent() instanceof PsiAnonymousClass)) {
PsiFile file = element1.getContainingFile();
Document document = file == null ? null : PsiDocumentManager.getInstance(file.getProject()).getLastCommittedDocument(file);
boolean drawSeparator = false;
if (document != null) {
CharSequence documentChars = document.getCharsSequence();
int category = getCategory(element1, documentChars);
for (PsiElement child = element1.getPrevSibling(); child != null; child = child.getPrevSibling()) {
int category1 = getCategory(child, documentChars);
if (category1 == 0) continue;
drawSeparator = category != 1 || category1 != 1;
break;
}
}
if (drawSeparator) {
LineMarkerInfo info = new LineMarkerInfo<PsiElement>(element, element.getTextRange(), null, Pass.UPDATE_ALL,
FunctionUtil.<Object, String>nullConstant(), null,
GutterIconRenderer.Alignment.RIGHT);
EditorColorsScheme scheme = myColorsManager.getGlobalScheme();
info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
info.separatorPlacement = SeparatorPlacement.TOP;
return info;
}
}
}
return null;
}
示例12: getBackgroundColor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@NotNull
private static Color getBackgroundColor(@NotNull EditorColorsScheme scheme) {
Color color = scheme.getColor(BACKGROUND);
return color != null ? color : Gray._128;
}
示例13: createEditor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@NotNull
public static Editor createEditor(@NotNull Document doc,
final Project project,
boolean editable,
boolean addToolTipForVariableHandler,
@Nullable TemplateContextType contextType) {
final Editor editor =
editable ? EditorFactory.getInstance().createEditor(doc, project) : EditorFactory.getInstance().createViewer(doc, project);
EditorSettings editorSettings = editor.getSettings();
editorSettings.setVirtualSpace(false);
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setIndentGuidesShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
editorSettings.setCaretRowShown(false);
if (!editable) {
final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
Color c = globalScheme.getColor(EditorColors.READONLY_BACKGROUND_COLOR);
if (c == null) {
c = globalScheme.getDefaultBackground();
}
((EditorEx)editor).setBackgroundColor(c);
}
else {
((EditorEx)editor).setEmbeddedIntoDialogWrapper(true);
}
TemplateEditorUtil.setHighlighter(editor, contextType);
if (addToolTipForVariableHandler) {
SubstitutionShortInfoHandler handler = new SubstitutionShortInfoHandler(editor);
editor.addEditorMouseMotionListener(handler);
editor.getDocument().addDocumentListener(handler);
editor.getCaretModel().addCaretListener(handler);
editor.putUserData(LISTENER_KEY, handler);
}
return editor;
}
示例14: getDiffGutterBorderColor
import com.intellij.openapi.editor.colors.EditorColorsScheme; //导入方法依赖的package包/类
@Nullable
private static Color getDiffGutterBorderColor() {
final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
return globalScheme.getColor(EditorColors.BORDER_LINES_COLOR);
}