Search in sources :

Example 76 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.

the class HighlightingSessionImpl method queueHighlightInfo.

void queueHighlightInfo(@NotNull HighlightInfo info, @NotNull TextRange restrictedRange, int groupId) {
    myEDTQueue.offer(() -> {
        final EditorColorsScheme colorsScheme = getColorsScheme();
        UpdateHighlightersUtil.addHighlighterToEditorIncrementally(myProject, getDocument(), getPsiFile(), restrictedRange.getStartOffset(), restrictedRange.getEndOffset(), info, colorsScheme, groupId, myRanges2markersCache);
    });
}
Also used : EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme)

Example 77 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.

the class ColorSchemeActions method importScheme.

@Override
protected void importScheme(@NotNull String importerName) {
    if (tryImportWithImportHandler(importerName)) {
        return;
    }
    final SchemeImporter<EditorColorsScheme> importer = SchemeImporterEP.getImporter(importerName, EditorColorsScheme.class);
    if (importer != null) {
        VirtualFile importSource = SchemeImportUtil.selectImportSource(importer.getSourceExtensions(), getSchemesPanel(), null, "Choose " + importerName);
        if (importSource != null) {
            try {
                EditorColorsScheme imported = importer.importScheme(DefaultProjectFactory.getInstance().getDefaultProject(), importSource, getOptions().getSelectedScheme(), name -> {
                    String newName = SchemeNameGenerator.getUniqueName(name != null ? name : "Unnamed", candidate -> getSchemesPanel().getModel().containsScheme(candidate, false));
                    AbstractColorsScheme newScheme = new EditorColorsSchemeImpl(EmptyColorScheme.INSTANCE);
                    newScheme.setName(newName);
                    newScheme.setDefaultMetaInfo(EmptyColorScheme.INSTANCE);
                    return newScheme;
                });
                if (imported != null) {
                    getOptions().addImportedScheme(imported);
                }
            } catch (SchemeImportException e) {
                getSchemesPanel().showStatus("Import failed: " + e.getMessage(), MessageType.ERROR);
            }
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) AbstractColorsScheme(com.intellij.openapi.editor.colors.impl.AbstractColorsScheme) EditorColorsSchemeImpl(com.intellij.openapi.editor.colors.impl.EditorColorsSchemeImpl) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme)

Example 78 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.

the class ColorSchemeActions method exportScheme.

@Override
protected void exportScheme(@NotNull EditorColorsScheme scheme, @NotNull String exporterName) {
    EditorColorsScheme schemeToExport = scheme;
    if (scheme instanceof AbstractColorsScheme) {
        EditorColorsScheme parent = ((AbstractColorsScheme) scheme).getParentScheme();
        if (!(parent instanceof DefaultColorsScheme)) {
            schemeToExport = parent;
        }
    }
    if (schemeToExport.getName().startsWith(SchemeManager.EDITABLE_COPY_PREFIX)) {
        schemeToExport = (EditorColorsScheme) schemeToExport.clone();
        schemeToExport.setName(SchemeManager.getDisplayName(schemeToExport));
    }
    super.exportScheme(schemeToExport, exporterName);
}
Also used : AbstractColorsScheme(com.intellij.openapi.editor.colors.impl.AbstractColorsScheme) DefaultColorsScheme(com.intellij.openapi.editor.colors.impl.DefaultColorsScheme) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme)

Example 79 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.

the class ColorSchemeImporter method importScheme.

@Nullable
@Override
public EditorColorsScheme importScheme(@NotNull Project project, @NotNull VirtualFile selectedFile, @NotNull EditorColorsScheme currentScheme, @NotNull SchemeFactory<EditorColorsScheme> schemeFactory) throws SchemeImportException {
    Element root = SchemeImportUtil.loadSchemeDom(selectedFile);
    String name = getSchemeName(root);
    EditorColorsScheme scheme = schemeFactory.createNewScheme(name);
    String preferredName = scheme.getName();
    scheme.readExternal(root);
    scheme.setName(preferredName);
    return scheme;
}
Also used : Element(org.jdom.Element) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) Nullable(org.jetbrains.annotations.Nullable)

Example 80 with EditorColorsScheme

use of com.intellij.openapi.editor.colors.EditorColorsScheme in project intellij-community by JetBrains.

the class EditorOptionsPanel method reset.

