]> Dogcows Code - chaz/vimcoder/blobdiff - src/com/dogcows/VimCoder.java
do not add editor name to the end of a submission
[chaz/vimcoder] / src / com / dogcows / VimCoder.java
index 2f61bcc4586131f3c47697d232eb3dfaefa7cc7f..d094394f2a0dbe41cdb9bc3f220319df38397de8 100644 (file)
@@ -27,12 +27,7 @@ public class VimCoder
        /**
         * The name and version of this plugin.
         */
-       public final static String version = "VimCoder 0.3.4";
-
-       /**
-        * The website of the plugin project.
-        */
-       public final static String website = "http://github.com/chazmcgarvey/vimcoder";
+       public final static String version = "VimCoder 0.3.5";
 
 
        /**
@@ -54,6 +49,12 @@ public class VimCoder
                                   System.getProperty("file.separator") + ".vimcoder");
        }
 
+       /**
+        * Whether or not to use the contest name and point value as problem
+        * directory names.
+        */
+       private static boolean contestDirNames = false;
+
 
        /**
         * The panel given to the Arena applet when it is requested.
@@ -86,6 +87,11 @@ public class VimCoder
         */
        private final static String ROOTDIR = "com.dogcows.VimCoder.config.rootdir";
 
+       /**
+        * The key for the problem directory name preference.
+        */
+       private final static String CONTESTDIRNAMES = "com.dogcows.VimCoder.config.contestdirnames";
+
        /**
         * The preferences object for storing plugin settings.
         */
@@ -110,6 +116,16 @@ public class VimCoder
                return rootDir;
        }
 
+       /**
+        * Get whether or not to save problems in a human-readable directory
+        * structure.
+        * @return The directory name setting.
+        */
+       public static boolean isContestDirNames()
+       {
+               return contestDirNames;
+       }
+
 
        /**
         * Instantiate the entry point of the editor plugin.
@@ -283,16 +299,29 @@ public class VimCoder
                c.anchor = GridBagConstraints.BASELINE_LEADING;
                fieldPanel.add(browseButton, c);
 
+               final JCheckBox contestDirNamesButton = new JCheckBox(
+                       "Store problems according to contest name and point value.",
+                       contestDirNames
+               );
+               contestDirNamesButton.setForeground(Common.FG_COLOR);
+               contestDirNamesButton.setBackground(Common.WPB_COLOR);
+               contestDirNamesButton.setFont(rootDirLabel.getFont());
+               c.gridx = 1;
+               c.gridy = 1;
+               c.gridwidth = 2;
+               fieldPanel.add(contestDirNamesButton, c);
+
                JLabel vimCommandLabel = new JLabel("Vim Command:");
                vimCommandLabel.setForeground(Common.FG_COLOR);
                c.gridx = 0;
-               c.gridy = 1;
+               c.gridy = 2;
+               c.gridwidth = 1;
                fieldPanel.add(vimCommandLabel, c);
 
                final JTextField vimCommandField = new JTextField(vimCommand);
                vimCommandField.setPreferredSize(new Dimension(0, 24));
                c.gridx = 1;
-               c.gridy = 1;
+               c.gridy = 2;
                c.weightx = 1.0;
                c.gridwidth = 2;
                fieldPanel.add(vimCommandField, c);
@@ -339,6 +368,7 @@ public class VimCoder
                        {
                                prefs.setProperty(VIMCOMMAND, vimCommandField.getText());
                                prefs.setProperty(ROOTDIR, rootDirField.getText());
+                               prefs.setProperty(CONTESTDIRNAMES, String.valueOf(contestDirNamesButton.isSelected()));
                                JOptionPane.showMessageDialog(null, "Preferences were saved successfully.");
                        }
                });
@@ -362,6 +392,9 @@ public class VimCoder
 
                String dir = prefs.getProperty(ROOTDIR);
                if (dir != null) rootDir = new File(dir);
+
+               String cn  = prefs.getProperty(CONTESTDIRNAMES);
+               if (cn != null) contestDirNames = Boolean.parseBoolean(cn);
        }
 
 
@@ -409,3 +442,4 @@ public class VimCoder
        }
 }
 
+// vim:noet:ts=8
This page took 0.023076 seconds and 4 git commands to generate.