use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class DarculaInstaller method performImpl.
private static void performImpl(boolean dark) {
JBColor.setDark(dark);
IconLoader.setUseDarkIcons(dark);
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
EditorColorsScheme current = colorsManager.getGlobalScheme();
if (dark != ColorUtil.isDark(current.getDefaultBackground())) {
String targetScheme = dark ? DarculaLaf.NAME : EditorColorsScheme.DEFAULT_SCHEME_NAME;
PropertiesComponent properties = PropertiesComponent.getInstance();
String savedEditorThemeKey = dark ? DARCULA_EDITOR_THEME_KEY : DEFAULT_EDITOR_THEME_KEY;
String toSavedEditorThemeKey = dark ? DEFAULT_EDITOR_THEME_KEY : DARCULA_EDITOR_THEME_KEY;
String themeName = properties.getValue(savedEditorThemeKey);
if (themeName != null && colorsManager.getScheme(themeName) != null) {
targetScheme = themeName;
}
properties.setValue(toSavedEditorThemeKey, current.getName(), dark ? EditorColorsScheme.DEFAULT_SCHEME_NAME : DarculaLaf.NAME);
EditorColorsScheme scheme = colorsManager.getScheme(targetScheme);
if (scheme != null) {
colorsManager.setGlobalScheme(scheme);
}
}
update();
}
use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class IntroduceVariableHandler method getSettings.
@Override
public IntroduceVariableSettings getSettings(Project project, Editor editor, PsiExpression expr, PsiExpression[] occurrences, TypeSelectorManagerImpl typeSelectorManager, boolean declareFinalIfAll, boolean anyAssignmentLHS, final InputValidator validator, PsiElement anchor, JavaReplaceChoice replaceChoice) {
if (replaceChoice == null && ApplicationManager.getApplication().isUnitTestMode()) {
replaceChoice = JavaReplaceChoice.NO;
}
if (replaceChoice != null) {
return super.getSettings(project, editor, expr, occurrences, typeSelectorManager, declareFinalIfAll, anyAssignmentLHS, validator, anchor, replaceChoice);
}
ArrayList<RangeHighlighter> highlighters = new ArrayList<>();
HighlightManager highlightManager = null;
if (editor != null) {
highlightManager = HighlightManager.getInstance(project);
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
TextAttributes attributes = colorsManager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
if (occurrences.length > 1) {
highlightManager.addOccurrenceHighlights(editor, occurrences, attributes, true, highlighters);
}
}
IntroduceVariableDialog dialog = new IntroduceVariableDialog(project, expr, occurrences.length, anyAssignmentLHS, declareFinalIfAll, typeSelectorManager, validator);
if (!dialog.showAndGet()) {
if (occurrences.length > 1) {
WindowManager.getInstance().getStatusBar(project).setInfo(RefactoringBundle.message("press.escape.to.remove.the.highlighting"));
}
} else {
if (editor != null) {
for (RangeHighlighter highlighter : highlighters) {
highlightManager.removeSegmentHighlighter(editor, highlighter);
}
}
}
return dialog;
}
use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class MoveDeclarationIntention method highlightElement.
private static void highlightElement(@NotNull PsiElement element) {
final Project project = element.getProject();
final FileEditorManager editorManager = FileEditorManager.getInstance(project);
final HighlightManager highlightManager = HighlightManager.getInstance(project);
final EditorColorsManager editorColorsManager = EditorColorsManager.getInstance();
final Editor editor = editorManager.getSelectedTextEditor();
final EditorColorsScheme globalScheme = editorColorsManager.getGlobalScheme();
final TextAttributes textattributes = globalScheme.getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
final PsiElement[] elements = new PsiElement[] { element };
highlightManager.addOccurrenceHighlights(editor, elements, textattributes, true, null);
StatusBar.Info.set(IntentionPowerPackBundle.message("status.bar.escape.highlighting.message"), project);
}
use of com.intellij.openapi.editor.colors.EditorColorsManager in project intellij-community by JetBrains.
the class BaseMoveInitializerToMethodAction method highlightRExpression.
private static void highlightRExpression(@NotNull PsiAssignmentExpression assignment, @NotNull Project project, Editor editor) {
final EditorColorsManager manager = EditorColorsManager.getInstance();
final TextAttributes attributes = manager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
final PsiExpression expression = assignment.getRExpression();
HighlightManager.getInstance(project).addOccurrenceHighlights(editor, new PsiElement[] { expression }, attributes, false, null);
}
use of com.intellij.openapi.editor.colors.EditorColorsManager 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"));
}
}
Aggregations