geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r330594 - in /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui: sections/ wizards/
Date Thu, 03 Nov 2005 18:03:34 GMT
Author: sppatel
Date: Thu Nov  3 10:03:30 2005
New Revision: 330594

URL: http://svn.apache.org/viewcvs?rev=330594&view=rev
Log:
fix EReference as EAttribute issue

Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/DynamicTableSection.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/DynamicTableSection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/DynamicTableSection.java?rev=330594&r1=330593&r2=330594&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/DynamicTableSection.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/DynamicTableSection.java
Thu Nov  3 10:03:30 2005
@@ -255,6 +255,7 @@
 						dialog.open();
 						if (dialog.getReturnCode() == Dialog.OK) {
 							markDirty();
+							//TODO notify listeners
 						}
 					}
 				}
@@ -335,11 +336,11 @@
 	/**
 	 * @return
 	 */
-	abstract public EAttribute[] getTableColumnEAttributes();
+	abstract public EAttribute[] getTableColumnEAttributes();;
 
 	/**
 	 * @return
 	 */
-	abstract public Wizard getWizard();
+	abstract public Wizard getWizard();	
 
 }

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java?rev=330594&r1=330593&r2=330594&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/sections/SecuritySection.java
Thu Nov  3 10:03:30 2005
@@ -101,16 +101,14 @@
      * @return
      */
     public String[] getTableColumnNames() {
-        return new String[] { Messages.name, Messages.description };
+        return new String[] {Messages.name};
     }
 
     /**
      * @return
      */
     public EAttribute[] getTableColumnEAttributes() {
-        return new EAttribute[] {
-                SecurityPackage.eINSTANCE.getRoleType_RoleName(),
-                SecurityPackage.eINSTANCE.getDescriptionType_Lang() };
+        return new EAttribute[] {SecurityPackage.eINSTANCE.getRoleType_RoleName()};
     }
 
     /**
@@ -234,7 +232,7 @@
 
             if (!roleType.getDescription().isEmpty()) {
                 roleDescriptionText.setText(((DescriptionType) roleType
-                        .getDescription().get(0)).getLang());
+                        .getDescription().get(0)).getValue());
             } else {
             	roleDescriptionText.setText("");
             }

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java?rev=330594&r1=330593&r2=330594&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/DynamicAddEditWizard.java
Thu Nov  3 10:03:30 2005
@@ -18,6 +18,7 @@
 import org.apache.geronimo.ui.internal.GeronimoUIPlugin;
 import org.apache.geronimo.ui.sections.DynamicTableSection;
 import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAttribute;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.wizard.Wizard;
@@ -87,11 +88,8 @@
             ((EList) plan.eGet(section.getEReference())).add(eObject);
             isNew = true;
         }
-
-        for (int i = 0; i < section.getTableColumnEAttributes().length; i++) {
-            String value = page.textEntries[i].getText();
-            eObject.eSet(section.getTableColumnEAttributes()[i], value);
-        }
+        
+        processEAttributes(page);
 
         String[] tableText = section.getTableText(eObject);
 
@@ -113,6 +111,18 @@
         return true;
     }
 
+	public void processEAttributes(DynamicWizardPage page) {
+		for (int i = 0; i < section.getTableColumnEAttributes().length; i++) {
+            String value = page.textEntries[i].getText();
+            EAttribute attribute = section.getTableColumnEAttributes()[i];
+            if (attribute.getEContainingClass().equals(eObject.eClass())) {
+                eObject.eSet(attribute, value);
+            } else {
+            	//TODO
+            }
+        }
+	}
+
     /*
      * (non-Javadoc)
      * 
@@ -154,23 +164,14 @@
         }
 
         public void createControl(Composite parent) {
-            Composite composite = new Composite(parent, SWT.NULL);
-            GridLayout layout = new GridLayout();
-            layout.numColumns = 2;
-            composite.setLayout(layout);
-            GridData data = new GridData();
-            data.verticalAlignment = GridData.FILL;
-            data.horizontalAlignment = GridData.FILL;
-            data.widthHint = 300;
-            composite.setLayoutData(data);
-
+			Composite composite = createComposite(parent);
             for (int i = 0; i < section.getTableColumnNames().length; i++) {
                 Label label = new Label(composite, SWT.LEFT);
                 String columnName = section.getTableColumnNames()[i];
                 if(!columnName.endsWith(":"))
                     columnName = columnName.concat(":");
                 label.setText(columnName);
-                data = new GridData();
+                GridData data = new GridData();
                 data.horizontalAlignment = GridData.FILL;
                 label.setLayoutData(data);
 
@@ -190,11 +191,27 @@
                 }
                 textEntries[i] = text;
             }
-
-            setControl(composite);
-                        
+            
+            doCustom(composite);
+            setControl(composite);                                    
             textEntries[0].setFocus();
+        }
 
+		public Composite createComposite(Composite parent) {
+			Composite composite = new Composite(parent, SWT.NULL);
+            GridLayout layout = new GridLayout();
+            layout.numColumns = 2;
+            composite.setLayout(layout);
+            GridData data = new GridData();
+            data.verticalAlignment = GridData.FILL;
+            data.horizontalAlignment = GridData.FILL;
+            data.widthHint = 300;
+            composite.setLayoutData(data);
+			return composite;
+		}
+        
+        public void doCustom(Composite parent) {
+        	
         }
 
     }

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java?rev=330594&r1=330593&r2=330594&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.ui/src/org/apache/geronimo/ui/wizards/SecurityRoleWizard.java
Thu Nov  3 10:03:30 2005
@@ -24,10 +24,13 @@
 import org.apache.geronimo.xml.ns.security.SecurityFactory;
 import org.apache.geronimo.xml.ns.security.SecurityPackage;
 import org.apache.geronimo.xml.ns.security.SecurityType;
-import org.eclipse.emf.ecore.EAttribute;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
 
 public class SecurityRoleWizard extends DynamicAddEditWizard {
 
@@ -50,9 +53,58 @@
     public String getWizardFirstPageDescription() {
         return Messages.wizardPageDescription_SecurityRole;
     }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.wizard.IWizard#addPages()
+     */
+    public void addPages() {
+    	SecurityRoleWizardPage page = new SecurityRoleWizardPage("Page0");
+        page.setImageDescriptor(descriptor);
+        addPage(page);
+    }
+    
+    public class SecurityRoleWizardPage extends DynamicWizardPage {
+    	
+    	 Text descriptionText;
+    	 
+    	 public SecurityRoleWizardPage(String pageName) {
+             super(pageName);
+         }    	
+    	 
+    	 /* (non-Javadoc)
+    	 * @see org.apache.geronimo.ui.wizards.DynamicAddEditWizard.DynamicWizardPage#doCustom()
+    	 */
+    	public void doCustom(Composite parent) {    		 
+    		 Label label = new Label(parent, SWT.LEFT);
+             String columnName = Messages.description;
+             if(!columnName.endsWith(":"))
+                 columnName = columnName.concat(":");
+             label.setText(columnName);
+             GridData data = new GridData();
+             data.horizontalAlignment = GridData.FILL;
+             label.setLayoutData(data);
+
+             descriptionText = new Text(parent, SWT.SINGLE | SWT.BORDER);
+             data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+                     | GridData.VERTICAL_ALIGN_FILL);
+             data.grabExcessHorizontalSpace = true;
+             data.widthHint = 100;
+             descriptionText.setLayoutData(data);
+
+             if (eObject != null && eObject instanceof RoleType) {
+            	 RoleType roleType = (RoleType) eObject;
+            	 if(!roleType.getDescription().isEmpty()) {
+            		 DescriptionType desc = (DescriptionType) roleType.getDescription().get(0);
+            		 if(desc.eIsSet(SecurityPackage.eINSTANCE.getDescriptionType_Value())){
+            			 descriptionText.setText(desc.getValue());
+            		 }
+            	 }
+             }    		 
+    	}
+    }
 
     public boolean performFinish() {
-        DynamicWizardPage page = (DynamicWizardPage) getPages()[0];
+    	SecurityRoleWizardPage page = (SecurityRoleWizardPage) getPages()[0];
 
         boolean isNew = false;
 
@@ -80,27 +132,20 @@
             isNew = true;
         }
 
-        for (int i = 0; i < section.getTableColumnEAttributes().length; i++) {
-            String value = page.textEntries[i].getText();
-            EAttribute attribute = section.getTableColumnEAttributes()[i];
-            if (attribute.getEContainingClass().equals(eObject.eClass())) {
-                eObject.eSet(attribute, value);
-            } else {
-                if (attribute.getFeatureID() == SecurityPackage.DESCRIPTION_TYPE__LANG) {
-                    DescriptionType type = null;
-                    RoleType roleType = ((RoleType) eObject);
-                    if (roleType.getDescription().isEmpty()) {
-                        type = SecurityFactory.eINSTANCE
-                                .createDescriptionType();
-                        roleType.getDescription().add(type);
-                    } else {
-                        type = (DescriptionType) roleType.getDescription().get(
-                                0);
-                    }
-                    type.setLang(value);
-                }
-            }
+        processEAttributes(page);
+      
+        DescriptionType type = null;
+        RoleType roleType = ((RoleType) eObject);
+        if (roleType.getDescription().isEmpty()) {
+            type = SecurityFactory.eINSTANCE
+                    .createDescriptionType();
+            roleType.getDescription().add(type);
+        } else {
+            type = (DescriptionType) roleType.getDescription().get(
+                    0);
         }
+        type.setValue(page.descriptionText.getText());
+       
 
         String[] tableText = section.getTableText(eObject);
 



Mime
View raw message