mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
choose opening mode right from settings
This commit is contained in:
@@ -17,6 +17,7 @@ package com.intellij.ide;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.options.*;
|
||||
import com.intellij.ui.components.JBRadioButton;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -52,12 +53,8 @@ public class GeneralSettingsConfigurable extends CompositeConfigurable<Searchabl
|
||||
settings.setSyncOnFrameActivation(myComponent.myChkSyncOnFrameActivation.isSelected());
|
||||
settings.setSaveOnFrameDeactivation(myComponent.myChkSaveOnFrameDeactivation.isSelected());
|
||||
settings.setConfirmExit(myComponent.myConfirmExit.isSelected());
|
||||
if (myComponent.myConfirmFrameToOpenCheckBox.isSelected()) {
|
||||
settings.setConfirmOpenNewProject(GeneralSettings.OPEN_PROJECT_ASK);
|
||||
}
|
||||
else if (settings.getConfirmOpenNewProject() == GeneralSettings.OPEN_PROJECT_ASK) {
|
||||
settings.setConfirmOpenNewProject(GeneralSettings.OPEN_PROJECT_NEW_WINDOW);
|
||||
}
|
||||
settings.setConfirmOpenNewProject(getConfirmOpenNewProject());
|
||||
|
||||
settings.setAutoSaveIfInactive(myComponent.myChkAutoSaveIfInactive.isSelected());
|
||||
try {
|
||||
int newInactiveTimeout = Integer.parseInt(myComponent.myTfInactiveTimeout.getText());
|
||||
@@ -69,6 +66,18 @@ public class GeneralSettingsConfigurable extends CompositeConfigurable<Searchabl
|
||||
settings.setUseSafeWrite(myComponent.myChkUseSafeWrite.isSelected());
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
if (super.isModified()) return true;
|
||||
boolean isModified = false;
|
||||
@@ -78,11 +87,7 @@ public class GeneralSettingsConfigurable extends CompositeConfigurable<Searchabl
|
||||
isModified |= settings.isSaveOnFrameDeactivation() != myComponent.myChkSaveOnFrameDeactivation.isSelected();
|
||||
isModified |= settings.isAutoSaveIfInactive() != myComponent.myChkAutoSaveIfInactive.isSelected();
|
||||
isModified |= settings.isConfirmExit() != myComponent.myConfirmExit.isSelected();
|
||||
|
||||
int openProjectOption = settings.getConfirmOpenNewProject();
|
||||
|
||||
boolean savedOptionIsAsk = openProjectOption == GeneralSettings.OPEN_PROJECT_ASK;
|
||||
isModified |= myComponent.myConfirmFrameToOpenCheckBox.isSelected() != savedOptionIsAsk;
|
||||
isModified |= settings.getConfirmOpenNewProject() != getConfirmOpenNewProject();
|
||||
|
||||
int inactiveTimeout = -1;
|
||||
try {
|
||||
@@ -133,7 +138,17 @@ public class GeneralSettingsConfigurable extends CompositeConfigurable<Searchabl
|
||||
myComponent.myTfInactiveTimeout.setEditable(settings.isAutoSaveIfInactive());
|
||||
myComponent.myChkUseSafeWrite.setSelected(settings.isUseSafeWrite());
|
||||
myComponent.myConfirmExit.setSelected(settings.isConfirmExit());
|
||||
myComponent.myConfirmFrameToOpenCheckBox.setSelected(settings.getConfirmOpenNewProject() == GeneralSettings.OPEN_PROJECT_ASK);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public void disposeUIResources() {
|
||||
@@ -156,7 +171,9 @@ public class GeneralSettingsConfigurable extends CompositeConfigurable<Searchabl
|
||||
private JCheckBox myChkUseSafeWrite;
|
||||
private JCheckBox myConfirmExit;
|
||||
private JPanel myPluginOptionsPanel;
|
||||
private JCheckBox myConfirmFrameToOpenCheckBox;
|
||||
private JBRadioButton myOpenProjectInNewWindow;
|
||||
private JBRadioButton myOpenProjectInSameWindow;
|
||||
private JBRadioButton myConfirmWindowToOpenProject;
|
||||
|
||||
public MyComponent() { }
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?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="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="9d13a" binding="myPanel" 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>
|
||||
<xy x="43" y="136" width="637" height="645"/>
|
||||
<xy x="32" y="45" width="637" height="645"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="4bc17">
|
||||
<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"/>
|
||||
<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>
|
||||
<grid id="5dbad" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="5dbad" 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="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"/>
|
||||
@@ -35,7 +35,7 @@
|
||||
</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"/>
|
||||
<grid row="2" 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">
|
||||
@@ -46,20 +46,12 @@
|
||||
<text resource-bundle="messages/IdeBundle" key="checkbox.confirm.application.exit"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="52b12" class="javax.swing.JCheckBox" binding="myConfirmFrameToOpenCheckBox" 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 value="Confirm window to open project in"/>
|
||||
</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="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"/>
|
||||
<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>
|
||||
@@ -148,17 +140,59 @@
|
||||
</grid>
|
||||
<hspacer id="e616c">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" 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="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"/>
|
||||
<grid row="3" 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" 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="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="Project Opening"/>
|
||||
<children>
|
||||
<component id="45c11" class="com.intellij.ui.components.JBRadioButton" binding="myOpenProjectInSameWindow">
|
||||
<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 value="Open project in the same window"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a31cc" class="com.intellij.ui.components.JBRadioButton" binding="myConfirmWindowToOpenProject">
|
||||
<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 value="Confirm window to open project in"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="bacc9">
|
||||
<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="f4e03" class="com.intellij.ui.components.JBRadioButton" binding="myOpenProjectInNewWindow">
|
||||
<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="Open project in new window"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<buttonGroups>
|
||||
@@ -166,5 +200,10 @@
|
||||
<member id="eada9"/>
|
||||
<member id="3a5a5"/>
|
||||
</group>
|
||||
<group name="myNewProjectWindowGroup">
|
||||
<member id="f4e03"/>
|
||||
<member id="45c11"/>
|
||||
<member id="a31cc"/>
|
||||
</group>
|
||||
</buttonGroups>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user