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 23:43:48 UTC

svn commit: r712858 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse: cpcontainer/IvydeContainerPage.java ui/ConfTableViewer.java ui/IvyFilePathText.java ui/RetrieveComposite.java ui/SettingsPathText.java

Author: hibou
Date: Mon Nov 10 14:43:47 2008
New Revision: 712858

URL: http://svn.apache.org/viewvc?rev=712858&view=rev
Log:
IVYDE-119:
 - extraction of the retrieve configuration widget
 - make the "enable" propagated

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

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=712858&r1=712857&r2=712858&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 14:43:47 2008
@@ -22,6 +22,7 @@
 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.RetrieveComposite;
 import org.apache.ivyde.eclipse.ui.SettingsPathText;
 import org.apache.ivyde.eclipse.ui.IvyFilePathText.IvyXmlPathListener;
 import org.apache.ivyde.eclipse.ui.SettingsPathText.SettingsPathListener;
@@ -72,10 +73,6 @@
 
     private Text javadocSuffixesText;
 
-    private Button doRetrieveButton;
-
-    private Text retrievePatternText;
-
     private Combo alphaOrderCheck;
 
     private Button resolveInWorkspaceCheck;
@@ -90,14 +87,14 @@
 
     private IClasspathEntry entry;
 
-    private Button retrieveSyncButton;
-
     private TabItem mainTab;
 
     private TabFolder tabs;
 
     private TabItem advancedTab;
 
+    private RetrieveComposite retrieveComposite;
+
     /**
      * Constructor
      */
@@ -138,9 +135,9 @@
             conf.javadocTypes = IvyClasspathUtil.split(javadocTypesText.getText());
             conf.sourceSuffixes = IvyClasspathUtil.split(sourcesSuffixesText.getText());
             conf.javadocSuffixes = IvyClasspathUtil.split(javadocSuffixesText.getText());
-            conf.doRetrieve = doRetrieveButton.getSelection();
-            conf.retrievePattern = retrievePatternText.getText();
-            conf.retrieveSync = retrieveSyncButton.getSelection();
+            conf.doRetrieve = retrieveComposite.isRetrieveEnabled();
+            conf.retrievePattern = retrieveComposite.getRetrievePattern();
+            conf.retrieveSync = retrieveComposite.isSyncEnabled();
             conf.alphaOrder = alphaOrderCheck.getSelectionIndex() == 1;
             conf.resolveInWorkspace = resolveInWorkspaceCheck.getSelection();
         } else {
@@ -338,36 +335,11 @@
                 .setToolTipText("Comma separated list of suffixes to match javadocs to artifacts.\n"
                         + "Example: -javadoc, -doc");
 
-        doRetrieveButton = new Button(configComposite, SWT.CHECK);
-        doRetrieveButton.setText("Do retrieve after resolve");
-        doRetrieveButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 3,
+        retrieveComposite = new RetrieveComposite(configComposite, SWT.NONE);
+        retrieveComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 3,
                 1));
 
         label = new Label(configComposite, SWT.NONE);
-        label.setText("Retrieve pattern:");
-
-        retrievePatternText = new Text(configComposite, SWT.SINGLE | SWT.BORDER);
-        retrievePatternText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false,
-                2, 1));
-        retrievePatternText.setEnabled(doRetrieveButton.getSelection());
-        retrievePatternText.setToolTipText("Example: lib/[conf]/[artifact].[ext]\n"
-                + "To copy artifacts in folder named lib without revision by folder"
-                + " named like configurations");
-
-        retrieveSyncButton = new Button(configComposite, SWT.CHECK);
-        retrieveSyncButton.setText("Delete old retrieved artifacts");
-        retrieveSyncButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,
-                3, 1));
-        retrieveSyncButton.setEnabled(doRetrieveButton.getSelection());
-
-        doRetrieveButton.addSelectionListener(new SelectionAdapter() {
-            public void widgetSelected(SelectionEvent e) {
-                retrievePatternText.setEnabled(doRetrieveButton.getSelection());
-                retrieveSyncButton.setEnabled(doRetrieveButton.getSelection());
-            }
-        });
-
-        label = new Label(configComposite, SWT.NONE);
         label.setText("Order of the classpath entries:");
 
         alphaOrderCheck = new Combo(configComposite, SWT.READ_ONLY);
