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 2012/08/17 01:40:46 UTC

svn commit: r1374104 - in /ant/ivy/ivyde/trunk: doc/release-notes.html org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/FileListEditor.java org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/PathEditorDialog.java

Author: hibou
Date: Thu Aug 16 23:40:46 2012
New Revision: 1374104

URL: http://svn.apache.org/viewvc?rev=1374104&view=rev
Log:
Make the path of the properties editable (simpler than remove and add again)

Modified:
    ant/ivy/ivyde/trunk/doc/release-notes.html
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/FileListEditor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/PathEditorDialog.java

Modified: ant/ivy/ivyde/trunk/doc/release-notes.html
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/doc/release-notes.html?rev=1374104&r1=1374103&r2=1374104&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/doc/release-notes.html (original)
+++ ant/ivy/ivyde/trunk/doc/release-notes.html Thu Aug 16 23:40:46 2012
@@ -131,6 +131,9 @@ List of changes since <a href="/ivy/ivyd
     <li>NEW: Add support for the OSGi access rules</li>
 </ul>
 <ul>
+    <li>IMPROVE: The properties file paths can now be edited</li>
+</ul>
+<ul>
     <li>FIX: org.eclipse.swt.SWTException: Invalid thread access with Eclipse Juno (IVYDE-313)</li>
     <li>FIX: Divide by zero during IvyDE resolve (IVYDE-312) (thanks to Joe Sortelli)</li>
     <li>FIX: Ivy report view stopped working on Linux (IVYDE-292)</li>

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/FileListEditor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/FileListEditor.java?rev=1374104&r1=1374103&r2=1374104&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/FileListEditor.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/FileListEditor.java Thu Aug 16 23:40:46 2012
@@ -43,6 +43,8 @@ public class FileListEditor extends Comp
 
     private List/* <String> */files = new ArrayList();
 
+    private Button edit;
+
     private Button add;
 
     private Button remove;
@@ -66,6 +68,7 @@ public class FileListEditor extends Comp
         filelist.setLabelProvider(new LabelProvider());
         filelist.addSelectionChangedListener(new ISelectionChangedListener() {
             public void selectionChanged(SelectionChangedEvent event) {
+                edit.setEnabled(!event.getSelection().isEmpty());
                 remove.setEnabled(!event.getSelection().isEmpty());
                 updateUpDownEnableButtons(true);
             }
@@ -80,6 +83,24 @@ public class FileListEditor extends Comp
         layout.marginWidth = 0;
         buttons.setLayout(layout);
 
+        edit = new Button(buttons, SWT.PUSH);
+        edit.setText("Edit");
+        edit.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
+        edit.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                PathEditorDialog dialog = new PathEditorDialog(getShell(), labelPopup, project,
+                        defaultExtension);
+                String selection = (String) ((IStructuredSelection) filelist.getSelection()).getFirstElement();
+                dialog.init(selection);
+                if (dialog.open() == Window.OK) {
+                    int i = getSelectedConfigurationIndex(selection);
+                    files.set(i, dialog.getFile());
+                    filelist.refresh();
+                    fileListUpdated();
+                }
+            }
+        });
+
         add = new Button(buttons, SWT.PUSH);
         add.setText("Add");
         add.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
@@ -88,11 +109,9 @@ public class FileListEditor extends Comp
                 PathEditorDialog dialog = new PathEditorDialog(getShell(), labelPopup, project,
                         defaultExtension);
                 if (dialog.open() == Window.OK) {
-                    if (!files.contains(dialog.getFile())) {
-                        files.add(dialog.getFile());
-                        filelist.refresh();
-                        fileListUpdated();
-                    }
+                    files.add(dialog.getFile());
+                    filelist.refresh();
+                    fileListUpdated();
                 }
             }
         });
@@ -107,6 +126,7 @@ public class FileListEditor extends Comp
                 filelist.refresh();
                 fileListUpdated();
                 remove.setEnabled(false);
+                edit.setEnabled(false);
             }
         });
 
@@ -144,6 +164,10 @@ public class FileListEditor extends Comp
     private int getSelectedConfigurationIndex() {
         IStructuredSelection selection = (IStructuredSelection) filelist.getSelection();
         String file = (String) selection.getFirstElement();
+        return getSelectedConfigurationIndex(file);
+    }
+
+    private int getSelectedConfigurationIndex(String file) {
         for (int i = 0; i < files.size(); i++) {
             if (files.get(i) == file) {
                 return i;
@@ -163,6 +187,7 @@ public class FileListEditor extends Comp
         this.files = files;
         filelist.setInput(files);
         remove.setEnabled(false);
+        edit.setEnabled(false);
     }
 
     protected void fileListUpdated() {
@@ -176,6 +201,7 @@ public class FileListEditor extends Comp
     public void setEnabled(boolean enabled) {
         super.setEnabled(enabled);
         filelist.getList().setEnabled(enabled);
+        edit.setEnabled(enabled && !filelist.getSelection().isEmpty());
         remove.setEnabled(enabled && !filelist.getSelection().isEmpty());
         add.setEnabled(enabled);
         updateUpDownEnableButtons(enabled);

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/PathEditorDialog.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/PathEditorDialog.java?rev=1374104&r1=1374103&r2=1374104&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/PathEditorDialog.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/PathEditorDialog.java Thu Aug 16 23:40:46 2012
@@ -37,6 +37,8 @@ public class PathEditorDialog extends Di
 
     private String file;
 
+    private String path;
+
     protected PathEditorDialog(Shell parentShell, String label, IProject project,
             String defaultExtension) {
         super(parentShell);
@@ -49,6 +51,9 @@ public class PathEditorDialog extends Di
     protected Control createDialogArea(Composite parent) {
         Control dialogArea = super.createDialogArea(parent);
         editor = new PathEditor((Composite) dialogArea, SWT.NONE, label, project, defaultExtension);
+        if (path != null) {
+            editor.getText().setText(path);
+        }
         GridData layoutData = new GridData(GridData.FILL, GridData.FILL, true, true);
         layoutData.widthHint = 500;
         editor.setLayoutData(layoutData);
@@ -59,7 +64,11 @@ public class PathEditorDialog extends Di
         file = editor.getText().getText();
         super.okPressed();
     }
-    
+
+    public void init(String path) {
+        this.path = path;
+    }
+
     public String getFile() {
         return file;
     }