reformat code confirmation

This commit is contained in:
Dmitry Avdeev
2010-01-21 14:40:58 +03:00
parent 40b3555733
commit a5575d520f
13 changed files with 358 additions and 208 deletions
@@ -22,10 +22,14 @@ import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.util.IconLoader;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
public class EditorOptions implements SearchableConfigurable.Parent {
@NonNls public static final String ID = "preferences.editor";
private EditorOptionsPanel myEditorOptionsPanel;
public Configurable[] getConfigurables() {
@@ -41,11 +45,11 @@ public class EditorOptions implements SearchableConfigurable.Parent {
}
public String getHelpTopic() {
return "preferences.editor";
return ID;
}
public String getId() {
return getHelpTopic();
return ID;
}
public Runnable enableSearch(final String option) {
@@ -2,7 +2,7 @@
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.editor.EditorOptionsPanel">
<tabbedpane id="97a1e">
<constraints>
<xy x="22" y="49" width="773" height="686"/>
<xy x="22" y="49" width="622" height="455"/>
</constraints>
<properties/>
<border type="none"/>
@@ -15,10 +15,135 @@
<properties/>
<border type="none"/>
<children>
<vspacer id="b6665">
<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">
<preferred-size width="334" height="14"/>
</grid>
</constraints>
</vspacer>
<grid id="8dc1a" 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="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="334" height="106"/>
</grid>
</constraints>
<properties/>
<border type="none" title-resource-bundle="messages/ApplicationBundle" title-key="group.advanced.mouse.usages"/>
<children>
<component id="18220" class="javax.swing.JCheckBox" binding="myCbHonorCamelHumpsWhenSelectingByClicking">
<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">
<preferred-size width="328" height="22"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.honor.camelhumps.words.settings.on.double.click"/>
</properties>
</component>
<component id="34803" class="javax.swing.JCheckBox" binding="myCbEnableDnD">
<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">
<preferred-size width="328" height="22"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.enable.drag.n.drop.functionality.in.editor"/>
</properties>
</component>
<component id="d0105" class="javax.swing.JCheckBox" binding="myCbEnableWheelFontChange">
<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">
<preferred-size width="328" height="22"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.enable.ctrl.mousewheel.changes.font.size"/>
</properties>
</component>
</children>
</grid>
<grid id="5342a" 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="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="1" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="240" height="45"/>
</grid>
</constraints>
<properties/>
<border type="none" title-resource-bundle="messages/ApplicationBundle" title-key="group.virtual.space"/>
<children>
<component id="400d4" class="javax.swing.JCheckBox" binding="myCbVirtualPageAtBottom">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.show.virtual.space.at.file.bottom"/>
</properties>
</component>
<component id="f762" class="javax.swing.JCheckBox" binding="myCbCaretInsideTabs">
<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/ApplicationBundle" key="checkbox.allow.placement.of.caret.inside.tabs"/>
</properties>
</component>
<component id="bb18b" class="javax.swing.JCheckBox" binding="myCbVirtualSpace">
<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/ApplicationBundle" key="checkbox.allow.placement.of.caret.after.end.of.line"/>
</properties>
</component>
</children>
</grid>
<grid id="dcf48" 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="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="334" height="106"/>
</grid>
</constraints>
<properties/>
<border type="none" title="Scrolling"/>
<children>
<component id="a193a" class="javax.swing.JRadioButton" binding="myRbPreferScrolling">
<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 value="Prefer scrolling editor canvas to keep caret line centered"/>
</properties>
</component>
<component id="ef76d" class="javax.swing.JRadioButton" binding="myRbPreferMovingCaret">
<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="Prefer moving caret line to minimize editor scrolling"/>
</properties>
</component>
<component id="a62e2" class="javax.swing.JCheckBox" binding="myCbSmoothScrolling">
<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/ApplicationBundle" key="checkbox.smooth.scrolling"/>
</properties>
</component>
</children>
</grid>
<grid id="54c3d" 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="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="215" height="26"/>
</grid>
</constraints>
<properties/>
<border type="none" title-resource-bundle="messages/ApplicationBundle" title-key="group.brace.highlighting"/>
@@ -49,123 +174,29 @@
</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="7f3f5" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="10" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none" title-resource-bundle="messages/ApplicationBundle" title-key="group.limits"/>
<children>
<component id="498f1" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="0" anchor="9" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="editbox.maximum.number.of.contents.to.keep.in.clipboard"/>
</properties>
</component>
<component id="25b75" class="javax.swing.JTextField" binding="myClipboardContentLimitTextField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="9" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="35" height="-1"/>
</grid>
</constraints>
<properties>
<text value="5"/>
</properties>
</component>
<component id="48bb5" class="javax.swing.JLabel">
<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/ApplicationBundle" key="editbox.recent.files.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="2" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="35" height="-1"/>
</grid>
</constraints>
<properties>
<text value="10"/>
</properties>
</component>
</children>
</grid>
<grid id="99111" binding="myHighlightSettingsPanel" layout-manager="GridLayoutManager" row-count="1" 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="2" column="1" row-span="2" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
<grid id="dcf48" 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="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none" title="Scrolling"/>
<children>
<component id="a193a" class="javax.swing.JRadioButton" binding="myRbPreferScrolling">
<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 value="Prefer scrolling editor canvas to keep caret line centered"/>
</properties>
</component>
<component id="ef76d" class="javax.swing.JRadioButton" binding="myRbPreferMovingCaret">
<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="Prefer moving caret line to minimize editor scrolling"/>
</properties>
</component>
<component id="a62e2" class="javax.swing.JCheckBox" binding="myCbSmoothScrolling">
<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/ApplicationBundle" key="checkbox.smooth.scrolling"/>
</properties>
</component>
<vspacer id="d2acc">
<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>
</children>
</grid>
<vspacer id="b6665">
<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>
<grid id="7f3f5" 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="15" bottom="0" right="0"/>
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" 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="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="334" height="80"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="87620" class="javax.swing.JComboBox" binding="myStripTrailingSpacesCombo">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="42" height="22"/>
</grid>
</constraints>
<properties/>
</component>
<component id="95b8f" 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"/>
<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">
<preferred-size width="248" height="14"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="combobox.strip.trailing.spaces.on.save"/>
@@ -173,7 +204,9 @@
</component>
<component id="c0a29" class="javax.swing.JCheckBox" binding="myCbRenameLocalVariablesInplace">
<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="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">
<preferred-size width="248" height="22"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.rename.local.variables.inplace"/>
@@ -187,77 +220,102 @@
<text value="Ensure &amp;blank line before end of file on Save"/>
</properties>
</component>
<vspacer id="98ff8">
<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">
<preferred-size width="248" height="14"/>
</grid>
</constraints>
</vspacer>
</children>
</grid>
<grid id="8dc1a" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="358be" layout-manager="GridLayoutManager" row-count="2" 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="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" column="1" 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" title-resource-bundle="messages/ApplicationBundle" title-key="group.advanced.mouse.usages"/>
<border type="none" title="Formatting"/>
<children>
<component id="18220" class="javax.swing.JCheckBox" binding="myCbHonorCamelHumpsWhenSelectingByClicking">
<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/ApplicationBundle" key="checkbox.honor.camelhumps.words.settings.on.double.click"/>
</properties>
</component>
<component id="34803" class="javax.swing.JCheckBox" binding="myCbEnableDnD">
<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/ApplicationBundle" key="checkbox.enable.drag.n.drop.functionality.in.editor"/>
</properties>
</component>
<component id="d0105" class="javax.swing.JCheckBox" binding="myCbEnableWheelFontChange">
<component id="d393f" class="javax.swing.JCheckBox" binding="myShowOptimizeImportsDialogCheckBox" default-binding="true">
<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/ApplicationBundle" key="checkbox.enable.ctrl.mousewheel.changes.font.size"/>
<text value="Show &quot;Optimize Imports&quot; dialog"/>
</properties>
</component>
</children>
</grid>
<grid id="5342a" 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="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="1" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none" title-resource-bundle="messages/ApplicationBundle" title-key="group.virtual.space"/>
<children>
<component id="400d4" class="javax.swing.JCheckBox" binding="myCbVirtualPageAtBottom">
<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/ApplicationBundle" key="checkbox.show.virtual.space.at.file.bottom"/>
</properties>
</component>
<component id="f762" class="javax.swing.JCheckBox" binding="myCbCaretInsideTabs">
<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/ApplicationBundle" key="checkbox.allow.placement.of.caret.inside.tabs"/>
</properties>
</component>
<component id="bb18b" class="javax.swing.JCheckBox" binding="myCbVirtualSpace">
<component id="5263" class="javax.swing.JCheckBox" binding="myShowReformatCodeDialogCheckBox" 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>
<selected value="true"/>
<text resource-bundle="messages/ApplicationBundle" key="checkbox.allow.placement.of.caret.after.end.of.line"/>
<text value="Show &quot;Reformat Code&quot; dialog "/>
</properties>
</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">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="334" height="75"/>
</grid>
</constraints>
<properties/>
<border type="none" title-resource-bundle="messages/ApplicationBundle" title-key="group.limits"/>
<children>
<component id="498f1" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="0" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="247" height="14"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="editbox.maximum.number.of.contents.to.keep.in.clipboard"/>
</properties>
</component>
<component id="25b75" class="javax.swing.JTextField" binding="myClipboardContentLimitTextField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="9" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="35" height="-1"/>
</grid>
</constraints>
<properties>
<text value="5"/>
</properties>
</component>
<component id="48bb5" class="javax.swing.JLabel">
<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">
<preferred-size width="247" height="14"/>
</grid>
</constraints>
<properties>
<text resource-bundle="messages/ApplicationBundle" key="editbox.recent.files.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="6" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="35" height="-1"/>
</grid>
</constraints>
<properties>
<text value="10"/>
</properties>
</component>
</children>
</grid>
<grid id="1ecbd" binding="myHighlightSettingsPanel" layout-manager="GridLayoutManager" row-count="1" 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="3" column="1" 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>
</children>
</grid>
</children>
@@ -70,6 +70,8 @@ public class EditorOptionsPanel {
private JCheckBox myCbRenameLocalVariablesInplace;
private JCheckBox myCbHighlightIdentifierUnderCaret;
private JCheckBox myCbEnsureBlankLineBeforeCheckBox;
private JCheckBox myShowReformatCodeDialogCheckBox;
private JCheckBox myShowOptimizeImportsDialogCheckBox;
private final ErrorHighlightingPanel myErrorHighlightingPanel = new ErrorHighlightingPanel();
private final MyConfigurable myConfigurable;
@@ -148,6 +150,9 @@ public class EditorOptionsPanel {
myCbRenameLocalVariablesInplace.setSelected(editorSettings.isVariableInplaceRenameEnabled());
myShowReformatCodeDialogCheckBox.setSelected(editorSettings.getOptions().SHOW_REFORMAT_DIALOG);
myShowOptimizeImportsDialogCheckBox.setSelected(editorSettings.getOptions().SHOW_OPIMIZE_IMPORTS_DIALOG);
myErrorHighlightingPanel.reset();
}
@@ -211,6 +216,9 @@ public class EditorOptionsPanel {
editorSettings.setVariableInplaceRenameEnabled(myCbRenameLocalVariablesInplace.isSelected());
editorSettings.getOptions().SHOW_REFORMAT_DIALOG = myShowReformatCodeDialogCheckBox.isSelected();
editorSettings.getOptions().SHOW_OPIMIZE_IMPORTS_DIALOG = myShowOptimizeImportsDialogCheckBox.isSelected();
reinitAllEditors();
String temp=myRecentFilesLimitField.getText();
@@ -305,7 +313,10 @@ public class EditorOptionsPanel {
isModified |= isModified(myRecentFilesLimitField, UISettings.getInstance().RECENT_FILES_LIMIT);
isModified |= isModified(myCbRenameLocalVariablesInplace, editorSettings.isVariableInplaceRenameEnabled());
isModified |= isModified(myShowReformatCodeDialogCheckBox, editorSettings.getOptions().SHOW_REFORMAT_DIALOG);
isModified |= isModified(myShowOptimizeImportsDialogCheckBox, editorSettings.getOptions().SHOW_OPIMIZE_IMPORTS_DIALOG);
isModified |= myErrorHighlightingPanel.isModified();
return isModified;
}
@@ -16,6 +16,7 @@
package com.intellij.codeInsight.actions;
import com.intellij.CommonBundle;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.lang.LanguageImportStatements;
@@ -24,11 +25,14 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
import com.intellij.util.ui.OptionsDialog;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@@ -42,6 +46,8 @@ public class LayoutCodeDialog extends DialogWrapper {
private JRadioButton myRbDirectory;
private JCheckBox myCbIncludeSubdirs;
private JCheckBox myCbOptimizeImports;
private JCheckBox myDoNotAskMeCheckBox;
public static final @NonNls String OPTIMIZE_IMPORTS_KEY = "LayoutCode.optimizeImports";
private final String myHelpId;
@@ -105,9 +111,12 @@ public class LayoutCodeDialog extends DialogWrapper {
myCbIncludeSubdirs.setEnabled(myRbDirectory.isSelected());
myCbOptimizeImports.setEnabled(
!myRbSelectedText.isSelected() && !(myFile != null && LanguageImportStatements.INSTANCE.forFile(myFile) == null && myRbFile.isSelected()));
myDoNotAskMeCheckBox.setEnabled(!myRbDirectory.isSelected());
myRbDirectory.setEnabled(!myDoNotAskMeCheckBox.isSelected());
}
protected JComponent createNorthPanel() {
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(BorderFactory.createEmptyBorder(4, 8, 8, 0));
GridBagConstraints gbConstraints = new GridBagConstraints();
@@ -165,19 +174,16 @@ public class LayoutCodeDialog extends DialogWrapper {
return panel;
}
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbConstraints = new GridBagConstraints();
gbConstraints.gridy = 0;
gbConstraints.gridx = 0;
gbConstraints.gridwidth = 1;
gbConstraints.gridheight = 1;
gbConstraints.weightx = 1;
gbConstraints.insets = new Insets(0, 4, 0, 0);
gbConstraints.fill = GridBagConstraints.BOTH;
return panel;
@Override
protected JComponent createSouthPanel() {
JComponent southPanel = super.createSouthPanel();
myDoNotAskMeCheckBox = new JCheckBox(CommonBundle.message("dialog.options.do.not.show"));
myDoNotAskMeCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
updateState();
}
});
return OptionsDialog.addDoNotShowCheckBox(southPanel, myDoNotAskMeCheckBox);
}
protected Action[] createActions() {
@@ -204,6 +210,10 @@ public class LayoutCodeDialog extends DialogWrapper {
return myCbOptimizeImports.isSelected();
}
boolean isDoNotAskMe() {
return myDoNotAskMeCheckBox.isSelected();
}
protected void doOKAction() {
super.doOKAction();
setOptimizeImportsOption(isOptimizeImports());
@@ -21,6 +21,7 @@ import com.intellij.lang.LanguageImportStatements;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
@@ -104,10 +105,16 @@ public class OptimizeImportsAction extends AnAction {
if (ApplicationManager.getApplication().isUnitTestMode()) {
includeSubdirectories = processDirectory = false;
} else {
}
else if (!EditorSettingsExternalizable.getInstance().getOptions().SHOW_OPIMIZE_IMPORTS_DIALOG) {
includeSubdirectories = processDirectory = false;
}
else {
final LayoutCodeDialog dialog = new LayoutCodeDialog(project, CodeInsightBundle.message("process.optimize.imports"), file, dir, null, HELP_ID);
dialog.show();
if (!dialog.isOK()) return;
EditorSettingsExternalizable.getInstance().getOptions().SHOW_OPIMIZE_IMPORTS_DIALOG = !dialog.isDoNotAskMe();
ReformatCodeAction.updateShowDialogSetting(dialog, "\"Optimize Imports\" dialog disabled");
processDirectory = dialog.isProcessDirectory();
includeSubdirectories = dialog.isIncludeSubdirectories();
}
@@ -16,21 +16,33 @@
package com.intellij.codeInsight.actions;
import com.intellij.application.options.editor.EditorOptions;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.formatting.FormattingModelBuilder;
import com.intellij.lang.LanguageFormatting;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.psi.*;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import java.util.ArrayList;
public class ReformatCodeAction extends AnAction implements DumbAware {
@@ -125,35 +137,55 @@ public class ReformatCodeAction extends AnAction implements DumbAware {
}
}
final LayoutCodeDialog dialog = new LayoutCodeDialog(project, CodeInsightBundle.message("process.reformat.code"), file, dir,
hasSelection ? Boolean.TRUE : Boolean.FALSE, HELP_ID);
dialog.show();
if (!dialog.isOK()) return;
boolean optimizeImports = ReformatFilesDialog.isOptmizeImportsOptionOn();
if (EditorSettingsExternalizable.getInstance().getOptions().SHOW_REFORMAT_DIALOG) {
final LayoutCodeDialog dialog = new LayoutCodeDialog(project, CodeInsightBundle.message("process.reformat.code"), file, dir,
hasSelection ? Boolean.TRUE : Boolean.FALSE, HELP_ID);
dialog.show();
if (!dialog.isOK()) return;
EditorSettingsExternalizable.getInstance().getOptions().SHOW_REFORMAT_DIALOG = !dialog.isDoNotAskMe();
updateShowDialogSetting(dialog, "\"Reformat Code\" dialog disabled");
optimizeImports = dialog.isOptimizeImports();
if (dialog.isProcessDirectory()){
if (optimizeImports) {
new ReformatAndOptimizeImportsProcessor(project, dir, dialog.isIncludeSubdirectories()).run();
}
else {
new ReformatCodeProcessor(project, dir, dialog.isIncludeSubdirectories()).run();
}
}
return;
}
final boolean optimizeImports = dialog.isOptimizeImports();
if (dialog.isProcessDirectory()){
if (optimizeImports) {
new ReformatAndOptimizeImportsProcessor(project, dir, dialog.isIncludeSubdirectories()).run();
}
else {
new ReformatCodeProcessor(project, dir, dialog.isIncludeSubdirectories()).run();
}
final TextRange range;
if (editor != null && editor.getSelectionModel().hasSelection()){
range = new TextRange(editor.getSelectionModel().getSelectionStart(), editor.getSelectionModel().getSelectionEnd());
}
else{
final TextRange range;
if (editor != null && dialog.isProcessSelectedText()){
range = new TextRange(editor.getSelectionModel().getSelectionStart(), editor.getSelectionModel().getSelectionEnd());
}
else{
range = null;
}
range = null;
}
if (optimizeImports && range == null) {
new ReformatAndOptimizeImportsProcessor(project, file).run();
}
else {
new ReformatCodeProcessor(project, file, range).run();
}
if (optimizeImports && range == null) {
new ReformatAndOptimizeImportsProcessor(project, file).run();
}
else {
new ReformatCodeProcessor(project, file, range).run();
}
}
public static void updateShowDialogSetting(LayoutCodeDialog dialog, String title) {
if (dialog.isDoNotAskMe()) {
Notifications.Bus.notify(new Notification("settings", title,
"<html>You can re-enable the dialog on the <a href=''>IDE Settings -> Editor</a> pane</html>",
NotificationType.INFORMATION, new NotificationListener() {
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
EditorOptions editorOptions = ShowSettingsUtil.getInstance().findApplicationConfigurable(EditorOptions.class);
IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
ShowSettingsUtil.getInstance().editConfigurable((JFrame)ideFrame, editorOptions);
}
}
}));
}
}
@@ -47,7 +47,7 @@ public class ReformatFilesDialog extends DialogWrapper {
super.doOKAction();
}
private boolean isOptmizeImportsOptionOn() {
static boolean isOptmizeImportsOptionOn() {
return Boolean.valueOf(PropertiesComponent.getInstance().getValue(LayoutCodeDialog.OPTIMIZE_IMPORTS_KEY));
}
@@ -20,6 +20,9 @@ import org.jetbrains.annotations.NotNull;
import java.awt.*;
import java.awt.event.ActionListener;
/**
* @see JBPopupFactory#createBalloonBuilder(javax.swing.JComponent)
*/
public interface BalloonBuilder {
@NotNull
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Condition;
import com.intellij.ui.awt.RelativePoint;
import org.jetbrains.annotations.NotNull;
@@ -229,7 +230,9 @@ public abstract class JBPopupFactory {
public abstract BalloonBuilder createBalloonBuilder(@NotNull JComponent content);
public abstract BalloonBuilder createHtmlTextBalloonBuilder(@NotNull String htmlContent, @Nullable Icon icon, final Color fillColor, @Nullable HyperlinkListener listener);
public abstract BalloonBuilder createHtmlTextBalloonBuilder(@NotNull String htmlContent, @Nullable Icon icon, Color fillColor, @Nullable HyperlinkListener listener);
public abstract BalloonBuilder createHtmlTextBalloonBuilder(@NotNull String htmlContent, MessageType messageType, @Nullable HyperlinkListener listener);
public abstract JBPopup createMessage(String text);
@@ -66,14 +66,21 @@ public abstract class OptionsDialog extends DialogWrapper {
return southPanel;
}
final JPanel panel = new JPanel(new GridBagLayout());
panel.add(myCheckBoxDoNotShowDialog, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
panel.add(southPanel, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
myCheckBoxDoNotShowDialog.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
final JPanel panel = addDoNotShowCheckBox(southPanel, myCheckBoxDoNotShowDialog);
myCheckBoxDoNotShowDialog.setSelected(!isToBeShown());
return panel;
}
public static JPanel addDoNotShowCheckBox(JComponent southPanel, JCheckBox checkBox) {
final JPanel panel = new JPanel(new GridBagLayout());
checkBox.setVerticalAlignment(SwingConstants.BOTTOM);
panel.add(checkBox, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 0, 0, 0), 0, 0));
panel.add(southPanel, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
checkBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
return panel;
}
public static boolean shiftIsPressed(int inputEventModifiers) {
return (inputEventModifiers & Event.SHIFT_MASK) != 0;
}
@@ -38,7 +38,7 @@ import java.nio.charset.Charset;
public class EditorSettingsExternalizable implements NamedJDOMExternalizable, ExportableApplicationComponent, Cloneable {
//Q: make it interface?
private static class OptionSet implements Cloneable {
public static class OptionSet implements Cloneable {
public String LINE_SEPARATOR;
public boolean IS_VIRTUAL_SPACE = true;
public boolean IS_CARET_INSIDE_TABS;
@@ -69,6 +69,9 @@ public class EditorSettingsExternalizable implements NamedJDOMExternalizable, Ex
public boolean RENAME_VARIABLES_INPLACE = true;
public boolean REFRAIN_FROM_SCROLLING = false;
public boolean SHOW_REFORMAT_DIALOG = true;
public boolean SHOW_OPIMIZE_IMPORTS_DIALOG = true;
public Object clone() {
try {
return super.clone();
@@ -131,6 +134,10 @@ public class EditorSettingsExternalizable implements NamedJDOMExternalizable, Ex
return "editor";
}
public OptionSet getOptions() {
return myOptions;
}
public boolean isRightMarginShown() {
return myOptions.IS_RIGHT_MARGIN_SHOWN;
}
@@ -27,6 +27,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.VisualPosition;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.popup.*;
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
import com.intellij.openapi.util.Condition;
@@ -725,4 +726,11 @@ public class PopupFactoryImpl extends JBPopupFactory {
return builder;
}
@Override
public BalloonBuilder createHtmlTextBalloonBuilder(@NotNull String htmlContent,
MessageType messageType,
@Nullable HyperlinkListener listener) {
return createHtmlTextBalloonBuilder(htmlContent, messageType.getDefaultIcon(), messageType.getPopupBackground(), listener);
}
}
@@ -307,7 +307,7 @@ group.advanced.mouse.usages=Advanced mouse usages
checkbox.enable.ctrl.mousewheel.changes.font.size=<html>Enable Ctrl+MouseWheel changes font size</html>
checkbox.enable.ctrl.mousewheel.changes.font.size.macos=<html>Enable Command+MouseWheel changes font size</html>
checkbox.enable.drag.n.drop.functionality.in.editor=<html>Enable Drag'n'Drop functionality in editor</html>
checkbox.honor.camelhumps.words.settings.on.double.click=<html><body>Honor "CamelHumps" words settings<br> when selecting on double click</body></html>
checkbox.honor.camelhumps.words.settings.on.double.click=Honor "CamelHumps" words settings when selecting on double click
group.smart.keys=Smart Keys
checkbox.use.camelhumps.words=Use "CamelHumps" words
checkbox.insert.pair.quote=Insert pair quote