@@ -410,9 +382,7 @@
             sourcesSuffixesText.setText(IvyClasspathUtil.concat(conf.sourceSuffixes));
             javadocTypesText.setText(IvyClasspathUtil.concat(conf.javadocTypes));
             javadocSuffixesText.setText(IvyClasspathUtil.concat(conf.javadocSuffixes));
-            doRetrieveButton.setSelection(conf.doRetrieve);
-            retrievePatternText.setText(conf.retrievePattern);
-            retrieveSyncButton.setSelection(conf.retrieveSync);
+            retrieveComposite.init(conf.doRetrieve, conf.retrievePattern, conf.retrieveSync);
             alphaOrderCheck.select(conf.alphaOrder ? 1 : 0);
             resolveInWorkspaceCheck.setSelection(this.conf.resolveInWorkspace);
         } else {
@@ -424,9 +394,7 @@
             sourcesSuffixesText.setText(IvyClasspathUtil.concat(helper.getSourceSuffixes()));
             javadocTypesText.setText(IvyClasspathUtil.concat(helper.getJavadocTypes()));
             javadocSuffixesText.setText(IvyClasspathUtil.concat(helper.getJavadocSuffixes()));
-            doRetrieveButton.setSelection(helper.getDoRetrieve());
-            retrievePatternText.setText(helper.getRetrievePattern());
-            retrieveSyncButton.setSelection(helper.getRetrieveSync());
+            retrieveComposite.init(helper.getDoRetrieve(), helper.getRetrievePattern(), helper.getRetrieveSync());
             alphaOrderCheck.select(helper.isAlphOrder() ? 1 : 0);
             resolveInWorkspaceCheck.setSelection(helper.isResolveInWorkspace());
         }
@@ -444,9 +412,8 @@
         sourcesSuffixesText.setEnabled(projectSpecific);
         javadocTypesText.setEnabled(projectSpecific);
         javadocSuffixesText.setEnabled(projectSpecific);
-        doRetrieveButton.setEnabled(projectSpecific);
-        retrievePatternText.setEnabled(doRetrieveButton.getSelection() && projectSpecific);
-        retrieveSyncButton.setEnabled(doRetrieveButton.getSelection() && projectSpecific);
+        retrieveComposite.setEnabled(projectSpecific);
+        retrieveComposite.setEnabled(projectSpecific);
         alphaOrderCheck.setEnabled(projectSpecific);
         resolveInWorkspaceCheck.setEnabled(projectSpecific);
     }

Modified: 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=712858&r1=712857&r2=712858&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ConfTableViewer.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ConfTableViewer.java Mon Nov 10 14:43:47 2008
@@ -44,6 +44,8 @@
 
     private ModuleDescriptor md;
 
+    private Link select;
+
     public ConfTableViewer(Composite parent, int style) {
         super(parent, style);
         GridLayout layout = new GridLayout();
@@ -83,7 +85,7 @@
         });
         confTableViewer.setLabelProvider(new ConfigurationLabelProvider());
 
-        Link select = new Link(this, SWT.PUSH);
+        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() {
@@ -145,4 +147,10 @@
             return ((Configuration) element).getDescription();
         }
     }
+
+    public void setEnabled(boolean enabled) {
+        super.setEnabled(enabled);
+        confTableViewer.getTable().setEnabled(enabled);
+        select.setEnabled(enabled);
+    }
 }

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=712858&r1=712857&r2=712858&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 Nov 10 14:43:47 2008
@@ -62,6 +62,8 @@
 
     private final List listeners = new ArrayList();
 
