Search in sources :

Example 11 with EditorSettingsExternalizable

use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.

the class EditorAppearanceConfigurable method reset.

@Override
public void reset() {
    EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
    myCbShowMethodSeparators.setSelected(DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS);
    myCbBlinkCaret.setSelected(editorSettings.isBlinkCaret());
    myBlinkIntervalField.setText(Integer.toString(editorSettings.getBlinkPeriod()));
    myBlinkIntervalField.setEnabled(editorSettings.isBlinkCaret());
    myCbRightMargin.setSelected(editorSettings.isRightMarginShown());
    myCbShowLineNumbers.setSelected(editorSettings.isLineNumbersShown());
    myCbBlockCursor.setSelected(editorSettings.isBlockCursor());
    myCbShowWhitespaces.setSelected(editorSettings.isWhitespacesShown());
    myLeadingWhitespacesCheckBox.setSelected(editorSettings.isLeadingWhitespacesShown());
    myInnerWhitespacesCheckBox.setSelected(editorSettings.isInnerWhitespacesShown());
    myTrailingWhitespacesCheckBox.setSelected(editorSettings.isTrailingWhitespacesShown());
    myShowVerticalIndentGuidesCheckBox.setSelected(editorSettings.isIndentGuidesShown());
    myShowBreadcrumbsCheckBox.setSelected(editorSettings.isBreadcrumbsShown());
    //myAntialiasingInEditorCheckBox.setSelected(UISettings.getInstance().ANTIALIASING_IN_EDITOR);
    //myUseLCDRendering.setSelected(UISettings.getInstance().USE_LCD_RENDERING_IN_EDITOR);
    myShowCodeLensInEditorCheckBox.setSelected(UISettings.getInstance().getShowToolWindowsNumbers());
    updateWhitespaceCheckboxesState();
    myShowParameterNameHints.setSelected(editorSettings.isShowParameterNameHints());
    super.reset();
}
Also used : EditorSettingsExternalizable(com.intellij.openapi.editor.ex.EditorSettingsExternalizable)

Example 12 with EditorSettingsExternalizable

use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.

the class EditorAppearanceConfigurable method applyNameHintsSettings.

private void applyNameHintsSettings() {
    EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance();
    settings.setShowParameterNameHints(myShowParameterNameHints.isSelected());
}
Also used : EditorSettingsExternalizable(com.intellij.openapi.editor.ex.EditorSettingsExternalizable)

Example 13 with EditorSettingsExternalizable

use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.

the class EditorOptionsPanel method isModified.

