use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class ExtractMethodProcessor method showMultipleExitPointsMessage.
private void showMultipleExitPointsMessage() {
if (myShowErrorDialogs) {
HighlightManager highlightManager = HighlightManager.getInstance(myProject);
PsiStatement[] exitStatementsArray = myExitStatements.toArray(new PsiStatement[myExitStatements.size()]);
EditorColorsManager manager = EditorColorsManager.getInstance();
TextAttributes attributes = manager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
highlightManager.addOccurrenceHighlights(myEditor, exitStatementsArray, attributes, true, null);
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("there.are.multiple.exit.points.in.the.selected.code.fragment"));
CommonRefactoringUtil.showErrorHint(myProject, myEditor, message, myRefactoringName, myHelpId);
WindowManager.getInstance().getStatusBar(myProject).setInfo(RefactoringBundle.message("press.escape.to.remove.the.highlighting"));
}
}
use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class IntroduceConstantHandler method highlightError.
private static void highlightError(Project project, Editor editor, PsiElement errorElement) {
if (editor != null) {
final TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
final TextRange textRange = errorElement.getTextRange();
HighlightManager.getInstance(project).addRangeHighlight(editor, textRange.getStartOffset(), textRange.getEndOffset(), attributes, true, new ArrayList<>());
}
}
use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class HighlightInfo method getAttributesByType.
public static TextAttributes getAttributesByType(@Nullable final PsiElement element, @NotNull HighlightInfoType type, @NotNull TextAttributesScheme colorsScheme) {
final SeverityRegistrar severityRegistrar = SeverityRegistrar.getSeverityRegistrar(element != null ? element.getProject() : null);
final TextAttributes textAttributes = severityRegistrar.getTextAttributesBySeverity(type.getSeverity(element));
if (textAttributes != null) {
return textAttributes;
}
TextAttributesKey key = type.getAttributesKey();
return colorsScheme.getAttributes(key);
}
use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class HighlightInfo method fromAnnotation.
@NotNull
static HighlightInfo fromAnnotation(@NotNull Annotation annotation, @Nullable TextRange fixedRange, boolean batchMode) {
final TextAttributes forcedAttributes = annotation.getEnforcedTextAttributes();
TextAttributesKey key = annotation.getTextAttributes();
final TextAttributesKey forcedAttributesKey = forcedAttributes == null ? (key == HighlighterColors.NO_HIGHLIGHTING ? null : key) : null;
HighlightInfo info = new HighlightInfo(forcedAttributes, forcedAttributesKey, convertType(annotation), fixedRange != null ? fixedRange.getStartOffset() : annotation.getStartOffset(), fixedRange != null ? fixedRange.getEndOffset() : annotation.getEndOffset(), annotation.getMessage(), annotation.getTooltip(), annotation.getSeverity(), annotation.isAfterEndOfLine(), annotation.needsUpdateOnTyping(), annotation.isFileLevelAnnotation(), 0, annotation.getProblemGroup(), annotation.getGutterIconRenderer());
appendFixes(fixedRange, info, batchMode ? annotation.getBatchFixes() : annotation.getQuickFixes());
return info;
}
use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class RainbowHighlighter method getColorsFromCache.
@Nullable
private static Color[] getColorsFromCache(@NotNull TextAttributesScheme colorsScheme) {
final Map<TextAttributesKey, TextAttributes> cache = getGeneratedTextAttributesCache(colorsScheme);
if (cache == null) {
return null;
}
List<Color> colors = new ArrayList<>();
boolean invalidCache = false;
for (TextAttributesKey tempKey : RAINBOW_TEMP_KEYS) {
final TextAttributes attributes = cache.get(tempKey);
if (attributes == null) {
invalidCache = true;
break;
}
colors.add(getRainbowColorFromAttribute(attributes));
}
if (invalidCache) {
return null;
}
return colors.toArray(new Color[colors.size()]);
}
Aggregations