Commit 7319b281 authored by Dmitry.Krasilschikov's avatar Dmitry.Krasilschikov
Browse files

IDEA-200666 IDEA-205681 move list size settings from Registry to General | Editor | Limits group

parent 3a3e0fd2
Showing with 51 additions and 15 deletions
+51 -15
......@@ -251,6 +251,9 @@ class UISettings @JvmOverloads constructor(private val notRoamableOptions: NotRo
val recentFilesLimit: Int
get() = state.recentFilesLimit
val recentLocationsLimit: Int
get() = state.recentLocationsLimit
var maxLookupWidth: Int
get() = state.maxLookupWidth
set(value) {
......
......@@ -37,6 +37,9 @@ class UISettingsState : BaseState() {
@get:OptionTag("RECENT_FILES_LIMIT")
var recentFilesLimit by property(50)
@get:OptionTag("RECENT_LOCATIONS_LIMIT")
var recentLocationsLimit by property(10)
@get:OptionTag("CONSOLE_COMMAND_HISTORY_LIMIT")
var consoleCommandHistoryLimit by property(300)
@get:OptionTag("OVERRIDE_CONSOLE_CYCLE_BUFFER_SIZE")
......
......@@ -100,7 +100,7 @@
</component>
</children>
</grid>
<grid id="7fdc1" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="7fdc1" layout-manager="GridLayoutManager" row-count="3" 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"/>
......@@ -143,6 +143,22 @@
<text value="10"/>
</properties>
</component>
<component id="7b2ca" 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.recent.locations.limit"/>
</properties>
</component>
<component id="3075f" class="javax.swing.JTextField" binding="myRecentLocationsLimitField">
<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"/>
</constraints>
<properties>
<text value="10"/>
</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">
......
......@@ -96,10 +96,12 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
private JCheckBox myCbEnableRichCopyByDefault;
private JCheckBox myShowLSTInGutterCheckBox;
private JCheckBox myShowWhitespacesModificationsInLSTGutterCheckBox;
private JCheckBox myCbKeepTrailingSpacesOnCaretLine;
private JCheckBox myCbKeepTrailingSpacesOnCaretLine;
private JTextField myRecentLocationsLimitField;
private static final String ACTIVE_COLOR_SCHEME = ApplicationBundle.message("combobox.richcopy.color.scheme.active");
private static final UINumericRange RECENT_FILES_RANGE = new UINumericRange(50, 1, 500);
private static final UINumericRange RECENT_LOCATIONS_RANGE = new UINumericRange(10, 1, 100);
private final ErrorHighlightingPanel myErrorHighlightingPanel = new ErrorHighlightingPanel(getConfigurables());
......@@ -208,6 +210,7 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
myRecentFilesLimitField.setText(Integer.toString(uiSettings.getRecentFilesLimit()));
myRecentLocationsLimitField.setText(Integer.toString(uiSettings.getRecentLocationsLimit()));
myCbRenameLocalVariablesInplace.setSelected(editorSettings.isVariableInplaceRenameEnabled());
myPreselectCheckBox.setSelected(editorSettings.isPreselectRename());
......@@ -349,6 +352,11 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
uiSettings.fireUISettingsChanged();
}
uiSettingsChanged = setRecentLocationLimit(uiSettings, myRecentLocationsLimitField.getText()) || uiSettingsChanged;
if (uiSettingsChanged) {
uiSettings.fireUISettingsChanged();
}
myErrorHighlightingPanel.apply();
super.apply();
UISettings.getInstance().fireUISettingsChanged();
......@@ -364,6 +372,19 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
ApplicationManager.getApplication().getMessageBus().syncPublisher(EditorOptionsListener.OPTIONS_PANEL_TOPIC).changesApplied();
}
private static boolean setRecentLocationLimit(@NotNull UISettings uiSettings, @NotNull String recentLocationsLimit) {
try {
int newRecentLocationsLimit = Integer.parseInt(recentLocationsLimit.trim());
if (uiSettings.getRecentLocationsLimit() != newRecentLocationsLimit) {
uiSettings.getState().setRecentLocationsLimit(newRecentLocationsLimit);
return true;
}
}
catch (NumberFormatException ignored) {
}
return false;
}
private int getQuickDocDelayFromGui() {
try {
return EditorSettingsExternalizable.QUICK_DOC_DELAY_RANGE.fit(Integer.parseInt(myQuickDocDelayTextField.getText().trim()));
......@@ -461,6 +482,7 @@ public class EditorOptionsPanel extends CompositeConfigurable<ErrorOptionsProvid
isModified |= isModified(myRecentFilesLimitField, UISettings.getInstance().getRecentFilesLimit(), RECENT_FILES_RANGE);
isModified |= isModified(myRecentLocationsLimitField, UISettings.getInstance().getRecentLocationsLimit(), RECENT_LOCATIONS_RANGE);
isModified |= isModified(myCbRenameLocalVariablesInplace, editorSettings.isVariableInplaceRenameEnabled());
isModified |= isModified(myPreselectCheckBox, editorSettings.isPreselectRename());
isModified |= isModified(myShowInlineDialogForCheckBox, editorSettings.isShowInlineLocalDialog());
......
......@@ -2,6 +2,7 @@
package com.intellij.ide.actions;
import com.intellij.codeInsight.breadcrumbs.FileBreadcrumbsCollector;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
......@@ -19,7 +20,6 @@ import com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl.PlaceInfo;
import com.intellij.openapi.fileEditor.impl.text.TextEditorState;
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
......@@ -243,7 +243,7 @@ public class RecentLocationManager implements ProjectComponent {
private static class RecentLocationFixedSizeHashMap extends LinkedHashMap<PlaceInfo, PlaceInfoPersistentItem> {
@Override
protected boolean removeEldestEntry(Map.Entry<PlaceInfo, PlaceInfoPersistentItem> eldest) {
return size() > Registry.intValue("recent.locations.list.size", 10);
return size() > UISettings.getInstance().getRecentLocationsLimit();
}
}
}
......@@ -333,15 +333,9 @@ public class RecentLocationsAction extends AnAction {
List<RecentLocationItem> caretsList = ContainerUtil.newArrayList();
for (PlaceInfo placeInfo : places) {
EditorEx editor = createEditor(project, placeInfo);
if (editor == null) {
continue;
if (editor != null) {
caretsList.add(new RecentLocationItem(editor, placeInfo));
}
if (caretsList.size() > Registry.intValue("recent.locations.list.size", 10) - 1) {
break;
}
caretsList.add(new RecentLocationItem(editor, placeInfo));
}
return caretsList;
......
......@@ -447,6 +447,7 @@ combobox.strip.trailing.spaces.on.save=Strip trailing spaces on Save:
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.recent.locations.limit=Recent locations limit:
editbox.console.history.limit=Console commands history size:
checkbox.override.console.cycle.buffer.size=Override console cycle buffer size ({0} KB)
checkbox.override.console.cycle.buffer.size.warning.unlimited=Warning: unlimited buffer size can cause performance degradation
......
......@@ -1785,11 +1785,8 @@ ide.system.tray.enabled.description=Enables notifications via SystemTray
idea.profiler.jvm.dtrace=false
idea.profiler.jvm.dtrace.description=Enable JVM DTrace based profiler on Mac OS
recent.locations.list.size=10
recent.locations.list.size.description=Recent locations list size
recent.locations.lines.before.and.after=2
recent.locations.lines.before.and.after.description=Defines lines count that are shown before and after recent location.
uast.java.use.psi.type.precheck=true
uast.java.use.psi.type.precheck.description=Enable Java Uast performance optimisation which will check in advance if PsiElement converting is possible
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment