ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r988023 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: ./ src/java/org/apache/ivyde/eclipse/ src/java/org/apache/ivyde/eclipse/cpcontainer/ src/java/org/apache/ivyde/eclipse/ui/ src/java/org/apache/ivyde/eclipse/ui/preferences/
Date Mon, 23 Aug 2010 08:09:39 GMT
Author: hibou
Date: Mon Aug 23 08:09:38 2010
New Revision: 988023

URL: http://svn.apache.org/viewvc?rev=988023&view=rev
Log:
IVYDE-56:
 before trying to make the retrieve part of the classpath, let's move the current retrieve config to be independant from the classpath container:
 * add a project level Ivy configuration to manage retrieve configuration

Added:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/StandaloneRetrieveSetup.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvySettingsTab.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/EditStandaloneRetrieveDialog.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEProjectPreferences.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/StandaloneRetrieveSerializer.java   (with props)
Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDERuntimeClasspathEntryResolver.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/IvyFilePathText.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml?rev=988023&r1=988022&r2=988023&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml Mon Aug 23 08:09:38 2010
@@ -439,6 +439,19 @@
          </run>
       </runtime>
    </extension>
+   <extension
+         point="org.eclipse.ui.propertyPages">
+      <page
+            class="org.apache.ivyde.eclipse.ui.preferences.IvyDEProjectPreferences"
+            id="org.apache.ivyde.eclipse.projectpreferences"
+            name="Ivy"
+            objectClass="org.eclipse.core.resources.IProject">
+         <filter
+               name="nature"
+               value="org.apache.ivyde.eclipse.ivyNature">
+         </filter>
+      </page>
+   </extension>
 
 
    <!--

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDERuntimeClasspathEntryResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDERuntimeClasspathEntryResolver.java?rev=988023&r1=988022&r2=988023&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDERuntimeClasspathEntryResolver.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyDERuntimeClasspathEntryResolver.java Mon Aug 23 08:09:38 2010
@@ -77,7 +77,7 @@ public class IvyDERuntimeClasspathEntryR
             }
         }
         IClasspathEntry[] cpes = container.getClasspathEntries();
-        int property = -1;
+        int property;
         switch (container.getKind()) {
             case IClasspathContainer.K_APPLICATION:
                 property = IRuntimeClasspathEntry.USER_CLASSES;
@@ -88,6 +88,8 @@ public class IvyDERuntimeClasspathEntryR
             case IClasspathContainer.K_SYSTEM:
                 property = IRuntimeClasspathEntry.BOOTSTRAP_CLASSES;
                 break;
+            default:
+                property = -1;
         }
         List resolved = new ArrayList(cpes.length);
         List projects = new ArrayList();

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=988023&r1=988022&r2=988023&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 Aug 23 08:09:38 2010
@@ -29,15 +29,13 @@ import org.apache.ivyde.eclipse.IvyPlugi
 import org.apache.ivyde.eclipse.ui.AcceptedSuffixesTypesComposite;
 import org.apache.ivyde.eclipse.ui.ConfTableViewer;
 import org.apache.ivyde.eclipse.ui.IvyFilePathText;
+import org.apache.ivyde.eclipse.ui.IvySettingsTab;
 import org.apache.ivyde.eclipse.ui.RetrieveComposite;
-import org.apache.ivyde.eclipse.ui.SettingsEditor;
 import org.apache.ivyde.eclipse.ui.ConfTableViewer.ConfTableListener;
 import org.apache.ivyde.eclipse.ui.IvyFilePathText.IvyXmlPathListener;
-import org.apache.ivyde.eclipse.ui.SettingsEditor.SettingsEditorListener;
 import org.apache.ivyde.eclipse.ui.preferences.ClasspathPreferencePage;
 import org.apache.ivyde.eclipse.ui.preferences.IvyDEPreferenceStoreHelper;
 import org.apache.ivyde.eclipse.ui.preferences.RetrievePreferencePage;
-import org.apache.ivyde.eclipse.ui.preferences.SettingsPreferencePage;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
@@ -78,20 +76,14 @@ public class IvydeContainerPage extends 
 
     private ConfTableViewer confTableViewer;
 
-    private SettingsEditor settingsEditor;
-
     private Combo alphaOrderCheck;
 
     private Button resolveInWorkspaceCheck;
 
     private Button resolveBeforeLaunchCheck;
 
-    private Button settingsProjectSpecificButton;
-
     private Button advancedProjectSpecificButton;
 
-    private Link mainGeneralSettingsLink;
-
     private Link advancedGeneralSettingsLink;
 
     private IvyClasspathContainerConfiguration conf;
