You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2008/11/10 15:46:34 UTC

svn commit: r712668 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse: cpcontainer/ ui/

Author: hibou
Date: Mon Nov 10 06:46:34 2008
New Revision: 712668

URL: http://svn.apache.org/viewvc?rev=712668&view=rev
Log:
IVYDE-119: first setp towards UI refactoring, the extraction of some widgets

Added:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ConfTableViewer.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java   (with props)
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java   (with props)
Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
    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/IvydeContainerPage.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java?rev=712668&r1=712667&r2=712668&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java Mon Nov 10 06:46:34 2008
@@ -89,10 +89,9 @@
      * @throws MalformedURLException
      */
     public IvyClasspathContainer(IJavaProject javaProject, IPath path,
-            IClasspathEntry[] classpathEntries) throws MalformedURLException, ParseException,
-            IOException {
+            IClasspathEntry[] classpathEntries) throws IOException {
         this.path = path;
-        conf = new IvyClasspathContainerConfiguration(javaProject, path);
+        conf = new IvyClasspathContainerConfiguration(javaProject, path, false);
         this.classpathEntries = classpathEntries;
     }
 

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=712668&r1=712667&r2=712668&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 Nov 10 06:46:34 2008
@@ -99,6 +99,8 @@
 
     boolean confOk;
 
+    private final boolean editing;
+
     /**
      * Constructor
      * 
@@ -106,10 +108,15 @@
      *            the classpath container's Java project, <code>null</code> is not bind to a project
      * @param ivyXmlPath
      *            the path to the ivy.xml
+     * @param editing
+     *            if set to true, this bean will be used for edition purpose, so no need to trigger
+     *            UI notification about some errors in there
      */
