geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r690385 [1/2] - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/ org.apache.geronimo....
Date Fri, 29 Aug 2008 20:43:48 GMT
Author: mcconne
Date: Fri Aug 29 13:43:47 2008
New Revision: 690385

URL: http://svn.apache.org/viewvc?rev=690385&view=rev
Log:
GERONIMODEVTOOLS-129 Enhanced Editor Support for specifying GBeans in all the deployment editors -- Thanks to Shiva for the original patch, and BJ Reed for enhancements!!

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingSection.java   (with props)
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingWizard.java   (with props)
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRunAsSubjectWizard.java   (with props)
Removed:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ImportSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingsSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyAddWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ImportWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingsAddWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingsEditWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRunAsSubjectAddWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRunAsSubjectEditWizard.java
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTreeSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractTableWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/SecurityPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DependencySection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/GBeanSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyWizard.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java Fri Aug 29 13:43:47 2008
@@ -29,7 +29,7 @@
     static {
         NLS.initializeMessages(Activator.PLUGIN_ID + ".internal.Messages", Messages.class);
     }
-	
+    
     public static String editorTabSource;
     
     public static String editorSectionSecurityTitle;
@@ -127,6 +127,7 @@
     public static String editorSecurityRealmName;
     public static String editorApplicationName;
     public static String editorCallbackHandler;
+    public static String editorDomainName;
     public static String editorRealmName;
     public static String editorSubjectId;
     public static String editorejbqlCompilerFactory;
@@ -239,6 +240,16 @@
     public static String wizardPageTitle_EjbLocalRef;
     public static String wizardPageDescription_EjbLocalRef;
     //
+    public static String wizardNewTitle_RoleMapping;
+    public static String wizardEditTitle_RoleMapping;
+    public static String wizardPageTitle_RoleMapping;
+    public static String wizardPageDescription_RoleMapping;
+    //
+    public static String wizardNewTitle_RunAsSubject;
+    public static String wizardEditTitle_RunAsSubject;
+    public static String wizardPageTitle_RunAsSubject;
+    public static String wizardPageDescription_RunAsSubject;
+    //
     public static String wizardNewTitle_Dependency;
     public static String wizardEditTitle_Dependency;
     public static String wizardPageTitle_Dependency;
@@ -251,6 +262,9 @@
     public static String artifactId;
     public static String version;
     public static String type;
+    public static String element;
+    public static String customName;
+    public static String value;
     public static String messageDestinationName;
     public static String adminModule;
     public static String adminLink;
@@ -294,7 +308,8 @@
     public static String securityRunAsSubjects;
     public static String securityRunAsSubjectRole;
     public static String securityRunAsSubjectRealm;
-    public static String securityRunAsSubjectId;    
+    public static String securityRunAsSubjectId;  
+    public static String securityRefreshRoles;
 
     public static String editorCorrect;
     public static String editorDefault;
@@ -327,10 +342,7 @@
     public static String web;
 
     public static String licenseAgreement;
-
     public static String acceptLicenseAgreement;
-
     public static String rejectLicenseAgreement;
-
     public static String confirmLicenseRejection;
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties Fri Aug 29 13:43:47 2008
@@ -103,6 +103,7 @@
 editorWorkDir=Working Directory:
 editorSecurityRealmName=Security Realm Name:
 editorCallbackHandler=Callback Handler:
+editorDomainName=Domain Name:
 editorRealmName=Realm Name:
 editorSubjectId=Subject Id:
 editorApplicationName=Application Name:
@@ -183,7 +184,7 @@
 wizardEditTitle_Dependency=Edit Dependency
 wizardPageTitle_Dependency=Dependency Details
 wizardPageDescription_Dependency=Provide details for this dependency.
-wizardTabManual_Dependency=Add Manually
+wizardTabManual_Dependency=Manual Input
 wizardTabServer_Dependency=Add From Server
 
 wizardNewTitle_Import=New Import
@@ -211,6 +212,21 @@
 wizardPageTitle_ExtModule=External Module Details
 wizardPageDescription_ExtModule=Provide details for this external module.
 
+wizardNewTitle_ServiceRef=New Service Reference
+wizardEditTitle_ServiceRef=Edit Service Reference
+wizardPageTitle_ServiceRef=Service Reference Details
+wizardPageDescription_ServiceRef=Provide details for this service reference.
+
+wizardNewTitle_RoleMapping=New Role Mapping
+wizardEditTitle_RoleMapping=Edit Role Mapping
+wizardPageTitle_RoleMapping=Role Mapping Details
+wizardPageDescription_RoleMapping=Provide details for this role mapping.
+
+wizardNewTitle_RunAsSubject=New Run As Subject
+wizardEditTitle_RunAsSubject=Edit Run As Subject
+wizardPageTitle_RunAsSubject=Run As Subject Details
+wizardPageDescription_RunAsSubject=Provide details for this run-as subject.
+
 securityCredentialStore=Credential Store:
 securityDefaultSubject=Default Subject:
 securityDefaultSubjectRealmName=Realm Name
@@ -221,12 +237,16 @@
 securityRunAsSubjectRole=Role
 securityRunAsSubjectRealm=Realm
 securityRunAsSubjectId=Id
+securityRefreshRoles=Refresh Roles from Deployment Descriptor/Annotations
 
 dependencyGroupLabel=Dependency type and location
 groupId=Group Id
 artifactId=Artifact Id
 version=Version