@@ -116,6 +108,8 @@ public class IvydeContainerPage extends 
 
     private IvyClasspathContainerState state;
 
+    private IvySettingsTab settingsTab;
+
     /**
      * Constructor
      */
@@ -204,12 +198,13 @@ public class IvydeContainerPage extends 
         }
         conf.setConfs(confs);
 
-        if (settingsProjectSpecificButton.getSelection()) {
+        if (settingsTab.isProjectSpecific()) {
             conf.setSettingsProjectSpecific(true);
-            conf.setIvySettingsSetup(settingsEditor.getIvySettingsSetup());
+            conf.setIvySettingsSetup(settingsTab.getSettingsEditor().getIvySettingsSetup());
         } else {
             conf.setSettingsProjectSpecific(false);
         }
+
         if (retrieveProjectSpecificButton.getSelection()) {
             conf.setRetrieveProjectSpecific(true);
             conf.setRetrieveSetup(retrieveComposite.getRetrieveSetup());
@@ -292,9 +287,20 @@ public class IvydeContainerPage extends 
         mainTab.setText("Main");
         mainTab.setControl(createMainTab(tabs));
 
-        TabItem settingsTab = new TabItem(tabs, SWT.NONE);
-        settingsTab.setText("Settings");
-        settingsTab.setControl(createSettingsTab(tabs));
+        settingsTab = new IvySettingsTab(tabs) {
+            protected void settingsUpdated() {
+                try {
+                    conf.setSettingsProjectSpecific(isProjectSpecific());
+                    conf.setIvySettingsSetup(getSettingsEditor().getIvySettingsSetup());
+                    state.setIvySettingsLastModified(-1);
+                    state.getIvy();
+                    getSettingsEditor().setSettingsError(null);
+                    checkIvyXmlPath();
+                } catch (IvyDEException e) {
+                    getSettingsEditor().setSettingsError(e);
+                }
+            }
+        };
 
         TabItem retrieveTab = new TabItem(tabs, SWT.NONE);
         retrieveTab.setText("Retrieve");
@@ -307,7 +313,7 @@ public class IvydeContainerPage extends 
         tabs.addSelectionListener(new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
                 ivyFilePathText.updateErrorMarker();
-                settingsEditor.updateErrorMarker();
+                settingsTab.getSettingsEditor().updateErrorMarker();
             }
         });
 
@@ -332,15 +338,15 @@ public class IvydeContainerPage extends 
         Label pathLabel = new Label(configComposite, SWT.NONE);
         pathLabel.setText("Ivy File");
 
-        ivyFilePathText = new IvyFilePathText(configComposite, SWT.NONE, project);
+        ivyFilePathText = new IvyFilePathText(configComposite, SWT.NONE, project.getProject());
         ivyFilePathText.addListener(new IvyXmlPathListener() {
             public void ivyXmlPathUpdated(String path) {
                 conf.setIvyXmlPath(path);
                 checkIvyXmlPath();
             }
         });
-        ivyFilePathText
-                .setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
+        ivyFilePathText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2,
+                1));
 
         // Label for ivy configurations field
         Label confLabel = new Label(configComposite, SWT.NONE);
@@ -376,57 +382,6 @@ public class IvydeContainerPage extends 
         return composite;
     }
 
-    private Control createSettingsTab(Composite parent) {
-        Composite composite = new Composite(parent, SWT.NONE);
-        composite.setLayout(new GridLayout());
-        composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
-
-        Composite headerComposite = new Composite(composite, SWT.NONE);
-        headerComposite.setLayout(new GridLayout(2, false));
-        headerComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
-
-        settingsProjectSpecificButton = new Button(headerComposite, SWT.CHECK);
-        settingsProjectSpecificButton.setText("Enable project specific settings");
-        settingsProjectSpecificButton.addSelectionListener(new SelectionAdapter() {
-            public void widgetSelected(SelectionEvent e) {
-                updateFieldsStatusSettings();
-                conf.setIvySettingsSetup(settingsEditor.getIvySettingsSetup());
-                settingsUpdated();
-            }
-        });
-
-        mainGeneralSettingsLink = new Link(headerComposite, SWT.NONE);
-        mainGeneralSettingsLink.setFont(headerComposite.getFont());
-        mainGeneralSettingsLink.setText("<A>Configure Workspace Settings...</A>");
-        mainGeneralSettingsLink.addSelectionListener(new SelectionAdapter() {
-            public void widgetSelected(SelectionEvent e) {
-                PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(),
-                    SettingsPreferencePage.PEREFERENCE_PAGE_ID, null, null);
-                dialog.open();
-            }
-        });
-        mainGeneralSettingsLink.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
-
-        Label horizontalLine = new Label(headerComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
-        horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
-
-        // CheckStyle:MagicNumber| OFF
-        Composite configComposite = new Composite(composite, SWT.NONE);
-        configComposite.setLayout(new GridLayout(3, false));
-        configComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
-
-        settingsEditor = new SettingsEditor(configComposite, SWT.NONE);
-        settingsEditor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 3, 1));
-        settingsEditor.addListener(new SettingsEditorListener() {
-            public void settingsEditorUpdated(IvySettingsSetup setup) {
-                conf.setIvySettingsSetup(setup);
-                settingsUpdated();
-            }
-        });
-
-        return composite;
-    }
-
     private Control createRetrieveTab(Composite parent) {
         Composite composite = new Composite(parent, SWT.NONE);
         composite.setLayout(new GridLayout());
@@ -537,30 +492,13 @@ public class IvydeContainerPage extends 
         return composite;
     }
 
