Convert system settings configurable to UI DSL

GitOrigin-RevId: 7e6a5d3a14407ebbeaf9271795af4d6f24a3a1fb
This commit is contained in:
Dmitry Jemerov
2019-07-03 18:50:15 +03:00
committed by intellij-monorepo-bot
parent b3d9490a55
commit 8554717972
4 changed files with 164 additions and 559 deletions
@@ -1,253 +0,0 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.fileChooser.PathChooserDialog;
import com.intellij.openapi.options.CompositeConfigurable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.options.ex.ConfigurableWrapper;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.IdeUICustomization;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBRadioButton;
import com.intellij.util.PlatformUtils;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.util.List;
/**
* To provide additional options in General section register implementation of {@link SearchableConfigurable} in the plugin.xml:
* <p/>
* &lt;extensions defaultExtensionNs="com.intellij"&gt;<br>
* &nbsp;&nbsp;&lt;generalOptionsProvider instance="class-name"/&gt;<br>
* &lt;/extensions&gt;
* <p>
* A new instance of the specified class will be created each time then the Settings dialog is opened
*/
public class GeneralSettingsConfigurable extends CompositeConfigurable<SearchableConfigurable> implements SearchableConfigurable {
private static final ExtensionPointName<GeneralSettingsConfigurableEP> EP_NAME = ExtensionPointName.create("com.intellij.generalOptionsProvider");
private MyComponent myComponent;
public GeneralSettingsConfigurable() {
myComponent = new MyComponent();
}
@Override
public void apply() throws ConfigurationException {
super.apply();
GeneralSettings settings = GeneralSettings.getInstance();
settings.setReopenLastProject(myComponent.myChkReopenLastProject.isSelected());
settings.setSyncOnFrameActivation(myComponent.myChkSyncOnFrameActivation.isSelected());
settings.setSaveOnFrameDeactivation(myComponent.myChkSaveOnFrameDeactivation.isSelected());
settings.setConfirmExit(myComponent.myConfirmExit.isSelected());
settings.setShowWelcomeScreen(myComponent.myShowWelcomeScreen.isSelected());
settings.setConfirmOpenNewProject(getConfirmOpenNewProject());
settings.setProcessCloseConfirmation(getProcessCloseConfirmation());
settings.setAutoSaveIfInactive(myComponent.myChkAutoSaveIfInactive.isSelected());
try {
settings.setInactiveTimeout(Integer.parseInt(myComponent.myTfInactiveTimeout.getText()));//See range validation inside settings
}
catch (NumberFormatException ignored) { }
settings.setUseSafeWrite(myComponent.myChkUseSafeWrite.isSelected());
settings.setDefaultProjectDirectory(myComponent.myProjectDirectoryTextField.getText());
}
private GeneralSettings.ProcessCloseConfirmation getProcessCloseConfirmation() {
if (myComponent.myTerminateProcessJBRadioButton.isSelected()) {
return GeneralSettings.ProcessCloseConfirmation.TERMINATE;
}
else if (myComponent.myDisconnectJBRadioButton.isSelected()) {
return GeneralSettings.ProcessCloseConfirmation.DISCONNECT;
}
else {
return GeneralSettings.ProcessCloseConfirmation.ASK;
}
}
@GeneralSettings.OpenNewProjectOption
private int getConfirmOpenNewProject() {
if (myComponent.myConfirmWindowToOpenProject.isSelected()) {
return GeneralSettings.OPEN_PROJECT_ASK;
}
else if (myComponent.myOpenProjectInNewWindow.isSelected()) {
return GeneralSettings.OPEN_PROJECT_NEW_WINDOW;
}
else {
return GeneralSettings.OPEN_PROJECT_SAME_WINDOW;
}
}
@Override
public boolean isModified() {
if (super.isModified()) return true;
GeneralSettings settings = GeneralSettings.getInstance();
boolean isModified = settings.isReopenLastProject() != myComponent.myChkReopenLastProject.isSelected();
isModified |= settings.isSyncOnFrameActivation() != myComponent.myChkSyncOnFrameActivation.isSelected();
isModified |= settings.isSaveOnFrameDeactivation() != myComponent.myChkSaveOnFrameDeactivation.isSelected();
isModified |= settings.isAutoSaveIfInactive() != myComponent.myChkAutoSaveIfInactive.isSelected();
isModified |= settings.isConfirmExit() != myComponent.myConfirmExit.isSelected();
isModified |= settings.isShowWelcomeScreen() != myComponent.myShowWelcomeScreen.isSelected();
isModified |= settings.getConfirmOpenNewProject() != getConfirmOpenNewProject();
isModified |= settings.getProcessCloseConfirmation() != getProcessCloseConfirmation();
isModified |= isModified(myComponent.myTfInactiveTimeout, settings.getInactiveTimeout(), GeneralSettings.SAVE_FILES_AFTER_IDLE_SEC);
isModified |= settings.isUseSafeWrite() != myComponent.myChkUseSafeWrite.isSelected();
isModified |= !settings.getDefaultProjectDirectory().equals(myComponent.myProjectDirectoryTextField.getText());
return isModified;
}
@Override
public JComponent createComponent() {
if (myComponent == null) {
myComponent = new MyComponent();
}
myComponent.myShowWelcomeScreen.setVisible(PlatformUtils.isDataGrip());
myComponent.myChkAutoSaveIfInactive.addChangeListener(
e -> myComponent.myTfInactiveTimeout.setEditable(myComponent.myChkAutoSaveIfInactive.isSelected()));
List<SearchableConfigurable> list = getConfigurables();
if (!list.isEmpty()) {
myComponent.myPluginOptionsPanel.setLayout(new GridLayout(list.size(), 1));
for (Configurable c : list) {
myComponent.myPluginOptionsPanel.add(c.createComponent());
}
}
return myComponent.myPanel;
}
@Override
public String getDisplayName() {
return IdeBundle.message("title.general");
}
@Override
public void reset() {
super.reset();
GeneralSettings settings = GeneralSettings.getInstance();
myComponent.myChkReopenLastProject.setSelected(settings.isReopenLastProject());
myComponent.myChkSyncOnFrameActivation.setSelected(settings.isSyncOnFrameActivation());
myComponent.myChkSaveOnFrameDeactivation.setSelected(settings.isSaveOnFrameDeactivation());
myComponent.myChkAutoSaveIfInactive.setSelected(settings.isAutoSaveIfInactive());
myComponent.myTfInactiveTimeout.setText(Integer.toString(settings.getInactiveTimeout()));
myComponent.myTfInactiveTimeout.setEditable(settings.isAutoSaveIfInactive());
myComponent.myChkUseSafeWrite.setSelected(settings.isUseSafeWrite());
myComponent.myConfirmExit.setSelected(settings.isConfirmExit());
myComponent.myShowWelcomeScreen.setSelected(settings.isShowWelcomeScreen());
switch (settings.getConfirmOpenNewProject()) {
case GeneralSettings.OPEN_PROJECT_ASK:
myComponent.myConfirmWindowToOpenProject.setSelected(true);
break;
case GeneralSettings.OPEN_PROJECT_NEW_WINDOW:
myComponent.myOpenProjectInNewWindow.setSelected(true);
break;
case GeneralSettings.OPEN_PROJECT_SAME_WINDOW:
myComponent.myOpenProjectInSameWindow.setSelected(true);
break;
}
switch (settings.getProcessCloseConfirmation()) {
case TERMINATE:
myComponent.myTerminateProcessJBRadioButton.setSelected(true);
break;
case DISCONNECT:
myComponent.myDisconnectJBRadioButton.setSelected(true);
break;
case ASK:
myComponent.myAskJBRadioButton.setSelected(true);
break;
}
myComponent.myProjectDirectoryTextField.setText(settings.getDefaultProjectDirectory());
}
@Override
public void disposeUIResources() {
super.disposeUIResources();
myComponent = null;
}
@Override
@NotNull
public String getHelpTopic() {
return "preferences.general";
}
private static class MyComponent {
private JPanel myPanel;
private JCheckBox myChkReopenLastProject;
private JCheckBox myChkSyncOnFrameActivation;
private JCheckBox myChkSaveOnFrameDeactivation;
private JCheckBox myChkAutoSaveIfInactive;
private JTextField myTfInactiveTimeout;
private JCheckBox myChkUseSafeWrite;
private JCheckBox myConfirmExit;
private JCheckBox myShowWelcomeScreen;
private JPanel myPluginOptionsPanel;
private JBRadioButton myOpenProjectInNewWindow;
private JBRadioButton myOpenProjectInSameWindow;
private JBRadioButton myConfirmWindowToOpenProject;
private JBRadioButton myTerminateProcessJBRadioButton;
private JBRadioButton myDisconnectJBRadioButton;
private JBRadioButton myAskJBRadioButton;
private TextFieldWithBrowseButton myProjectDirectoryTextField;
private JPanel myProjectOpeningPanel;
private JBLabel myProjectDirComment;
MyComponent() {
String conceptName = IdeUICustomization.getInstance().getProjectConceptName();
myChkReopenLastProject.setText(IdeBundle.message("checkbox.reopen.last.project.on.startup", conceptName));
((TitledBorder) myProjectOpeningPanel.getBorder()).setTitle(IdeBundle.message("border.title.project.opening",
StringUtil.capitalize(conceptName)));
myOpenProjectInNewWindow.setText(IdeBundle.message("radio.button.open.project.in.the.new.window", conceptName));
myOpenProjectInSameWindow.setText(IdeBundle.message("radio.button.open.project.in.the.same.window", conceptName));
myConfirmWindowToOpenProject.setText(IdeBundle.message("radio.button.confirm.window.to.open.project.in", conceptName));
myProjectDirComment.setComponentStyle(UIUtil.ComponentStyle.SMALL);
}
private void createUIComponents() {
myProjectDirectoryTextField = new TextFieldWithBrowseButton();
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.putUserData(PathChooserDialog.PREFER_LAST_OVER_EXPLICIT, false);
myProjectDirectoryTextField.addBrowseFolderListener(null, null, null, descriptor);
}
}
@Override
@NotNull
public String getId() {
return getHelpTopic();
}
@NotNull
@Override
protected List<SearchableConfigurable> createConfigurables() {
return ConfigurableWrapper.createConfigurables(EP_NAME);
}
}
@@ -0,0 +1,152 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide
import com.intellij.application.options.editor.CheckboxDescriptor
import com.intellij.application.options.editor.checkBox
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.fileChooser.PathChooserDialog
import com.intellij.openapi.options.BoundCompositeConfigurable
import com.intellij.openapi.options.SearchableConfigurable
import com.intellij.openapi.options.ex.ConfigurableWrapper
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.IdeUICustomization
import com.intellij.ui.layout.*
import com.intellij.util.PlatformUtils
val model = GeneralSettings.getInstance()
val myChkReopenLastProject = CheckboxDescriptor(IdeBundle.message("checkbox.reopen.last.project.on.startup", IdeUICustomization.getInstance().projectConceptName),
PropertyBinding(model::isReopenLastProject, model::setReopenLastProject))
val myConfirmExit = CheckboxDescriptor(IdeBundle.message("checkbox.confirm.application.exit"),
PropertyBinding(model::isConfirmExit, model::setConfirmExit))
val myShowWelcomeScreen = CheckboxDescriptor(IdeBundle.message("checkbox.show.welcome.screen"),
PropertyBinding(model::isShowWelcomeScreen, model::setShowWelcomeScreen))
val myChkSyncOnFrameActivation = CheckboxDescriptor(IdeBundle.message("checkbox.synchronize.files.on.frame.activation"),
PropertyBinding(model::isSyncOnFrameActivation, model::setSyncOnFrameActivation))
val myChkSaveOnFrameDeactivation = CheckboxDescriptor(IdeBundle.message("checkbox.save.files.on.frame.deactivation"),
PropertyBinding(model::isSyncOnFrameActivation, model::setSyncOnFrameActivation))
val myChkAutoSaveIfInactive = CheckboxDescriptor(IdeBundle.message("checkbox.save.files.automatically"),
PropertyBinding(model::isAutoSaveIfInactive, model::setAutoSaveIfInactive))
val myChkUseSafeWrite = CheckboxDescriptor("Use \"safe write\" (save changes to a temporary file first)",
PropertyBinding(model::isUseSafeWrite, model::setUseSafeWrite))
val allOptionDescriptors = listOf(
myChkReopenLastProject,
myConfirmExit,
myChkSyncOnFrameActivation,
myChkSaveOnFrameDeactivation,
myChkAutoSaveIfInactive,
myChkUseSafeWrite
).map { it.asOptionDescriptor() }
/**
* To provide additional options in General section register implementation of {@link SearchableConfigurable} in the plugin.xml:
* <p/>
* &lt;extensions defaultExtensionNs="com.intellij"&gt;<br>
* &nbsp;&nbsp;&lt;generalOptionsProvider instance="class-name"/&gt;<br>
* &lt;/extensions&gt;
* <p>
* A new instance of the specified class will be created each time then the Settings dialog is opened
*/
class GeneralSettingsConfigurable: BoundCompositeConfigurable<SearchableConfigurable>(
IdeBundle.message("title.general"),
"preferences.general"
), SearchableConfigurable {
private val model = GeneralSettings.getInstance()
override fun createPanel(): DialogPanel {
val projectConceptName = IdeUICustomization.getInstance().projectConceptName
return panel {
row {
titledRow("Startup/Shutdown") {
row {
checkBox(myChkReopenLastProject)
}
row {
checkBox(myConfirmExit)
}
if (PlatformUtils.isDataGrip()) {
row {
checkBox(myShowWelcomeScreen)
}
}
}
}
row {
titledRow(IdeBundle.message("border.title.project.opening", projectConceptName.capitalize())) {
row("Default directory:") {
textFieldWithBrowseButton(model::getDefaultProjectDirectory, model::setDefaultProjectDirectory,
fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor()
.also { it.putUserData(PathChooserDialog.PREFER_LAST_OVER_EXPLICIT, false) },
growPolicy = GrowPolicy.MEDIUM_TEXT)
.comment("This directory is preselected in \"Open...\" and \"New | Project...\" dialogs.", 80)
}
buttonGroup(model::getConfirmOpenNewProject, model::setConfirmOpenNewProject) {
row {
radioButton(IdeBundle.message("radio.button.open.project.in.the.new.window", projectConceptName), GeneralSettings.OPEN_PROJECT_NEW_WINDOW)
}
row {
radioButton(IdeBundle.message("radio.button.open.project.in.the.same.window", projectConceptName), GeneralSettings.OPEN_PROJECT_SAME_WINDOW)
}
row {
radioButton(IdeBundle.message("radio.button.confirm.window.to.open.project.in", projectConceptName), GeneralSettings.OPEN_PROJECT_ASK)
}
}
}
}
row {
titledRow("Synchronization") {
row {
checkBox(myChkSyncOnFrameActivation)
}
row {
checkBox(myChkSaveOnFrameDeactivation)
}
row {
cell(isFullWidth = true) {
val autoSaveCheckbox = checkBox(myChkAutoSaveIfInactive)
intTextField(model::getInactiveTimeout, model::setInactiveTimeout, columns = 4).enableIf(autoSaveCheckbox.selected)
label(IdeBundle.message("label.inactive.timeout.sec"))
}
}
row {
checkBox(myChkUseSafeWrite)
}
}
}
row {
titledRow(IdeBundle.message("group.settings.process.tab.close")) {
buttonGroup(model::getProcessCloseConfirmation, model::setProcessCloseConfirmation) {
row {
radioButton(IdeBundle.message("radio.process.close.terminate"), GeneralSettings.ProcessCloseConfirmation.TERMINATE)
}
row {
radioButton(IdeBundle.message("radio.process.close.disaconnect"), GeneralSettings.ProcessCloseConfirmation.DISCONNECT)
}
row {
radioButton(IdeBundle.message("radio.process.close.ask"), GeneralSettings.ProcessCloseConfirmation.ASK)
}
}
}
}
for (configurable in createConfigurables()) {
row {
configurable.createComponent()?.invoke()
}
}
}
}
override fun getId(): String = helpTopic!!
override fun createConfigurables(): List<SearchableConfigurable> {
return ConfigurableWrapper.createConfigurables(EP_NAME)
}
companion object {
private val EP_NAME = ExtensionPointName.create<GeneralSettingsConfigurableEP>("com.intellij.generalOptionsProvider")
}
}
@@ -1,294 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ide.GeneralSettingsConfigurable.MyComponent">
<grid id="9d13a" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" 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>
<xy x="32" y="45" width="636" height="742"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="4bc17">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="5dbad" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="etched" title="Startup/Shutdown"/>
<children>
<component id="81bcc" class="javax.swing.JCheckBox" binding="myChkReopenLastProject">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text resource-bundle="messages/IdeBundle" key="checkbox.reopen.last.project.on.startup"/>
</properties>
</component>
<vspacer id="bf212">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="e487d" class="javax.swing.JCheckBox" binding="myConfirmExit">
<constraints>
<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"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="checkbox.confirm.application.exit"/>
</properties>
</component>
<component id="8db4c" class="javax.swing.JCheckBox" binding="myShowWelcomeScreen">
<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"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="checkbox.show.welcome.screen"/>
</properties>
</component>
</children>
</grid>
<grid id="ca628" layout-manager="GridLayoutManager" row-count="5" 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="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="etched" title="Synchronization"/>
<children>
<component id="86192" class="javax.swing.JCheckBox" binding="myChkSyncOnFrameActivation">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text resource-bundle="messages/IdeBundle" key="checkbox.synchronize.files.on.frame.activation"/>
</properties>
</component>
<hspacer id="b5249">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<vspacer id="da5bb">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="e5195" class="javax.swing.JCheckBox" binding="myChkSaveOnFrameDeactivation">
<constraints>
<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"/>
</constraints>
<properties>
<selected value="true"/>
<text resource-bundle="messages/IdeBundle" key="checkbox.save.files.on.frame.deactivation"/>
</properties>
</component>
<component id="204fc" class="javax.swing.JCheckBox" binding="myChkAutoSaveIfInactive">
<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"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="checkbox.save.files.automatically"/>
</properties>
</component>
<grid id="6e62" layout-manager="GridLayoutManager" row-count="1" 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="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="0" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="298ce" class="javax.swing.JLabel">
<constraints>
<grid row="0" 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/IdeBundle" key="label.inactive.timeout.sec"/>
</properties>
</component>
<component id="db590" class="javax.swing.JTextField" binding="myTfInactiveTimeout">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="50" height="-1"/>
<preferred-size width="50" height="-1"/>
<maximum-size width="50" height="-1"/>
</grid>
</constraints>
<properties>
<columns value="10"/>
<margin top="1" left="5" bottom="1" right="5"/>
</properties>
</component>
</children>
</grid>
<component id="6f8cf" class="javax.swing.JCheckBox" binding="myChkUseSafeWrite">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Use &quot;safe write&quot; (save changes to a temporary file first)"/>
<toolTipText value="&lt;html&gt;If this check box is selected, a changed file will be first saved to a temporary file;&lt;br&gt;if the save operation is completed successfully, the original file is deleted, and the temporary file is renamed.&lt;/html&gt; "/>
</properties>
</component>
</children>
</grid>
<hspacer id="e616c">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="857f8" binding="myPluginOptionsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
<grid id="dab62" binding="myProjectOpeningPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" 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="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/IdeBundle" title-key="border.title.project.opening"/>
<children>
<component id="45c11" class="com.intellij.ui.components.JBRadioButton" binding="myOpenProjectInSameWindow">
<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/IdeBundle" key="radio.button.open.project.in.the.same.window"/>
</properties>
</component>
<component id="a31cc" class="com.intellij.ui.components.JBRadioButton" binding="myConfirmWindowToOpenProject">
<constraints>
<grid row="3" 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/IdeBundle" key="radio.button.confirm.window.to.open.project.in"/>
</properties>
</component>
<vspacer id="bacc9">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="f4e03" class="com.intellij.ui.components.JBRadioButton" binding="myOpenProjectInNewWindow">
<constraints>
<grid row="1" 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/IdeBundle" key="radio.button.open.project.in.the.new.window"/>
</properties>
</component>
<grid id="ee74a" 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="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="87581" class="javax.swing.JLabel">
<constraints>
<grid row="0" 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 value="Default directory:"/>
</properties>
</component>
<component id="12470" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myProjectDirectoryTextField" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="6b133" class="com.intellij.ui.components.JBLabel" binding="myProjectDirComment">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<anchor value="cb2c8"/>
<background color="-8882056"/>
<foreground color="-8882056"/>
<text value="This directory is preselected in &quot;Open...&quot; and &quot;New | Project...&quot; dialogs."/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="ef6e1" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/IdeBundle" title-key="group.settings.process.tab.close"/>
<children>
<component id="a998a" class="com.intellij.ui.components.JBRadioButton" binding="myTerminateProcessJBRadioButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="radio.process.close.terminate"/>
</properties>
</component>
<component id="9903d" class="com.intellij.ui.components.JBRadioButton" binding="myDisconnectJBRadioButton">
<constraints>
<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"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="radio.process.close.disaconnect"/>
</properties>
</component>
<component id="9c112" class="com.intellij.ui.components.JBRadioButton" binding="myAskJBRadioButton" default-binding="true">
<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"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="radio.process.close.ask"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<buttonGroups>
<group name="newButtonGroup">
<member id="eada9"/>
<member id="3a5a5"/>
</group>
<group name="myNewProjectWindowGroup">
<member id="f4e03"/>
<member id="45c11"/>
<member id="a31cc"/>
</group>
<group name="myProjectCloseGroup">
<member id="a998a"/>
<member id="9903d"/>
<member id="9c112"/>
</group>
</buttonGroups>
</form>
@@ -2,10 +2,10 @@
package com.intellij.ide.ui;
import com.intellij.ide.GeneralSettings;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.GeneralSettingsConfigurableKt;
import com.intellij.ide.ui.search.BooleanOptionDescription;
import com.intellij.ide.ui.search.OptionDescription;
import com.intellij.ui.IdeUICustomization;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
@@ -18,18 +18,18 @@ import static com.intellij.ide.ui.OptionsTopHitProvider.messageIde;
* @author Sergey.Malenkov
*/
final class SystemOptionsTopHitProvider implements OptionsTopHitProvider.ApplicationLevelProvider {
private static final Collection<OptionDescription> ourOptions = Collections.unmodifiableCollection(Arrays.asList(
option(messageIde("checkbox.show.tips.on.startup"), "showTipsOnStartup", "setShowTipsOnStartup"),
option(IdeBundle.message("checkbox.reopen.last.project.on.startup", IdeUICustomization.getInstance().getProjectConceptName()), "isReopenLastProject", "setReopenLastProject"),
option(messageIde("checkbox.support.screen.readers"), "isSupportScreenReaders", "setSupportScreenReaders"),
option(messageIde("checkbox.confirm.application.exit"), "isConfirmExit", "setConfirmExit"),
option(messageIde("checkbox.synchronize.files.on.frame.activation"), "isSyncOnFrameActivation", "setSyncOnFrameActivation"),
option(messageIde("checkbox.save.files.on.frame.deactivation"), "isSaveOnFrameDeactivation", "setSaveOnFrameDeactivation"),
option(messageIde("checkbox.save.files.automatically"), "isAutoSaveIfInactive", "setAutoSaveIfInactive"),
option("Use \"safe write\" (save changes to a temporary file first)", "isUseSafeWrite", "setUseSafeWrite"),
private static final Collection<OptionDescription> ourOptions = Collections.unmodifiableCollection(
ContainerUtil.concat(
GeneralSettingsConfigurableKt.getAllOptionDescriptors(),
Arrays.asList(
option(messageIde("checkbox.show.tips.on.startup"), "showTipsOnStartup", "setShowTipsOnStartup"),
option(messageIde("checkbox.support.screen.readers"), "isSupportScreenReaders", "setSupportScreenReaders"),
option("Start search in background", "isSearchInBackground", "setSearchInBackground")
)
));
//option("Use default browser", "isUseDefaultBrowser", "setUseDefaultBrowser"),
//option("Show confirmation before extracting files", "isConfirmExtractFiles", "setConfirmExtractFiles"),
option("Start search in background", "isSearchInBackground", "setSearchInBackground")));
@NotNull
@Override