use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.
the class TrailingSpacesStripperTest method testDisableStrip_Modify_Save_EnableOnModifiedLines_Modify_Save_ShouldStripModifiedOnly.
public void testDisableStrip_Modify_Save_EnableOnModifiedLines_Modify_Save_ShouldStripModifiedOnly() throws IOException {
EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance();
settings.setStripTrailingSpaces(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE);
configureFromFileText("x.txt", "");
type("xxx \nyyy \nzzz \n");
myEditor.getCaretModel().moveToOffset(0);
end();
end();
FileDocumentManager.getInstance().saveAllDocuments();
checkResultByText("xxx <caret>\nyyy \nzzz \n");
settings.setStripTrailingSpaces(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED);
type(' ');
myEditor.getCaretModel().moveToOffset(myEditor.getDocument().getText().length());
FileDocumentManager.getInstance().saveAllDocuments();
checkResultByText("xxx\nyyy \nzzz \n<caret>");
}
use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.
the class ConsoleConfigurable method apply.
@Override
public void apply() throws ConfigurationException {
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
UISettings uiSettings = UISettings.getInstance();
editorSettings.setUseSoftWraps(myCbUseSoftWrapsAtConsole.isSelected(), SoftWrapAppliancePlaces.CONSOLE);
boolean uiSettingsChanged = false;
if (isModified(myCommandsHistoryLimitField, uiSettings.getConsoleCommandHistoryLimit())) {
uiSettings.setConsoleCommandHistoryLimit(Math.max(0, Math.min(1000, Integer.parseInt(myCommandsHistoryLimitField.getText().trim()))));
uiSettingsChanged = true;
}
if (ConsoleBuffer.useCycleBuffer()) {
if (isModified(myCbOverrideConsoleCycleBufferSize, uiSettings.getOverrideConsoleCycleBufferSize())) {
uiSettings.setOverrideConsoleCycleBufferSize(myCbOverrideConsoleCycleBufferSize.isSelected());
uiSettingsChanged = true;
}
if (isModified(myConsoleCycleBufferSizeField, uiSettings.getConsoleCycleBufferSizeKb())) {
uiSettings.setConsoleCycleBufferSizeKb(Math.max(0, Math.min(1024 * 100, Integer.parseInt(myConsoleCycleBufferSizeField.getText().trim()))));
uiSettingsChanged = true;
}
}
if (uiSettingsChanged) {
uiSettings.fireUISettingsChanged();
}
myNegativePanel.applyTo(mySettings.getNegativePatterns());
myPositivePanel.applyTo(mySettings.getPositivePatterns());
}
use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.
the class ConsoleConfigurable method reset.
@Override
public void reset() {
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
UISettings uiSettings = UISettings.getInstance();
myCbUseSoftWrapsAtConsole.setSelected(editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE));
myCommandsHistoryLimitField.setText(Integer.toString(uiSettings.getConsoleCommandHistoryLimit()));
myCbOverrideConsoleCycleBufferSize.setEnabled(ConsoleBuffer.useCycleBuffer());
myCbOverrideConsoleCycleBufferSize.setSelected(uiSettings.getOverrideConsoleCycleBufferSize());
myConsoleCycleBufferSizeField.setEnabled(ConsoleBuffer.useCycleBuffer() && uiSettings.getOverrideConsoleCycleBufferSize());
myConsoleCycleBufferSizeField.setText(Integer.toString(uiSettings.getConsoleCycleBufferSizeKb()));
myNegativePanel.resetFrom(mySettings.getNegativePatterns());
myPositivePanel.resetFrom(mySettings.getPositivePatterns());
}
use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.
the class EditorAppearanceConfigurable method apply.
@Override
public void apply() throws ConfigurationException {
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
editorSettings.setBlinkCaret(myCbBlinkCaret.isSelected());
try {
editorSettings.setBlinkPeriod(Integer.parseInt(myBlinkIntervalField.getText()));
} catch (NumberFormatException ignore) {
}
editorSettings.setBlockCursor(myCbBlockCursor.isSelected());
editorSettings.setRightMarginShown(myCbRightMargin.isSelected());
editorSettings.setLineNumbersShown(myCbShowLineNumbers.isSelected());
editorSettings.setWhitespacesShown(myCbShowWhitespaces.isSelected());
editorSettings.setLeadingWhitespacesShown(myLeadingWhitespacesCheckBox.isSelected());
editorSettings.setInnerWhitespacesShown(myInnerWhitespacesCheckBox.isSelected());
editorSettings.setTrailingWhitespacesShown(myTrailingWhitespacesCheckBox.isSelected());
editorSettings.setIndentGuidesShown(myShowVerticalIndentGuidesCheckBox.isSelected());
EditorOptionsPanel.reinitAllEditors();
DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = myCbShowMethodSeparators.isSelected();
UISettings uiSettings = UISettings.getInstance();
boolean uiSettingsModified = false;
boolean lafSettingsModified = false;
if (uiSettings.getShowEditorToolTip() != myShowCodeLensInEditorCheckBox.isSelected()) {
uiSettings.setShowToolWindowsNumbers(myShowCodeLensInEditorCheckBox.isSelected());
uiSettingsModified = true;
lafSettingsModified = true;
}
if (editorSettings.isBreadcrumbsShown() != myShowBreadcrumbsCheckBox.isSelected()) {
editorSettings.setBreadcrumbsShown(myShowBreadcrumbsCheckBox.isSelected());
uiSettingsModified = true;
}
if (lafSettingsModified) {
LafManager.getInstance().repaintUI();
}
if (uiSettingsModified) {
uiSettings.fireUISettingsChanged();
}
EditorOptionsPanel.restartDaemons();
applyNameHintsSettings();
super.apply();
}
use of com.intellij.openapi.editor.ex.EditorSettingsExternalizable in project intellij-community by JetBrains.
the class EditorAppearanceConfigurable method isModified.
@Override
public boolean isModified() {
if (super.isModified())
return true;
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
boolean isModified = isModified(myCbBlinkCaret, editorSettings.isBlinkCaret());
isModified |= isModified(myBlinkIntervalField, editorSettings.getBlinkPeriod(), EditorSettingsExternalizable.BLINKING_RANGE);
isModified |= isModified(myCbBlockCursor, editorSettings.isBlockCursor());
isModified |= isModified(myCbRightMargin, editorSettings.isRightMarginShown());
isModified |= isModified(myCbShowLineNumbers, editorSettings.isLineNumbersShown());
isModified |= isModified(myCbShowWhitespaces, editorSettings.isWhitespacesShown());
isModified |= isModified(myLeadingWhitespacesCheckBox, editorSettings.isLeadingWhitespacesShown());
isModified |= isModified(myInnerWhitespacesCheckBox, editorSettings.isInnerWhitespacesShown());
isModified |= isModified(myTrailingWhitespacesCheckBox, editorSettings.isTrailingWhitespacesShown());
isModified |= isModified(myShowVerticalIndentGuidesCheckBox, editorSettings.isIndentGuidesShown());
isModified |= isModified(myCbShowMethodSeparators, DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS);
//isModified |= myAntialiasingInEditorCheckBox.isSelected() != UISettings.getInstance().ANTIALIASING_IN_EDITOR;
//isModified |= myUseLCDRendering.isSelected() != UISettings.getInstance().USE_LCD_RENDERING_IN_EDITOR;
isModified |= myShowCodeLensInEditorCheckBox.isSelected() != UISettings.getInstance().getShowEditorToolTip();
isModified |= myShowBreadcrumbsCheckBox.isSelected() != editorSettings.isBreadcrumbsShown();
isModified |= myShowParameterNameHints.isSelected() != editorSettings.isShowParameterNameHints();
return isModified;
}
Aggregations