@Override
public boolean isModified() {
    EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
    CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
    UISettings uiSettings = UISettings.getInstance();
    VcsApplicationSettings vcsSettings = VcsApplicationSettings.getInstance();
    // Display
    boolean isModified = isModified(myCbSmoothScrolling, editorSettings.isSmoothScrolling());
    // Brace highlighting
    isModified |= isModified(myCbHighlightBraces, codeInsightSettings.HIGHLIGHT_BRACES);
    isModified |= isModified(myCbHighlightScope, codeInsightSettings.HIGHLIGHT_SCOPE);
    isModified |= isModified(myCbHighlightIdentifierUnderCaret, codeInsightSettings.HIGHLIGHT_IDENTIFIER_UNDER_CARET);
    // Virtual space
    isModified |= isModified(myCbUseSoftWrapsAtEditor, editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR));
    isModified |= isModified(myCbUseCustomSoftWrapIndent, editorSettings.isUseCustomSoftWrapIndent());
    isModified |= editorSettings.getCustomSoftWrapIndent() != getCustomSoftWrapIndent();
    isModified |= isModified(myCbShowSoftWrapsOnlyOnCaretLine, !editorSettings.isAllSoftWrapsShown());
    isModified |= isModified(myCbVirtualSpace, editorSettings.isVirtualSpace());
    isModified |= isModified(myCbCaretInsideTabs, editorSettings.isCaretInsideTabs());
    isModified |= isModified(myCbVirtualPageAtBottom, editorSettings.isAdditionalPageAtBottom());
    // Limits
    isModified |= getMaxClipboardContents() != uiSettings.getMaxClipboardContents();
    // Paste
    // Strip trailing spaces, ensure EOL on EOF on save
    isModified |= !getStripTrailingSpacesValue().equals(editorSettings.getStripTrailingSpaces());
    isModified |= isModified(myCbKeepTrailingSpacesOnCaretLine, editorSettings.isKeepTrailingSpacesOnCaretLine());
    isModified |= isModified(myCbEnsureBlankLineBeforeCheckBox, editorSettings.isEnsureNewLineAtEOF());
    isModified |= isModified(myCbShowQuickDocOnMouseMove, editorSettings.isShowQuickDocOnMouseOverElement());
    isModified |= isModified(myQuickDocDelayTextField, editorSettings.getQuickDocOnMouseOverElementDelayMillis(), EditorSettingsExternalizable.QUICK_DOC_DELAY_RANGE);
    // advanced mouse
    isModified |= isModified(myCbEnableDnD, editorSettings.isDndEnabled());
    isModified |= isModified(myCbEnableWheelFontChange, editorSettings.isWheelFontChangeEnabled());
    isModified |= isModified(myCbHonorCamelHumpsWhenSelectingByClicking, editorSettings.isMouseClickSelectionHonorsCamelWords());
    isModified |= isModified(myRbPreferMovingCaret, editorSettings.isRefrainFromScrolling());
    isModified |= isModified(myRecentFilesLimitField, UISettings.getInstance().getRecentFilesLimit(), RECENT_FILES_RANGE);
    isModified |= isModified(myCbRenameLocalVariablesInplace, editorSettings.isVariableInplaceRenameEnabled());
    isModified |= isModified(myPreselectCheckBox, editorSettings.isPreselectRename());
    isModified |= isModified(myShowInlineDialogForCheckBox, editorSettings.isShowInlineLocalDialog());
    isModified |= isModified(myShowNotificationAfterReformatCodeCheckBox, editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION);
    isModified |= isModified(myShowNotificationAfterOptimizeImportsCheckBox, editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION);
    isModified |= isModified(myShowLSTInGutterCheckBox, vcsSettings.SHOW_LST_GUTTER_MARKERS);
    isModified |= isModified(myShowWhitespacesModificationsInLSTGutterCheckBox, vcsSettings.SHOW_WHITESPACES_IN_LST);
    isModified |= myErrorHighlightingPanel.isModified();
    RichCopySettings settings = RichCopySettings.getInstance();
    isModified |= isModified(myCbEnableRichCopyByDefault, settings.isEnabled());
    isModified |= !Comparing.equal(settings.getSchemeName(), myRichCopyColorSchemeComboBox.getSelectedItem());
    return isModified;
}
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) EditorSettingsExternalizable(com.intellij.openapi.editor.ex.EditorSettingsExternalizable)

Example 14 with EditorSettingsExternalizable

use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.

the class EditorSmartKeysConfigurable method reset.

@Override
public void reset() {
    EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
    CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
    // Paste
    switch(codeInsightSettings.REFORMAT_ON_PASTE) {
        case CodeInsightSettings.NO_REFORMAT:
            myReformatOnPasteCombo.setSelectedItem(NO_REFORMAT);
            break;
        case CodeInsightSettings.INDENT_BLOCK:
            myReformatOnPasteCombo.setSelectedItem(INDENT_BLOCK);
            break;
        case CodeInsightSettings.INDENT_EACH_LINE:
            myReformatOnPasteCombo.setSelectedItem(INDENT_EACH_LINE);
            break;
        case CodeInsightSettings.REFORMAT_BLOCK:
            myReformatOnPasteCombo.setSelectedItem(REFORMAT_BLOCK);
            break;
    }
    myCbSmartHome.setSelected(editorSettings.isSmartHome());
    myCbSmartEnd.setSelected(codeInsightSettings.SMART_END_ACTION);
    myCbSmartIndentOnEnter.setSelected(codeInsightSettings.SMART_INDENT_ON_ENTER);
    myCbInsertPairCurlyBraceOnEnter.setSelected(codeInsightSettings.INSERT_BRACE_ON_ENTER);
    myCbInsertJavadocStubOnEnter.setSelected(codeInsightSettings.JAVADOC_STUB_ON_ENTER);
    myCbInsertPairBracket.setSelected(codeInsightSettings.AUTOINSERT_PAIR_BRACKET);
    myCbInsertPairQuote.setSelected(codeInsightSettings.AUTOINSERT_PAIR_QUOTE);
    myCbReformatBlockOnTypingRBrace.setSelected(codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE);
    myCbCamelWords.setSelected(editorSettings.isCamelWords());
    myCbSurroundSelectionOnTyping.setSelected(codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED);
    myCbEnableAddingCaretsOnDoubleCtrlArrows.setSelected(editorSettings.addCaretsOnDoubleCtrl());
    SmartBackspaceMode backspaceMode = codeInsightSettings.getBackspaceMode();
    switch(backspaceMode) {
        case OFF:
            mySmartBackspaceCombo.setSelectedItem(OFF);
            break;
        case INDENT:
            mySmartBackspaceCombo.setSelectedItem(SIMPLE);
            break;
        case AUTOINDENT:
            mySmartBackspaceCombo.setSelectedItem(SMART);
            break;
        default:
            LOG.error("Unexpected smart backspace mode value: " + backspaceMode);
    }
    super.reset();
}
Also used : CodeInsightSettings(com.intellij.codeInsight.CodeInsightSettings) SmartBackspaceMode(com.intellij.codeInsight.editorActions.SmartBackspaceMode) EditorSettingsExternalizable(com.intellij.openapi.editor.ex.EditorSettingsExternalizable)