@Override
public void reset() {
    EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
    CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
    UISettings uiSettings = UISettings.getInstance();
    VcsApplicationSettings vcsSettings = VcsApplicationSettings.getInstance();
    // Display
    myCbSmoothScrolling.setSelected(editorSettings.isSmoothScrolling());
    // Brace highlighting
    myCbHighlightBraces.setSelected(codeInsightSettings.HIGHLIGHT_BRACES);
    myCbHighlightScope.setSelected(codeInsightSettings.HIGHLIGHT_SCOPE);
    myCbHighlightIdentifierUnderCaret.setSelected(codeInsightSettings.HIGHLIGHT_IDENTIFIER_UNDER_CARET);
    // Virtual space
    myCbUseSoftWrapsAtEditor.setSelected(editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR));
    myCbUseCustomSoftWrapIndent.setSelected(editorSettings.isUseCustomSoftWrapIndent());
    myCustomSoftWrapIndent.setText(Integer.toString(editorSettings.getCustomSoftWrapIndent()));
    myCbShowSoftWrapsOnlyOnCaretLine.setSelected(!editorSettings.isAllSoftWrapsShown());
    updateSoftWrapSettingsRepresentation();
    myCbVirtualSpace.setSelected(editorSettings.isVirtualSpace());
    myCbCaretInsideTabs.setSelected(editorSettings.isCaretInsideTabs());
    myCbVirtualPageAtBottom.setSelected(editorSettings.isAdditionalPageAtBottom());
    // Limits
    myClipboardContentLimitTextField.setText(Integer.toString(uiSettings.getMaxClipboardContents()));
    // Strip trailing spaces on save
    String stripTrailingSpaces = editorSettings.getStripTrailingSpaces();
    if (EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE.equals(stripTrailingSpaces)) {
        myStripTrailingSpacesCombo.setSelectedItem(STRIP_NONE);
    } else if (EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED.equals(stripTrailingSpaces)) {
        myStripTrailingSpacesCombo.setSelectedItem(STRIP_CHANGED);
    } else if (EditorSettingsExternalizable.STRIP_TRAILING_SPACES_WHOLE.equals(stripTrailingSpaces)) {
        myStripTrailingSpacesCombo.setSelectedItem(STRIP_ALL);
    }
    myCbKeepTrailingSpacesOnCaretLine.setSelected(editorSettings.isKeepTrailingSpacesOnCaretLine());
    myCbEnsureBlankLineBeforeCheckBox.setSelected(editorSettings.isEnsureNewLineAtEOF());
    myCbShowQuickDocOnMouseMove.setSelected(editorSettings.isShowQuickDocOnMouseOverElement());
    myQuickDocDelayTextField.setText(Long.toString(editorSettings.getQuickDocOnMouseOverElementDelayMillis()));
    myQuickDocDelayTextField.setEnabled(editorSettings.isShowQuickDocOnMouseOverElement());
    myQuickDocDelayLabel.setEnabled(editorSettings.isShowQuickDocOnMouseOverElement());
    // Advanced mouse
    myCbEnableDnD.setSelected(editorSettings.isDndEnabled());
    myCbEnableWheelFontChange.setSelected(editorSettings.isWheelFontChangeEnabled());
    myCbHonorCamelHumpsWhenSelectingByClicking.setSelected(editorSettings.isMouseClickSelectionHonorsCamelWords());
    myRbPreferMovingCaret.setSelected(editorSettings.isRefrainFromScrolling());
    myRbPreferScrolling.setSelected(!editorSettings.isRefrainFromScrolling());
    myRecentFilesLimitField.setText(Integer.toString(uiSettings.getRecentFilesLimit()));
    myCbRenameLocalVariablesInplace.setSelected(editorSettings.isVariableInplaceRenameEnabled());
    myPreselectCheckBox.setSelected(editorSettings.isPreselectRename());
    myShowInlineDialogForCheckBox.setSelected(editorSettings.isShowInlineLocalDialog());
    myShowNotificationAfterReformatCodeCheckBox.setSelected(editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION);
    myShowNotificationAfterOptimizeImportsCheckBox.setSelected(editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION);
    myShowLSTInGutterCheckBox.setSelected(vcsSettings.SHOW_LST_GUTTER_MARKERS);
    myShowWhitespacesModificationsInLSTGutterCheckBox.setSelected(vcsSettings.SHOW_WHITESPACES_IN_LST);
    myShowWhitespacesModificationsInLSTGutterCheckBox.setEnabled(myShowLSTInGutterCheckBox.isSelected());
    myErrorHighlightingPanel.reset();
    RichCopySettings settings = RichCopySettings.getInstance();
    myCbEnableRichCopyByDefault.setSelected(settings.isEnabled());
    myRichCopyColorSchemeComboBox.removeAllItems();
    EditorColorsScheme[] schemes = EditorColorsManager.getInstance().getAllSchemes();
    myRichCopyColorSchemeComboBox.addItem(RichCopySettings.ACTIVE_GLOBAL_SCHEME_MARKER);
    for (EditorColorsScheme scheme : schemes) {
        myRichCopyColorSchemeComboBox.addItem(scheme.getName());
    }
    String toSelect = settings.getSchemeName();
    if (!StringUtil.isEmpty(toSelect)) {
        myRichCopyColorSchemeComboBox.setSelectedItem(toSelect);
    }
}
Also used : CodeInsightSettings(com.intellij.codeInsight.CodeInsightSettings) RichCopySettings(com.intellij.openapi.editor.richcopy.settings.RichCopySettings) UISettings(com.intellij.ide.ui.UISettings) VcsApplicationSettings(com.intellij.openapi.vcs.VcsApplicationSettings) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) EditorSettingsExternalizable(com.intellij.openapi.editor.ex.EditorSettingsExternalizable)

Aggregations

EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)105 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)31 NotNull (org.jetbrains.annotations.NotNull)28 EditorColorsManager (com.intellij.openapi.editor.colors.EditorColorsManager)17 Nullable (org.jetbrains.annotations.Nullable)15 Document (com.intellij.openapi.editor.Document)14 Project (com.intellij.openapi.project.Project)14 TextAttributesKey (com.intellij.openapi.editor.colors.TextAttributesKey)12 Editor (com.intellij.openapi.editor.Editor)11 DocumentMarkupModel (com.intellij.openapi.editor.impl.DocumentMarkupModel)10 EditorEx (com.intellij.openapi.editor.ex.EditorEx)8 TextRange (com.intellij.openapi.util.TextRange)8 EditorHighlighter (com.intellij.openapi.editor.highlighter.EditorHighlighter)7 PsiFile (com.intellij.psi.PsiFile)7 List (java.util.List)7 HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)6 ApplicationManager (com.intellij.openapi.application.ApplicationManager)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 java.awt (java.awt)6 java.util (java.util)6