mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-63980 Make idea.cycle.buffer.size configurable in IDEA GUI / IDEA settings
This commit is contained in:
@@ -67,6 +67,8 @@ public class UISettings extends SimpleModificationTracker implements PersistentS
|
||||
@Property(filter = FontFilter.class) public int FONT_SIZE;
|
||||
public int RECENT_FILES_LIMIT = 50;
|
||||
public int CONSOLE_COMMAND_HISTORY_LIMIT = 300;
|
||||
public boolean OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE = false;
|
||||
public int CONSOLE_CYCLE_BUFFER_SIZE_KB = 1024;
|
||||
public int EDITOR_TAB_LIMIT = 10;
|
||||
public boolean REUSE_NOT_MODIFIED_TABS = false;
|
||||
public boolean ANIMATE_WINDOWS = true;
|
||||
|
||||
+7
-33
@@ -100,7 +100,7 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="7fdc1" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="7fdc1" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -137,14 +137,6 @@
|
||||
<text resource-bundle="messages/ApplicationBundle" key="editbox.recent.files.limit"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f8fa5" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="editbox.console.history.limit"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="695ab" class="javax.swing.JTextField" binding="myRecentFilesLimitField">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
@@ -155,16 +147,6 @@
|
||||
<text value="10"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8f324" class="javax.swing.JTextField" binding="myCommandsHistoryLimitField">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="50" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="20"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="5df80" binding="myHighlightSettingsPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
@@ -438,7 +420,7 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="7bb4" layout-manager="GridLayoutManager" row-count="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="7bb4" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -451,7 +433,7 @@
|
||||
<children>
|
||||
<vspacer id="32f7b">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="3" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="3" column="0" row-span="1" col-span="3" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="2a6d" class="javax.swing.JCheckBox" binding="myCbUseSoftWrapsAtEditor">
|
||||
@@ -463,17 +445,9 @@
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.use.soft.wraps.at.editor"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="42235" class="javax.swing.JCheckBox" binding="myCbUseSoftWrapsAtConsole">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.use.soft.wraps.at.console"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="42c6f" class="javax.swing.JCheckBox" binding="myCbShowSoftWrapsOnlyOnCaretLine">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.softwraps.only.for.caret.line"/>
|
||||
@@ -481,7 +455,7 @@
|
||||
</component>
|
||||
<component id="579d0" class="javax.swing.JCheckBox" binding="myCbUseCustomSoftWrapIndent">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="318" height="22"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -492,7 +466,7 @@
|
||||
</component>
|
||||
<component id="e5f5a" class="javax.swing.JTextField" binding="myCustomSoftWrapIndent">
|
||||
<constraints>
|
||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="35" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -503,7 +477,7 @@
|
||||
</component>
|
||||
<component id="41357" class="javax.swing.JLabel" binding="myCustomSoftWrapIndentLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/ApplicationBundle" key="label.use.custom.soft.wraps.indent"/>
|
||||
|
||||
+1
-10
@@ -73,7 +73,6 @@ public class EditorOptionsPanel {
|
||||
private JCheckBox myCbCaretInsideTabs;
|
||||
|
||||
private JTextField myRecentFilesLimitField;
|
||||
private JTextField myCommandsHistoryLimitField;
|
||||
|
||||
private JCheckBox myCbHighlightScope;
|
||||
|
||||
@@ -93,7 +92,6 @@ public class EditorOptionsPanel {
|
||||
private JCheckBox myShowNotificationAfterReformatCodeCheckBox;
|
||||
private JCheckBox myShowNotificationAfterOptimizeImportsCheckBox;
|
||||
private JCheckBox myCbUseSoftWrapsAtEditor;
|
||||
private JCheckBox myCbUseSoftWrapsAtConsole;
|
||||
private JCheckBox myCbUseCustomSoftWrapIndent;
|
||||
private JTextField myCustomSoftWrapIndent;
|
||||
private JLabel myCustomSoftWrapIndentLabel;
|
||||
@@ -180,7 +178,6 @@ public class EditorOptionsPanel {
|
||||
// Virtual space
|
||||
|
||||
myCbUseSoftWrapsAtEditor.setSelected(editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR));
|
||||
myCbUseSoftWrapsAtConsole.setSelected(editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE));
|
||||
myCbUseCustomSoftWrapIndent.setSelected(editorSettings.isUseCustomSoftWrapIndent());
|
||||
myCustomSoftWrapIndent.setText(Integer.toString(editorSettings.getCustomSoftWrapIndent()));
|
||||
myCbShowSoftWrapsOnlyOnCaretLine.setSelected(!editorSettings.isAllSoftWrapsShown());
|
||||
@@ -223,7 +220,6 @@ public class EditorOptionsPanel {
|
||||
|
||||
|
||||
myRecentFilesLimitField.setText(Integer.toString(uiSettings.RECENT_FILES_LIMIT));
|
||||
myCommandsHistoryLimitField.setText(Integer.toString(uiSettings.CONSOLE_COMMAND_HISTORY_LIMIT));
|
||||
|
||||
myCbRenameLocalVariablesInplace.setSelected(editorSettings.isVariableInplaceRenameEnabled());
|
||||
myPreselectCheckBox.setSelected(editorSettings.isPreselectRename());
|
||||
@@ -289,7 +285,6 @@ public class EditorOptionsPanel {
|
||||
// Virtual space
|
||||
|
||||
editorSettings.setUseSoftWraps(myCbUseSoftWrapsAtEditor.isSelected(), SoftWrapAppliancePlaces.MAIN_EDITOR);
|
||||
editorSettings.setUseSoftWraps(myCbUseSoftWrapsAtConsole.isSelected(), SoftWrapAppliancePlaces.CONSOLE);
|
||||
editorSettings.setUseCustomSoftWrapIndent(myCbUseCustomSoftWrapIndent.isSelected());
|
||||
editorSettings.setCustomSoftWrapIndent(getCustomSoftWrapIndent());
|
||||
editorSettings.setAllSoftwrapsShown(!myCbShowSoftWrapsOnlyOnCaretLine.isSelected());
|
||||
@@ -373,7 +368,6 @@ public class EditorOptionsPanel {
|
||||
if(uiSettingsChanged){
|
||||
uiSettings.fireUISettingsChanged();
|
||||
}
|
||||
uiSettings.CONSOLE_COMMAND_HISTORY_LIMIT = StringUtil.parseInt(myCommandsHistoryLimitField.getText(), uiSettings.CONSOLE_COMMAND_HISTORY_LIMIT);
|
||||
|
||||
myErrorHighlightingPanel.apply();
|
||||
|
||||
@@ -460,7 +454,6 @@ public class EditorOptionsPanel {
|
||||
|
||||
// Virtual space
|
||||
isModified |= isModified(myCbUseSoftWrapsAtEditor, editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR));
|
||||
isModified |= isModified(myCbUseSoftWrapsAtConsole, editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE));
|
||||
isModified |= isModified(myCbUseCustomSoftWrapIndent, editorSettings.isUseCustomSoftWrapIndent());
|
||||
isModified |= editorSettings.getCustomSoftWrapIndent() != getCustomSoftWrapIndent();
|
||||
isModified |= isModified(myCbShowSoftWrapsOnlyOnCaretLine, !editorSettings.isAllSoftWrapsShown());
|
||||
@@ -494,7 +487,6 @@ public class EditorOptionsPanel {
|
||||
|
||||
|
||||
isModified |= isModified(myRecentFilesLimitField, UISettings.getInstance().RECENT_FILES_LIMIT);
|
||||
isModified |= isModified(myCommandsHistoryLimitField, UISettings.getInstance().CONSOLE_COMMAND_HISTORY_LIMIT);
|
||||
isModified |= isModified(myCbRenameLocalVariablesInplace, editorSettings.isVariableInplaceRenameEnabled());
|
||||
isModified |= isModified(myPreselectCheckBox, editorSettings.isPreselectRename());
|
||||
isModified |= isModified(myShowInlineDialogForCheckBox, editorSettings.isShowInlineLocalDialog());
|
||||
@@ -573,12 +565,11 @@ public class EditorOptionsPanel {
|
||||
}
|
||||
};
|
||||
myCbUseSoftWrapsAtEditor.addItemListener(listener);
|
||||
myCbUseSoftWrapsAtConsole.addItemListener(listener);
|
||||
myCbUseCustomSoftWrapIndent.addItemListener(listener);
|
||||
}
|
||||
|
||||
private void updateSoftWrapSettingsRepresentation() {
|
||||
boolean softWrapsEnabled = myCbUseSoftWrapsAtEditor.isSelected() || myCbUseSoftWrapsAtConsole.isSelected();
|
||||
boolean softWrapsEnabled = myCbUseSoftWrapsAtEditor.isSelected();
|
||||
myCbUseCustomSoftWrapIndent.setEnabled(softWrapsEnabled);
|
||||
myCustomSoftWrapIndent.setEnabled(myCbUseCustomSoftWrapIndent.isEnabled() && myCbUseCustomSoftWrapIndent.isSelected());
|
||||
myCustomSoftWrapIndentLabel.setEnabled(myCustomSoftWrapIndent.isEnabled());
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
package com.intellij.execution.console;
|
||||
|
||||
import com.intellij.execution.impl.ConsoleBuffer;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
|
||||
import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.ui.InputValidatorEx;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.AddEditDeleteListPanel;
|
||||
import com.intellij.util.ui.GridBag;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class ConsoleConfigurable implements SearchableConfigurable, Configurable.NoScroll {
|
||||
private JPanel myMainComponent;
|
||||
private JCheckBox myCbUseSoftWrapsAtConsole;
|
||||
private JTextField myCommandsHistoryLimitField;
|
||||
private JCheckBox myCbOverrideConsoleCycleBufferSize;
|
||||
private JTextField myConsoleCycleBufferSizeField;
|
||||
|
||||
|
||||
private MyAddDeleteListPanel myPositivePanel;
|
||||
private MyAddDeleteListPanel myNegativePanel;
|
||||
private final ConsoleFoldingSettings mySettings = ConsoleFoldingSettings.getSettings();
|
||||
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
if (myMainComponent == null) {
|
||||
myMainComponent = new JPanel(new BorderLayout());
|
||||
myCbUseSoftWrapsAtConsole = new JCheckBox(ApplicationBundle.message("checkbox.use.soft.wraps.at.console"), false);
|
||||
myCommandsHistoryLimitField = new JTextField(3);
|
||||
myCbOverrideConsoleCycleBufferSize = new JCheckBox(ApplicationBundle.message("checkbox.override.console.cycle.buffer.size", String.valueOf(ConsoleBuffer.getLegacyCycleBufferSize() / 1024)), false);
|
||||
myCbOverrideConsoleCycleBufferSize.addChangeListener(new ChangeListener(){
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
myConsoleCycleBufferSizeField.setEnabled(myCbOverrideConsoleCycleBufferSize.isSelected());
|
||||
}
|
||||
});
|
||||
myConsoleCycleBufferSizeField = new JTextField(3);
|
||||
|
||||
JPanel northPanel = new JPanel(new GridBagLayout());
|
||||
GridBag gridBag = new GridBag();
|
||||
gridBag.anchor(GridBagConstraints.WEST).setDefaultAnchor(GridBagConstraints.WEST);
|
||||
northPanel
|
||||
.add(myCbUseSoftWrapsAtConsole,
|
||||
gridBag.nextLine().next());
|
||||
northPanel.add(Box.createHorizontalGlue(), gridBag.next().coverLine());
|
||||
northPanel.add(new JLabel(ApplicationBundle.message("editbox.console.history.limit")), gridBag.nextLine().next());
|
||||
northPanel.add(myCommandsHistoryLimitField, gridBag.next());
|
||||
if (ConsoleBuffer.useCycleBuffer()) {
|
||||
northPanel.add(myCbOverrideConsoleCycleBufferSize, gridBag.nextLine().next());
|
||||
northPanel.add(myConsoleCycleBufferSizeField, gridBag.next());
|
||||
}
|
||||
if (!editFoldingsOnly()) {
|
||||
JPanel wrapper = new JPanel(new BorderLayout());
|
||||
wrapper.add(northPanel, BorderLayout.WEST);
|
||||
myMainComponent.add(wrapper, BorderLayout.NORTH);
|
||||
}
|
||||
Splitter splitter = new Splitter(true);
|
||||
myMainComponent.add(splitter, BorderLayout.CENTER);
|
||||
myPositivePanel =
|
||||
new MyAddDeleteListPanel("Fold console lines that contain", "Enter a substring of a console line you'd like to see folded:");
|
||||
myNegativePanel = new MyAddDeleteListPanel("Exceptions", "Enter a substring of a console line you don't want to fold:");
|
||||
splitter.setFirstComponent(myPositivePanel);
|
||||
splitter.setSecondComponent(myNegativePanel);
|
||||
|
||||
myPositivePanel.getEmptyText().setText("Fold nothing");
|
||||
myNegativePanel.getEmptyText().setText("No exceptions");
|
||||
}
|
||||
return myMainComponent;
|
||||
}
|
||||
|
||||
protected boolean editFoldingsOnly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addRule(@NotNull String rule) {
|
||||
myPositivePanel.addRule(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
|
||||
boolean isModified = !Arrays.asList(myNegativePanel.getListItems()).equals(mySettings.getNegativePatterns());
|
||||
isModified |= !Arrays.asList(myPositivePanel.getListItems()).equals(mySettings.getPositivePatterns());
|
||||
isModified |= isModified(myCbUseSoftWrapsAtConsole, editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE));
|
||||
isModified |= isModified(myCommandsHistoryLimitField, UISettings.getInstance().CONSOLE_COMMAND_HISTORY_LIMIT);
|
||||
if (ConsoleBuffer.useCycleBuffer()) {
|
||||
isModified |= isModified(myCbOverrideConsoleCycleBufferSize, UISettings.getInstance().OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE);
|
||||
isModified |= isModified(myConsoleCycleBufferSizeField, UISettings.getInstance().CONSOLE_CYCLE_BUFFER_SIZE_KB);
|
||||
}
|
||||
|
||||
return isModified;
|
||||
}
|
||||
|
||||
private static boolean isModified(JToggleButton checkBox, boolean value) {
|
||||
return checkBox.isSelected() != value;
|
||||
}
|
||||
|
||||
private static boolean isModified(JTextField textField, int value) {
|
||||
try {
|
||||
int fieldValue = Integer.parseInt(textField.getText().trim());
|
||||
return fieldValue != value;
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@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.CONSOLE_COMMAND_HISTORY_LIMIT)) {
|
||||
uiSettings.CONSOLE_COMMAND_HISTORY_LIMIT = Math.max(0, Math.min(1000, Integer.parseInt(myCommandsHistoryLimitField.getText().trim())));
|
||||
uiSettingsChanged = true;
|
||||
}
|
||||
if (ConsoleBuffer.useCycleBuffer()) {
|
||||
if (isModified(myCbOverrideConsoleCycleBufferSize, uiSettings.OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE)) {
|
||||
uiSettings.OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE = myCbOverrideConsoleCycleBufferSize.isSelected();
|
||||
uiSettingsChanged = true;
|
||||
}
|
||||
if (isModified(myConsoleCycleBufferSizeField, uiSettings.CONSOLE_CYCLE_BUFFER_SIZE_KB)) {
|
||||
uiSettings.CONSOLE_CYCLE_BUFFER_SIZE_KB = 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());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
|
||||
UISettings uiSettings = UISettings.getInstance();
|
||||
|
||||
myCbUseSoftWrapsAtConsole.setSelected(editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.CONSOLE));
|
||||
myCommandsHistoryLimitField.setText(Integer.toString(uiSettings.CONSOLE_COMMAND_HISTORY_LIMIT));
|
||||
|
||||
myCbOverrideConsoleCycleBufferSize.setEnabled(ConsoleBuffer.useCycleBuffer());
|
||||
myCbOverrideConsoleCycleBufferSize.setSelected(uiSettings.OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE);
|
||||
myConsoleCycleBufferSizeField.setEnabled(ConsoleBuffer.useCycleBuffer() && uiSettings.OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE);
|
||||
myConsoleCycleBufferSizeField.setText(Integer.toString(uiSettings.CONSOLE_CYCLE_BUFFER_SIZE_KB));
|
||||
|
||||
|
||||
myNegativePanel.resetFrom(mySettings.getNegativePatterns());
|
||||
myPositivePanel.resetFrom(mySettings.getPositivePatterns());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
myMainComponent = null;
|
||||
myNegativePanel = null;
|
||||
myPositivePanel = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getId() {
|
||||
return getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Runnable enableSearch(String option) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nls
|
||||
public String getDisplayName() {
|
||||
return "Console Folding";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpTopic() {
|
||||
return "reference.idesettings.console.folding";
|
||||
}
|
||||
|
||||
private static class MyAddDeleteListPanel extends AddEditDeleteListPanel<String> {
|
||||
private final String myQuery;
|
||||
|
||||
public MyAddDeleteListPanel(String title, String query) {
|
||||
super(title, new ArrayList<String>());
|
||||
myQuery = query;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected String findItemToAdd() {
|
||||
return showEditDialog("");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String showEditDialog(final String initialValue) {
|
||||
return Messages.showInputDialog(this, myQuery, "Folding Pattern", Messages.getQuestionIcon(), initialValue, new InputValidatorEx() {
|
||||
@Override
|
||||
public boolean checkInput(String inputString) {
|
||||
return !StringUtil.isEmpty(inputString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canClose(String inputString) {
|
||||
return !StringUtil.isEmpty(inputString);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getErrorText(String inputString) {
|
||||
if (!checkInput(inputString)) {
|
||||
return "Console folding rule string cannot be empty";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void resetFrom(List<String> patterns) {
|
||||
myListModel.clear();
|
||||
for (String pattern : patterns) {
|
||||
myListModel.addElement(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
void applyTo(List<String> patterns) {
|
||||
patterns.clear();
|
||||
for (Object o : getListItems()) {
|
||||
patterns.add((String)o);
|
||||
}
|
||||
}
|
||||
|
||||
public void addRule(String rule) {
|
||||
addElement(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds(int x, int y, int width, int height) {
|
||||
super.setBounds(x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String editSelectedItem(String item) {
|
||||
return showEditDialog(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
-166
@@ -1,166 +0,0 @@
|
||||
package com.intellij.execution.console;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.ui.InputValidatorEx;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.AddEditDeleteListPanel;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class ConsoleFoldingConfigurable implements SearchableConfigurable, Configurable.NoScroll {
|
||||
private JPanel myMainComponent;
|
||||
private MyAddDeleteListPanel myPositivePanel;
|
||||
private MyAddDeleteListPanel myNegativePanel;
|
||||
private final ConsoleFoldingSettings mySettings = ConsoleFoldingSettings.getSettings();
|
||||
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
if (myMainComponent == null) {
|
||||
myMainComponent = new JPanel(new BorderLayout());
|
||||
Splitter splitter = new Splitter(true);
|
||||
myMainComponent.add(splitter);
|
||||
myPositivePanel =
|
||||
new MyAddDeleteListPanel("Fold console lines that contain", "Enter a substring of a console line you'd like to see folded:");
|
||||
myNegativePanel = new MyAddDeleteListPanel("Exceptions", "Enter a substring of a console line you don't want to fold:");
|
||||
splitter.setFirstComponent(myPositivePanel);
|
||||
splitter.setSecondComponent(myNegativePanel);
|
||||
|
||||
myPositivePanel.getEmptyText().setText("Fold nothing");
|
||||
myNegativePanel.getEmptyText().setText("No exceptions");
|
||||
}
|
||||
return myMainComponent;
|
||||
}
|
||||
|
||||
public void addRule(@NotNull String rule) {
|
||||
myPositivePanel.addRule(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return !Arrays.asList(myNegativePanel.getListItems()).equals(mySettings.getNegativePatterns()) ||
|
||||
!Arrays.asList(myPositivePanel.getListItems()).equals(mySettings.getPositivePatterns());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
myNegativePanel.applyTo(mySettings.getNegativePatterns());
|
||||
myPositivePanel.applyTo(mySettings.getPositivePatterns());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
myNegativePanel.resetFrom(mySettings.getNegativePatterns());
|
||||
myPositivePanel.resetFrom(mySettings.getPositivePatterns());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
myMainComponent = null;
|
||||
myNegativePanel = null;
|
||||
myPositivePanel = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getId() {
|
||||
return getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Runnable enableSearch(String option) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nls
|
||||
public String getDisplayName() {
|
||||
return "Console Folding";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpTopic() {
|
||||
return "reference.idesettings.console.folding";
|
||||
}
|
||||
|
||||
private static class MyAddDeleteListPanel extends AddEditDeleteListPanel<String> {
|
||||
private final String myQuery;
|
||||
|
||||
public MyAddDeleteListPanel(String title, String query) {
|
||||
super(title, new ArrayList<String>());
|
||||
myQuery = query;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected String findItemToAdd() {
|
||||
return showEditDialog("");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String showEditDialog(final String initialValue) {
|
||||
return Messages.showInputDialog(this, myQuery, "Folding Pattern", Messages.getQuestionIcon(), initialValue, new InputValidatorEx() {
|
||||
@Override
|
||||
public boolean checkInput(String inputString) {
|
||||
return !StringUtil.isEmpty(inputString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canClose(String inputString) {
|
||||
return !StringUtil.isEmpty(inputString);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getErrorText(String inputString) {
|
||||
if (!checkInput(inputString)) {
|
||||
return "Console folding rule string cannot be empty";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void resetFrom(List<String> patterns) {
|
||||
myListModel.clear();
|
||||
for (String pattern : patterns) {
|
||||
myListModel.addElement(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
void applyTo(List<String> patterns) {
|
||||
patterns.clear();
|
||||
for (Object o : getListItems()) {
|
||||
patterns.add((String)o);
|
||||
}
|
||||
}
|
||||
|
||||
public void addRule(String rule) {
|
||||
addElement(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds(int x, int y, int width, int height) {
|
||||
super.setBounds(x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String editSelectedItem(String item) {
|
||||
return showEditDialog(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,12 @@ public class FoldLinesLikeThis extends DumbAwareAction {
|
||||
assert editor != null;
|
||||
final String selection = getSingleLineSelection(editor);
|
||||
assert selection != null;
|
||||
ShowSettingsUtil.getInstance().editConfigurable(editor.getProject(), new ConsoleFoldingConfigurable() {
|
||||
ShowSettingsUtil.getInstance().editConfigurable(editor.getProject(), new ConsoleConfigurable() {
|
||||
@Override
|
||||
protected boolean editFoldingsOnly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.execution.impl;
|
||||
|
||||
import com.intellij.execution.filters.HyperlinkInfo;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -120,11 +121,17 @@ public class ConsoleBuffer {
|
||||
}
|
||||
|
||||
public static boolean useCycleBuffer() {
|
||||
final String useCycleBufferProperty = System.getProperty("idea.cycle.buffer.size");
|
||||
return useCycleBufferProperty == null || !"disabled".equalsIgnoreCase(useCycleBufferProperty);
|
||||
return !"disabled".equalsIgnoreCase(System.getProperty("idea.cycle.buffer.size"));
|
||||
}
|
||||
|
||||
public static int getCycleBufferSize() {
|
||||
if (UISettings.getInstance().OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE) {
|
||||
return UISettings.getInstance().CONSOLE_CYCLE_BUFFER_SIZE_KB * 1024;
|
||||
}
|
||||
return getLegacyCycleBufferSize();
|
||||
}
|
||||
|
||||
public static int getLegacyCycleBufferSize() {
|
||||
String cycleBufferSizeProperty = System.getProperty("idea.cycle.buffer.size");
|
||||
if (cycleBufferSizeProperty == null) return 1024 * 1024;
|
||||
try {
|
||||
|
||||
@@ -409,6 +409,7 @@ checkbox.show.quick.doc.on.mouse.over=Show quick doc on mouse over element (ms):
|
||||
group.limits=Limits
|
||||
editbox.recent.files.limit=Recent files limit:
|
||||
editbox.console.history.limit=Console commands history size:
|
||||
checkbox.override.console.cycle.buffer.size=Override console cycle buffer size ({0} KB)
|
||||
editbox.maximum.number.of.contents.to.keep.in.clipboard=<html>Maximum number of contents to keep in clipboard:</html>
|
||||
group.brace.highlighting=Highlight on Caret Movement
|
||||
checkbox.highlight.matched.brace=Highlight matched brace
|
||||
|
||||
@@ -262,8 +262,8 @@
|
||||
<projectConfigurable groupId="build" provider="com.intellij.externalDependencies.impl.ExternalDependenciesConfigurableProvider"
|
||||
id="preferences.externalDependencies" displayName="Required Plugins"/>
|
||||
|
||||
<applicationConfigurable parentId="preferences.editor" instance="com.intellij.execution.console.ConsoleFoldingConfigurable" id="Console Folding"
|
||||
displayName="Console Folding"/>
|
||||
<applicationConfigurable parentId="preferences.editor" instance="com.intellij.execution.console.ConsoleConfigurable" id="Console"
|
||||
displayName="Console"/>
|
||||
|
||||
<editorNotificationProvider implementation="com.intellij.codeInsight.daemon.impl.AttachSourcesNotificationProvider"/>
|
||||
<editorNotificationProvider implementation="com.intellij.codeInsight.daemon.impl.SetupSDKNotificationProvider"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Set up IDEA_PROPERTIES environment variable to specify custom location of this properties file like
|
||||
I# Set up IDEA_PROPERTIES environment variable to specify custom location of this properties file like
|
||||
# SET IDEA_PROPERTIES=c:\ideaconfig\idea.properties
|
||||
# before launching idea.
|
||||
# If not specified it is searched according following sequence (first successful is used).
|
||||
|
||||
Reference in New Issue
Block a user