-type=Artifact Type
+type=Type
+element=Element
+customName=Custom Name
+value=Value
 
 messageDestinationName=Message Destination Name
 adminModule=Admin Module

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java Fri Aug 29 13:43:47 2008
@@ -199,7 +199,7 @@
         addButton = toolkit.createButton(buttonComp, CommonMessages.add, SWT.NONE);
         addButton.addSelectionListener(new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
-                Wizard wizard = getAddWizard();
+                Wizard wizard = getWizard();
                 if (wizard != null) {
                     WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
                     dialog.open();
@@ -219,7 +219,7 @@
             public void widgetSelected(SelectionEvent e) {
                 Object selectedObject = ((StructuredSelection) getViewer().getSelection()).getFirstElement();
                 if (selectedObject != null) {
-                    Wizard wizard = getEditWizard();
+                    Wizard wizard = getWizard();
                     if (wizard != null) {
                         if (wizard instanceof AbstractWizard) {
                             ((AbstractWizard) wizard).setEObject(selectedObject);
@@ -262,9 +262,7 @@
 
     abstract public String getDescription();
 
-    abstract public Wizard getAddWizard();
-
-    abstract public Wizard getEditWizard();
+    abstract protected Wizard getWizard();
 
     abstract public Class getTableEntryObjectType();
 

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java Fri Aug 29 13:43:47 2008
@@ -131,15 +131,5 @@
         button.setEnabled(selected);
     }
 
-    @Override
-    public Wizard getAddWizard() {
-        return getWizard();
-    }
-
-    @Override
-    public Wizard getEditWizard() {
-        return getWizard();
-    }
-
-    protected abstract Wizard getWizard();
+    abstract protected Wizard getWizard();
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTreeSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTreeSection.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTreeSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTreeSection.java Fri Aug 29 13:43:47 2008
@@ -82,7 +82,6 @@
     }
 
     protected void activateButton(Button button) {
-        boolean Selected = tree.getSelectionCount() > 0;
-        button.setEnabled(Selected);
+        button.setEnabled(tree.getSelectionCount() > 0);
     }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractTableWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractTableWizard.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractTableWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractTableWizard.java Fri Aug 29 13:43:47 2008
@@ -60,7 +60,7 @@
                 if (eObject != null) {
                     initialValue = (String) JAXBUtils.getValue(eObject, getTableColumnEAttributes()[i]);
                 }
-                textEntries[i] = createTextFeild(composite, initialValue);
+                textEntries[i] = createTextField(composite, initialValue);
             }
         }
 
@@ -111,15 +111,6 @@
         return getWizardFirstPageDescription();
     }
 
-    @Override
-    protected String getWizardWindowTitle() {
-        return getAddWizardWindowTitle();
-    }
-
-    public abstract String getAddWizardWindowTitle();
-
-    public abstract String getEditWizardWindowTitle();
-
     public abstract String getWizardFirstPageTitle();
 
     public abstract String getWizardFirstPageDescription();

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractWizard.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/wizards/AbstractWizard.java Fri Aug 29 13:43:47 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.geronimo.st.ui.wizards;
 
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
 import org.apache.geronimo.st.ui.Activator;
 import org.apache.geronimo.st.ui.sections.AbstractListSection;
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -41,11 +42,12 @@
     public AbstractWizard(AbstractListSection section) {
         super();
         this.section = section;
-        setWindowTitle(getWizardWindowTitle());
+        setWindowTitle(getAddWizardWindowTitle());
     }
 
     public void setEObject(Object object) {
         eObject = object;
+        setWindowTitle(getEditWizardWindowTitle());
     }
 
     public abstract class AbstractWizardPage extends WizardPage {
@@ -82,7 +84,7 @@
             return label;
         }
 
-        protected Text createTextFeild(Composite composite, String initialValue) {
+        protected Text createTextField(Composite composite, String initialValue) {
             Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
             GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
             data.grabExcessHorizontalSpace = true;
@@ -107,12 +109,14 @@
         }
     }
 
-    protected abstract String getWizardWindowTitle();
-
     protected abstract String getWizardPageTitle();
 
     protected abstract String getWizardPageDescription();
 
+    protected abstract String getAddWizardWindowTitle();
+
+    protected abstract String getEditWizardWindowTitle();
+    
     protected ImageDescriptor getImageDescriptor() {
         return Activator.imageDescriptorFromPlugin("org.apache.geronimo.ui", "icons/bigG.gif");
     }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java Fri Aug 29 13:43:47 2008
@@ -21,11 +21,13 @@
 import org.apache.geronimo.jee.application.Module;
 import org.apache.geronimo.jee.application.Path;
 import org.apache.geronimo.jee.deployment.Artifact;
+import org.apache.geronimo.jee.deployment.Attribute;
 import org.apache.geronimo.jee.deployment.ClassFilter;
 import org.apache.geronimo.jee.deployment.Dependencies;
 import org.apache.geronimo.jee.deployment.Dependency;
 import org.apache.geronimo.jee.deployment.Environment;
 import org.apache.geronimo.jee.deployment.Gbean;
+import org.apache.geronimo.jee.deployment.Reference;
 import org.apache.geronimo.jee.naming.EjbRef;
 import org.apache.geronimo.jee.naming.EjbLocalRef;
 import org.apache.geronimo.jee.naming.GbeanRef;
@@ -34,6 +36,10 @@
 import org.apache.geronimo.jee.naming.ResourceRef;
 import org.apache.geronimo.jee.naming.ServiceRef;
 import org.apache.geronimo.jee.security.Description;
+import org.apache.geronimo.jee.security.DistinguishedName;
+import org.apache.geronimo.jee.security.LoginDomainPrincipal;
+import org.apache.geronimo.jee.security.Principal;
+import org.apache.geronimo.jee.security.RealmPrincipal;
 import org.apache.geronimo.jee.security.RoleMappings;
 import org.apache.geronimo.jee.security.Role;
 import org.apache.geronimo.jee.security.Security;
@@ -78,6 +84,14 @@
             return (new org.apache.geronimo.jee.security.ObjectFactory()).createDescription();
         } else if ( type.equals( Role.class ) ) {
             return (new org.apache.geronimo.jee.security.ObjectFactory()).createRole();
+        } else if ( type.equals( DistinguishedName.class ) ) {
+            return (new org.apache.geronimo.jee.security.ObjectFactory()).createDistinguishedName();
+        } else if ( type.equals( Principal.class ) ) {
+            return (new org.apache.geronimo.jee.security.ObjectFactory()).createPrincipal();
+        } else if ( type.equals( LoginDomainPrincipal.class ) ) {
+            return (new org.apache.geronimo.jee.security.ObjectFactory()).createLoginDomainPrincipal();
+        } else if ( type.equals( RealmPrincipal.class ) ) {
+            return (new org.apache.geronimo.jee.security.ObjectFactory()).createRealmPrincipal();
         } else if ( type.equals( Gbean.class ) ) {
             return (new org.apache.geronimo.jee.deployment.ObjectFactory()).createGbean();
         } else if ( type.equals( Artifact.class ) ) {
@@ -92,6 +106,10 @@
             return (new org.apache.geronimo.jee.deployment.ObjectFactory()).createEnvironment();
         } else if ( type.equals( org.apache.geronimo.jee.deployment.Pattern.class ) ) {
             return (new org.apache.geronimo.jee.deployment.ObjectFactory()).createPattern();
+        } else if ( type.equals( Attribute.class ) ) {
+            return (new org.apache.geronimo.jee.deployment.ObjectFactory()).createAttribute();
+        } else if ( type.equals( Reference.class ) ) {
+            return (new org.apache.geronimo.jee.deployment.ObjectFactory()).createReference();
         } else if ( type.equals( ExtModule.class ) ) {
             return (new org.apache.geronimo.jee.application.ObjectFactory()).createExtModule();
         } else if ( type.equals( Module.class ) ) {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/SecurityPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/SecurityPage.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/SecurityPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/SecurityPage.java Fri Aug 29 13:43:47 2008
@@ -20,7 +20,7 @@
 import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
 import org.apache.geronimo.st.v21.core.GeronimoServerInfo;
 import org.apache.geronimo.st.v21.ui.sections.SecurityAdvancedSection;
-import org.apache.geronimo.st.v21.ui.sections.SecurityRoleMappingsSection;
+import org.apache.geronimo.st.v21.ui.sections.SecurityRoleMappingSection;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.ui.forms.IManagedForm;
 import org.eclipse.ui.forms.editor.FormEditor;
@@ -40,7 +40,7 @@
      * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
      */
     protected void fillBody(IManagedForm managedForm) {
-        managedForm.addPart(new SecurityRoleMappingsSection(getDeploymentPlan(), getDeploymentDescriptor(), body, toolkit, getStyle()));
+        managedForm.addPart(new SecurityRoleMappingSection(getDeploymentPlan(), getDeploymentDescriptor(), body, toolkit, getStyle()));
         managedForm.addPart(new SecurityAdvancedSection(getDeploymentPlan(), body, toolkit, getStyle()));
     }
 

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DependencySection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DependencySection.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DependencySection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DependencySection.java Fri Aug 29 13:43:47 2008
@@ -26,7 +26,6 @@
 import org.apache.geronimo.st.ui.CommonMessages;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.Activator;
-import org.apache.geronimo.st.v21.ui.wizards.DependencyAddWizard;
 import org.apache.geronimo.st.v21.ui.wizards.DependencyWizard;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.IContentProvider;
@@ -40,10 +39,9 @@
  */
 public class DependencySection extends AbstractTableSection {
 
+    boolean isServerEnvironment;
     protected Environment environment;
 
-    protected boolean isServerEnvironment;
-
     public DependencySection(JAXBElement plan, Environment environment, Composite parent, FormToolkit toolkit, int style) {
         this(plan, environment, parent, toolkit, style, true);
     }
@@ -53,7 +51,7 @@
         this.environment = environment;
         this.isServerEnvironment = isServerEnvironment; 
         this.COLUMN_NAMES = new String[] {
-                CommonMessages.groupId, CommonMessages.artifactId, CommonMessages.version, CommonMessages.type
+                CommonMessages.groupId, CommonMessages.artifactId, CommonMessages.version, CommonMessages.artifactType
         };
         createClient();
         getSection().setExpanded(false);
@@ -90,13 +88,8 @@
     }
 
     @Override
-    public Wizard getAddWizard() {
-        return new DependencyAddWizard(this);
-    }
-
-    @Override
     public Wizard getWizard() {
-        return new DependencyWizard(this, isServerEnvironment);
+        return new DependencyWizard(this);
     }
 
     public ImageDescriptor getImageDescriptor() {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java Fri Aug 29 13:43:47 2008
@@ -39,7 +39,7 @@
         this.objectContainer = extModules;
         COLUMN_NAMES = new String[] {
                 CommonMessages.moduleType, CommonMessages.path, CommonMessages.internalPath,
-                CommonMessages.groupId, CommonMessages.artifactId, CommonMessages.version, CommonMessages.type };
+                CommonMessages.groupId, CommonMessages.artifactId, CommonMessages.version, CommonMessages.artifactType };
         createClient();
     }
 

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/GBeanSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/GBeanSection.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/GBeanSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/GBeanSection.java Fri Aug 29 13:43:47 2008
@@ -16,65 +16,86 @@
  */
 package org.apache.geronimo.st.v21.ui.sections;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.deployment.Attribute;
 import org.apache.geronimo.jee.deployment.Gbean;
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.apache.geronimo.jee.deployment.Reference;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.sections.AbstractTableSection;
-import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.v21.ui.Activator;
 import org.apache.geronimo.st.v21.ui.wizards.GBeanWizard;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 
 /**
- * @version $Rev$ $Date$
+ * @version $Rev: 688452 $ $Date: 2008-08-24 01:56:20 -0400 (Sun, 24 Aug 2008) $
  */