-    void settingsUpdated() {
-        try {
-            state.setIvySettingsLastModified(-1);
-            state.getIvy();
-            settingsEditor.setSettingsError(null);
-            checkIvyXmlPath();
-        } catch (IvyDEException e) {
-            settingsEditor.setSettingsError(e);
-        }
-    }
-
     private void loadFromConf() {
         ivyFilePathText.init(conf.getIvyXmlPath());
         confTableViewer.init(conf.getConfs());
 
         IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper();
 
-        if (conf.isSettingsProjectSpecific()) {
-            settingsProjectSpecificButton.setSelection(true);
-            settingsEditor.init(conf.getIvySettingsSetup());
-        } else {
-            settingsProjectSpecificButton.setSelection(false);
-            settingsEditor.init(helper.getIvySettingsSetup());
-        }
+        settingsTab.init(conf.isSettingsProjectSpecific(), conf.getIvySettingsSetup());
 
         if (conf.isRetrieveProjectSpecific()) {
             retrieveProjectSpecificButton.setSelection(true);
@@ -584,18 +522,11 @@ public class IvydeContainerPage extends 
             resolveBeforeLaunchCheck.setSelection(helper.isResolveBeforeLaunch());
         }
 
-        updateFieldsStatusSettings();
+        settingsTab.updateFieldsStatusSettings();
         updateFieldsStatusRetrieve();
         updateFieldsStatusAdvanced();
     }
 
