The updated version of the applicationConfigurable sample plugin.
authorAlexey <Alexey.Chursin@jetbrains.com>
Thu, 26 Aug 2010 08:36:43 +0000 (12:36 +0400)
committerAlexey <Alexey.Chursin@jetbrains.com>
Thu, 26 Aug 2010 08:42:17 +0000 (12:42 +0400)
samples/applicationConfigurable/src/META-INF/plugin.xml
samples/applicationConfigurable/src/MyPack/MyButtonListener.java [deleted file]
samples/applicationConfigurable/src/fontConfigurable/IDEDialog.form [moved from samples/applicationConfigurable/src/MyPack/IDEdialog.form with 89% similarity]
samples/applicationConfigurable/src/fontConfigurable/IDEDialog.java [moved from samples/applicationConfigurable/src/MyPack/IDEdialog.java with 67% similarity]
samples/applicationConfigurable/src/fontConfigurable/ImagesConfigurable.png [moved from samples/applicationConfigurable/src/MyPack/ImagesConfigurable.png with 100% similarity]
samples/applicationConfigurable/src/fontConfigurable/MyButtonListener.java [new file with mode: 0644]
samples/applicationConfigurable/src/fontConfigurable/MyExtensConfigurable.java [moved from samples/applicationConfigurable/src/MyPack/MyExtensConfigurable.java with 67% similarity]

index 1eb50b164ac82faba5065f6b4b57f7ba165711ee..324a800cd4377f18f6fa637fa05fd323d36c7c8f 100644 (file)
@@ -22,6 +22,6 @@
 
   <extensions defaultExtensionNs="com.intellij">
     <!-- Add your extensions here -->
-      <applicationConfigurable implementation="MyPack.MyExtensConfigurable"></applicationConfigurable>
+      <applicationConfigurable implementation="fontConfigurable.MyExtensConfigurable"></applicationConfigurable>
   </extensions>
 </idea-plugin>
\ No newline at end of file
diff --git a/samples/applicationConfigurable/src/MyPack/MyButtonListener.java b/samples/applicationConfigurable/src/MyPack/MyButtonListener.java
deleted file mode 100644 (file)
index 647a923..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package MyPack;
-
-import com.intellij.ide.ui.LafManager;
-import com.intellij.ide.ui.UISettings;
-
-import javax.swing.*;
-import javax.swing.plaf.ButtonUI;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Alexey.Chursin
- * Date: Aug 7, 2010
- * Time: 9:36:45 PM
-
- */
-public class MyButtonListener implements ActionListener {
-
-
-    public JButton button;
-    public JComboBox myFontCombo;
-    public JComboBox myFontSize;
-
-
-      public void actionPerformed(ActionEvent e) {
-
-       UISettings settings = UISettings.getInstance();
-       LafManager lafManager = LafManager.getInstance();
-        // Restore default font
-       settings.FONT_FACE="Segoe UI";
-       settings.FONT_SIZE=12;
-       myFontCombo.setSelectedItem(settings.FONT_FACE);
-       myFontSize.setSelectedItem( String.valueOf(settings.FONT_SIZE));
-       settings.fireUISettingsChanged();
-       lafManager.updateUI();
-
-         
-
-
-      }
-
- }
-
similarity index 89%
rename from samples/applicationConfigurable/src/MyPack/IDEdialog.form
rename to samples/applicationConfigurable/src/fontConfigurable/IDEDialog.form
index 2d6d487e5130ab3a8b832ab4d8a99f60f44bce42..5c0fe57bbe028f35b3390b7e04c9d9be9c013255 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="MyPack.IDEdialog">
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="fontConfigurable.IDEDialog">
   <grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="10" left="10" bottom="10" right="10"/>
     <constraints>
@@ -17,7 +17,7 @@
         <border type="none"/>
         <children/>
       </grid>
-      <grid id="e3588" binding="Name" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+      <grid id="e3588" binding="name" 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="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"/>
@@ -65,7 +65,7 @@
               <text value="Font Size:"/>
             </properties>
           </component>
-          <component id="a38e1" class="javax.swing.JButton" binding="ButtonRestoreDefaultFont">
+          <component id="a38e1" class="javax.swing.JButton" binding="buttonRestoreDefaultFont">
             <constraints>
               <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
                 <preferred-size width="5" height="50"/>
               <text value="Default Font"/>
             </properties>
           </component>
+          <vspacer id="de61d">
+            <constraints>
+              <grid row="4" column="1" 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>
     </children>
similarity index 67%
rename from samples/applicationConfigurable/src/MyPack/IDEdialog.java
rename to samples/applicationConfigurable/src/fontConfigurable/IDEDialog.java
index 8da028d388c941cdfc9a056693c2637542fa6633..124521759f54951cd31c48e16728bb4c1561342a 100644 (file)
@@ -1,38 +1,36 @@
-package MyPack;
+package fontConfigurable;
 
 import com.intellij.ide.ui.UISettings;
 import com.intellij.util.ui.UIUtil;
 
 import javax.swing.*;
-import java.awt.*;
 import java.awt.event.*;
 
