ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r731619 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: ./ src/java/org/apache/ivyde/eclipse/cpcontainer/ src/java/org/apache/ivyde/eclipse/ui/preferences/
Date Mon, 05 Jan 2009 17:03:05 GMT
Author: hibou
Date: Mon Jan  5 09:03:04 2009
New Revision: 731619

URL: http://svn.apache.org/viewvc?rev=731619&view=rev
Log:
IVYDE-74:
 - option added to control what to do on startup

Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java
    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/PreferenceConstants.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt?rev=731619&r1=731618&r2=731619&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/CHANGES.txt Mon Jan  5 09:03:04 2009
@@ -7,6 +7,7 @@
 - NEW: Export IVY_HOME as a classpath variable (IVYDE-141)
 - NEW: Support variables in ivyconf.xml (IVYDE-13) (thanks to Will Gorman)
 - NEW: Allow to manually reload the settings (IVYDE-26)
+- NEW: Allow to not trigger full resolve at startup (IVYDE-74)
 
 - FIX: When migrating from ivyde alpha to ivyde beta eclipse is throwing NPE at startup (IVYDE-136)
(thanks to Daniel Becheanu)
 - FIX: The retrieve configuration doesn't support '*' as accepted types (IVYDE-137) (thanks
to Daniel Becheanu)

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java?rev=731619&r1=731618&r2=731619&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java
Mon Jan  5 09:03:04 2009
@@ -650,7 +650,7 @@
 
     public boolean getInheritedLoadSettingsOnDemandPath() {
         if (!isSettingsSpecific) {
-            return IvyPlugin.getPreferenceStoreHelper().isLoadSettingsOnDemand();
+            return IvyPlugin.getPreferenceStoreHelper().getLoadSettingsOnDemand();
         }
         return loadSettingsOnDemand;
     }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java?rev=731619&r1=731618&r2=731619&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java