-    void updateFieldsStatusSettings() {
-        boolean projectSpecific = settingsProjectSpecificButton.getSelection();
-        conf.setSettingsProjectSpecific(projectSpecific);
-        mainGeneralSettingsLink.setEnabled(!projectSpecific);
-        settingsEditor.setEnabled(projectSpecific);
-    }
-
     void updateFieldsStatusRetrieve() {
         boolean projectSpecific = retrieveProjectSpecificButton.getSelection();
         conf.setRetrieveProjectSpecific(projectSpecific);

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/StandaloneRetrieveSetup.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/StandaloneRetrieveSetup.java?rev=988023&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/StandaloneRetrieveSetup.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/StandaloneRetrieveSetup.java Mon Aug 23 08:09:38 2010
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.cpcontainer;
+
+public class StandaloneRetrieveSetup {
+
+    private String name = "";
+
+    private IvySettingsSetup ivySettingsSetup = new IvySettingsSetup();
+
+    private String ivyXmlPath = "";
+
+    private RetrieveSetup retrieveSetup = new RetrieveSetup();
+
+    private boolean isSettingsProjectSpecific;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public IvySettingsSetup getIvySettingsSetup() {
+        return ivySettingsSetup;
+    }
+
+    public void setIvySettingsSetup(IvySettingsSetup ivySettingsSetup) {
+        this.ivySettingsSetup = ivySettingsSetup;
+    }
+
+    public String getIvyXmlPath() {
+        return ivyXmlPath;
+    }
+
+    public void setIvyXmlPath(String ivyXmlPath) {
+        this.ivyXmlPath = ivyXmlPath;
+    }
+
+    public RetrieveSetup getRetrieveSetup() {
+        return retrieveSetup;
+    }
+
+    public void setRetrieveSetup(RetrieveSetup retrieveSetup) {
+        this.retrieveSetup = retrieveSetup;
+    }
+
+    public boolean isSettingProjectSpecific() {
+        return isSettingsProjectSpecific;
+    }
+    
+    public void setSettingsProjectSpecific(boolean isSettingsProjectSpecific) {
+        this.isSettingsProjectSpecific = isSettingsProjectSpecific;
+    }
+
+    public String toString() {
+        return name != null ? name : retrieveSetup.getRetrievePattern();
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/StandaloneRetrieveSetup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/StandaloneRetrieveSetup.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/StandaloneRetrieveSetup.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java?rev=988023&r1=988022&r2=988023&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java Mon Aug 23 08:09:38 2010
@@ -24,10 +24,10 @@ import java.util.List;
 import org.apache.ivyde.eclipse.IvyDEException;
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jface.fieldassist.DecoratedField;
 import org.eclipse.jface.fieldassist.FieldDecoration;
 import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
@@ -60,7 +60,7 @@ public class IvyFilePathText extends Com
 
     private IvyDEException ivyXmlError;
 
-    private final IJavaProject project;
+    private final IProject project;
 
     private final List listeners = new ArrayList();
 
@@ -68,7 +68,7 @@ public class IvyFilePathText extends Com
 
     private FieldDecoration errorDecoration;
 
-    public IvyFilePathText(Composite parent, int style, IJavaProject project) {
+    public IvyFilePathText(Composite parent, int style, IProject project) {
         super(parent, style);
         GridLayout layout = new GridLayout(2, false);
         layout.marginHeight = 0;

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvySettingsTab.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvySettingsTab.java?rev=988023&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvySettingsTab.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvySettingsTab.java Mon Aug 23 08:09:38 2010
@@ -0,0 +1,130 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.ui;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.cpcontainer.IvySettingsSetup;
+import org.apache.ivyde.eclipse.ui.SettingsEditor.SettingsEditorListener;
+import org.apache.ivyde.eclipse.ui.preferences.SettingsPreferencePage;
+import org.eclipse.jface.preference.PreferenceDialog;
+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;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+public class IvySettingsTab {
+
+    private Button settingsProjectSpecificButton;
+
+    private Link mainGeneralSettingsLink;
+
+    private SettingsEditor settingsEditor;
+
+    public IvySettingsTab(TabFolder tabs) {
+        TabItem settingsTab = new TabItem(tabs, SWT.NONE);
+        settingsTab.setText("Settings");
+        settingsTab.setControl(createSettingsTab(tabs));
+    }
+
+    private Control createSettingsTab(final Composite parent) {
+        Composite composite = new Composite(parent, SWT.NONE);
+        composite.setLayout(new GridLayout());
+        composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+
+        Composite headerComposite = new Composite(composite, SWT.NONE);
+        headerComposite.setLayout(new GridLayout(2, false));
+        headerComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+
+        settingsProjectSpecificButton = new Button(headerComposite, SWT.CHECK);
+        settingsProjectSpecificButton.setText("Enable project specific settings");
+        settingsProjectSpecificButton.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                updateFieldsStatusSettings();
+                settingsUpdated();
+            }
+        });
+
+        mainGeneralSettingsLink = new Link(headerComposite, SWT.NONE);
+        mainGeneralSettingsLink.setFont(headerComposite.getFont());
+        mainGeneralSettingsLink.setText("<A>Configure Workspace Settings...</A>");
+        mainGeneralSettingsLink.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(parent
+                        .getShell(), SettingsPreferencePage.PEREFERENCE_PAGE_ID, null, null);
+                dialog.open();
+            }
+        });
+        mainGeneralSettingsLink.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
+
+        Label horizontalLine = new Label(headerComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
+        horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
+
+        // CheckStyle:MagicNumber| OFF
+        Composite configComposite = new Composite(composite, SWT.NONE);
+        configComposite.setLayout(new GridLayout(3, false));
+        configComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+
+        settingsEditor = new SettingsEditor(configComposite, SWT.NONE);
+        settingsEditor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 3, 1));
+        settingsEditor.addListener(new SettingsEditorListener() {
+            public void settingsEditorUpdated(IvySettingsSetup setup) {
+                settingsUpdated();
+            }
+        });
+
+        return composite;
+    }
+
+    public void init(boolean isProjectSpecific, IvySettingsSetup setup) {
+        if (isProjectSpecific) {
+            settingsProjectSpecificButton.setSelection(true);
+            settingsEditor.init(setup);
+        } else {
+            settingsProjectSpecificButton.setSelection(false);
+            settingsEditor.init(IvyPlugin.getPreferenceStoreHelper().getIvySettingsSetup());
+        }
+    }
+
+    public boolean isProjectSpecific() {
+        return settingsProjectSpecificButton.getSelection();
+    }
+
+    public void updateFieldsStatusSettings() {
+        boolean projectSpecific = settingsProjectSpecificButton.getSelection();
+        mainGeneralSettingsLink.setEnabled(!projectSpecific);
+        settingsEditor.setEnabled(projectSpecific);
+    }
+
+    protected void settingsUpdated() {
+        // nothing to do
+    }
+
+    public SettingsEditor getSettingsEditor() {
+        return settingsEditor;
+    }
+
+}
\ No newline at end of file

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvySettingsTab.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvySettingsTab.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvySettingsTab.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/EditStandaloneRetrieveDialog.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/EditStandaloneRetrieveDialog.java?rev=988023&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/EditStandaloneRetrieveDialog.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/EditStandaloneRetrieveDialog.java Mon Aug 23 08:09:38 2010
@@ -0,0 +1,113 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.ui.preferences;
+
+import org.apache.ivyde.eclipse.cpcontainer.StandaloneRetrieveSetup;
+import org.apache.ivyde.eclipse.ui.IvyFilePathText;
+import org.apache.ivyde.eclipse.ui.IvySettingsTab;
+import org.apache.ivyde.eclipse.ui.RetrieveComposite;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+
+public class EditStandaloneRetrieveDialog extends Dialog {
+
+    private final IProject project;
+
+    private Text nameText;
+
+    private StandaloneRetrieveSetup retrieveSetup;
+
+    private IvyFilePathText ivyFilePathText;
+
+    private RetrieveComposite retrieveComposite;
+
+    private IvySettingsTab settingsTab;
+
+    protected EditStandaloneRetrieveDialog(Shell parentShell, IProject project,
+            StandaloneRetrieveSetup retrieveSetup) {
+        super(parentShell);
+        this.project = project;
+        this.retrieveSetup = retrieveSetup;
+    }
+
+    protected Control createDialogArea(Composite parent) {
+        TabFolder tabs = new TabFolder(parent, SWT.BORDER);
+
+        TabItem mainTab = new TabItem(tabs, SWT.NONE);
+        mainTab.setText("Main");
+        mainTab.setControl(createMainTab(tabs));
+
+        settingsTab = new IvySettingsTab(tabs) {
+            protected void settingsUpdated() {
+                super.settingsUpdated();
+            }
+        };
+
+        nameText.setText(retrieveSetup.getName());
+        settingsTab.init(retrieveSetup.isSettingProjectSpecific(),
+            retrieveSetup.getIvySettingsSetup());
+        ivyFilePathText.init(retrieveSetup.getIvyXmlPath());
+        retrieveComposite.init(retrieveSetup.getRetrieveSetup());
+
+        return tabs;
+    }
+
+    private Control createMainTab(Composite parent) {
+        Composite body = new Composite(parent, SWT.NONE);
+        body.setLayout(new GridLayout(1, false));
+
+        Composite nameComposite = new Composite(body, SWT.NONE);
+        nameComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        nameComposite.setLayout(new GridLayout(2, false));
+
+        Label nameLabel = new Label(nameComposite, SWT.NONE);
+        nameLabel.setText("Name: ");
+        nameLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
+
+        nameText = new Text(nameComposite, SWT.BORDER);
+        nameText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+
+        ivyFilePathText = new IvyFilePathText(parent, SWT.NONE, project);
+        ivyFilePathText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+
+        retrieveComposite = new RetrieveComposite(body, SWT.NONE);
+        retrieveComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+
+        return body;
+    }
+
+    public StandaloneRetrieveSetup getStandaloneRetrieveSetup() {
+        StandaloneRetrieveSetup setup = new StandaloneRetrieveSetup();
+        setup.setName(nameText.getText());
+        setup.setSettingsProjectSpecific(settingsTab.isProjectSpecific());
+        setup.setIvySettingsSetup(settingsTab.getSettingsEditor().getIvySettingsSetup());
+        setup.setIvyXmlPath(ivyFilePathText.getIvyFilePath());
+        setup.setRetrieveSetup(retrieveComposite.getRetrieveSetup());
+        return setup;
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/EditStandaloneRetrieveDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/EditStandaloneRetrieveDialog.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/EditStandaloneRetrieveDialog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEProjectPreferences.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEProjectPreferences.java?rev=988023&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEProjectPreferences.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEProjectPreferences.java Mon Aug 23 08:09:38 2010
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ivyde.eclipse.cpcontainer.StandaloneRetrieveSetup;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.window.Window;
+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;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.dialogs.PropertyPage;
+
+public class IvyDEProjectPreferences extends PropertyPage implements IWorkbenchPropertyPage {
+
+    private static final int NUM_COLUMNS = 3;
+
+    protected Control createContents(Composite parent) {
+        Composite composite = new Composite(parent, SWT.NONE);
+        composite.setLayout(new GridLayout(1, false));
+
+        Label label = new Label(parent, SWT.NONE);
+        label.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        label.setText("Retrieve list:");
+
+        final ListViewer listViewer = new ListViewer(composite);
+        listViewer.getList().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+        listViewer.setContentProvider(ArrayContentProvider.getInstance());
+        listViewer.setLabelProvider(new LabelProvider());
+
+        Composite buttons = new Composite(composite, SWT.NONE);
+        buttons.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        buttons.setLayout(new GridLayout(NUM_COLUMNS, false));
+
+        Composite empty = new Composite(buttons, SWT.NONE);
+        empty.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+
+        Button addButton = new Button(buttons, SWT.PUSH);
+        addButton.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, false));
+        addButton.setText("Add...");
+        addButton.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                StandaloneRetrieveSetup setup = new StandaloneRetrieveSetup();
+                EditStandaloneRetrieveDialog editDialog = new EditStandaloneRetrieveDialog(
+                        getShell(), (IProject) getElement(), setup);
+                if (editDialog.open() == Window.OK) {
+                    listViewer.add(editDialog.getStandaloneRetrieveSetup());
+                }
+            }
+        });
+
+        final Button removeButton = new Button(buttons, SWT.PUSH);
+        removeButton.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, false));
+        removeButton.setText("Remove...");
+        removeButton.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                boolean confirmed = MessageDialog.openConfirm(getShell(), "Delete retrieve setup",
+                    "Do you really want to delete the selected retrieve configuration ?");
+                if (confirmed) {
+                    Iterator it = ((IStructuredSelection) listViewer.getSelection()).iterator();
+                    while (it.hasNext()) {
+                        listViewer.remove(it.next());
+                    }
+                }
+            }
+        });
+
+        listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+            public void selectionChanged(SelectionChangedEvent event) {
+                removeButton.setEnabled(event.getSelection().isEmpty());
+            }
+        });
+
+        listViewer.addDoubleClickListener(new IDoubleClickListener() {
+            public void doubleClick(DoubleClickEvent event) {
+                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+                StandaloneRetrieveSetup setup = (StandaloneRetrieveSetup) selection
+                        .getFirstElement();
+                EditStandaloneRetrieveDialog editDialog = new EditStandaloneRetrieveDialog(
+                        getShell(), (IProject) getElement(), setup);
+                if (editDialog.open() == Window.OK) {
+                    listViewer.remove(setup);
+                    listViewer.add(editDialog.getStandaloneRetrieveSetup());
+                }
+            }
+        });
+
+        // TODO find a way to store this in the preference store...
+        getPreferenceStore().getString("StandaloneRetrieveSetup");
+        List/* <StandaloneRetrieveSetup> */retrieveSetups = new ArrayList();
+        listViewer.setInput(retrieveSetups);
+
+        return composite;
+    }
+
+    public boolean performOk() {
+        // TODO Auto-generated method stub
+        return true;
+    }
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEProjectPreferences.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEProjectPreferences.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEProjectPreferences.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/StandaloneRetrieveSerializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/StandaloneRetrieveSerializer.java?rev=988023&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/StandaloneRetrieveSerializer.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/StandaloneRetrieveSerializer.java Mon Aug 23 08:09:38 2010
@@ -0,0 +1,300 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.ui.preferences;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.ivyde.eclipse.cpcontainer.IvySettingsSetup;
+import org.apache.ivyde.eclipse.cpcontainer.RetrieveSetup;
+import org.apache.ivyde.eclipse.cpcontainer.StandaloneRetrieveSetup;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class StandaloneRetrieveSerializer {
+
+    private static final String ROOT = "setuplist";
+
+    private static final String SETUP = "setup";
+
+    private static final String SETUP_NAME = "name";
+
+    private static final String IVYSETTINGS = "ivysettings";
+
+    private static final String IVYSETTING_PATH = "path";
+
+    private static final String IVYSETTING_LOADONDEMAND = "loadondemand";
+
+    private static final String PROPERTYFILE = "propertyfile";
+
+    private static final String PROPERTYFILE_PATH = "path";
+
+    private static final String IVYXML = "ivyxml";
+
+    private static final String IVYXML_PATH = "path";
+
+    private static final String RETRIEVE = "retrieve";
+
+    private static final String RETRIEVE_SYNC = "sync";
+
+    private static final String RETRIEVE_TYPES = "types";
+
+    private static final String RETRIEVE_CONFS = "confs";
+
+    private static final String RETRIEVE_PATTERN = "pattern";
+
+    public void write(OutputStream out, List/* <StandaloneRetrieveSetup> */setuplist)
+            throws IOException {
+        try {
+            StreamResult result = new StreamResult(out);
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            Document document = builder.newDocument();
+
+            Node root = document.createElement(ROOT);
+            document.appendChild(root);
+
+            Iterator it = setuplist.iterator();
+            while (it.hasNext()) {
+                StandaloneRetrieveSetup setup = (StandaloneRetrieveSetup) it.next();
+
+                Node node = document.createElement(SETUP);
+                root.appendChild(node);
+                NamedNodeMap attributes = node.getAttributes();
+                Attr attr = document.createAttribute(SETUP_NAME);
+                attr.setValue(setup.getName());
+                attributes.setNamedItem(attr);
+
+                Node settingsNode = document.createElement(IVYSETTINGS);
+                node.appendChild(settingsNode);
+                writeIvySettingsSetup(document, settingsNode, setup.getIvySettingsSetup());
+
+                Node ivyxmlNode = document.createElement(IVYXML);
+                node.appendChild(ivyxmlNode);
+                writeIvyXmlPath(document, ivyxmlNode, setup.getIvyXmlPath());
+
+                Node retrieveNode = document.createElement(RETRIEVE);
+                node.appendChild(retrieveNode);
+                writeRetrieveSetup(document, retrieveNode, setup.getRetrieveSetup());
+            }
+
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+            transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+            DOMSource source = new DOMSource(document);
+
+            transformer.transform(source, result);
+
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (TransformerException e) {
+            if (e.getException() instanceof IOException) {
+                throw (IOException) e.getException();
+            }
+            throw new IOException(e.getMessage(), e);
+        }
+    }
+
+    private void writeIvySettingsSetup(Document document, Node settingsNode,
+            IvySettingsSetup ivySettingsSetup) {
+        NamedNodeMap attributes = settingsNode.getAttributes();
+
+        Attr attr = document.createAttribute(IVYSETTING_PATH);
+        attr.setValue(ivySettingsSetup.getRawIvySettingsPath());
+        attributes.setNamedItem(attr);
+
+        attr = document.createAttribute(IVYSETTING_LOADONDEMAND);
+        attr.setValue(Boolean.toString(ivySettingsSetup.isLoadSettingsOnDemand()));
+        attributes.setNamedItem(attr);
+
+        Iterator it = ivySettingsSetup.getRawPropertyFiles().iterator();
+        while (it.hasNext()) {
+            String file = (String) it.next();
+            Node pathNode = document.createElement(PROPERTYFILE);
+            settingsNode.appendChild(pathNode);
+            attributes = settingsNode.getAttributes();
+            attr = document.createAttribute(PROPERTYFILE_PATH);
+            attr.setValue(file);
+            attributes.setNamedItem(attr);
+        }
+    }
+
+    private void writeIvyXmlPath(Document document, Node ivyxmlNode, String ivyXmlPath) {
+        NamedNodeMap attributes = ivyxmlNode.getAttributes();
+        Attr attr = document.createAttribute(IVYXML_PATH);
+        attr.setValue(ivyXmlPath);
+        attributes.setNamedItem(attr);
+    }
+
+    private void writeRetrieveSetup(Document document, Node retrieveNode,
+            RetrieveSetup retrieveSetup) {
+        NamedNodeMap attributes = retrieveNode.getAttributes();
+
+        Attr attr = document.createAttribute(RETRIEVE_PATTERN);
+        attr.setValue(retrieveSetup.getRetrievePattern());
+        attributes.setNamedItem(attr);
+
+        attr = document.createAttribute(RETRIEVE_CONFS);
+        attr.setValue(retrieveSetup.getRetrieveConfs());
+        attributes.setNamedItem(attr);
+
+        attr = document.createAttribute(RETRIEVE_TYPES);
+        attr.setValue(retrieveSetup.getRetrieveTypes());
+        attributes.setNamedItem(attr);
+
+        attr = document.createAttribute(RETRIEVE_SYNC);
+        attr.setValue(Boolean.toString(retrieveSetup.isRetrieveSync()));
+        attributes.setNamedItem(attr);
+    }
+
+    public List/* <StandaloneRetrieveSetup> */read(InputStream in) throws IOException {
+        try {
+            InputSource source = new InputSource(in);
+
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder parser = factory.newDocumentBuilder();
+            Document document = parser.parse(source);
+
+            NodeList elements = document.getElementsByTagName(ROOT);
+
+            List/* <StandaloneRetrieveSetup> */setupList = new ArrayList();
+
+            int count = elements.getLength();
+            for (int i = 0; i != count; i++) {
+                Node node = elements.item(i);
+
+                StandaloneRetrieveSetup setup = new StandaloneRetrieveSetup();
+
+                NamedNodeMap attributes = node.getAttributes();
+                setup.setName(getAttribute(attributes, SETUP_NAME));
+
+                NodeList children = node.getChildNodes();
+                for (int j = 0; j != children.getLength(); j++) {
+                    Node item = children.item(j);
+                    if (item.getLocalName().equals(IVYSETTINGS)) {
+                        IvySettingsSetup ivySettingsSetup = readIvySettingsSetup(item);
+                        setup.setIvySettingsSetup(ivySettingsSetup);
+                    } else if (item.getLocalName().equals(IVYXML)) {
+                        String ivyXmlPath = readIvyXmlPath(item);
+                        setup.setIvyXmlPath(ivyXmlPath);
+                    } else if (item.getLocalName().equals(RETRIEVE)) {
+                        RetrieveSetup retrieveSetup = readRetrieveSetup(item);
+                        setup.setRetrieveSetup(retrieveSetup);
+                    }
+                }
+
+                setupList.add(setup);
+            }
+            return setupList;
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (SAXException e) {
+            Throwable t = e.getCause();
+            if (t instanceof IOException) {
+                throw (IOException) t;
+            } else if (t != null) {
+                throw new IOException(t.getMessage());
+            } else {
+                throw new IOException(e.getMessage());
+            }
+        }
+
+    }
+
+    private String getAttribute(NamedNodeMap attributes, String name) throws SAXException {
+        Node node = attributes.getNamedItem(name);
+        if (node == null) {
+            throw new SAXException("Attribute '" + name + "' not found");
+        }
+        return node.getNodeValue();
+    }
+
+    private IvySettingsSetup readIvySettingsSetup(Node node) throws SAXException {
+        NamedNodeMap attributes = node.getAttributes();
+
+        IvySettingsSetup ivySettingsSetup = new IvySettingsSetup();
+
+        String path = getAttribute(attributes, IVYSETTING_PATH);
+        ivySettingsSetup.setIvySettingsPath(path);
+
+        String loadOnDemand = getAttribute(attributes, IVYSETTING_LOADONDEMAND);
+        ivySettingsSetup.setLoadSettingsOnDemand(Boolean.valueOf(loadOnDemand).booleanValue());
+
+        List/* <String> */propertyFiles = new ArrayList();
+
+        NodeList children = node.getChildNodes();
+        for (int j = 0; j != children.getLength(); j++) {
+            Node item = children.item(j);
+            if (item.getLocalName().equals(PROPERTYFILE)) {
+                attributes = node.getAttributes();
+
+                path = getAttribute(attributes, PROPERTYFILE_PATH);
+                propertyFiles.add(path);
+            }
+        }
+
+        ivySettingsSetup.setPropertyFiles(propertyFiles);
+
+        return ivySettingsSetup;
+    }
+
+    private String readIvyXmlPath(Node node) throws SAXException {
+        NamedNodeMap attributes = node.getAttributes();
+        return getAttribute(attributes, IVYXML_PATH);
+    }
+
+    private RetrieveSetup readRetrieveSetup(Node node) throws SAXException {
+        NamedNodeMap attributes = node.getAttributes();
+
+        RetrieveSetup retrieveSetup = new RetrieveSetup();
+
+        String pattern = getAttribute(attributes, RETRIEVE_PATTERN);
+        retrieveSetup.setRetrievePattern(pattern);
+
+        String confs = getAttribute(attributes, RETRIEVE_CONFS);
+        retrieveSetup.setRetrieveConfs(confs);
+
+        String types = getAttribute(attributes, RETRIEVE_TYPES);
+        retrieveSetup.setRetrieveTypes(types);
+
+        String sync = getAttribute(attributes, RETRIEVE_SYNC);
+        retrieveSetup.setRetrieveSync(Boolean.valueOf(sync).booleanValue());
+
+        return retrieveSetup;
+    }
+
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/StandaloneRetrieveSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/StandaloneRetrieveSerializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/StandaloneRetrieveSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message