-    public IvyClasspathContainerConfiguration(IJavaProject javaProject, String ivyXmlPath) {
+    public IvyClasspathContainerConfiguration(IJavaProject javaProject, String ivyXmlPath,
+            boolean editing) {
         this.javaProject = javaProject;
         this.ivyXmlPath = ivyXmlPath;
+        this.editing = editing;
     }
 
     /**
@@ -119,9 +126,13 @@
      *            the classpath container's Java project, <code>null</code> is not bind to a project
      * @param path
      *            the path of the classpath container
+     * @param editing
+     *            if set to true, this bean will be used for edition purpose, so no need to trigger
+     *            UI notification about some errors in there
      */
-    public IvyClasspathContainerConfiguration(IJavaProject javaProject, IPath path) {
+    public IvyClasspathContainerConfiguration(IJavaProject javaProject, IPath path, boolean editing) {
         this.javaProject = javaProject;
+        this.editing = editing;
         if (path.segmentCount() > 2) {
             loadV0(path);
         } else {
@@ -324,7 +335,7 @@
     }
 
     private void setConfStatus(IvyDEException e) {
-        if (confOk != (e == null)) {
+        if (!editing && confOk != (e == null)) {
             confOk = (e == null);
             IvyPlugin.getDefault().getContainerDecorator().statusChaged(this);
             if (e != null) {
@@ -337,7 +348,7 @@
     }
 
     public void setResolveStatus(IStatus status) {
-        if (javaProject != null) {
+        if (!editing && javaProject != null) {
             IFile ivyFile = javaProject.getProject().getFile(ivyXmlPath);
             if (!ivyFile.exists()) {
                 return;

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=712668&r1=712667&r2=712668&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 Nov 10 06:46:34 2008
@@ -17,76 +17,50 @@
  */
 package org.apache.ivyde.eclipse.cpcontainer;
 
-import java.io.File;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.ivy.core.module.descriptor.Configuration;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivyde.eclipse.IvyDEException;
 import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.ui.ConfTableViewer;
+import org.apache.ivyde.eclipse.ui.IvyFilePathText;
+import org.apache.ivyde.eclipse.ui.SettingsPathText;
+import org.apache.ivyde.eclipse.ui.IvyFilePathText.IvyXmlPathListener;
+import org.apache.ivyde.eclipse.ui.SettingsPathText.SettingsPathListener;
 import org.apache.ivyde.eclipse.ui.preferences.IvyDEPreferenceStoreHelper;
 import org.apache.ivyde.eclipse.ui.preferences.IvyPreferencePage;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaProject;
 import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
 import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
 import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
 import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.FileDialog;
 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.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
 import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceSorter;
 
 public class IvydeContainerPage extends NewElementWizardPage implements IClasspathContainerPage,
         IClasspathContainerPageExtension {
 
     private IJavaProject project;
 
-    private Text ivyFilePathText;
+    private IvyFilePathText ivyFilePathText;
 
-    private CheckboxTableViewer confTableViewer;
+    private ConfTableViewer confTableViewer;
 
-    private Text settingsText;
+    private SettingsPathText settingsText;
 
     private Text acceptedTypesText;
 
@@ -108,8 +82,6 @@
 
     private Button projectSpecificButton;
 
-    private Button browse;
-
     private Link generalSettingsLink;
 
     private Composite configComposite;
@@ -118,20 +90,8 @@
 
     private IClasspathEntry entry;
 
-    private ModuleDescriptor md;
-
     private Button retrieveSyncButton;
 
-    private ControlDecoration ivyFilePathTextDeco;
-
-    private IvyDEException ivyXmlError;
-
-    private Image errorDecoImage;
-
-    private ControlDecoration settingsTextDeco;
-
-    private IvyDEException settingsError;
-
     private TabItem mainTab;
 
     private TabFolder tabs;
@@ -147,7 +107,7 @@
 
     void checkCompleted() {
         String error;
-        if (ivyFilePathText.getText().length() == 0) {
+        if (ivyFilePathText.getIvyFilePath().length() == 0) {
             error = "Choose an ivy file";
         } else {
             error = null;
@@ -156,10 +116,23 @@
         setPageComplete(error == null);
     }
 
+    void checkIvyXmlPath() {
+        ModuleDescriptor md;
+        try {
+            md = conf.getModuleDescriptor();
+            ivyFilePathText.setIvyXmlError(null);
+        } catch (IvyDEException e) {
+            md = null;
+            ivyFilePathText.setIvyXmlError(e);
+        }
+        confTableViewer.setModuleDescriptor(md);
+        checkCompleted();
+    }
+
     public boolean finish() {
-        conf.confs = getSelectedConfigurations();
+        conf.confs = confTableViewer.getSelectedConfigurations();
         if (projectSpecificButton.getSelection()) {
-            conf.ivySettingsPath = settingsText.getText();
+            conf.ivySettingsPath = settingsText.getSettingsPath();
             conf.acceptedTypes = IvyClasspathUtil.split(acceptedTypesText.getText());
             conf.sourceTypes = IvyClasspathUtil.split(sourcesTypesText.getText());
             conf.javadocTypes = IvyClasspathUtil.split(javadocTypesText.getText());
@@ -183,33 +156,16 @@
 
     public void setSelection(IClasspathEntry entry) {
         if (entry == null) {
-            conf = new IvyClasspathContainerConfiguration(project, "ivy.xml");
+            conf = new IvyClasspathContainerConfiguration(project, "ivy.xml", true);
         } else {
-            conf = new IvyClasspathContainerConfiguration(project, entry.getPath());
-        }
-    }
-
-    private List getSelectedConfigurations() {
-        Object[] confs = confTableViewer.getCheckedElements();
-        int total = confTableViewer.getTable().getItemCount();
-        if (confs.length == total) {
-            return Arrays.asList(new String[] {"*"});
-        }
-        List confList = new ArrayList();
-        for (int i = 0; i < confs.length; i++) {
-            Configuration c = (Configuration) confs[i];
-            confList.add(c.getName());
+            conf = new IvyClasspathContainerConfiguration(project, entry.getPath(), true);
         }
-        return confList;
     }
 
     public void createControl(Composite parent) {
         setTitle("IvyDE Managed Libraries");
         setDescription("Choose ivy file and its configurations.");
 
-        errorDecoImage = FieldDecorationRegistry.getDefault().getFieldDecoration(
-            FieldDecorationRegistry.DEC_ERROR).getImage();
-
         tabs = new TabFolder(parent, SWT.BORDER);
         tabs.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
 
@@ -219,14 +175,8 @@
 
         tabs.addSelectionListener(new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
-                TabItem item = tabs.getSelection()[0];
-                if (item == mainTab && ivyXmlError != null) {
-                    ivyFilePathTextDeco.showHoverText(ivyXmlError.getShortMsg());
-                    settingsTextDeco.showHoverText(null);
-                } else if (item == advancedTab && settingsError != null) {
-                    settingsTextDeco.showHoverText(settingsError.getShortMsg());
-                    ivyFilePathTextDeco.showHoverText(null);
-                }
+                ivyFilePathText.updateErrorMarker();
+                settingsText.updateErrorMarker();
             }
         });
 
@@ -237,62 +187,10 @@
         setControl(tabs);
 
         loadFromConf();
-        ivyXmlPathUpdated();
         checkCompleted();
         tabs.setFocus();
     }
 
-    private class BrowseButtonListener extends SelectionAdapter {
-        public void widgetSelected(SelectionEvent e) {
-            String path = null;
-            if (project != null) {
-                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(Display
-                        .getDefault().getActiveShell(), new WorkbenchLabelProvider(),
-                        new WorkbenchContentProvider());
-                dialog.setValidator(new ISelectionStatusValidator() {
-                    private final IStatus errorStatus = new Status(IStatus.ERROR, IvyPlugin.ID, 0,
-                            "", null);
-
-                    public IStatus validate(Object[] selection) {
-                        if (selection.length == 0) {
-                            return errorStatus;
-                        }
-                        for (int i = 0; i < selection.length; i++) {
-                            Object o = selection[i];
-                            if (!(o instanceof IFile)) {
-                                return errorStatus;
-                            }
-                        }
-                        return Status.OK_STATUS;
-                    }
-
-                });
-                dialog.setTitle("choose ivy file");
-                dialog.setMessage("choose the ivy file to use to resolve dependencies");
-                dialog.setInput(project.getProject());
-                dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
-
-                if (dialog.open() == Window.OK) {
-                    Object[] elements = dialog.getResult();
-                    if (elements.length > 0 && elements[0] instanceof IFile) {
-                        IPath p = ((IFile) elements[0]).getProjectRelativePath();
-                        path = p.toString();
-                    }
-                }
-            } else {
-                FileDialog dialog = new FileDialog(IvyPlugin.getActiveWorkbenchShell(), SWT.OPEN);
-                dialog.setText("Choose an ivy.xml");
-                path = dialog.open();
-            }
-
-            if (path != null) {
-                conf.ivyXmlPath = path;
-                ivyFilePathText.setText(path);
-                ivyXmlPathUpdated();
-            }
-        }
-    }
-
     private Control createMainTab(Composite parent) {
         Composite composite = new Composite(parent, SWT.NONE);
         composite.setLayout(new GridLayout(3, false));
@@ -302,128 +200,45 @@
         Label pathLabel = new Label(composite, SWT.NONE);
         pathLabel.setText("Ivy File");
 
-        ivyFilePathText = new Text(composite, SWT.SINGLE | SWT.BORDER);
-        ivyFilePathText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
-        ivyFilePathText.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent ev) {
-                conf.ivyXmlPath = ivyFilePathText.getText();
-                ivyXmlPathUpdated();
-            }
-        });
-        ivyFilePathTextDeco = new ControlDecoration(ivyFilePathText, SWT.LEFT | SWT.TOP);
-        ivyFilePathTextDeco.setMarginWidth(2);
-        ivyFilePathTextDeco.setImage(errorDecoImage);
-        ivyFilePathTextDeco.hide();
-        ivyFilePathTextDeco.addSelectionListener(new SelectionAdapter() {
-            public void widgetSelected(SelectionEvent e) {
-                if (ivyXmlError != null) {
-                    ivyXmlError.show(IStatus.ERROR, "IvyDE configuration problem", null);
-                }
+        ivyFilePathText = new IvyFilePathText(composite, SWT.NONE, project);
+        ivyFilePathText.addListener(new IvyXmlPathListener() {
+            public void ivyXmlPathUpdated(String path) {
+                conf.ivyXmlPath = path;
+                checkIvyXmlPath();
             }
         });
-
-        Button btn = new Button(composite, SWT.NONE);
-        btn.setText("Browse");
-        btn.addSelectionListener(new BrowseButtonListener());
+        ivyFilePathText
+                .setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
 
         // Label for ivy configurations field
         Label confLabel = new Label(composite, SWT.NONE);
         confLabel.setText("Configurations");
 
         // table for configuration selection
-        confTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.H_SCROLL
-                | SWT.V_SCROLL);
-        confTableViewer.getTable().setHeaderVisible(true);
-        TableColumn col1 = new TableColumn(confTableViewer.getTable(), SWT.NONE);
-        col1.setText("Name");
-        col1.setWidth(100);
-        TableColumn col2 = new TableColumn(confTableViewer.getTable(), SWT.NONE);
-        col2.setText("Description");
-        col2.setWidth(300);
-        confTableViewer.setColumnProperties(new String[] {"Name", "Description"});
-        confTableViewer.getTable().setLayoutData(
-            new GridData(GridData.FILL, GridData.FILL, true, true));
-        confTableViewer.setContentProvider(new IStructuredContentProvider() {
-            public Object[] getElements(Object inputElement) {
-                if (md != null) {
-                    return md.getConfigurations();
-                }
-                return new Configuration[0];
-            }
-
-            public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-                // nothing to do
-            }
-
-            public void dispose() {
-                // nothing to do
-            }
-        });
-        confTableViewer.setLabelProvider(new ConfigurationLabelProvider());
-        confTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-            public void selectionChanged(SelectionChangedEvent event) {
-                checkCompleted();
-            }
-        });
+        confTableViewer = new ConfTableViewer(composite, SWT.NONE);
+        confTableViewer.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
 
         // refresh
         Button refreshConf = new Button(composite, SWT.NONE);
+        refreshConf.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
         refreshConf.setText("Refresh");
         refreshConf.addSelectionListener(new SelectionAdapter() {
             public void widgetSelected(SelectionEvent ev) {
+                ModuleDescriptor md;
                 try {
                     md = conf.getModuleDescriptor();
                 } catch (IvyDEException e) {
+                    md = null;
                     e.show(IStatus.ERROR, "Ivy configuration error",
                         "The configurations of the ivy.xml could not be retrieved: ");
                 }
-                confTableViewer.setInput(ivyFilePathText.getText());
-            }
-        });
-
-        // some spacer
-        new Composite(composite, SWT.NONE);
-
-        Link select = new Link(composite, SWT.PUSH);
-        select.setText("<A>All</A>/<A>None</A>");
-        select.addSelectionListener(new SelectionAdapter() {
-            public void widgetSelected(SelectionEvent e) {
-                if (e.text.equals("All") && md != null) {
-                    confTableViewer.setCheckedElements(md.getConfigurations());
-                } else {
-                    confTableViewer.setCheckedElements(new Configuration[0]);
-                }
+                confTableViewer.setModuleDescriptor(md);
             }
         });
 
         return composite;
     }
 
-    void ivyXmlPathUpdated() {
-        try {
-            md = conf.getModuleDescriptor();
-            setIvyXmlError(null);
-        } catch (IvyDEException e) {
-            md = null;
-            setIvyXmlError(e);
-        }
-        checkCompleted();
-    }
-
-    void setIvyXmlError(IvyDEException error) {
-        if (error == null) {
-            ivyXmlError = null;
-            ivyFilePathTextDeco.hide();
-            ivyFilePathTextDeco.hideHover();
-        } else if (!error.equals(ivyXmlError)) {
-            ivyXmlError = error;
-            ivyFilePathTextDeco.show();
-            if (ivyFilePathText.isVisible()) {
-                ivyFilePathTextDeco.showHoverText(error.getShortMsg());
-            }
-        }
-    }
-
     private Control createAdvancedTab(Composite parent) {
         Composite composite = new Composite(parent, SWT.NONE);
         composite.setLayout(new GridLayout());
@@ -438,7 +253,7 @@
         projectSpecificButton.addSelectionListener(new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
                 updateFieldsStatus();
-                conf.ivySettingsPath = settingsText.getText();
+                conf.ivySettingsPath = settingsText.getSettingsPath();
                 settingsUpdated();
             }
         });
@@ -465,47 +280,14 @@
         Label label = new Label(configComposite, SWT.NONE);
         label.setText("Ivy settings path:");
 
-        settingsText = new Text(configComposite, SWT.SINGLE | SWT.BORDER);
-        settingsText.setToolTipText("The url where your ivysettings file can be found. \n"
-                + "Use 'default' to reference the default ivy settings. \n"
-                + "Relative paths are handled relative to the project."
-                + " Example: 'file://./ivysettings.xml'.");
-        settingsText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
-        settingsText.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
-                conf.ivySettingsPath = settingsText.getText();
+        settingsText = new SettingsPathText(configComposite, SWT.NONE);
+        settingsText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
+        settingsText.addListener(new SettingsPathListener() {
+            public void settingsPathUpdated(String path) {
+                conf.ivySettingsPath = path;
                 settingsUpdated();
             }
         });
-        settingsTextDeco = new ControlDecoration(settingsText, SWT.LEFT | SWT.TOP);
-        settingsTextDeco.setMarginWidth(2);
-        settingsTextDeco.setImage(errorDecoImage);
-        settingsTextDeco.hide();
-        settingsTextDeco.addSelectionListener(new SelectionAdapter() {
-            public void widgetSelected(SelectionEvent e) {
-                if (settingsError != null) {
-                    settingsError.show(IStatus.ERROR, "IvyDE configuration problem", null);
-                }
-            }
-        });
-
-        browse = new Button(configComposite, SWT.NONE);
-        browse.setText("Browse");
-        browse.addSelectionListener(new SelectionAdapter() {
-            public void widgetSelected(SelectionEvent e) {
-                File f = getFile(new File("/"));
-                if (f != null) {
-                    try {
-                        settingsText.setText(f.toURL().toExternalForm());
-                        settingsUpdated();
-                    } catch (MalformedURLException ex) {
-                        // this cannot happen
-                        IvyPlugin.log(IStatus.ERROR,
-                            "The file got from the file browser has not a valid URL", ex);
-                    }
-                }
-            }
-        });
 
         label = new Label(configComposite, SWT.NONE);
         label.setText("Accepted types:");
@@ -591,8 +373,7 @@
         alphaOrderCheck = new Combo(configComposite, SWT.READ_ONLY);
         alphaOrderCheck
                 .setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
-        alphaOrderCheck
-                .setToolTipText("Order of the artifacts in the classpath container");
+        alphaOrderCheck.setToolTipText("Order of the artifacts in the classpath container");
         alphaOrderCheck.add("From the ivy.xml");
         alphaOrderCheck.add("Lexical");
 
@@ -610,37 +391,20 @@
         try {
             conf.ivySettingsLastModified = -1;
             conf.getIvy();
-            setSettingsError(null);
+            settingsText.setSettingsError(null);
         } catch (IvyDEException e) {
-            md = null;
-            setSettingsError(e);
-        }
-        ivyXmlPathUpdated();
-    }
-
-    void setSettingsError(IvyDEException error) {
-        if (error == null) {
-            settingsError = null;
-            settingsTextDeco.hide();
-            settingsTextDeco.hideHover();
-        } else if (!error.equals(settingsError)) {
-            settingsError = error;
-            settingsTextDeco.show();
-            if (settingsText.isVisible()) {
-                settingsTextDeco.showHoverText(error.getShortMsg());
-            }
+            settingsText.setSettingsError(e);
         }
+        checkIvyXmlPath();
     }
 
     private void loadFromConf() {
-        ivyFilePathText.setText(conf.ivyXmlPath);
-
-        confTableViewer.setInput(conf.ivyXmlPath);
-        initTableSelection();
+        ivyFilePathText.init(conf.ivyXmlPath);
+        confTableViewer.init(conf.confs);
 
         if (conf.isProjectSpecific()) {
             projectSpecificButton.setSelection(true);
-            settingsText.setText(conf.ivySettingsPath);
+            settingsText.init(conf.ivySettingsPath);
             acceptedTypesText.setText(IvyClasspathUtil.concat(conf.acceptedTypes));
             sourcesTypesText.setText(IvyClasspathUtil.concat(conf.sourceTypes));
             sourcesSuffixesText.setText(IvyClasspathUtil.concat(conf.sourceSuffixes));
@@ -654,7 +418,7 @@
         } else {
             projectSpecificButton.setSelection(false);
             IvyDEPreferenceStoreHelper helper = IvyPlugin.getPreferenceStoreHelper();
-            settingsText.setText(helper.getIvySettingsPath());
+            settingsText.init(helper.getIvySettingsPath());
             acceptedTypesText.setText(IvyClasspathUtil.concat(helper.getAcceptedTypes()));
             sourcesTypesText.setText(IvyClasspathUtil.concat(helper.getSourceTypes()));
             sourcesSuffixesText.setText(IvyClasspathUtil.concat(helper.getSourceSuffixes()));
@@ -687,63 +451,8 @@
         resolveInWorkspaceCheck.setEnabled(projectSpecific);
     }
 
-    File getFile(File startingDirectory) {
-        FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
-        if (startingDirectory != null) {
-            dialog.setFileName(startingDirectory.getPath());
-        }
-        dialog.setFilterExtensions(new String[] {"*.xml", "*"});
-        String file = dialog.open();
-        if (file != null) {
-            file = file.trim();
-            if (file.length() > 0) {
-                return new File(file);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * @param ivyFile
-     */
-    private void initTableSelection() {
-        if (md != null) {
-            Configuration[] configurations = md.getConfigurations();
-            if ("*".equals(conf.confs.get(0))) {
-                confTableViewer.setCheckedElements(configurations);
-            } else {
-                for (int i = 0; i < conf.confs.size(); i++) {
-                    Configuration configuration = md.getConfiguration((String) conf.confs.get(i));
-                    if (configuration != null) {
-                        confTableViewer.setChecked(configuration, true);
-                    }
-                }
-            }
-        }
-    }
-
     public void initialize(IJavaProject p, IClasspathEntry[] currentEntries) {
         this.project = p;
     }
 
-    void refreshConfigurationTable() {
-        if (confTableViewer.getInput() == null
-                || !confTableViewer.getInput().equals(ivyFilePathText.getText())) {
-            confTableViewer.setInput(ivyFilePathText.getText());
-        }
-    }
-
-    static class ConfigurationLabelProvider extends LabelProvider implements ITableLabelProvider {
-
-        public Image getColumnImage(Object element, int columnIndex) {
-            return null;
-        }
-
-        public String getColumnText(Object element, int columnIndex) {
-            if (columnIndex == 0) {
-                return ((Configuration) element).getName();
-            }
-            return ((Configuration) element).getDescription();
-        }
-    }
 }

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ConfTableViewer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ConfTableViewer.java?rev=712668&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ConfTableViewer.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ConfTableViewer.java Mon Nov 10 06:46:34 2008
@@ -0,0 +1,148 @@
+/*
+ *  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 java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.ivy.core.module.descriptor.Configuration;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.TableColumn;
+
+public class ConfTableViewer extends Composite {
+
+    private CheckboxTableViewer confTableViewer;
+
+    private ModuleDescriptor md;
+
+    public ConfTableViewer(Composite parent, int style) {
+        super(parent, style);
+        GridLayout layout = new GridLayout();
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        setLayout(layout);
+
+        confTableViewer = CheckboxTableViewer.newCheckList(this, SWT.BORDER | SWT.H_SCROLL
+                | SWT.V_SCROLL);
+        confTableViewer.getTable().setHeaderVisible(true);
+        confTableViewer.getTable().setLayoutData(
+            new GridData(GridData.FILL, GridData.FILL, true, true));
+        TableColumn col1 = new TableColumn(confTableViewer.getTable(), SWT.NONE);
+        col1.setText("Name");
+        col1.setWidth(100);
+        TableColumn col2 = new TableColumn(confTableViewer.getTable(), SWT.NONE);
+        col2.setText("Description");
+        col2.setWidth(300);
+        confTableViewer.setColumnProperties(new String[] {"Name", "Description"});
+        confTableViewer.getTable().setLayoutData(
+            new GridData(GridData.FILL, GridData.FILL, true, true));
+        confTableViewer.setContentProvider(new IStructuredContentProvider() {
+            public Object[] getElements(Object inputElement) {
+                if (md != null) {
+                    return md.getConfigurations();
+                }
+                return new Configuration[0];
+            }
+
+            public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+                // nothing to do
+            }
+
+            public void dispose() {
+                // nothing to do
+            }
+        });
+        confTableViewer.setLabelProvider(new ConfigurationLabelProvider());
+
+        Link select = new Link(this, SWT.PUSH);
+        select.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        select.setText("<A>All</A>/<A>None</A>");
+        select.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (e.text.equals("All") && md != null) {
+                    confTableViewer.setCheckedElements(md.getConfigurations());
+                } else {
+                    confTableViewer.setCheckedElements(new Configuration[0]);
+                }
+            }
+        });
+    }
+
+    public void setModuleDescriptor(ModuleDescriptor md) {
+        this.md = md;
+        confTableViewer.setInput(md);
+    }
+
+    public void init(List/* <String> */confs) {
+        if (md != null) {
+            Configuration[] configurations = md.getConfigurations();
+            if ("*".equals(confs.get(0))) {
+                confTableViewer.setCheckedElements(configurations);
+            } else {
+                for (int i = 0; i < confs.size(); i++) {
+                    Configuration configuration = md.getConfiguration((String) confs.get(i));
+                    if (configuration != null) {
+                        confTableViewer.setChecked(configuration, true);
+                    }
+                }
+            }
+        }
+    }
+
+    public List getSelectedConfigurations() {
+        Object[] confs = confTableViewer.getCheckedElements();
+        int total = confTableViewer.getTable().getItemCount();
+        if (confs.length == total) {
+            return Arrays.asList(new String[] {"*"});
+        }
+        List confList = new ArrayList();
+        for (int i = 0; i < confs.length; i++) {
+            Configuration c = (Configuration) confs[i];
+            confList.add(c.getName());
+        }
+        return confList;
+    }
+
+    static class ConfigurationLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+        public Image getColumnImage(Object element, int columnIndex) {
+            return null;
+        }
+
+        public String getColumnText(Object element, int columnIndex) {
+            if (columnIndex == 0) {
+                return ((Configuration) element).getName();
+            }
+            return ((Configuration) element).getDescription();
+        }
+    }
+}

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

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

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

Added: 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=712668&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/IvyFilePathText.java Mon Nov 10 06:46:34 2008
@@ -0,0 +1,205 @@
+/*
+ *  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 java.util.ArrayList;
+import java.util.Iterator;
+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.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.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+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.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.views.navigator.ResourceSorter;
+
+public class IvyFilePathText extends Composite {
+
+    private Text ivyFilePathText;
+
+    private ControlDecoration ivyFilePathTextDeco;
+
+    private IvyDEException ivyXmlError;
+
+    private final IJavaProject project;
+
+    private final List listeners = new ArrayList();
+
+    public IvyFilePathText(Composite parent, int style, IJavaProject project) {
+        super(parent, style);
+        GridLayout layout = new GridLayout(2, false);
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        setLayout(layout);
+        this.project = project;
+
+        Image errorDecoImage = FieldDecorationRegistry.getDefault().getFieldDecoration(
+            FieldDecorationRegistry.DEC_ERROR).getImage();
+
+        ivyFilePathText = new Text(this, SWT.SINGLE | SWT.BORDER);
+        ivyFilePathText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        ivyFilePathText.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent ev) {
+                ivyXmlPathUpdated();
+            }
+        });
+        ivyFilePathTextDeco = new ControlDecoration(ivyFilePathText, SWT.LEFT | SWT.TOP);
+        ivyFilePathTextDeco.setMarginWidth(2);
+        ivyFilePathTextDeco.setImage(errorDecoImage);
+        ivyFilePathTextDeco.hide();
+        ivyFilePathTextDeco.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (ivyXmlError != null) {
+                    ivyXmlError.show(IStatus.ERROR, "IvyDE configuration problem", null);
+                }
+            }
+        });
+
+        Button btn = new Button(this, SWT.NONE);
+        btn.setText("Browse");
+        btn.addSelectionListener(new BrowseButtonListener());
+    }
+
+    public interface IvyXmlPathListener {
+        void ivyXmlPathUpdated(String path);
+    }
+
+    public void addListener(IvyXmlPathListener listener) {
+        synchronized (listeners) {
+            listeners.add(listener);
+        }
+    }
+
+    public void remodeListener(IvyXmlPathListener listener) {
+        synchronized (listeners) {
+            listeners.remove(listener);
+        }
+    }
+
+    public String getIvyFilePath() {
+        return ivyFilePathText.getText();
+    }
+
+    void ivyXmlPathUpdated() {
+        synchronized (listeners) {
+            Iterator it = listeners.iterator();
+            while (it.hasNext()) {
+                ((IvyXmlPathListener) it.next()).ivyXmlPathUpdated(ivyFilePathText.getText());
+            }
+        }
+    }
+
+    public void setIvyXmlError(IvyDEException error) {
+        if (error == null) {
+            ivyXmlError = null;
+            ivyFilePathTextDeco.hide();
+            ivyFilePathTextDeco.hideHover();
+        } else if (!error.equals(ivyXmlError)) {
+            ivyXmlError = error;
+            ivyFilePathTextDeco.show();
+            if (ivyFilePathText.isVisible()) {
+                ivyFilePathTextDeco.showHoverText(error.getShortMsg());
+            }
+        }
+    }
+
+    public void updateErrorMarker() {
+        if (isVisible() && ivyXmlError != null) {
+            ivyFilePathTextDeco.showHoverText(ivyXmlError.getShortMsg());
+        } else {
+            ivyFilePathTextDeco.hideHover();
+        }
+    }
+
+    private class BrowseButtonListener extends SelectionAdapter {
+        public void widgetSelected(SelectionEvent e) {
+            String path = null;
+            if (project != null) {
+                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(Display
+                        .getDefault().getActiveShell(), new WorkbenchLabelProvider(),
+                        new WorkbenchContentProvider());
+                dialog.setValidator(new ISelectionStatusValidator() {
+                    private final IStatus errorStatus = new Status(IStatus.ERROR, IvyPlugin.ID, 0,
+                            "", null);
+
+                    public IStatus validate(Object[] selection) {
+                        if (selection.length == 0) {
+                            return errorStatus;
+                        }
+                        for (int i = 0; i < selection.length; i++) {
+                            Object o = selection[i];
+                            if (!(o instanceof IFile)) {
+                                return errorStatus;
+                            }
+                        }
+                        return Status.OK_STATUS;
+                    }
+
+                });
+                dialog.setTitle("choose ivy file");
+                dialog.setMessage("choose the ivy file to use to resolve dependencies");
+                dialog.setInput(project.getProject());
+                dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
+
+                if (dialog.open() == Window.OK) {
+                    Object[] elements = dialog.getResult();
+                    if (elements.length > 0 && elements[0] instanceof IFile) {
+                        IPath p = ((IFile) elements[0]).getProjectRelativePath();
+                        path = p.toString();
+                    }
+                }
+            } else {
+                FileDialog dialog = new FileDialog(IvyPlugin.getActiveWorkbenchShell(), SWT.OPEN);
+                dialog.setText("Choose an ivy.xml");
+                path = dialog.open();
+            }
+
+            if (path != null) {
+                ivyFilePathText.setText(path);
+                ivyXmlPathUpdated();
+            }
+        }
+    }
+
+    public void init(String ivyXmlPath) {
+        ivyFilePathText.setText(ivyXmlPath);
+    }
+
+}

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

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

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

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java?rev=712668&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java Mon Nov 10 06:46:34 2008
@@ -0,0 +1,177 @@
+/*
+ *  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 java.io.File;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ivyde.eclipse.IvyDEException;
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+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.FileDialog;
+import org.eclipse.swt.widgets.Text;
+
+public class SettingsPathText extends Composite {
+
+    private Text settingsText;
+
+    private ControlDecoration settingsTextDeco;
+
+    private final List listeners = new ArrayList();
+
+    private IvyDEException settingsError;
+
+    public SettingsPathText(Composite parent, int style) {
+        super(parent, style);
+        GridLayout layout = new GridLayout(2, false);
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        setLayout(layout);
+
+        Image errorDecoImage = FieldDecorationRegistry.getDefault().getFieldDecoration(
+            FieldDecorationRegistry.DEC_ERROR).getImage();
+
+        settingsText = new Text(this, SWT.SINGLE | SWT.BORDER);
+        settingsText.setToolTipText("The url where your ivysettings file can be found. \n"
+                + "Use 'default' to reference the default ivy settings. \n"
+                + "Relative paths are handled relative to the project."
+                + " Example: 'file://./ivysettings.xml'.");
+        settingsText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        settingsText.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                settingsPathUpdated();
+            }
+        });
+        settingsTextDeco = new ControlDecoration(settingsText, SWT.LEFT | SWT.TOP);
+        settingsTextDeco.setMarginWidth(2);
+        settingsTextDeco.setImage(errorDecoImage);
+        settingsTextDeco.hide();
+        settingsTextDeco.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (settingsError != null) {
+                    settingsError.show(IStatus.ERROR, "IvyDE configuration problem", null);
+                }
+            }
+        });
+
+        Button browse = new Button(this, SWT.NONE);
+        browse.setText("Browse");
+        browse.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                File f = getFile(new File("/"));
+                if (f != null) {
+                    try {
+                        settingsText.setText(f.toURL().toExternalForm());
+                        settingsPathUpdated();
+                    } catch (MalformedURLException ex) {
+                        // this cannot happen
+                        IvyPlugin.log(IStatus.ERROR,
+                            "The file got from the file browser has not a valid URL", ex);
+                    }
+                }
+            }
+        });
+    }
+
+    public String getSettingsPath() {
+        return settingsText.getText();
+    }
+
+    public interface SettingsPathListener {
+        void settingsPathUpdated(String path);
+    }
+
+    public void addListener(SettingsPathListener listener) {
+        synchronized (listeners) {
+            listeners.add(listener);
+        }
+    }
+
+    public void remodeListener(SettingsPathListener listener) {
+        synchronized (listeners) {
+            listeners.remove(listener);
+        }
+    }
+
+    void settingsPathUpdated() {
+        synchronized (listeners) {
+            Iterator it = listeners.iterator();
+            while (it.hasNext()) {
+                ((SettingsPathListener) it.next()).settingsPathUpdated(settingsText.getText());
+            }
+        }
+    }
+
+    public void setSettingsError(IvyDEException error) {
+        if (error == null) {
+            settingsError = null;
+            settingsTextDeco.hide();
+            settingsTextDeco.hideHover();
+        } else if (!error.equals(settingsError)) {
+            settingsError = error;
+            settingsTextDeco.show();
+            if (settingsText.isVisible()) {
+                settingsTextDeco.showHoverText(error.getShortMsg());
+            }
+        }
+    }
+
+    public void updateErrorMarker() {
+        if (isVisible() && settingsError != null) {
+            settingsTextDeco.showHoverText(settingsError.getShortMsg());
+        } else {
+            settingsTextDeco.hideHover();
+        }
+    }
+
+    File getFile(File startingDirectory) {
+        FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
+        if (startingDirectory != null) {
+            dialog.setFileName(startingDirectory.getPath());
+        }
+        dialog.setFilterExtensions(new String[] {"*.xml", "*"});
+        String file = dialog.open();
+        if (file != null) {
+            file = file.trim();
+            if (file.length() > 0) {
+                return new File(file);
+            }
+        }
+        return null;
+    }
+
+    public void init(String ivySettingsPath) {
+        settingsText.setText(ivySettingsPath);
+    }
+
+}

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

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

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