Example 15 with EditorSettingsExternalizable

use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.

the class EditorSettingsStatisticsCollector method getUsages.

@NotNull
@Override
public Set<UsageDescriptor> getUsages() throws CollectUsagesException {
    Set<UsageDescriptor> set = new HashSet<>();
    EditorSettingsExternalizable es = EditorSettingsExternalizable.getInstance();
    addIfDiffers(set, es.isVirtualSpace(), false, "caretAfterLineEnd");
    addIfDiffers(set, es.isCaretInsideTabs(), false, "caretInsideTabs");
    addIfDiffers(set, es.isAdditionalPageAtBottom(), false, "virtualSpaceAtFileBottom");
    addIfDiffers(set, es.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR), false, "softWraps");
    addIfDiffers(set, es.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE), false, "softWraps.console");
    addIfDiffers(set, es.isUseSoftWraps(SoftWrapAppliancePlaces.PREVIEW), false, "softWraps.preview");
    addIfDiffers(set, es.isUseCustomSoftWrapIndent(), false, "softWraps.relativeIndent");
    addIfDiffers(set, es.isAllSoftWrapsShown(), false, "softWraps.showAll");
    addIfDiffers(set, es.getStripTrailingSpaces(), EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED, "stripTrailingSpaces");
    addIfDiffers(set, es.isEnsureNewLineAtEOF(), false, "ensureNewlineAtEOF");
    addIfDiffers(set, es.isShowQuickDocOnMouseOverElement(), false, "quickDocOnMouseHover");
    addIfDiffers(set, es.isBlinkCaret(), true, "blinkingCaret");
    addIfDiffers(set, es.isBlockCursor(), false, "blockCaret");
    addIfDiffers(set, es.isRightMarginShown(), true, "rightMargin");
    addIfDiffers(set, es.isLineNumbersShown(), true, "lineNumbers");
    addIfDiffers(set, es.areGutterIconsShown(), true, "gutterIcons");
    addIfDiffers(set, es.isFoldingOutlineShown(), true, "foldingOutline");
    addIfDiffers(set, es.isWhitespacesShown() && es.isLeadingWhitespacesShown(), false, "showLeadingWhitespace");
    addIfDiffers(set, es.isWhitespacesShown() && es.isInnerWhitespacesShown(), false, "showInnerWhitespace");
    addIfDiffers(set, es.isWhitespacesShown() && es.isTrailingWhitespacesShown(), false, "showTrailingWhitespace");
    addIfDiffers(set, es.isIndentGuidesShown(), true, "indentGuides");
    addIfDiffers(set, es.isSmoothScrolling(), true, "animatedScroll");
    addIfDiffers(set, es.isDndEnabled(), true, "dragNDrop");
    addIfDiffers(set, es.isWheelFontChangeEnabled(), false, "wheelZoom");
    addIfDiffers(set, es.isMouseClickSelectionHonorsCamelWords(), true, "mouseCamel");
    addIfDiffers(set, es.isVariableInplaceRenameEnabled(), true, "inplaceRename");
    addIfDiffers(set, es.isPreselectRename(), true, "preselectOnRename");
    addIfDiffers(set, es.isShowInlineLocalDialog(), true, "inlineDialog");
    addIfDiffers(set, es.isRefrainFromScrolling(), false, "minimizeScrolling");
    addIfDiffers(set, es.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION, true, "afterReformatNotification");
    addIfDiffers(set, es.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION, true, "afterOptimizeNotification");
    addIfDiffers(set, es.isSmartHome(), true, "smartHome");
    addIfDiffers(set, es.isCamelWords(), false, "camelWords");
    addIfDiffers(set, es.isShowParameterNameHints(), true, "editor.inlay.parameter.hints");
    RichCopySettings rcs = RichCopySettings.getInstance();
    addIfDiffers(set, rcs.isEnabled(), true, "richCopy");
    CodeInsightSettings cis = CodeInsightSettings.getInstance();
    addIfDiffers(set, cis.AUTO_POPUP_PARAMETER_INFO, true, "parameterAutoPopup");
    addIfDiffers(set, cis.AUTO_POPUP_JAVADOC_INFO, false, "javadocAutoPopup");
    addIfDiffers(set, cis.AUTO_POPUP_COMPLETION_LOOKUP, true, "completionAutoPopup");
    addIfDiffers(set, cis.COMPLETION_CASE_SENSITIVE, CodeInsightSettings.FIRST_LETTER, "completionCaseSensitivity");
    addIfDiffers(set, cis.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS, false, "autoPopupCharComplete");
    addIfDiffers(set, cis.AUTOCOMPLETE_ON_CODE_COMPLETION, true, "autoCompleteBasic");
    addIfDiffers(set, cis.AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION, true, "autoCompleteSmart");
    addIfDiffers(set, cis.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO, false, "parameterInfoFullSignature");
    addIfDiffers(set, cis.getBackspaceMode(), SmartBackspaceMode.AUTOINDENT, "smartBackspace");
    addIfDiffers(set, cis.SMART_INDENT_ON_ENTER, true, "indentOnEnter");
    addIfDiffers(set, cis.INSERT_BRACE_ON_ENTER, true, "braceOnEnter");
    addIfDiffers(set, cis.JAVADOC_STUB_ON_ENTER, true, "javadocOnEnter");
    addIfDiffers(set, cis.SMART_END_ACTION, true, "smartEnd");
    addIfDiffers(set, cis.JAVADOC_GENERATE_CLOSING_TAG, true, "autoCloseJavadocTags");
    addIfDiffers(set, cis.SURROUND_SELECTION_ON_QUOTE_TYPED, false, "surroundByQuoteOrBrace");
    addIfDiffers(set, cis.AUTOINSERT_PAIR_BRACKET, true, "pairBracketAutoInsert");
    addIfDiffers(set, cis.AUTOINSERT_PAIR_QUOTE, true, "pairQuoteAutoInsert");
    addIfDiffers(set, cis.REFORMAT_BLOCK_ON_RBRACE, true, "reformatOnRBrace");
    addIfDiffers(set, cis.REFORMAT_ON_PASTE, CodeInsightSettings.INDENT_EACH_LINE, "reformatOnPaste");
    addIfDiffers(set, cis.ADD_IMPORTS_ON_PASTE, CodeInsightSettings.ASK, "importsOnPaste");
    addIfDiffers(set, cis.HIGHLIGHT_BRACES, true, "bracesHighlight");
    addIfDiffers(set, cis.HIGHLIGHT_SCOPE, false, "scopeHighlight");
    addIfDiffers(set, cis.HIGHLIGHT_IDENTIFIER_UNDER_CARET, true, "identifierUnderCaretHighlight");
    addIfDiffers(set, cis.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY, false, "autoAddImports");
    return set;
}
Also used : CodeInsightSettings(com.intellij.codeInsight.CodeInsightSettings) RichCopySettings(com.intellij.openapi.editor.richcopy.settings.RichCopySettings) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) HashSet(java.util.HashSet) EditorSettingsExternalizable(com.intellij.openapi.editor.ex.EditorSettingsExternalizable) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

EditorSettingsExternalizable (com.intellij.openapi.editor.ex.EditorSettingsExternalizable)31 CodeInsightSettings (com.intellij.codeInsight.CodeInsightSettings)7 UISettings (com.intellij.ide.ui.UISettings)7 RichCopySettings (com.intellij.openapi.editor.richcopy.settings.RichCopySettings)4 CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)4 Document (com.intellij.openapi.editor.Document)3 VcsApplicationSettings (com.intellij.openapi.vcs.VcsApplicationSettings)3 CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)3 QuickDocOnMouseOverManager (com.intellij.codeInsight.documentation.QuickDocOnMouseOverManager)1 SmartBackspaceMode (com.intellij.codeInsight.editorActions.SmartBackspaceMode)1 DocumentWindow (com.intellij.injected.editor.DocumentWindow)1 UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)1 Editor (com.intellij.openapi.editor.Editor)1 LogicalPosition (com.intellij.openapi.editor.LogicalPosition)1 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)1 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiElement (com.intellij.psi.PsiElement)1 PsiWhiteSpace (com.intellij.psi.PsiWhiteSpace)1