-public class GBeanSection extends AbstractTableSection {
+public class GBeanSection extends AbstractTreeSection {
 
-    /**
-     * @param plan
-     * @param parent
-     * @param toolkit
-     * @param style
-     */
     public GBeanSection(JAXBElement plan, List gbeans, Composite parent, FormToolkit toolkit, int style) {
         super(plan, parent, toolkit, style);
         this.objectContainer = gbeans;
-        this.COLUMN_NAMES = new String[] {
-                CommonMessages.name, CommonMessages.className };
         createClient();
     }
 
+    @Override
     public String getTitle() {
         return CommonMessages.editorSectionGBeanTitle;
     }
 
+    @Override
     public String getDescription() {
         return CommonMessages.editorSectionGBeanDescription;
     }
 
-    public List getObjectContainer() {
-        //NOTE this is a list of JAXBElements of GBeans, not just GBeans
-        if (objectContainer == null) {
-            objectContainer = (List)JAXBObjectFactoryImpl.getInstance().create(List.class);
-        }
-        return objectContainer;
-    }
-
+    @Override
     public Wizard getWizard() {
         return new GBeanWizard(this);
     }
 
+    @Override
     public Class getTableEntryObjectType() {
         return Gbean.class;
     }
 
+    @Override
+    protected void activateAddButton() {
+        if (tree.getSelectionCount() == 0 || tree.getSelection()[0].getParentItem() == null) {
+            addButton.setEnabled(true);
+        } else {
+            addButton.setEnabled(false);
+        }
+    }
+
+    public Gbean getSelectedGbean () {
+        if (tree.getSelection().length == 0) {
+            return null;
+        }
+        return (Gbean)((JAXBElement)tree.getSelection()[0].getData()).getValue();
+    }
+    
+    @Override
+    public void removeItem(Object anItem) {
+        JAXBElement element =(JAXBElement)tree.getSelection()[0].getData(); 
+        Object object = element.getValue();
+        if (Gbean.class.isInstance(object)) {
+            objectContainer.remove(anItem);
+        }
+        else {
+            Gbean gbean = (Gbean)((JAXBElement)tree.getSelection()[0].getParentItem().getData()).getValue();
+            gbean.getAttributeOrXmlAttributeOrReference().remove(element);
+        }
+    }
+    
+    @Override
     public Object getInput() {
         if (objectContainer != null) {
             return objectContainer;
@@ -82,62 +103,78 @@
         return super.getInput();
     }
 
-    // overwrite this method.
-    // The item is a GBean and the list is a list of JAXBElements of GBean 
-    public void removeItem (Object anItem) {
-        JAXBElement element;
-        Gbean gbean, removeItem;
-        removeItem = (Gbean)anItem;
-        for (int i = 0; i < objectContainer.size(); i++)
-        {
-            element = (JAXBElement)objectContainer.get(i);
-            gbean = (Gbean)element.getValue();
-            if (removeItem.getName().equals(gbean.getName()) && 
-                removeItem.getClazz().equals(gbean.getClazz()))
-            {
-                getObjectContainer().remove(i);
-                return;
-            }
-        }
-    }
-
     @Override
-    public IContentProvider getContentProvider() {
+    public ITreeContentProvider getContentProvider() {
         return new ContentProvider() {
             @Override
             public Object[] getElements(Object inputElement) {
-                if (!List.class.isInstance(inputElement)) {
-                    return new String[] { "" };
+                return getChildren(inputElement);
+            }
+
+            @Override
+            public Object[] getChildren(Object parentElement) {
+                if (List.class.isInstance(parentElement)) {
+                    return ((List)parentElement).toArray();
                 }
-                // convert the list of JAXBElements into regular GBeans
-                List elementList = (List) inputElement;
-                ArrayList gbeanList = new ArrayList();
-                JAXBElement element;
-                Gbean gbean;
-                for (int i = 0; i < elementList.size(); i++) {
-                    element = (JAXBElement) elementList.get(i);
-                    gbean = (Gbean) element.getValue();
-                    gbeanList.add(gbean);
+                if (JAXBElement.class.isInstance(parentElement)) {
+                    Object object = ((JAXBElement)parentElement).getValue();
+                    if (Gbean.class.isInstance(object)) {
+                        Gbean gbean = (Gbean)object;
+                        return gbean.getAttributeOrXmlAttributeOrReference().toArray();
+                    }
                 }
-                return gbeanList.toArray();
+                return new String[] {};
             }
         };
     }
 
     @Override
-    public ITableLabelProvider getLabelProvider() {
+    public ILabelProvider getLabelProvider() {
         return new LabelProvider() {
             @Override
-            public String getColumnText(Object element, int columnIndex) {
-                if (Gbean.class.isInstance(element)) {
-                    Gbean gbean = (Gbean)element;
-                    switch (columnIndex) {
-                    case 0: return gbean.getName();
-                    case 1: return gbean.getClazz();
+            public String getText(Object element) {
+                if (JAXBElement.class.isInstance(element)) {
+                    Object object = ((JAXBElement)element).getValue();
+                    if (Gbean.class.isInstance(object)) {
+                        Gbean gbean = (Gbean)object;
+                        return "GBean: name = \"" + gbean.getName() +
+                                "\", class = \"" + gbean.getClazz() + "\"";
+                    }
+                    else if (Attribute.class.isInstance(object)) {
+                        Attribute attribute = (Attribute)object;
+                        return "Attribute: name = \"" + attribute.getName() + 
+                                "\", type = \"" + attribute.getType() + 
+                                "\", value = \"" + attribute.getValue() + "\"";
+                    }
+                    else if (Pattern.class.isInstance(object)) {
+                        Pattern dependency = (Pattern)object;
+                        return "Dependency: group = \"" + dependency.getGroupId() +
+                                "\", artifact = \"" + dependency.getArtifactId() +
+                                "\", version = \"" + dependency.getVersion() +
+                                "\", module = \"" + dependency.getModule() +
+                                "\", type = \"" + dependency.getType() +
+                                "\", custom name = \"" + dependency.getCustomFoo() + "\"";
+                    }
+                    else if (Reference.class.isInstance(object)) {
+                        Reference reference = (Reference)object;
+                        return "Reference: name = \"" + reference.getName() +
+                                "\", group = \"" + reference.getGroupId() +
+                                "\", artifact = \"" + reference.getArtifactId() +
+                                "\", version = \"" + reference.getVersion() +
+                                "\", module = \"" + reference.getModule() +
+                                "\", type = \"" + reference.getType() +
+                                "\", custom name = \"" + reference.getCustomFoo() + "\"";
                     }
                 }
+
                 return null;
             }
+
+            @Override
+            public Image getImage(Object arg0) {
+                return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee",
+                        "icons/full/obj16/security_role.gif").createImage();
+            }
         };
     }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java Fri Aug 29 13:43:47 2008
@@ -30,8 +30,7 @@
 import org.apache.geronimo.st.ui.CommonMessages;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.core.jaxb.JAXBModelUtils;
-import org.apache.geronimo.st.v21.ui.wizards.SecurityRunAsSubjectAddWizard;
-import org.apache.geronimo.st.v21.ui.wizards.SecurityRunAsSubjectEditWizard;
+import org.apache.geronimo.st.v21.ui.wizards.SecurityRunAsSubjectWizard;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.viewers.IBaseLabelProvider;
 import org.eclipse.jface.viewers.IContentProvider;
@@ -230,7 +229,7 @@
 
     @Override
     public Object getInput() {
-        return SecurityRoleMappingsSection.getRoleMappings(getPlan(), false);
+        return SecurityRoleMappingSection.getRoleMappings(getPlan(), false);
     }
 
     @Override
@@ -285,13 +284,8 @@
     }
 
     @Override
-    public Wizard getAddWizard() {
-        return new SecurityRunAsSubjectAddWizard(this);
-    }
-
-    @Override
     protected Wizard getWizard() {
-        return new SecurityRunAsSubjectEditWizard(this);
+        return new SecurityRunAsSubjectWizard(this);
     }
 
     @Override
@@ -305,7 +299,7 @@
     }
 
     public Role getRole(String roleName) {
-        List<Role> roles = SecurityRoleMappingsSection.getRoles(getPlan(), false);
+        List<Role> roles = SecurityRoleMappingSection.getRoles(getPlan(), false);
         for (int i = 0; i < roles.size(); i++) {
             Role role = roles.get(i);
             if (role.getRoleName().equals(roleName)) {
@@ -316,7 +310,7 @@
     }
 
     public String[] getRolesWithoutRunAsSubject() {
-        List<Role> roles = SecurityRoleMappingsSection.getRoles(getPlan(), false);
+        List<Role> roles = SecurityRoleMappingSection.getRoles(getPlan(), false);
         List<Role> rolesWithoutRunAsSubject = new ArrayList<Role>();
         for (int i = 0; i < roles.size(); i++) {
             Role role = roles.get(i);

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingSection.java?rev=690385&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingSection.java Fri Aug 29 13:43:47 2008
@@ -0,0 +1,288 @@
+/*
+ * 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.geronimo.st.v21.ui.sections;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.security.DistinguishedName;
+import org.apache.geronimo.jee.security.LoginDomainPrincipal;
+import org.apache.geronimo.jee.security.Principal;
+import org.apache.geronimo.jee.security.RealmPrincipal;
+import org.apache.geronimo.jee.security.Role;
+import org.apache.geronimo.jee.security.RoleMappings;
+import org.apache.geronimo.jee.security.Security;
+import org.apache.geronimo.st.core.descriptor.AbstractDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.ApplicationDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.EjbDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.WebDeploymentDescriptor;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.v21.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v21.ui.Activator;
+import org.apache.geronimo.st.v21.ui.wizards.SecurityRoleMappingWizard;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SecurityRoleMappingSection extends AbstractTreeSection {
+
+    public SecurityRoleMappingSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style) {
+        super(plan, parent, toolkit, style);
+        createClient();
+    }
+
+    public SecurityRoleMappingSection(JAXBElement plan, AbstractDeploymentDescriptor descriptor, Composite parent,
+            FormToolkit toolkit, int style) {
+        super(plan, descriptor, parent, toolkit, style);
+        createClient();
+    }
+
+    @Override
+    protected boolean isRequiredSyncToolbarAction() {
+        return true;
+    }
+
+    @Override
+    protected IAction getSyncAction() {
+        return new SyncAction(CommonMessages.securityRefreshRoles) {
+            @Override
+            public void run() {
+                if( addRolesFromDeploymentDescriptor() ) {
+                    markDirty();
+                }
+            }
+        };
+    }
+
+    @Override
+    protected void activateRemoveButton() {
+        if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() != null) {
+            removeButton.setEnabled(true);
+        } else {
+            removeButton.setEnabled(false);
+        }
+    }
+
+    @Override
+    protected void activateEditButton() {
+        if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() != null) {
+            editButton.setEnabled(true);
+        } else {
+            editButton.setEnabled(false);
+        }
+    }
+
+    @Override
+    protected void activateAddButton() {
+        if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() == null) {
+            addButton.setEnabled(true);
+        } else {
+            addButton.setEnabled(false);
+        }
+    }
+
+    @Override
+    public void handleDelete() {
+        TreeItem selectedItem = tree.getSelection()[0];
+        Object selectedObject = selectedItem.getData();
+        Role role = (Role) selectedItem.getParentItem().getData();
+        ((ArrayList) JAXBUtils.getValue(role, selectedObject.getClass().getSimpleName())).remove(selectedObject);
+    }
+
+    public Role getSelectedRoleDuringAdd() {
+        return (Role) tree.getSelection()[0].getData();
+    }
+
+    @Override
+    public String getTitle() {
+        return CommonMessages.editorSectionSecurityRolesTitle;
+    }
+
+    @Override
+    public String getDescription() {
+        return CommonMessages.editorSectionSecurityRolesDescription;
+    }
+
+    @Override
+    public Wizard getWizard() {
+        return new SecurityRoleMappingWizard(this);
+    }
+
+    @Override
+    public Class getTableEntryObjectType() {
+        return Role.class;
+    }
+
+    @Override
+    public List getObjectContainer() {
+        return getRoles(getPlan(), false);
+    }
+
+    public static List<Role> getRoles(JAXBElement plan, boolean create) {
+        RoleMappings roleMappings = getRoleMappings(plan, create);
+        if (roleMappings != null) {
+            return roleMappings.getRole();
+        }
+        return null;
+    }
+
+    public static RoleMappings getRoleMappings(JAXBElement plan, boolean create) {
+        Security security = JAXBModelUtils.getSecurity(plan);
+        if (security == null && create) {
+            security = new Security();
+            JAXBModelUtils.setSecurity(plan, security);
+        }
+        if (security != null) {
+            RoleMappings roleMappings = security.getRoleMappings();
+            if (roleMappings == null && create) {
+                roleMappings = new RoleMappings();
+                security.setRoleMappings(roleMappings);
+            }
+            return roleMappings;
+        }
+        return null;
+    }
+
+    protected boolean addRolesFromDeploymentDescriptor() {
+        List<String> declaredRoleNames = null;
+        if (WebDeploymentDescriptor.class.isInstance(getDescriptor())) {
+            declaredRoleNames = ((WebDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+        }
+        else if (ApplicationDeploymentDescriptor.class.isInstance(getDescriptor())) {
+            declaredRoleNames = ((ApplicationDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+        }
+        else if (EjbDeploymentDescriptor.class.isInstance(getDescriptor())) {
+            declaredRoleNames = ((EjbDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+        }
+        
+        if (declaredRoleNames == null || declaredRoleNames.size() <= 0) {
+            return false;
+        }
+        List<Role> definedRoles = getRoles(getPlan(), true);
+        List<Role> newRoles = new ArrayList<Role>();
+        for (int i = 0; i < declaredRoleNames.size(); i++) {
+            String roleName = declaredRoleNames.get(i);
+            boolean roleExists = false;
+            for (int j = 0; j < definedRoles.size(); j++) {
+                if (definedRoles.get(j).getRoleName().equals(roleName)) {
+                    roleExists = true;
+                    break;
+                }
+            }
+            if (!roleExists) {
+                Role newRole = new Role();
+                newRole.setRoleName(roleName);
+                newRoles.add(newRole);
+            }
+        }
+        definedRoles.addAll(newRoles);
+        return newRoles.size() > 0;
+    }
+
+    @Override
+    public Object getInput() {
+        addRolesFromDeploymentDescriptor();
+        return getRoleMappings(getPlan(), false);
+    }
+
+    @Override
+    public ITreeContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
+            public Object[] getElements(Object inputElement) {
+                return getChildren(inputElement);
+            }
+
+            @Override
+            public Object[] getChildren(Object parentElement) {
+                if (RoleMappings.class.isInstance(parentElement)) {
+                    return ((RoleMappings) parentElement).getRole().toArray();
+                }
+                if (parentElement instanceof Role) {
+                    Role role = (Role) parentElement;
+                    return concat(role.getDistinguishedName().toArray(), role.getPrincipal().toArray(), 
+                            role.getLoginDomainPrincipal().toArray(), role.getRealmPrincipal().toArray());
+                }
+                return new String[] {};
+            }
+
+            private Object[] concat(Object[] arr1, Object[] arr2, Object[] arr3, Object[] arr4) {
+                Object[] all = new Object[arr1.length + arr2.length + arr3.length + arr4.length];
+                System.arraycopy(arr1, 0, all, 0, arr1.length);
+                System.arraycopy(arr2, 0, all, arr1.length, arr2.length);
+                System.arraycopy(arr3, 0, all, arr1.length + arr2.length, arr3.length);
+                System.arraycopy(arr4, 0, all, arr1.length + arr2.length + arr3.length, arr4.length);
+                return all;
+            }
+        };
+    }
+
+    @Override
+    public ILabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
+            public String getText(Object element) {
+                if (Role.class.isInstance(element)) {
+                    Role role = (Role) element;
+                    return "Role: role-name = \"" + role.getRoleName() + "\"";
+                }
+                else if (element instanceof DistinguishedName) {
+                    DistinguishedName object = (DistinguishedName) element;
+                    return "DistinguishedName: name = \"" + object.getName() + "\"";
+                }
+                else if (element instanceof RealmPrincipal) {
+                    RealmPrincipal object = (RealmPrincipal) element;
+                    return "RealmPrincipal: name = \"" + object.getName() +
+                            "\", class = \"" + object.getClazz() +
+                            "\", domain-name = \"" + object.getDomainName() +
+                            "\", realm-name = \"" + object.getRealmName() +"\"";
+                }
+                else if (element instanceof LoginDomainPrincipal) {
+                    LoginDomainPrincipal object = (LoginDomainPrincipal) element;
+                    return "LoginDomainPrincipal: name = \"" + object.getName() +
+                            "\", class = \"" + object.getClazz() +
+                            "\", domain-name = \"" + object.getDomainName() +"\"";
+                }
+                else if (element instanceof Principal) {
+                    Principal object = (Principal) element;
+                    return "Principal: name = \"" + object.getName() +
+                            "\", class = \"" + object.getClazz() + "\"";
+                }
+
+                return null;
+            }
+
+            @Override
+            public Image getImage(Object arg0) {
+                return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee",
+                        "icons/full/obj16/security_role.gif").createImage();
+            }
+        };
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyWizard.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyWizard.java Fri Aug 29 13:43:47 2008
@@ -16,23 +16,36 @@
  */
 package org.apache.geronimo.st.v21.ui.wizards;
 
+import java.util.List;
+
 import org.apache.geronimo.jee.deployment.Dependency;
 import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
 import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.SortListener;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.st.v21.core.GeronimoServerInfo;
 import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
 
 /**
  * @version $Rev$ $Date$
  */
 public class DependencyWizard extends AbstractTableWizard {
 
-    protected boolean isServerEnvironment;
+    private Table dependencyTable;
+    private TabFolder tabFolder;
 
-    public DependencyWizard(AbstractTableSection section, boolean isServerEnvironment) {
+    public DependencyWizard(AbstractTableSection section) {
         super(section);
-        this.isServerEnvironment = isServerEnvironment;
     }
 
     public JAXBObjectFactory getEFactory() {
@@ -52,6 +65,118 @@
         return stringArray;
     }
 
+    public void addPages() {
+        addPage(new DependencyWizardPage("AddDependencyPage"));
+    }
+
+    public class DependencyWizardPage extends DynamicWizardPage {
+
+        public DependencyWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public void createControl(Composite parent) {
+            parent.setLayoutData(createGridData());
+
+            Composite composite = createComposite(parent);
+            tabFolder = new TabFolder(composite, SWT.NONE);
+            tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+            TabItem item1 = new TabItem(tabFolder, SWT.NONE);
+            item1.setText(CommonMessages.wizardTabManual_Dependency);
+            Composite addManuallyComposite = createComposite(tabFolder);
+            createEditFields(addManuallyComposite);
+            item1.setControl(addManuallyComposite);
+
+            if (eObject == null) {
+                TabItem item2 = new TabItem(tabFolder, SWT.NONE);
+                item2.setText(CommonMessages.wizardTabServer_Dependency);
+                createTable(tabFolder);
+                populateTable();
+                item2.setControl(dependencyTable);
+            }
+            tabFolder.pack();
+            doCustom(composite);
+            setControl(composite);
+        }
+
+        public GridData createGridData() {
+            GridData data = new GridData();
+            data.verticalAlignment = GridData.FILL;
+            data.horizontalAlignment = GridData.FILL;
+            data.grabExcessVerticalSpace = true;
+            data.grabExcessHorizontalSpace = true;
+            data.heightHint = 230;
+            data.widthHint = 300;
+            return data;
+        }
+
+        private void createTable(Composite composite) {
+            int style = SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
+
+            dependencyTable = new Table(composite, style);
+            GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+            data.grabExcessHorizontalSpace = true;
+            data.grabExcessVerticalSpace = true;
+            data.horizontalSpan = 2;
+            data.horizontalAlignment = GridData.FILL;
+            data.heightHint = 60;
+            data.widthHint = 400;
+            dependencyTable.setLayoutData(data);
+            dependencyTable.setLinesVisible(false);
+            dependencyTable.setHeaderVisible(true);
+
+            String[] columnNames = section.getTableColumnNames();
+            final TableColumn[] column = new TableColumn[columnNames.length];
+            int columnWidth[] = { 80, 220, 50, 65 };
+            Listener sortListener = new SortListener(dependencyTable, columnNames);
+            for (int i = 0; i < columnNames.length; ++i) {
+                column[i] = new TableColumn(dependencyTable, SWT.LEFT, i);
+                column[i].setText(columnNames[i]);
+                column[i].setWidth(columnWidth[i]);
+                column[i].addListener(SWT.Selection, sortListener);
+            }
+        }
+
+        public void populateTable() {
+            List<Dependency> serverList = GeronimoServerInfo.getInstance().getCommonLibs();
+            List<Dependency> alreadyAddedDependencies = (List<Dependency>) section.getObjectContainer();
+            serverList.removeAll(alreadyAddedDependencies);
+            for (int i = 0; i < serverList.size(); ++i) {
+                TableItem tabItem = new TableItem(dependencyTable, SWT.NONE);
+                Dependency dependency = serverList.get(i);
+                tabItem.setData(dependency);
+                tabItem.setText(dependencyToStringArray(dependency));
+            }
+        }
+    }
+
+    public boolean performFinish() {
+        switch (tabFolder.getSelectionIndex()) {
+        case -1:
+            // no item selected!
+            return false;
+        case 0:
+            // Adding Manually
+            if (eObject == null) {
+                eObject = new Dependency();
+                section.getObjectContainer().add(eObject);
+            }
+            processEAttributes(getPages()[0]);
+            break;
+        case 1:
+            // Adding from Server
+            TableItem[] selectedItems = dependencyTable.getSelection();
+            for (int i = 0; i < selectedItems.length; i++) {
+                TableItem selectedItem = selectedItems[i];
+                Dependency dependency = (Dependency) selectedItem.getData();
+                section.getObjectContainer().add(dependency);
+            }
+            break;
+        }
+        return true;
+    }
+
     public String getAddWizardWindowTitle() {
         return CommonMessages.wizardNewTitle_Dependency;
     }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.java?rev=690385&r1=690384&r2=690385&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.java Fri Aug 29 13:43:47 2008
@@ -16,33 +16,271 @@
  */
 package org.apache.geronimo.st.v21.ui.wizards;
 
+import java.util.ArrayList;
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.deployment.Attribute;
 import org.apache.geronimo.jee.deployment.Gbean;
 import org.apache.geronimo.jee.deployment.ObjectFactory;
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.apache.geronimo.jee.deployment.Reference;
 import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.sections.AbstractTableSection;
-import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.ui.wizards.AbstractWizard;
 import org.apache.geronimo.st.v21.core.jaxb.JAXBModelUtils;
 import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v21.ui.sections.GBeanSection;
+import org.apache.geronimo.st.v21.ui.wizards.SecurityRoleMappingWizard.SecurityRoleMappingsWizardPage;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
 
 /**
  * @version $Rev$ $Date$
  */
-public class GBeanWizard extends AbstractTableWizard {
+public class GBeanWizard extends AbstractWizard {
 
-    public GBeanWizard(AbstractTableSection section) {
+    private final int GBEAN = 0;
+    private final int ATTRIBUTE = 1;
+    private final int DEPENDENCY = 2;
+    private final int REFERENCE = 3;
+    private final String[] ELEMENT_TYPES = {
+            "GBean", "Attribute", "Dependency", "Reference" };
+
+    protected Combo element;
+    protected ArrayList<Text> textList;
+
+    public GBeanWizard(AbstractTreeSection section) {
         super(section);
+        textList = new ArrayList<Text>(7);
+    }
+
+    public class GBeanWizardPage extends AbstractWizardPage {
+        protected ArrayList<Label> labelList;
+        protected Composite composite;
+
+        public GBeanWizardPage(String pageName) {
+            super(pageName);
+            labelList = new ArrayList<Label>(7);
+        }
+
+        public void createControl(Composite parent) {
+            Label label;
+            Text text;
+            composite = createComposite(parent);
+            createLabel(composite, CommonMessages.element);
+            element = createCombo(composite, ELEMENT_TYPES, false);
+            for (int i = 0; i < 7; i++) {
+                label = createLabel(composite, "");
+                labelList.add(label);
+                text = createTextField(composite, "");
+                textList.add(text);
+            }
+            element.addSelectionListener(new SelectionAdapter() {
+                public void widgetSelected(SelectionEvent arg0) {
+                    toggleFields();
+                }
+            });
+
+            if (eObject == null) {
+                element.select(GBEAN);
+                if (((GBeanSection)section).getSelectedGbean() == null) {
+                    element.setEnabled(false);
+                }
+            }
+            else {
+                // change eObject to be the value of the JAXBElement
+                eObject = ((JAXBElement)eObject).getValue();
+                if (Gbean.class.isInstance(eObject)) {
+                    textList.get(0).setText(((Gbean)eObject).getName());
+                    textList.get(1).setText(((Gbean)eObject).getClazz());
+                    element.select(GBEAN);
+                }
+                else if (Attribute.class.isInstance(eObject)) {
+                    textList.get(0).setText(((Attribute)eObject).getName());
+                    textList.get(1).setText(((Attribute)eObject).getType());
+                    textList.get(2).setText(((Attribute)eObject).getValue());
+                    element.select(ATTRIBUTE);
+                }
+                else if (Pattern.class.isInstance(eObject)) {
+                    textList.get(0).setText(((Pattern)eObject).getGroupId());
+                    textList.get(1).setText(((Pattern)eObject).getArtifactId());
+                    textList.get(2).setText(((Pattern)eObject).getVersion());
+                    textList.get(3).setText(((Pattern)eObject).getModule());
+                    textList.get(4).setText(((Pattern)eObject).getType());
+                    textList.get(5).setText(((Pattern)eObject).getCustomFoo());
+                    element.select(DEPENDENCY);
+                }
+                else if (Reference.class.isInstance(eObject)) {
+                    textList.get(0).setText(((Reference)eObject).getName());
+                    textList.get(1).setText(((Reference)eObject).getGroupId());
+                    textList.get(2).setText(((Reference)eObject).getArtifactId());
+                    textList.get(3).setText(((Reference)eObject).getVersion());
+                    textList.get(4).setText(((Reference)eObject).getModule());
+                    textList.get(5).setText(((Reference)eObject).getType());
+                    textList.get(6).setText(((Reference)eObject).getCustomFoo());
+                    element.select(REFERENCE);
+                }
+                element.setEnabled(false);
+            }
+            toggleFields();
+            setControl(composite);
+        }
+        
+        private void toggleFields () {
+            int selection = element.getSelectionIndex();
+            switch (selection) {
+            case GBEAN:
+                for (int i = 0; i < 7; i++) {
+                    labelList.get(i).setVisible(i < 2 ? true : false);
+                    textList.get(i).setVisible(i < 2 ? true : false);
+                }
+                labelList.get(0).setText(CommonMessages.name);
+                labelList.get(1).setText(CommonMessages.className);
+                // if we are doing an add, then we need to make sure that the longest
+                // text can be handled
+                labelList.get(2).setText(CommonMessages.groupId);
+                labelList.get(3).setText(CommonMessages.artifactId);
+                labelList.get(4).setText(CommonMessages.moduleId);
+                labelList.get(5).setText(CommonMessages.artifactType);
+                labelList.get(6).setText(CommonMessages.customName);
+                break;
+            case ATTRIBUTE:
+                for (int i = 0; i < 7; i++) {
+                    labelList.get(i).setVisible(i < 3 ? true : false);
+                    textList.get(i).setVisible(i < 3 ? true : false);
+                }
+                labelList.get(0).setText(CommonMessages.name);
+                labelList.get(1).setText(CommonMessages.type);
+                labelList.get(2).setText(CommonMessages.value);
+                break;
+            case DEPENDENCY:
+                for (int i = 0; i < 7; i++) {
+                    labelList.get(i).setVisible(i < 6 ? true : false);
+                    textList.get(i).setVisible(i < 6 ? true : false);
+                }
+                labelList.get(0).setText(CommonMessages.groupId);
+                labelList.get(1).setText(CommonMessages.artifactId);
+                labelList.get(2).setText(CommonMessages.version);
+                labelList.get(3).setText(CommonMessages.moduleId);
+                labelList.get(4).setText(CommonMessages.artifactType);
+                labelList.get(5).setText(CommonMessages.customName);
+                break;
+            case REFERENCE:
+                for (int i = 0; i < 7; i++) {
+                    labelList.get(i).setVisible(true);
+                    textList.get(i).setVisible(true);
+                }
+                labelList.get(0).setText(CommonMessages.name);
+                labelList.get(1).setText(CommonMessages.groupId);
+                labelList.get(2).setText(CommonMessages.artifactId);
+                labelList.get(3).setText(CommonMessages.version);
+                labelList.get(4).setText(CommonMessages.moduleId);
+                labelList.get(5).setText(CommonMessages.artifactType);
+                labelList.get(6).setText(CommonMessages.customName);
+                break;
+            }
+        }
+    }
+
+    @Override
+    public void addPages() {
+        addPage(new GBeanWizardPage("Page0"));
+    }
+
+    @Override
+    public boolean performFinish() {
+        Gbean gbean;
+        switch (element.getSelectionIndex()) {
+        case GBEAN:
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            gbean = (Gbean)eObject;
+            if (gbean == null) {
+                gbean = (Gbean)getEFactory().create(Gbean.class);
+                JAXBElement plan = section.getPlan();
+                
+                // add the JAXBElement of a GBean, not the GBean
+                ObjectFactory objectFactory = new ObjectFactory();
+                JAXBModelUtils.getGbeans(plan).add(objectFactory.createGbean((Gbean)gbean));
+            }
+            gbean.setName(textList.get(0).getText());
+            gbean.setClazz(textList.get(1).getText());
+            break;
+
+        case ATTRIBUTE:
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            Attribute attribute = (Attribute)eObject;
+            if (attribute == null) {
+                attribute = (Attribute)getEFactory().create(Attribute.class);
+                gbean = ((GBeanSection)section).getSelectedGbean();
+                
+                // add the JAXBElement of an Attribute, not the Attribute
+                ObjectFactory objectFactory = new ObjectFactory();
+                gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanAttribute(attribute));
+            }
+            attribute.setName(textList.get(0).getText());
+            attribute.setType(textList.get(1).getText());
+            attribute.setValue(textList.get(2).getText());
+            break;
+
+        case DEPENDENCY:
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            Pattern dependency = (Pattern)eObject;
+            if (dependency == null) {
+                dependency = (Pattern)getEFactory().create(Pattern.class);
+                gbean = ((GBeanSection)section).getSelectedGbean();
+
+                // add the JAXBElement of a Dependency, not the Dependency
+                ObjectFactory objectFactory = new ObjectFactory();
+                gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanDependency(dependency));
+            }
+            dependency.setGroupId(textList.get(0).getText());
+            dependency.setArtifactId(textList.get(1).getText());
+            dependency.setVersion(textList.get(2).getText());
+            dependency.setModule(textList.get(3).getText());
+            dependency.setType(textList.get(4).getText());
+            dependency.setCustomFoo(textList.get(5).getText());
+            break;
+
+        case REFERENCE:
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText()) ||
+                    isEmpty(textList.get(2).getText())) {
+                return false;
+            }
+            Reference reference = (Reference)eObject;
+            if (reference == null) {
+                reference = (Reference)getEFactory().create(Reference.class);
+                gbean = ((GBeanSection)section).getSelectedGbean();
+
+                // add the JAXBElement of a Dependency, not the Dependency
+                ObjectFactory objectFactory = new ObjectFactory();
+                gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanReference(reference));
+            }
+            reference.setName(textList.get(0).getText());
+            reference.setGroupId(textList.get(1).getText());
+            reference.setArtifactId(textList.get(2).getText());
+            reference.setVersion(textList.get(3).getText());
+            reference.setModule(textList.get(4).getText());
+            reference.setType(textList.get(5).getText());
+            reference.setCustomFoo(textList.get(6).getText());
+            break;
+        }
+        return true;
     }
 
     public JAXBObjectFactory getEFactory() {
         return JAXBObjectFactoryImpl.getInstance();
     }
-    
-    public String[] getTableColumnEAttributes() {
-        return new String[] { "Name", "Clazz" };
-    }
 
     public String getAddWizardWindowTitle() {
         return CommonMessages.wizardNewTitle_GBean;
@@ -52,32 +290,11 @@
         return CommonMessages.wizardEditTitle_GBean;
     }
 
-    public String getWizardFirstPageTitle() {
+    public String getWizardPageTitle() {
         return CommonMessages.wizardEditTitle_GBean;
     }
 
-    public String getWizardFirstPageDescription() {
+    public String getWizardPageDescription() {
         return CommonMessages.wizardPageTitle_GBean;
     }
-
-    public boolean performFinish() {
-        DynamicWizardPage page = (DynamicWizardPage) getPages()[0];
-
-        if (eObject == null) {
-            eObject = getEFactory().create(Gbean.class);
-            JAXBElement plan = section.getPlan();
-
-            // add the JAXBElement of a GBean, not the GBean
-            ObjectFactory objectFactory = new ObjectFactory();
-            JAXBModelUtils.getGbeans(plan).add(objectFactory.createGbean((Gbean)eObject));
-        }
-
-        processEAttributes (page);
-
-        if (section.getViewer().getInput() == null) {
-            section.getViewer().setInput(section.getInput());
-        }
-
-        return true;
-    }
 }

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingWizard.java?rev=690385&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingWizard.java Fri Aug 29 13:43:47 2008
@@ -0,0 +1,233 @@
+/*
+ * 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.geronimo.st.v21.ui.wizards;
+
+import java.util.List;
+
+import org.apache.geronimo.jee.security.DistinguishedName;
+import org.apache.geronimo.jee.security.LoginDomainPrincipal;
+import org.apache.geronimo.jee.security.Principal;
+import org.apache.geronimo.jee.security.RealmPrincipal;
+import org.apache.geronimo.jee.security.Role;
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.ui.wizards.AbstractWizard;
+import org.apache.geronimo.st.v21.core.GeronimoServerInfo;
+import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v21.ui.sections.SecurityRoleMappingSection;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ *  @version $Rev$ $Date$
+ */
+public class SecurityRoleMappingWizard extends AbstractWizard {
+    public static final String[] PRINCIPAL_CLASSES = {
+            "org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal",
+            "org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" };
+
+    private final int DISTINGUISHED_NAME = 0;
+    private final int PRINCIPAL = 1;
+    private final int LOGIN_DOMAIN_PRINCIPAL = 2;
+    private final int REALM_PRINCIPAL = 3;
+    private final String[] ROLE_MAPPING_TYPES = {
+            "Distinguished Name", "Principal", "Login Domain Principal", "Realm Principal" };
+
+    protected Combo type;
+    protected Text name;
+    protected Combo clazz;
+    protected Text domainName;
+    protected Combo realmName;
+    
+    public SecurityRoleMappingWizard(AbstractTreeSection section) {
+        super(section);
+    }
+
+    protected static String[] getSecurityRealms() {
+        List<String> securityRealms = GeronimoServerInfo.getInstance().getSecurityRealms();
+        return securityRealms.toArray(new String[securityRealms.size()]);
+    }
+
+    public class SecurityRoleMappingsWizardPage extends AbstractWizardPage {
+        protected Label nameLabel, clazzLabel, domainNameLabel, realmNameLabel;
+
+        public SecurityRoleMappingsWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public void createControl(Composite parent) {
+            Composite composite = createComposite(parent);
+            createLabel(composite, CommonMessages.type);
+            type = createCombo(composite, ROLE_MAPPING_TYPES, false);
+            nameLabel = createLabel(composite, CommonMessages.name);
+            name = createTextField(composite, "");
+            name.setFocus();
+            clazzLabel = createLabel(composite, CommonMessages.className);
+            clazz = createCombo(composite, PRINCIPAL_CLASSES, true);
+            clazz.select(0);
+            domainNameLabel = createLabel(composite, CommonMessages.editorDomainName);
+            domainName = createTextField(composite, "");
+            realmNameLabel = createLabel(composite, CommonMessages.editorRealmName);
+            realmName = createCombo(composite, getSecurityRealms(), true);
+
+            type.addSelectionListener(new SelectionAdapter() {
+                public void widgetSelected(SelectionEvent arg0) {
+                    toggleFields();
+                }
+            });
+            if (eObject == null) {
+                type.select(DISTINGUISHED_NAME);
+            }
+            else {
+                // set the fields to the values in eObject and select the correct type
+                if (DistinguishedName.class.isInstance(eObject)) {
+                    name.setText(((DistinguishedName)eObject).getName());
+                    type.select(DISTINGUISHED_NAME);
+                }
+                else {
+                    name.setText(((Principal)eObject).getName());
+                    clazz.setText(((Principal)eObject).getClazz());
+                    if (LoginDomainPrincipal.class.isInstance(eObject)) {
+                        domainName.setText(((LoginDomainPrincipal)eObject).getDomainName());
+                        if (RealmPrincipal.class.isInstance(eObject)) {
+                            realmName.setText(((RealmPrincipal)eObject).getRealmName());
+                            type.select(REALM_PRINCIPAL);
+                        }
+                        else {
+                            type.select(LOGIN_DOMAIN_PRINCIPAL);
+                        }
+                    }
+                    else {
+                        type.select(PRINCIPAL);
+                    }
+                }
+                type.setEnabled(false);
+            }
+            toggleFields();
+            setControl(composite);
+        }
+
+        private void toggleFields() {
+            int selection = type.getSelectionIndex();
+            clazzLabel.setVisible (selection >= PRINCIPAL ? true : false);
+            clazz.setVisible (selection >= PRINCIPAL ? true : false);
+            domainNameLabel.setVisible (selection >= LOGIN_DOMAIN_PRINCIPAL ? true : false);
+            domainName.setVisible (selection >= LOGIN_DOMAIN_PRINCIPAL ? true : false);
+            realmNameLabel.setVisible (selection == REALM_PRINCIPAL ? true : false);
+            realmName.setVisible (selection == REALM_PRINCIPAL ? true : false);
+        }
+    }
+
+    @Override
+    public void addPages() {
+        addPage(new SecurityRoleMappingsWizardPage("Page0"));
+    }
+
+    @Override
+    public boolean performFinish() {
+        switch (type.getSelectionIndex()) {
+        case DISTINGUISHED_NAME:
+            if (isEmpty(name.getText())) {
+                return false;
+            }
+            DistinguishedName distinguishedName = (DistinguishedName)eObject;
+            if (distinguishedName == null) {
+                distinguishedName = (DistinguishedName)getEFactory().create(DistinguishedName.class);
+                Role role = ((SecurityRoleMappingSection) section).getSelectedRoleDuringAdd();
+                role.getDistinguishedName().add(distinguishedName);
+            }
+            distinguishedName.setName(name.getText());
+            break;
+
+        case PRINCIPAL:
+            if (isEmpty(name.getText()) || isEmpty(clazz.getText())) {
+                return false;
+            }
+            Principal principal = (Principal)eObject;
+            if (principal == null) {
+                principal = (Principal)getEFactory().create(Principal.class);
+                Role role = ((SecurityRoleMappingSection) section).getSelectedRoleDuringAdd();
+                role.getPrincipal().add(principal);
+            }
+            principal.setName(name.getText());
+            principal.setClazz(clazz.getText());
+            break;
+
+        case LOGIN_DOMAIN_PRINCIPAL:
+            if (isEmpty(name.getText()) || isEmpty(clazz.getText()) || isEmpty(domainName.getText())) {
+                return false;
+            }
+            LoginDomainPrincipal loginDomainPrincipal = (LoginDomainPrincipal)eObject;
+            if (loginDomainPrincipal == null) {
+                loginDomainPrincipal = (LoginDomainPrincipal)getEFactory().create(LoginDomainPrincipal.class);
+                Role role = ((SecurityRoleMappingSection) section).getSelectedRoleDuringAdd();
+                role.getLoginDomainPrincipal().add(loginDomainPrincipal);
+            }
+            loginDomainPrincipal.setName(name.getText());
+            loginDomainPrincipal.setClazz(clazz.getText());
+            loginDomainPrincipal.setDomainName(domainName.getText()); 
+            break;
+
+        case REALM_PRINCIPAL:
+            if (isEmpty(name.getText()) || isEmpty(clazz.getText()) || isEmpty(domainName.getText())
+                    || isEmpty(realmName.getText())) {
+                return false;
+            }
+            RealmPrincipal realmPrincipal = (RealmPrincipal)eObject;
+            if (realmPrincipal == null) {
+                realmPrincipal = (RealmPrincipal)getEFactory().create(RealmPrincipal.class);
+                Role role = ((SecurityRoleMappingSection) section).getSelectedRoleDuringAdd();
+                role.getRealmPrincipal().add(realmPrincipal);
+            }
+            realmPrincipal.setName(name.getText());
+            realmPrincipal.setClazz(clazz.getText());
+            realmPrincipal.setDomainName(domainName.getText());
+            realmPrincipal.setRealmName(realmName.getText());
+            break;
+        }
+        return true;
+    }
+    
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    @Override
+    protected String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_RoleMapping;
+    }
+
+    @Override
+    protected String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_RoleMapping;
+    }
+
+    @Override
+    protected String getWizardPageTitle() {
+        return CommonMessages.wizardPageTitle_RoleMapping;
+    }
+
+    @Override
+    protected String getWizardPageDescription() {
+        return CommonMessages.wizardPageDescription_RoleMapping;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingWizard.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingWizard.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/SecurityRoleMappingWizard.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message