ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r731625 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences: IvyDEPreferenceStoreHelper.java IvyPreferencePage.java PreferenceInitializer.java
Date Mon, 05 Jan 2009 17:12:08 GMT
Author: hibou
Date: Mon Jan  5 09:12:08 2009
New Revision: 731625

URL: http://svn.apache.org/viewvc?rev=731625&view=rev
Log:
Set the default value in the right place

Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java?rev=731625&r1=731624&r2=731625&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
Mon Jan  5 09:12:08 2009
@@ -25,87 +25,10 @@
 
 public class IvyDEPreferenceStoreHelper {
 
-    public static final String DEFAULT_IVYSETTINGS_PATH = "";
-
-    public static final String DEFAULT_ORGANISATION = "";
-
-    public static final String DEFAULT_ORGANISATION_URL = "";
-
-    public static final String DEFAULT_ACCEPTED_TYPES = "jar,bundle,ejb,maven-plugin";
-
-    public static final String DEFAULT_SOURCES_TYPES = "source";
-
-    public static final String DEFAULT_JAVADOC_TYPES = "javadoc";
-
-    public static final String DEFAULT_SOURCES_SUFFIXES = "-source,-sources,-src";
-
-    public static final String DEFAULT_JAVADOC_SUFFIXES = "-javadoc,-javadocs,-doc,-docs";
-
-    public static final boolean DEFAULT_DO_RETRIEVE = false;
-
-    public static final String DEFAULT_RETRIEVE_PATTERN = "lib/[conf]/[artifact].[ext]";
-
-    public static final boolean DEFAULT_RETRIEVE_SYNC = false;
-
-    public static final String DEFAULT_RETRIEVE_CONFS = "*";
-
-    public static final String DEFAULT_RETRIEVE_TYPES = "*";
-
-    public static final boolean DEFAULT_ALPHABETICAL_ORDER = false;
-
-    public static final boolean DEFAULT_RESOLVE_IN_WORKSPACE = false;
-
-    public static final String DEFAULT_PROPERTY_FILES = "";
-
-    public static final boolean DEFAULT_LOAD_SETTINGS_ON_DEMAND = false;
-
-    public static final int DEFAULT_RESOLVE_ON_STARTUP = 1;
-
     private final IPreferenceStore prefStore;
 
     public IvyDEPreferenceStoreHelper(IPreferenceStore prefStore) {
         this.prefStore = prefStore;
-        setDefault();
-    }
-
-    public void setDefault() {
-        prefStore.setDefault(PreferenceConstants.IVYSETTINGS_PATH, DEFAULT_IVYSETTINGS_PATH);
-        prefStore.setDefault(PreferenceConstants.ORGANISATION, DEFAULT_ORGANISATION);
-        prefStore.setDefault(PreferenceConstants.ORGANISATION_URL, DEFAULT_ORGANISATION_URL);
-        prefStore.setDefault(PreferenceConstants.ACCEPTED_TYPES, DEFAULT_ACCEPTED_TYPES);
-        prefStore.setDefault(PreferenceConstants.SOURCES_TYPES, DEFAULT_SOURCES_TYPES);
-        prefStore.setDefault(PreferenceConstants.JAVADOC_TYPES, DEFAULT_JAVADOC_TYPES);
-        prefStore.setDefault(PreferenceConstants.SOURCES_SUFFIXES, DEFAULT_SOURCES_SUFFIXES);
-        prefStore.setDefault(PreferenceConstants.JAVADOC_SUFFIXES, DEFAULT_JAVADOC_SUFFIXES);
-
-        prefStore.setDefault(PreferenceConstants.DO_RETRIEVE, DEFAULT_DO_RETRIEVE);
-        boolean b = prefStore.getBoolean(PreferenceConstants.DO_RETRIEVE_DEPRECATED);
-        if (b) {
-            // not the default value, so it has been set
-            // erase the deprecated preference and store the new one
-            prefStore.setValue(PreferenceConstants.DO_RETRIEVE_DEPRECATED, "");
-            prefStore.setValue(PreferenceConstants.DO_RETRIEVE, b);
-        }
-
-        prefStore.setDefault(PreferenceConstants.RETRIEVE_PATTERN, DEFAULT_RETRIEVE_PATTERN);
-        prefStore.setDefault(PreferenceConstants.RETRIEVE_CONFS, DEFAULT_RETRIEVE_CONFS);
-        prefStore.setDefault(PreferenceConstants.RETRIEVE_TYPES, DEFAULT_RETRIEVE_TYPES);
-        String s = prefStore.getString(PreferenceConstants.RETRIEVE_PATTERN_DEPRECATED);
-        if (s != null && s.length() != 0) {
-            // not the default value, so it has been set
-            // erase the deprecated preference and store the new one
-            prefStore.setValue(PreferenceConstants.RETRIEVE_PATTERN_DEPRECATED, "");
-            prefStore.setValue(PreferenceConstants.RETRIEVE_PATTERN, s);
-        }
-
-        prefStore.setDefault(PreferenceConstants.RETRIEVE_SYNC, DEFAULT_RETRIEVE_SYNC);
-        prefStore.setDefault(PreferenceConstants.ALPHABETICAL_ORDER, DEFAULT_ALPHABETICAL_ORDER);
-        prefStore
-                .setDefault(PreferenceConstants.RESOLVE_IN_WORKSPACE, DEFAULT_RESOLVE_IN_WORKSPACE);
-        prefStore.setDefault(PreferenceConstants.PROPERTY_FILES, DEFAULT_PROPERTY_FILES);
-        prefStore.setDefault(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND,
-            DEFAULT_LOAD_SETTINGS_ON_DEMAND);
-        prefStore.setDefault(PreferenceConstants.RESOLVE_ON_STARTUP, DEFAULT_RESOLVE_ON_STARTUP);
     }
 
     public String getIvyOrg() {

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java?rev=731625&r1=731624&r2=731625&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java
Mon Jan  5 09:12:08 2009
@@ -25,8 +25,6 @@
 import org.apache.ivyde.eclipse.ui.SettingsEditor;
 import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -236,7 +234,7 @@
     }
 
     protected void performDefaults() {
-        switch (IvyDEPreferenceStoreHelper.DEFAULT_RESOLVE_ON_STARTUP) {
+        switch (PreferenceInitializer.DEFAULT_RESOLVE_ON_STARTUP) {
             case IvyClasspathInitializer.ON_STARTUP_NOTHING:
                 doNothingButton.setSelection(true);
                 break;
@@ -247,23 +245,22 @@
                 resolveOnStartupButton.setSelection(true);
                 break;
         }
-        settingsEditor.init(IvyDEPreferenceStoreHelper.DEFAULT_IVYSETTINGS_PATH,
-            IvyDEPreferenceStoreHelper.DEFAULT_PROPERTY_FILES,
-            IvyDEPreferenceStoreHelper.DEFAULT_LOAD_SETTINGS_ON_DEMAND);
-        retrieveComposite.init(IvyDEPreferenceStoreHelper.DEFAULT_DO_RETRIEVE,
-            IvyDEPreferenceStoreHelper.DEFAULT_RETRIEVE_PATTERN,
-            IvyDEPreferenceStoreHelper.DEFAULT_RETRIEVE_CONFS,
-            IvyDEPreferenceStoreHelper.DEFAULT_RETRIEVE_TYPES,
-            IvyDEPreferenceStoreHelper.DEFAULT_RETRIEVE_SYNC);
-        resolveInWorkspaceCheck
-                .setSelection(IvyDEPreferenceStoreHelper.DEFAULT_RESOLVE_IN_WORKSPACE);
-        alphaOrderCheck.select(IvyDEPreferenceStoreHelper.DEFAULT_ALPHABETICAL_ORDER ? 1
: 0);
-        acceptedSuffixesTypesComposite.init(IvyDEPreferenceStoreHelper.DEFAULT_ACCEPTED_TYPES,
-            IvyDEPreferenceStoreHelper.DEFAULT_SOURCES_TYPES,
-            IvyDEPreferenceStoreHelper.DEFAULT_SOURCES_SUFFIXES,
-            IvyDEPreferenceStoreHelper.DEFAULT_JAVADOC_TYPES,
-            IvyDEPreferenceStoreHelper.DEFAULT_JAVADOC_SUFFIXES);
-        organizationText.setText(IvyDEPreferenceStoreHelper.DEFAULT_ORGANISATION);
-        organizationUrlText.setText(IvyDEPreferenceStoreHelper.DEFAULT_ORGANISATION_URL);
+        settingsEditor.init(PreferenceInitializer.DEFAULT_IVYSETTINGS_PATH,
+            PreferenceInitializer.DEFAULT_PROPERTY_FILES,
+            PreferenceInitializer.DEFAULT_LOAD_SETTINGS_ON_DEMAND);
+        retrieveComposite.init(PreferenceInitializer.DEFAULT_DO_RETRIEVE,
+            PreferenceInitializer.DEFAULT_RETRIEVE_PATTERN,
+            PreferenceInitializer.DEFAULT_RETRIEVE_CONFS,
+            PreferenceInitializer.DEFAULT_RETRIEVE_TYPES,
+            PreferenceInitializer.DEFAULT_RETRIEVE_SYNC);
+        resolveInWorkspaceCheck.setSelection(PreferenceInitializer.DEFAULT_RESOLVE_IN_WORKSPACE);
+        alphaOrderCheck.select(PreferenceInitializer.DEFAULT_ALPHABETICAL_ORDER ? 1 : 0);
+        acceptedSuffixesTypesComposite.init(PreferenceInitializer.DEFAULT_ACCEPTED_TYPES,
+            PreferenceInitializer.DEFAULT_SOURCES_TYPES,
+            PreferenceInitializer.DEFAULT_SOURCES_SUFFIXES,
+            PreferenceInitializer.DEFAULT_JAVADOC_TYPES,
+            PreferenceInitializer.DEFAULT_JAVADOC_SUFFIXES);
+        organizationText.setText(PreferenceInitializer.DEFAULT_ORGANISATION);
+        organizationUrlText.setText(PreferenceInitializer.DEFAULT_ORGANISATION_URL);
     }
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java?rev=731625&r1=731624&r2=731625&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
Mon Jan  5 09:12:08 2009
@@ -26,16 +26,85 @@
  */
 public class PreferenceInitializer extends AbstractPreferenceInitializer {
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
-     */
+    public static final String DEFAULT_IVYSETTINGS_PATH = "";
+
+    public static final String DEFAULT_ORGANISATION = "";
+
+    public static final String DEFAULT_ORGANISATION_URL = "";
+
+    public static final String DEFAULT_ACCEPTED_TYPES = "jar,bundle,ejb,maven-plugin";
+
+    public static final String DEFAULT_SOURCES_TYPES = "source";
+
+    public static final String DEFAULT_JAVADOC_TYPES = "javadoc";
+
+    public static final String DEFAULT_SOURCES_SUFFIXES = "-source,-sources,-src";
+
+    public static final String DEFAULT_JAVADOC_SUFFIXES = "-javadoc,-javadocs,-doc,-docs";
+
+    public static final boolean DEFAULT_DO_RETRIEVE = false;
+
+    public static final String DEFAULT_RETRIEVE_PATTERN = "lib/[conf]/[artifact].[ext]";
+
+    public static final boolean DEFAULT_RETRIEVE_SYNC = false;
+
+    public static final String DEFAULT_RETRIEVE_CONFS = "*";
+
+    public static final String DEFAULT_RETRIEVE_TYPES = "*";
+
+    public static final boolean DEFAULT_ALPHABETICAL_ORDER = false;
+
+    public static final boolean DEFAULT_RESOLVE_IN_WORKSPACE = false;
+
+    public static final String DEFAULT_PROPERTY_FILES = "";
+
+    public static final boolean DEFAULT_LOAD_SETTINGS_ON_DEMAND = false;
+
+    public static final int DEFAULT_RESOLVE_ON_STARTUP = 1;
+
     public void initializeDefaultPreferences() {
         IPreferenceStore store = IvyPlugin.getDefault().getPreferenceStore();
         store.setDefault(PreferenceConstants.P_BOOLEAN, true);
         store.setDefault(PreferenceConstants.P_CHOICE, "choice2");
         store.setDefault(PreferenceConstants.P_STRING, "Default value");
+
+        store.setDefault(PreferenceConstants.IVYSETTINGS_PATH, DEFAULT_IVYSETTINGS_PATH);
+        store.setDefault(PreferenceConstants.ORGANISATION, DEFAULT_ORGANISATION);
+        store.setDefault(PreferenceConstants.ORGANISATION_URL, DEFAULT_ORGANISATION_URL);
+        store.setDefault(PreferenceConstants.ACCEPTED_TYPES, DEFAULT_ACCEPTED_TYPES);
+        store.setDefault(PreferenceConstants.SOURCES_TYPES, DEFAULT_SOURCES_TYPES);
+        store.setDefault(PreferenceConstants.JAVADOC_TYPES, DEFAULT_JAVADOC_TYPES);
+        store.setDefault(PreferenceConstants.SOURCES_SUFFIXES, DEFAULT_SOURCES_SUFFIXES);
+        store.setDefault(PreferenceConstants.JAVADOC_SUFFIXES, DEFAULT_JAVADOC_SUFFIXES);
+
+        store.setDefault(PreferenceConstants.DO_RETRIEVE, DEFAULT_DO_RETRIEVE);
+        boolean b = store.getBoolean(PreferenceConstants.DO_RETRIEVE_DEPRECATED);
+        if (b) {
+            // not the default value, so it has been set
+            // erase the deprecated preference and store the new one
+            store.setValue(PreferenceConstants.DO_RETRIEVE_DEPRECATED, "");
+            store.setValue(PreferenceConstants.DO_RETRIEVE, b);
+        }
+
+        store.setDefault(PreferenceConstants.RETRIEVE_PATTERN, DEFAULT_RETRIEVE_PATTERN);
+        store.setDefault(PreferenceConstants.RETRIEVE_CONFS, DEFAULT_RETRIEVE_CONFS);
+        store.setDefault(PreferenceConstants.RETRIEVE_TYPES, DEFAULT_RETRIEVE_TYPES);
+        String s = store.getString(PreferenceConstants.RETRIEVE_PATTERN_DEPRECATED);
+        if (s != null && s.length() != 0) {
+            // not the default value, so it has been set
+            // erase the deprecated preference and store the new one
+            store.setValue(PreferenceConstants.RETRIEVE_PATTERN_DEPRECATED, "");
+            store.setValue(PreferenceConstants.RETRIEVE_PATTERN, s);
+        }
+
+        store.setDefault(PreferenceConstants.RETRIEVE_SYNC, DEFAULT_RETRIEVE_SYNC);
+        store.setDefault(PreferenceConstants.ALPHABETICAL_ORDER, DEFAULT_ALPHABETICAL_ORDER);
+        store.setDefault(PreferenceConstants.RESOLVE_IN_WORKSPACE, DEFAULT_RESOLVE_IN_WORKSPACE);
+        store.setDefault(PreferenceConstants.PROPERTY_FILES, DEFAULT_PROPERTY_FILES);
+        store.setDefault(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND,
+            DEFAULT_LOAD_SETTINGS_ON_DEMAND);
+        store.setDefault(PreferenceConstants.RESOLVE_ON_STARTUP, DEFAULT_RESOLVE_ON_STARTUP);
+
     }
 
 }



Mime
View raw message