+    private Button browseButton;
+
     public IvyFilePathText(Composite parent, int style, IJavaProject project) {
         super(parent, style);
         GridLayout layout = new GridLayout(2, false);
@@ -92,9 +94,9 @@
             }
         });
 
-        Button btn = new Button(this, SWT.NONE);
-        btn.setText("Browse");
-        btn.addSelectionListener(new BrowseButtonListener());
+        browseButton = new Button(this, SWT.NONE);
+        browseButton.setText("Browse");
+        browseButton.addSelectionListener(new BrowseButtonListener());
     }
 
     public interface IvyXmlPathListener {
@@ -202,4 +204,9 @@
         ivyFilePathText.setText(ivyXmlPath);
     }
 
+    public void setEnabled(boolean enabled) {
+        super.setEnabled(enabled);
+        ivyFilePathText.setEnabled(enabled);
+        browseButton.setEnabled(enabled);
+    }
 }

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java?rev=712858&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java (added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/RetrieveComposite.java Mon Nov 10 14:43:47 2008
@@ -0,0 +1,98 @@
+/*
+ *  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.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.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class RetrieveComposite extends Composite {
+
+    private Button doRetrieveButton;
+
+    private Text retrievePatternText;
+
+    private Button retrieveSyncButton;
+
+    public RetrieveComposite(Composite parent, int style) {
+        super(parent, style);
+        GridLayout layout = new GridLayout(2, false);
+        layout.marginHeight = 0;
+        layout.marginWidth = 0;
+        setLayout(layout);
+
+        doRetrieveButton = new Button(this, SWT.CHECK);
+        doRetrieveButton.setText("Do retrieve after resolve");
+        doRetrieveButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 2,
+                1));
+
+        Label label = new Label(this, SWT.NONE);
+        label.setText("Retrieve pattern:");
+
+        retrievePatternText = new Text(this, SWT.SINGLE | SWT.BORDER);
+        retrievePatternText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+        retrievePatternText.setEnabled(doRetrieveButton.getSelection());
+        retrievePatternText.setToolTipText("Example: lib/[conf]/[artifact].[ext]\n"
+                + "To copy artifacts in folder named lib without revision by folder"
+                + " named like configurations");
+
+        retrieveSyncButton = new Button(this, SWT.CHECK);
+        retrieveSyncButton.setText("Delete old retrieved artifacts");
+        retrieveSyncButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false,
+                2, 1));
+        retrieveSyncButton.setEnabled(doRetrieveButton.getSelection());
+
+        doRetrieveButton.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                retrievePatternText.setEnabled(doRetrieveButton.getSelection());
+                retrieveSyncButton.setEnabled(doRetrieveButton.getSelection());
+            }
+        });
+    }
+
+    public boolean isRetrieveEnabled() {
+        return doRetrieveButton.getSelection();
+    }
+
+    public boolean isSyncEnabled() {
+        return retrieveSyncButton.getSelection();
+    }
+
+    public String getRetrievePattern() {
+        return retrievePatternText.getText();
+    }
+
+    public void init(boolean doRetrieve, String retrievePattern, boolean retrieveSync) {
+        doRetrieveButton.setSelection(doRetrieve);
+        retrievePatternText.setText(retrievePattern);
+        retrieveSyncButton.setSelection(retrieveSync);
+    }
+
+    public void setEnabled(boolean enabled) {
+        super.setEnabled(enabled);
+        doRetrieveButton.setEnabled(enabled);
+        retrievePatternText.setEnabled(enabled);
+        retrieveSyncButton.setEnabled(enabled);
+    }
+}

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

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

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

Modified: 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=712858&r1=712857&r2=712858&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/SettingsPathText.java Mon Nov 10 14:43:47 2008
@@ -174,4 +174,8 @@
         settingsText.setText(ivySettingsPath);
     }
 
+    public void setEnabled(boolean enabled) {
+        super.setEnabled(enabled);
+        settingsText.setEnabled(enabled);
+    }
 }