You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2005/10/05 23:29:38 UTC

svn commit: r295119 - /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DependencyWizard.java

Author: sppatel
Date: Wed Oct  5 14:29:35 2005
New Revision: 295119

URL: http://svn.apache.org/viewcvs?rev=295119&view=rev
Log:
edit support

Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DependencyWizard.java

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DependencyWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DependencyWizard.java?rev=295119&r1=295118&r2=295119&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DependencyWizard.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DependencyWizard.java Wed Oct  5 14:29:35 2005
@@ -114,20 +114,22 @@
      * @see org.eclipse.jface.wizard.IWizard#performFinish()
      */
     public boolean performFinish() {
-        
+
         boolean isNew = false;
-        
-        if (eObject == null) {            
+
+        if (eObject == null) {
             eObject = DeploymentFactory.eINSTANCE.createDependencyType();
-            ((EList) section.getPlan().eGet(section.getEReference())).add(eObject);
+            ((EList) section.getPlan().eGet(section.getEReference()))
+                    .add(eObject);
             isNew = true;
         }
-        
+
         DependencyType dt = (DependencyType) eObject;
-        
+
         if (uriButton.getSelection()) {
             dt.setUri(uriText.getText());
-            dt.eUnset(DeploymentPackage.eINSTANCE.getDependencyType_ArtifactId());
+            dt.eUnset(DeploymentPackage.eINSTANCE
+                    .getDependencyType_ArtifactId());
             dt.eUnset(DeploymentPackage.eINSTANCE.getDependencyType_GroupId());
             dt.eUnset(DeploymentPackage.eINSTANCE.getDependencyType_Version());
         } else {
@@ -136,7 +138,7 @@
             dt.setVersion(versionText.getText());
             dt.eUnset(DeploymentPackage.eINSTANCE.getDependencyType_Uri());
         }
-        
+
         String[] tableText = section.getTableText(eObject);
 
         if (isNew) {
@@ -202,7 +204,6 @@
             group.setLayout(layout);
 
             uriButton = new Button(group, SWT.LEFT | SWT.RADIO);
-            uriButton.setSelection(true);
             uriButton.setText(Messages.serverRepos);
             uriButton.setLayoutData(data);
 
@@ -214,7 +215,6 @@
             uriText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
 
             mavenButton = new Button(group, SWT.LEFT | SWT.RADIO);
-            mavenButton.setSelection(false);
             mavenButton.setText(Messages.mavenArtifact);
             mavenButton.setLayoutData(data);
 
@@ -240,13 +240,6 @@
             versionText = new Text(group, SWT.SINGLE | SWT.BORDER);
             versionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
 
-            groupIdLabel.setEnabled(false);
-            groupIdText.setEnabled(false);
-            artifactIdLabel.setEnabled(false);
-            artifactIdText.setEnabled(false);
-            versionLabel.setEnabled(false);
-            versionText.setEnabled(false);
-
             uriButton.addSelectionListener(new SelectionAdapter() {
                 public void widgetSelected(SelectionEvent e) {
                     if (uriButton.getSelection()) {
@@ -263,11 +256,58 @@
                 }
             });
 
+            if (eObject != null) {
+                if (eObject.eIsSet(DeploymentPackage.eINSTANCE
+                        .getDependencyType_Uri())) {
+                    uriButton.setSelection(true);
+                    uriText.setText(eObject
+                            .eGet(
+                                    DeploymentPackage.eINSTANCE
+                                            .getDependencyType_Uri())
+                            .toString());
+                } else {
+                    mavenButton.setSelection(true);
+                    if (eObject.eIsSet(DeploymentPackage.eINSTANCE
+                            .getDependencyType_ArtifactId())) {
+                        artifactIdText.setText(eObject.eGet(
+                                DeploymentPackage.eINSTANCE
+                                        .getDependencyType_ArtifactId())
+                                .toString());
+                    }
+                    if (eObject.eIsSet(DeploymentPackage.eINSTANCE
+                            .getDependencyType_GroupId())) {
+                        groupIdText.setText(eObject.eGet(
+                                DeploymentPackage.eINSTANCE
+                                        .getDependencyType_GroupId())
+                                .toString());
+                    }
+                    if (eObject.eIsSet(DeploymentPackage.eINSTANCE
+                            .getDependencyType_Version())) {
+                        versionText.setText(eObject.eGet(
+                                DeploymentPackage.eINSTANCE
+                                        .getDependencyType_Version())
+                                .toString());
+                    }
+                }
+            } else {
+                uriButton.setSelection(true);
+                uriLabel.setEnabled(true);
+                uriText.setEnabled(true);
+
+                mavenButton.setSelection(false);
+                groupIdLabel.setEnabled(false);
+                groupIdText.setEnabled(false);
+                artifactIdLabel.setEnabled(false);
+                artifactIdText.setEnabled(false);
+                versionLabel.setEnabled(false);
+                versionText.setEnabled(false);
+            }
+
             setControl(composite);
 
         }
     }
-    
+
     public GridData createLabelGridData() {
         GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
         gd.horizontalIndent = 20;