Mon Jan  5 09:03:04 2009
@@ -19,6 +19,7 @@
 
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.cpcontainer.fragmentinfo.IPackageFragmentExtraInfo;
+import org.apache.ivyde.eclipse.ui.preferences.IvyDEPreferenceStoreHelper;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
@@ -37,6 +38,12 @@
  */
 public class IvyClasspathInitializer extends ClasspathContainerInitializer {
 
+    public static final int ON_STARTUP_NOTHING = 0;
+
+    public static final int ON_STARTUP_REFRESH = 1;
+
+    public static final int ON_STARTUP_RESOLVE = 2;
+
     /**
      * Initialize the container with the "persisted" class path entries, and then schedule
the
      * refresh
@@ -56,19 +63,36 @@
             }
 
             try {
+                IvyClasspathContainer ivycp;
+
                 if (container == null) {
-                    container = new IvyClasspathContainer(project, containerPath,
+                    ivycp = new IvyClasspathContainer(project, containerPath,
                             new IClasspathEntry[0]);
                 } else if (!(container instanceof IvyClasspathContainer)) {
                     // this might be the persisted one : reuse the persisted entries
-                    container = new IvyClasspathContainer(project, containerPath, container
+                    ivycp = new IvyClasspathContainer(project, containerPath, container
                             .getClasspathEntries());
+                } else {
+                    ivycp = (IvyClasspathContainer) container;
                 }
+
                 JavaCore.setClasspathContainer(containerPath, new IJavaProject[] {project},
-                    new IClasspathContainer[] {container}, null);
+                    new IClasspathContainer[] {ivycp}, null);
+
+                IvyDEPreferenceStoreHelper prefHelper = IvyPlugin.getPreferenceStoreHelper();
+                boolean refresh = true;
+
+                // if we have a non ivy cp, it means Eclipse is starting
+                // maybe we don't want to trigger the resolve
+                if (container != null && !(container instanceof IvyClasspathContainer))
{
+                    if (prefHelper.getResolveOnStartup() == ON_STARTUP_NOTHING) {
+                        return;
+                    }
+                    refresh = prefHelper.getResolveOnStartup() == ON_STARTUP_REFRESH;
+                }
 
                 // now refresh the container to be synchronized with the ivy.xml
-                ((IvyClasspathContainer) container).launchResolve(false, false, null);
+                ivycp.launchResolve(refresh, false, null);
             } catch (Exception ex) {
                 IStatus status = new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.OK,
                         "Unable to set container for " + containerPath.toString(), ex);

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java?rev=731619&r1=731618&r2=731619&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java
Mon Jan  5 09:03:04 2009
@@ -439,7 +439,7 @@
         } else {
             settingsProjectSpecificButton.setSelection(false);
             settingsEditor.init(helper.getIvySettingsPath(), helper.getPropertyFiles(), helper
-                    .isLoadSettingsOnDemand());
+                    .getLoadSettingsOnDemand());
         }
 
         if (conf.isRetrieveProjectSpecific()) {

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=731619&r1=731618&r2=731619&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:03:04 2009
@@ -59,6 +59,8 @@
 
     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) {
@@ -103,6 +105,7 @@
         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() {
@@ -253,7 +256,7 @@
         prefStore.setValue(PreferenceConstants.PROPERTY_FILES, IvyClasspathUtil.concat(files));
     }
 
-    public boolean isLoadSettingsOnDemand() {
+    public boolean getLoadSettingsOnDemand() {
         return prefStore.getBoolean(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND);
     }
 
@@ -261,4 +264,12 @@
         prefStore.setValue(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND, onDemand);
     }
 
+    public int getResolveOnStartup() {
+        return prefStore.getInt(PreferenceConstants.RESOLVE_ON_STARTUP);
+    }
+
+    public void setResolveOnStartup(int resolveOnStartup) {
+        prefStore.setValue(PreferenceConstants.RESOLVE_ON_STARTUP, resolveOnStartup);
+    }
+
 }

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=731619&r1=731618&r2=731619&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:03:04 2009
@@ -19,11 +19,14 @@
 
 import org.apache.ivy.Ivy;
 import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathInitializer;
 import org.apache.ivyde.eclipse.ui.AcceptedSuffixesTypesComposite;
 import org.apache.ivyde.eclipse.ui.RetrieveComposite;
 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;
@@ -66,6 +69,12 @@
 
     private Text organizationUrlText;
 
+    private Button refreshOnStartupButton;
+
+    private Button resolveOnStartupButton;
+
+    private Button doNothingButton;
+
     public IvyPreferencePage() {
         setPreferenceStore(IvyPlugin.getDefault().getPreferenceStore());
         Object ivydeVersion = IvyPlugin.getDefault().getBundle().getHeaders().get(
@@ -88,6 +97,25 @@
         Label horizontalLine = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
         horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
 
+        Group startupGroup = new Group(composite, SWT.NONE);
+        startupGroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        startupGroup.setLayout(new GridLayout());
+        startupGroup.setText("On Eclipse startup");
+
+        doNothingButton = new Button(startupGroup, SWT.RADIO);
+        doNothingButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        doNothingButton.setText("Do nothing");
+
+        refreshOnStartupButton = new Button(startupGroup, SWT.RADIO);
+        refreshOnStartupButton
+                .setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        refreshOnStartupButton.setText("Trigger refresh");
+
+        resolveOnStartupButton = new Button(startupGroup, SWT.RADIO);
+        resolveOnStartupButton
+                .setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        resolveOnStartupButton.setText("Trigger resolve");
+
         Group settingsGroup = new Group(composite, SWT.NONE);
         settingsGroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
         settingsGroup.setLayout(new GridLayout());
@@ -156,8 +184,19 @@
 
     private void initPreferences() {
         IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper();
+        switch (helper.getResolveOnStartup()) {
+            case IvyClasspathInitializer.ON_STARTUP_NOTHING:
+                doNothingButton.setSelection(true);
+                break;
+            case IvyClasspathInitializer.ON_STARTUP_REFRESH:
+                refreshOnStartupButton.setSelection(true);
+                break;
+            case IvyClasspathInitializer.ON_STARTUP_RESOLVE:
+                resolveOnStartupButton.setSelection(true);
+                break;
+        }
         settingsEditor.init(helper.getIvySettingsPath(), helper.getPropertyFiles(), helper
-                .isLoadSettingsOnDemand());
+                .getLoadSettingsOnDemand());
         retrieveComposite.init(helper.getDoRetrieve(), helper.getRetrievePattern(), helper
                 .getRetrieveConfs(), helper.getRetrieveTypes(), helper.getRetrieveSync());
         resolveInWorkspaceCheck.setSelection(helper.isResolveInWorkspace());
@@ -171,6 +210,13 @@
     public boolean performOk() {
         IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper();
         helper.setIvySettingsPath(settingsEditor.getSettingsPath());
+        if (doNothingButton.getSelection()) {
+            helper.setResolveOnStartup(IvyClasspathInitializer.ON_STARTUP_NOTHING);
+        } else if (refreshOnStartupButton.getSelection()) {
+            helper.setResolveOnStartup(IvyClasspathInitializer.ON_STARTUP_REFRESH);
+        } else {
+            helper.setResolveOnStartup(IvyClasspathInitializer.ON_STARTUP_RESOLVE);
+        }
         helper.setPropertyFiles(settingsEditor.getPropertyFiles());
         helper.setDoRetrieve(retrieveComposite.isRetrieveEnabled());
         helper.setRetrievePattern(retrieveComposite.getRetrievePattern());
@@ -190,6 +236,17 @@
     }
 
     protected void performDefaults() {
+        switch (IvyDEPreferenceStoreHelper.DEFAULT_RESOLVE_ON_STARTUP) {
+            case IvyClasspathInitializer.ON_STARTUP_NOTHING:
+                doNothingButton.setSelection(true);
+                break;
+            case IvyClasspathInitializer.ON_STARTUP_REFRESH:
+                refreshOnStartupButton.setSelection(true);
+                break;
+            case IvyClasspathInitializer.ON_STARTUP_RESOLVE:
+                resolveOnStartupButton.setSelection(true);
+                break;
+        }
         settingsEditor.init(IvyDEPreferenceStoreHelper.DEFAULT_IVYSETTINGS_PATH,
             IvyDEPreferenceStoreHelper.DEFAULT_PROPERTY_FILES,
             IvyDEPreferenceStoreHelper.DEFAULT_LOAD_SETTINGS_ON_DEMAND);

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=731619&r1=731618&r2=731619&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
Mon Jan  5 09:03:04 2009
@@ -70,4 +70,6 @@
 
     public static final String LOAD_SETTINGS_ON_DEMAND = "loadSettingsOnDemand";
 
+    public static final String RESOLVE_ON_STARTUP = "resolveOnStartup";
+
 }



Mime
View raw message