-public class IDEdialog extends JDialog {
+public class IDEDialog extends JDialog {
     private JPanel contentPane;
-    public JPanel Name;
+    public JPanel name;
     public JComboBox myFontCombo;
     public JComboBox myFontSize;
     public JLabel menuFontSettingsLabel;
-    public JButton ButtonRestoreDefaultFont;
+    public JButton buttonRestoreDefaultFont;
 
 
-
-    public IDEdialog() {
+    public IDEDialog() {
         setContentPane(contentPane);
         setModal(true);
         UISettings settings = UISettings.getInstance();
         myFontCombo.setModel(new DefaultComboBoxModel(UIUtil.getValidFontNames(false)));
         myFontSize.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes()));
         myFontCombo.setSelectedItem(settings.FONT_FACE);
-        myFontSize.setSelectedItem( String.valueOf(settings.FONT_SIZE));
+        myFontSize.setSelectedItem(String.valueOf(settings.FONT_SIZE));
 
-// Configure the Set Default Font button listener.
+// Configure the Set Default Font myButton listener.
 
         MyButtonListener actionListener = new MyButtonListener();
-        actionListener.button=ButtonRestoreDefaultFont;
-        actionListener.myFontCombo= myFontCombo;
-        actionListener.myFontSize= myFontSize;
-        ButtonRestoreDefaultFont.addActionListener(actionListener);
+        actionListener.myButton = buttonRestoreDefaultFont;
+        actionListener.myFontCombo = myFontCombo;
+        actionListener.myFontSize = myFontSize;
+        buttonRestoreDefaultFont.addActionListener(actionListener);
 
 
 // call onCancel() when cross is clicked
@@ -53,25 +51,16 @@ public class IDEdialog extends JDialog {
 
     private void onOK() {
 // add your code here
-       
+
 
         dispose();
     }
 
-    
+
     private void onCancel() {
 // add your code here if necessary
         dispose();
     }
 
 
-
-    public static void main(String[] args) {
-        IDEdialog dialog = new IDEdialog();
-        dialog.pack();
-        dialog.setVisible(true);
-        System.exit(0);
-    }
-
-
 }
diff --git a/samples/applicationConfigurable/src/fontConfigurable/MyButtonListener.java b/samples/applicationConfigurable/src/fontConfigurable/MyButtonListener.java
new file mode 100644 (file)
index 0000000..d37220a
--- /dev/null
@@ -0,0 +1,40 @@
+package fontConfigurable;
+
+import com.intellij.ide.ui.LafManager;
+import com.intellij.ide.ui.UISettings;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Aug 7, 2010
+ * Time: 9:36:45 PM
+ */
+public class MyButtonListener implements ActionListener {
+
+
+    public JButton myButton;
+    public JComboBox myFontCombo;
+    public JComboBox myFontSize;
+
+
+    public void actionPerformed(ActionEvent e) {
+
+        UISettings settings = UISettings.getInstance();
+        LafManager lafManager = LafManager.getInstance();
+        // Restore default font
+        settings.FONT_FACE = "Segoe UI";
+        settings.FONT_SIZE = 12;
+        myFontCombo.setSelectedItem(settings.FONT_FACE);
+        myFontSize.setSelectedItem(String.valueOf(settings.FONT_SIZE));
+        settings.fireUISettingsChanged();
+        lafManager.updateUI();
+
+
+    }
+
+}
+
similarity index 67%
rename from samples/applicationConfigurable/src/MyPack/MyExtensConfigurable.java
rename to samples/applicationConfigurable/src/fontConfigurable/MyExtensConfigurable.java
index 8493eae940a359eded12b2b52030beb49c7084c8..f53725e2be768c7bcdff9bccc093f7f55e650cbe 100644 (file)
@@ -1,25 +1,22 @@
-package MyPack;
+package fontConfigurable;
 
 
 import com.intellij.ide.ui.LafManager;
 import com.intellij.ide.ui.UISettings;
 import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.ui.Messages;
 
 
 import javax.swing.*;
-import java.awt.*;
 
 /**
  * Created by IntelliJ IDEA.
  * User: Alexey.Chursin
  * Date: Jul 30, 2010
  * Time: 5:59:43 PM
-
  */
 public class MyExtensConfigurable implements Configurable {
     private JComponent myComponent;
-    private IDEdialog Mydialog;
+    private IDEDialog myDialog;
 
     public String getDisplayName() {
         return "Menu Font";
@@ -28,13 +25,13 @@ public class MyExtensConfigurable implements Configurable {
     public boolean isModified() {
 
 
-           return true;
+        return true;
     }
 
     public JComponent createComponent() {
-        Mydialog = new IDEdialog();
-        myComponent= (JComponent) Mydialog.getComponent(0);
-        return myComponent ;
+        myDialog = new IDEDialog();
+        myComponent = (JComponent) myDialog.getComponent(0);
+        return myComponent;
 
     }
 
@@ -46,16 +43,16 @@ public class MyExtensConfigurable implements Configurable {
     public void apply() {
         UISettings settings = UISettings.getInstance();
         LafManager lafManager = LafManager.getInstance();
-        String _fontFace = (String)Mydialog.myFontCombo.getSelectedItem();
-        String _fontSize_STR = (String)Mydialog.myFontSize.getSelectedItem();
-        int _fontSize= Integer.parseInt(_fontSize_STR);
-       
+        String _fontFace = (String) myDialog.myFontCombo.getSelectedItem();
+        String _fontSize_STR = (String) myDialog.myFontSize.getSelectedItem();
+        int _fontSize = Integer.parseInt(_fontSize_STR);
+
         if (_fontSize != settings.FONT_SIZE || !settings.FONT_FACE.equals(_fontFace)) {
             settings.FONT_SIZE = _fontSize;
             settings.FONT_FACE = _fontFace;
             settings.fireUISettingsChanged();
-             lafManager.updateUI();
-          }
+            lafManager.updateUI();
+        }
 
     }
 
@@ -68,7 +65,7 @@ public class MyExtensConfigurable implements Configurable {
     }
 
     public void reset() {
-        
+
     }
 
 }