geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shiv...@apache.org
Subject svn commit: r688452 [2/3] - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/deployment/ org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/ org.apache.geroni...
Date Sun, 24 Aug 2008 05:56:22 GMT
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ClassFilterSection.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/ClassFilterSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ClassFilterSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ClassFilterSection.java Sat Aug 23 22:56:20 2008
@@ -20,15 +20,16 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.deployment.ClassFilter;
+import org.apache.geronimo.jee.deployment.Environment;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
 import org.apache.geronimo.st.v21.ui.Activator;
 import org.apache.geronimo.st.v21.ui.wizards.ClassFilterWizard;
-import org.apache.geronimo.jee.deployment.ClassFilter;
-import org.apache.geronimo.jee.deployment.Environment;
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -131,20 +132,28 @@
         return super.getInput();
     }
     
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
+    @Override
+    public IContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
             public Object[] getElements(Object inputElement) {
                 if (!ClassFilter.class.isInstance(inputElement)) {
                     return new String[] { "" };
                 }
-                ClassFilter plan = (ClassFilter)inputElement;
-                return plan.getFilter().toArray();
+                return ((ClassFilter) inputElement).getFilter().toArray();
             }
+        };
+    }
+
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (String.class.isInstance(element)) {
-                    String clazz = (String)element;
                     switch (columnIndex) {
-                    case 0: return clazz;
+                    case 0:
+                        return (String) element;
                     }
                 }
                 return null;

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=688452&r1=688451&r2=688452&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 Sat Aug 23 22:56:20 2008
@@ -20,16 +20,17 @@
 
 import javax.xml.bind.JAXBElement;
 
+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.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
-import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
 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.apache.geronimo.jee.deployment.Dependencies;
-import org.apache.geronimo.jee.deployment.Dependency;
-import org.apache.geronimo.jee.deployment.Environment;
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -43,29 +44,10 @@
 
     protected boolean isServerEnvironment;
 
-    /**
-     * @param plan
-     * @param parent
-     * @param toolkit
-     * @param style
-     */
     public DependencySection(JAXBElement plan, Environment environment, Composite parent, FormToolkit toolkit, int style) {
-        super(plan, parent, toolkit, style);
-        this.environment = environment;
-        this.isServerEnvironment = true;
-        this.COLUMN_NAMES = new String[] {
-                CommonMessages.groupId, CommonMessages.artifactId, CommonMessages.version, CommonMessages.type
-        };
-        createClient();
+        this(plan, environment, parent, toolkit, style, true);
     }
 
-    /**
-     * @param plan
-     * @param parent
-     * @param toolkit
-     * @param style
-     * @param envType
-     */
     public DependencySection(JAXBElement plan, Environment environment, Composite parent, FormToolkit toolkit, int style, boolean isServerEnvironment) {
         super(plan, parent, toolkit, style);
         this.environment = environment;
@@ -77,31 +59,41 @@
     }
 
     public String getTitle() {
-        if (isServerEnvironment)
+        if (isServerEnvironment) {
             return CommonMessages.editorSectionDependenciesTitle;
-        else
+        } else {
             return CommonMessages.editorSectionClientDependenciesTitle;
+        }
     }
 
     public String getDescription() {
-        if (isServerEnvironment)
+        if (isServerEnvironment) {
             return CommonMessages.editorSectionDependenciesDescription;
-        else
+        } else {
             return CommonMessages.editorSectionClientDependenciesDescription;
+        }
     }
 
     public List getObjectContainer() {
+        return getDependencies().getDependency();
+    }
+
+    private Dependencies getDependencies() {
         if (environment == null) {
-            environment = (Environment)JAXBObjectFactoryImpl.getInstance().create(Environment.class);
+            environment = new Environment();
         }
-        
-        if ( environment.getDependencies() == null ) {
-            Dependencies dependencies = (Dependencies)JAXBObjectFactoryImpl.getInstance().create(Dependencies.class);
-            environment.setDependencies(dependencies);
+        if (environment.getDependencies() == null) {
+            environment.setDependencies(new Dependencies());
         }
-        return environment.getDependencies().getDependency();
+        return environment.getDependencies();
+    }
+
+    @Override
+    public Wizard getAddWizard() {
+        return new DependencyAddWizard(this);
     }
 
+    @Override
     public Wizard getWizard() {
         return new DependencyWizard(this, isServerEnvironment);
     }
@@ -115,32 +107,41 @@
     }
 
     public Object getInput() {
-        if (environment != null) {
-            return environment.getDependencies();
-        }
-        return super.getInput();
+        return getDependencies();
     }
-    
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
+
+    @Override
+    public IContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
             public Object[] getElements(Object inputElement) {
                 if (!Dependencies.class.isInstance(inputElement)) {
                     return new String[] { "" };
                 }
-                Dependencies plan = (Dependencies)inputElement;
-                return plan.getDependency().toArray();
+                return ((Dependencies) inputElement).getDependency().toArray();
             }
+        };
+    }
+
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (Dependency.class.isInstance(element)) {
-                    Dependency dependency = (Dependency)element;
+                    Dependency dependency = (Dependency) element;
                     switch (columnIndex) {
-                    case 0: return dependency.getGroupId();
-                    case 1: return dependency.getArtifactId();
-                    case 2: return dependency.getVersion();
-                    case 3: return dependency.getType();
+                    case 0:
+                        return dependency.getGroupId();
+                    case 1:
+                        return dependency.getArtifactId();
+                    case 2:
+                        return dependency.getVersion();
+                    case 3:
+                        return dependency.getType();
                     }
                 }
-                return null;
+                return "";
             }
         };
     }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/EjbLocalRefSection.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/EjbLocalRefSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/EjbLocalRefSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/EjbLocalRefSection.java Sat Aug 23 22:56:20 2008
@@ -20,13 +20,13 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.naming.EjbLocalRef;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.Activator;
 import org.apache.geronimo.st.v21.ui.wizards.EjbLocalRefWizard;
-import org.apache.geronimo.jee.naming.EjbLocalRef;
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -64,26 +64,18 @@
         return EjbLocalRef.class;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (EjbLocalRef.class.isInstance(element)) {
-                    EjbLocalRef ejbLocalRef = (EjbLocalRef)element;
+                    EjbLocalRef ejbLocalRef = (EjbLocalRef) element;
                     switch (columnIndex) {
-                    case 0: return ejbLocalRef.getRefName();
-                    case 1: return ejbLocalRef.getEjbLink();
+                    case 0:
+                        return ejbLocalRef.getRefName();
+                    case 1:
+                        return ejbLocalRef.getEjbLink();
                     }
                 }
                 return null;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/EjbRefSection.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/EjbRefSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/EjbRefSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/EjbRefSection.java Sat Aug 23 22:56:20 2008
@@ -20,13 +20,13 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.naming.EjbRef;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.Activator;
 import org.apache.geronimo.st.v21.ui.wizards.EjbRefWizard;
-import org.apache.geronimo.jee.naming.EjbRef;
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -70,26 +70,18 @@
         return EjbRef.class;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (EjbRef.class.isInstance(element)) {
-                    EjbRef ejbRef = (EjbRef)element;
+                    EjbRef ejbRef = (EjbRef) element;
                     switch (columnIndex) {
-                    case 0: return ejbRef.getRefName();
-                    case 1: return ejbRef.getEjbLink();
+                    case 0:
+                        return ejbRef.getRefName();
+                    case 1:
+                        return ejbRef.getEjbLink();
                     }
                 }
                 return null;

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=688452&r1=688451&r2=688452&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 Sat Aug 23 22:56:20 2008
@@ -20,11 +20,11 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.application.ExtModule;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.wizards.ExtModuleWizard;
-import org.apache.geronimo.jee.application.ExtModule;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -59,49 +59,33 @@
         return ExtModule.class;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (ExtModule.class.isInstance(element)) {
-                    ExtModule extModule = (ExtModule)element;
+                    ExtModule extModule = (ExtModule) element;
                     switch (columnIndex) {
                     case 0:
                         if (extModule.getConnector() != null) {
                             return "connector";
-                        }
-                        else if (extModule.getEjb() != null) {
+                        } else if (extModule.getEjb() != null) {
                             return "ejb";
-                        }
-                        else if (extModule.getJava() != null) {
+                        } else if (extModule.getJava() != null) {
                             return "java";
-                        }
-                        else if (extModule.getWeb() != null) {
+                        } else if (extModule.getWeb() != null) {
                             return "web";
                         }
                         return "";
-                    case 1: 
+                    case 1:
                         if (extModule.getConnector() != null) {
                             return extModule.getConnector().getValue();
-                        }
-                        else if (extModule.getEjb() != null) {
+                        } else if (extModule.getEjb() != null) {
                             return extModule.getEjb().getValue();
-                        }
-                        else if (extModule.getJava() != null) {
+                        } else if (extModule.getJava() != null) {
                             return extModule.getJava().getValue();
-                        }
-                        else if (extModule.getWeb() != null) {
+                        } else if (extModule.getWeb() != null) {
                             return extModule.getWeb().getValue();
                         }
                         return "";

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/GBeanRefSection.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/GBeanRefSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/GBeanRefSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/GBeanRefSection.java Sat Aug 23 22:56:20 2008
@@ -20,12 +20,11 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.naming.GbeanRef;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.wizards.GBeanRefWizard;
-import org.apache.geronimo.jee.naming.EjbRef;
-import org.apache.geronimo.jee.naming.GbeanRef;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -59,26 +58,18 @@
 		return GbeanRef.class;
 	}
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (GbeanRef.class.isInstance(element)) {
-                    GbeanRef gbeanRef = (GbeanRef)element;
+                    GbeanRef gbeanRef = (GbeanRef) element;
                     switch (columnIndex) {
-                    case 0: return gbeanRef.getRefName();
-                    case 1: return gbeanRef.getRefType().get(0);
+                    case 0:
+                        return gbeanRef.getRefName();
+                    case 1:
+                        return gbeanRef.getRefType().get(0);
                     }
                 }
                 return null;

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=688452&r1=688451&r2=688452&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 Sat Aug 23 22:56:20 2008
@@ -23,10 +23,11 @@
 
 import org.apache.geronimo.jee.deployment.Gbean;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
 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.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -100,30 +101,33 @@
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
+    @Override
+    public IContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
             public Object[] getElements(Object inputElement) {
                 if (!List.class.isInstance(inputElement)) {
                     return new String[] { "" };
                 }
                 // convert the list of JAXBElements into regular GBeans
-                List elementList = (List)inputElement;
+                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();
+                    element = (JAXBElement) elementList.get(i);
+                    gbean = (Gbean) element.getValue();
                     gbeanList.add(gbean);
                 }
                 return gbeanList.toArray();
             }
+        };
+    }
 
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (Gbean.class.isInstance(element)) {
                     Gbean gbean = (Gbean)element;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/MessageDestSection.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/MessageDestSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/MessageDestSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/MessageDestSection.java Sat Aug 23 22:56:20 2008
@@ -20,11 +20,11 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.naming.MessageDestination;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.wizards.MessageDestWizard;
-import org.apache.geronimo.jee.naming.MessageDestination;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -60,32 +60,30 @@
         return MessageDestination.class;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (MessageDestination.class.isInstance(element)) {
-                    MessageDestination msgDest = (MessageDestination)element;
+                    MessageDestination msgDest = (MessageDestination) element;
                     switch (columnIndex) {
-                    case 0: return msgDest.getMessageDestinationName();
-                    case 1: return msgDest.getAdminObjectModule();
-                    case 2: return msgDest.getAdminObjectLink();
-                    case 3: return msgDest.getPattern().getGroupId();
-                    case 4: return msgDest.getPattern().getArtifactId();
-                    case 5: return msgDest.getPattern().getVersion();
-                    case 6: return msgDest.getPattern().getModule();
-                    case 7: return msgDest.getPattern().getName();
+                    case 0:
+                        return msgDest.getMessageDestinationName();
+                    case 1:
+                        return msgDest.getAdminObjectModule();
+                    case 2:
+                        return msgDest.getAdminObjectLink();
+                    case 3:
+                        return msgDest.getPattern().getGroupId();
+                    case 4:
+                        return msgDest.getPattern().getArtifactId();
+                    case 5:
+                        return msgDest.getPattern().getVersion();
+                    case 6:
+                        return msgDest.getPattern().getModule();
+                    case 7:
+                        return msgDest.getPattern().getName();
                     }
                 }
                 return null;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ModuleSection.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/ModuleSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ModuleSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ModuleSection.java Sat Aug 23 22:56:20 2008
@@ -20,11 +20,11 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.application.Module;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.wizards.ModuleWizard;
-import org.apache.geronimo.jee.application.Module;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -58,49 +58,33 @@
         return Module.class;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (Module.class.isInstance(element)) {
-                    Module module = (Module)element;
+                    Module module = (Module) element;
                     switch (columnIndex) {
                     case 0:
                         if (module.getConnector() != null) {
                             return "connector";
-                        }
-                        else if (module.getEjb() != null) {
+                        } else if (module.getEjb() != null) {
                             return "ejb";
-                        }
-                        else if (module.getJava() != null) {
+                        } else if (module.getJava() != null) {
                             return "java";
-                        }
-                        else if (module.getWeb() != null) {
+                        } else if (module.getWeb() != null) {
                             return "web";
                         }
                         return "";
-                    case 1: 
+                    case 1:
                         if (module.getConnector() != null) {
                             return module.getConnector().getValue();
-                        }
-                        else if (module.getEjb() != null) {
+                        } else if (module.getEjb() != null) {
                             return module.getEjb().getValue();
-                        }
-                        else if (module.getJava() != null) {
+                        } else if (module.getJava() != null) {
                             return module.getJava().getValue();
-                        }
-                        else if (module.getWeb() != null) {
+                        } else if (module.getWeb() != null) {
                             return module.getWeb().getValue();
                         }
                         return "";

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ResourceEnvRefSection.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/ResourceEnvRefSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ResourceEnvRefSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ResourceEnvRefSection.java Sat Aug 23 22:56:20 2008
@@ -20,13 +20,13 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.naming.ResourceEnvRef;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.Activator;
 import org.apache.geronimo.st.v21.ui.wizards.ResourceEnvRefWizard;
-import org.apache.geronimo.jee.naming.ResourceEnvRef;
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -65,26 +65,18 @@
         return ResourceEnvRef.class;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (ResourceEnvRef.class.isInstance(element)) {
-                    ResourceEnvRef resourceEnvRef = (ResourceEnvRef)element;
+                    ResourceEnvRef resourceEnvRef = (ResourceEnvRef) element;
                     switch (columnIndex) {
-                    case 0: return resourceEnvRef.getRefName();
-                    case 1: return resourceEnvRef.getMessageDestinationLink();
+                    case 0:
+                        return resourceEnvRef.getRefName();
+                    case 1:
+                        return resourceEnvRef.getMessageDestinationLink();
                     }
                 }
                 return null;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ResourceRefSection.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/ResourceRefSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ResourceRefSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ResourceRefSection.java Sat Aug 23 22:56:20 2008
@@ -20,13 +20,13 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.naming.ResourceRef;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.Activator;
 import org.apache.geronimo.st.v21.ui.wizards.ResourceRefWizard;
-import org.apache.geronimo.jee.naming.ResourceRef;
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -64,26 +64,18 @@
         return ResourceRef.class;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (ResourceRef.class.isInstance(element)) {
-                    ResourceRef resourceRef = (ResourceRef)element;
+                    ResourceRef resourceRef = (ResourceRef) element;
                     switch (columnIndex) {
-                    case 0: return resourceRef.getRefName();
-                    case 1: return resourceRef.getResourceLink();
+                    case 0:
+                        return resourceRef.getRefName();
+                    case 1:
+                        return resourceRef.getResourceLink();
                     }
                 }
                 return null;

Added: 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=688452&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java Sat Aug 23 22:56:20 2008
@@ -0,0 +1,467 @@
+/*
+ * 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.Hashtable;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.deployment.Pattern;
+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.jee.security.SubjectInfo;
+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.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SecurityAdvancedSection extends AbstractTableSection {
+
+    private static final String SPECIFY_CREDENTIAL_STORE_MANUALLY = "<specify manually>";
+
+    protected Text credentialStoreRef;
+    protected Button specifyCredentialStoreRefButton;
+    protected Button deleteCredentialStoreRefButton;
+
+    private Hashtable<String, Pattern> credentialStoreList = new Hashtable<String, Pattern>();
+
+    protected Combo defaultSubjectRealmName;
+
+    protected Combo defaultSubjectId;
+
+    protected Button doAsCurrentCaller;
+
+    protected Button useContextHandler;
+
+    public SecurityAdvancedSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style) {
+        super(plan, parent, toolkit, style);
+        createClient();
+    }
+
+    public void createClient() {
+        Section section = getSection();
+        section.setText(getTitle());
+        section.setDescription(getDescription());
+        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+        Composite clientComposite = createComposite(getSection(), 3);
+        section.setClient(clientComposite);
+
+        Composite composite1 = createComposite(clientComposite, 2);
+        composite1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+
+        doAsCurrentCaller = toolkit.createButton(composite1, CommonMessages.securityDoasCurrentCaller,
+                SWT.CHECK);
+        doAsCurrentCaller.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+        doAsCurrentCaller.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                setDoAsCurrentCaller();
+                markDirty();
+            }
+        });
+        doAsCurrentCaller.setSelection(isDoasCurrentCaller());
+
+        useContextHandler = toolkit.createButton(composite1, CommonMessages.securityUseContextHandler,
+                SWT.CHECK);
+        useContextHandler.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+        useContextHandler.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                setUseContextHandler();
+                markDirty();
+            }
+        });
+        useContextHandler.setSelection(isUseContextHandler());
+
+        createLabel(clientComposite, CommonMessages.securityCredentialStore);
+        credentialStoreRef = new Text(clientComposite, SWT.READ_ONLY| SWT.BORDER);
+        credentialStoreRef.setText("<credential store ref name will go here>");
+        GridData gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
+        gridData.widthHint = 300;
+        credentialStoreRef.setLayoutData(gridData);
+
+        Composite composite2 = toolkit.createComposite(clientComposite);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.marginHeight = 5;
+        layout.marginWidth = 0;
+        layout.verticalSpacing = 5;
+        layout.horizontalSpacing = 5;
+        composite2.setLayout(layout);
+        composite2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+        specifyCredentialStoreRefButton = toolkit.createButton(composite2, CommonMessages.edit, SWT.NONE);
+        specifyCredentialStoreRefButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        specifyCredentialStoreRefButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                Wizard wizard = getCredentialStoreRefWizard();
+                WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
+                dialog.open();
+                if (dialog.getReturnCode() == Dialog.OK) {
+                    setCredentialStoreRef();
+                    toggleAdvancedSettings();
+                    markDirty();
+                }
+            }
+        });
+        deleteCredentialStoreRefButton = toolkit.createButton(composite2, CommonMessages.remove, SWT.NONE);
+        deleteCredentialStoreRefButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        deleteCredentialStoreRefButton.addSelectionListener(new SelectionAdapter(){
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+            }
+        });
+
+        createLabel(clientComposite, CommonMessages.securityDefaultSubject);
+        createLabel(clientComposite, "");
+        createLabel(clientComposite, "");
+        //group = createGroup(clientComposite, CommonMessages.securityDefaultSubject);
+
+        //createLabel(clientComposite, "");
+        //Composite composite3 = createComposite(clientComposite, 2);
+        //composite3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+        createLabel(clientComposite, CommonMessages.securityDefaultSubjectRealmName).setLayoutData(
+                new GridData(SWT.RIGHT, SWT.CENTER, false, false));
+        defaultSubjectRealmName = new Combo(clientComposite, SWT.SINGLE | SWT.DROP_DOWN);
+        defaultSubjectRealmName.add(getDefaultSubjectRealmName());
+        defaultSubjectRealmName.select(0);
+        gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
+        gridData.widthHint = 100;
+        defaultSubjectRealmName.setLayoutData(gridData);
+        defaultSubjectRealmName.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                setDefaultSubject();
+                markDirty();
+            }
+        });
+        defaultSubjectRealmName.pack();
+
+        //createLabel(clientComposite, "");
+        //Composite composite4 = createComposite(clientComposite, 2);
+        //composite4.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+        createLabel(clientComposite, CommonMessages.securityDefaultSubjectId).setLayoutData(
+                new GridData(SWT.RIGHT, SWT.CENTER, false, false));
+        defaultSubjectId = new Combo(clientComposite, SWT.SINGLE | SWT.DROP_DOWN);
+        defaultSubjectId.add(getDefaultSubjectId());
+        defaultSubjectId.select(0);
+        gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
+        gridData.widthHint = 100;
+        defaultSubjectId.setLayoutData(gridData);
+        defaultSubjectId.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                setDefaultSubject();
+                markDirty();
+            }
+        });
+        defaultSubjectId.pack();
+
+        //group = createGroup(clientComposite, CommonMessages.securityRunAsSubjects);
+        createLabel(clientComposite, "").setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
+        createLabel(clientComposite, CommonMessages.securityRunAsSubjects).setLayoutData(
+                new GridData(SWT.LEFT, SWT.TOP, false, false));
+        createViewer(clientComposite);
+        viewer.setContentProvider(getContentProvider());
+        viewer.setLabelProvider(getLabelProvider());
+        viewer.setInput(getInput());
+
+        Composite buttonComposite = createButtonComposite(clientComposite);
+        createAddButton(toolkit, buttonComposite);
+        createRemoveButton(toolkit, buttonComposite);
+        createEditButton(toolkit, buttonComposite);
+        activateButtons();
+
+        section.setExpanded(false);
+        toggleAdvancedSettings();
+    }
+
+    private Wizard getCredentialStoreRefWizard() {
+        return null;
+    }
+
+    private void toggleAdvancedSettings() {
+        boolean enable = false;
+        if (getSecurity() != null && getSecurity().getCredentialStoreRef() != null) {
+            enable = true;
+        }
+        defaultSubjectRealmName.setEnabled(enable);
+        defaultSubjectId.setEnabled(enable);
+        table.setEnabled(enable);
+        activateAddButton();
+    }
+
+    @Override
+    public Object getInput() {
+        return SecurityRoleMappingsSection.getRoleMappings(getPlan(), false);
+    }
+
+    @Override
+    public IContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
+            public Object[] getElements(Object inputElement) {
+                if (inputElement instanceof RoleMappings) {
+                    return ((RoleMappings) inputElement).getRole().toArray();
+                }
+                return super.getElements(inputElement);
+            }
+        };
+    }
+
+    @Override
+    protected boolean filter(Viewer viewer, Object parentElement, Object element) {
+        if (element instanceof Role) {
+            return ((Role) element).getRunAsSubject() != null;
+        }
+        return false;
+    }
+
+    @Override
+    public IBaseLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
+            public String getColumnText(Object element, int columnIndex) {
+                if (element instanceof Role) {
+                    Role role = (Role) element;
+                    switch (columnIndex) {
+                    case 0:
+                        return role.getRoleName();
+                    case 1:
+                        return role.getRunAsSubject().getRealm();
+                    case 2:
+                        return role.getRunAsSubject().getId();
+                    }
+                }
+                return "";
+            }
+        };
+    }
+
+    @Override
+    protected void removeItem(Object selectedItem) {
+        if (selectedItem instanceof Role) {
+            ((Role) selectedItem).setRunAsSubject(null);
+            return;
+        }
+        super.removeItem(selectedItem);
+    }
+
+    @Override
+    public Wizard getAddWizard() {
+        return new SecurityRunAsSubjectAddWizard(this);
+    }
+
+    @Override
+    protected Wizard getWizard() {
+        return new SecurityRunAsSubjectEditWizard(this);
+    }
+
+    @Override
+    public void activateAddButton() {
+        if (getSecurity() != null && getSecurity().getCredentialStoreRef() != null
+                && getRolesWithoutRunAsSubject().length > 0) {
+            addButton.setEnabled(true);
+        } else {
+            addButton.setEnabled(false);
+        }
+    }
+
+    public Role getRole(String roleName) {
+        List<Role> roles = SecurityRoleMappingsSection.getRoles(getPlan(), false);
+        for (int i = 0; i < roles.size(); i++) {
+            Role role = roles.get(i);
+            if (role.getRoleName().equals(roleName)) {
+                return role;
+            }
+        }
+        return null;
+    }
+
+    public String[] getRolesWithoutRunAsSubject() {
+        List<Role> roles = SecurityRoleMappingsSection.getRoles(getPlan(), false);
+        List<Role> rolesWithoutRunAsSubject = new ArrayList<Role>();
+        for (int i = 0; i < roles.size(); i++) {
+            Role role = roles.get(i);
+            if(role.getRunAsSubject() == null) {
+                rolesWithoutRunAsSubject.add(role);
+            }
+        }
+        String[] roleNames = new String[rolesWithoutRunAsSubject.size()];
+        for (int i = 0; i < rolesWithoutRunAsSubject.size(); i++) {
+            roleNames[i] = rolesWithoutRunAsSubject.get(i).getRoleName();
+        }
+        return roleNames;
+    }
+
+    /*private void populateCredentialStores() {
+        String credentialStoreRefName = getCredentialStoreRefName();
+        if (credentialStoreRefName.length() > 0) {
+            credentialStoreRef.add(""); //users will select this empty string to unset credentialStoreRef
+        }
+        credentialStoreRef.add(credentialStoreRefName);
+        List<Pattern> deployedCredentialStores = GeronimoServerInfo.getInstance().getDeployedCredentialStores();
+        Pattern pattern = new Pattern();
+        pattern.setCustomFoo(credentialStoreRefName);
+        if (deployedCredentialStores.contains(pattern)) {
+            deployedCredentialStores.remove(pattern);
+        }
+        for (int i = 0; i < deployedCredentialStores.size(); i++) {
+            credentialStoreRef.add(deployedCredentialStores.get(i).toString());
+        }
+        credentialStoreRef.add(SPECIFY_CREDENTIAL_STORE_MANUALLY);
+    }*/
+
+    @Override
+    public List getObjectContainer() {
+        return getSecurity().getRoleMappings().getRole();
+    }
+
+    @Override
+    public Class getTableEntryObjectType() {
+        return Role.class;
+    }
+
+    @Override
+    public String[] getTableColumnNames() {
+        return new String[] { CommonMessages.securityRunAsSubjectRole, CommonMessages.securityRunAsSubjectRealm,
+                CommonMessages.securityRunAsSubjectId };
+    }
+
+    @Override
+    public String getTitle() {
+        return CommonMessages.editorSectionSecurityAdvancedTitle;
+    }
+
+    @Override
+    public String getDescription() {
+        return CommonMessages.editorSectionSecurityAdvancedDescription;
+    }
+
+    private Security getSecurity() {
+        return JAXBModelUtils.getSecurity(getPlan());
+    }
+
+    private String getCredentialStoreRefName() {
+        if (getSecurity() != null) {
+            Pattern credentialStoreRef = getSecurity().getCredentialStoreRef();
+            if (credentialStoreRef != null) {
+                return credentialStoreRef.getCustomFoo();
+            }
+        }
+        return "";
+    }
+
+    private String getDefaultSubjectRealmName() {
+        if (getSecurity() != null) {
+            SubjectInfo subjectInfo = getSecurity().getDefaultSubject();
+            if (subjectInfo != null) {
+                return subjectInfo.getRealm();
+            }
+        }
+        return "";
+    }
+
+    private String getDefaultSubjectId() {
+        if (getSecurity() != null) {
+            SubjectInfo subjectInfo = getSecurity().getDefaultSubject();
+            if (subjectInfo != null) {
+                return subjectInfo.getId();
+            }
+        }
+        return "";
+    }
+
+    private boolean isDoasCurrentCaller() {
+        if (getSecurity() != null) {
+            return getSecurity().isDoasCurrentCaller();
+        }
+        return false;
+    }
+
+    private boolean isUseContextHandler() {
+        if (getSecurity() != null) {
+            return getSecurity().isUseContextHandler();
+        }
+        return false;
+    }
+
+    private void setCredentialStoreRef() {
+        if (getSecurity() != null) {
+            String credentialStoreRefName = credentialStoreRef.getText();
+            if (credentialStoreRefName.trim().length() > 0) {
+                Pattern credentialStoreRef = new Pattern();
+                // credentialStoreRef.setGroupId("org.apache.geronimo.framework");
+                // credentialStoreRef.setArtifactId("server-security-config");
+                //credentialStoreRef.setCustomFoo(credentialStoreRef.getText());
+                getSecurity().setCredentialStoreRef(credentialStoreRef);
+            } else {
+                getSecurity().setCredentialStoreRef(null);
+            }
+        }
+    }
+
+    private void setDefaultSubject() {
+        if (getSecurity() != null) {
+            String realmName = defaultSubjectRealmName.getText();
+            String realmId = defaultSubjectId.getText();
+            if (realmName.trim().length() > 0 && realmId.trim().length() > 0) {
+                SubjectInfo defaultSubject = new SubjectInfo();
+                defaultSubject.setRealm(realmName);
+                defaultSubject.setId(realmId);
+                getSecurity().setDefaultSubject(defaultSubject);
+            } else {
+                getSecurity().setDefaultSubject(null);
+            }
+        }
+    }
+
+    private void setDoAsCurrentCaller() {
+        if (getSecurity() != null) {
+            getSecurity().setDoasCurrentCaller(doAsCurrentCaller.getSelection());
+        }
+    }
+
+    private void setUseContextHandler() {
+        if (getSecurity() != null) {
+            getSecurity().setUseContextHandler(useContextHandler.getSelection());
+        }
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.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/SecurityAdvancedSection.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/SecurityAdvancedSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingsSection.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/SecurityRoleMappingsSection.java?rev=688452&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingsSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityRoleMappingsSection.java Sat Aug 23 22:56:20 2008
@@ -0,0 +1,286 @@
+/*
+ * 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.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.SecurityRoleMappingsAddWizard;
+import org.apache.geronimo.st.v21.ui.wizards.SecurityRoleMappingsEditWizard;
+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 SecurityRoleMappingsSection extends AbstractTreeSection {
+
+    public SecurityRoleMappingsSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style) {
+        super(plan, parent, toolkit, style);
+        createClient();
+    }
+
+    public SecurityRoleMappingsSection(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("Refresh Roles from Deployment Descriptor/Annotations") {
+            @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 getAddWizard() {
+        return new SecurityRoleMappingsAddWizard(this);
+    }
+
+    @Override
+    public Wizard getEditWizard() {
+        return new SecurityRoleMappingsEditWizard(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 = ((WebDeploymentDescriptor) getDescriptor()).getSecurityRoles();
+        if (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) {
+                String str = "";
+                if (Role.class.isInstance(element)) {
+                    Role role = (Role) element;
+                    str += "role-name = " + "\"" + role.getRoleName() + "\"";
+                    return str;
+                }
+
+                if (element instanceof DistinguishedName) {
+                    DistinguishedName object = (DistinguishedName) element;
+                    str = "DistinguishedName: name = " + "\"" + object.getName() + "\"";
+                    return str;
+                } else if (element instanceof RealmPrincipal) {
+                    RealmPrincipal object = (RealmPrincipal) element;
+                    str += "RealmPrincipal: realm-name = " + "\"" + object.getRealmName() + "\""
+                            + ", domain-name = " + "\"" + object.getDomainName() + "\"" + ", name = "
+                            + "\"" + object.getName() + "\"" + ", class = " + "\"" + object.getClazz()
+                            + "\"";
+                    return str;
+                } else if (element instanceof LoginDomainPrincipal) {
+                    LoginDomainPrincipal object = (LoginDomainPrincipal) element;
+                    str += "LoginDomainPrincipal: domain-name = " + "\"" + object.getDomainName()
+                            + "\"" + ", name = " + "\"" + object.getName() + "\"" + ", class = " + "\""
+                            + object.getClazz() + "\"";
+                    return str;
+                } else if (element instanceof Principal) {
+                    Principal object = (Principal) element;
+                    str += "Principal: name = " + "\"" + object.getName() + "\"" + ", class = " + "\""
+                            + object.getClazz() + "\"";
+                    return str;
+                }
+
+                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/SecurityRoleMappingsSection.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/SecurityRoleMappingsSection.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/SecurityRoleMappingsSection.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/sections/ServiceRefSection.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/ServiceRefSection.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ServiceRefSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ServiceRefSection.java Sat Aug 23 22:56:20 2008
@@ -20,11 +20,11 @@
 
 import javax.xml.bind.JAXBElement;
 
+import org.apache.geronimo.jee.naming.ServiceRef;
 import org.apache.geronimo.st.ui.CommonMessages;
-import org.apache.geronimo.st.ui.providers.AdapterFactory;
 import org.apache.geronimo.st.ui.sections.AbstractTableSection;
 import org.apache.geronimo.st.v21.ui.wizards.ServiceRefWizard;
-import org.apache.geronimo.jee.naming.ServiceRef;
+import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -57,25 +57,16 @@
         return ServiceRef.class;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.geronimo.st.ui.sections.AbstractTableSection#getAdapterFactory()
-     */
-    public AdapterFactory getAdapterFactory() {
-        return new AdapterFactory() {
-            public Object[] getElements(Object inputElement) {
-                if (!JAXBElement.class.isInstance(inputElement)) {
-                    return new String[] { "" };
-                }
-                return getObjectContainer().toArray();
-            }
-
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
             public String getColumnText(Object element, int columnIndex) {
                 if (ServiceRef.class.isInstance(element)) {
-                    ServiceRef serviceRef = (ServiceRef)element;
+                    ServiceRef serviceRef = (ServiceRef) element;
                     switch (columnIndex) {
-                    case 0: return serviceRef.getServiceRefName();
+                    case 0:
+                        return serviceRef.getServiceRefName();
                     }
                 }
                 return null;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ClassFilterWizard.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/ClassFilterWizard.java?rev=688452&r1=688451&r2=688452&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ClassFilterWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ClassFilterWizard.java Sat Aug 23 22:56:20 2008
@@ -93,8 +93,8 @@
             filter.getFilter().set(filter.getFilter().indexOf(eObject), page.getTextEntry(0).getText());
         }
 
-        if (section.getTableViewer().getInput() == null) {
-            section.getTableViewer().setInput(section.getInput());
+        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/DependencyAddWizard.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/DependencyAddWizard.java?rev=688452&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyAddWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyAddWizard.java Sat Aug 23 22:56:20 2008
@@ -0,0 +1,155 @@
+/*
+ * 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.deployment.Dependency;
+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.v21.core.GeronimoServerInfo;
+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 DependencyAddWizard extends DependencyWizard {
+    public Table dependencyTable;
+    private TabFolder tabFolder;
+
+    public DependencyAddWizard(AbstractTableSection section) {
+        super(section, true);
+    }
+
+    public void addPages() {
+        addPage(new DependencyAddWizardPage("AddDependencyPage"));
+    }
+
+    public class DependencyAddWizardPage extends DynamicWizardPage {
+
+        public DependencyAddWizardPage(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);
+
+            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
+            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;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DependencyAddWizard.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/DependencyAddWizard.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/DependencyAddWizard.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=688452&r1=688451&r2=688452&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 Sat Aug 23 22:56:20 2008
@@ -16,17 +16,12 @@
  */
 package org.apache.geronimo.st.v21.ui.wizards;
 
-import javax.xml.bind.JAXBElement;
-
+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.sections.AbstractTableSection;
 import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
-import org.apache.geronimo.st.v21.core.jaxb.JAXBModelUtils;
 import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
-import org.apache.geronimo.jee.deployment.Dependency;
-import org.apache.geronimo.jee.deployment.Dependencies;
-import org.apache.geronimo.jee.deployment.Environment;
 
 /**
  * @version $Rev$ $Date$
@@ -34,7 +29,7 @@
 public class DependencyWizard extends AbstractTableWizard {
 
     protected boolean isServerEnvironment;
-    
+
     public DependencyWizard(AbstractTableSection section, boolean isServerEnvironment) {
         super(section);
         this.isServerEnvironment = isServerEnvironment;
@@ -45,7 +40,16 @@
     }
 
     public String[] getTableColumnEAttributes() {
-        return new String[] {"GroupId", "ArtifactId", "Version", "Type" };
+        return new String[] { "GroupId", "ArtifactId", "Version", "Type" };
+    }
+
+    protected String[] dependencyToStringArray(Dependency dependency) {
+        String[] stringArray = new String[getTableColumnEAttributes().length];
+        stringArray[0] = dependency.getGroupId();
+        stringArray[1] = dependency.getArtifactId();
+        stringArray[2] = dependency.getVersion();
+        stringArray[3] = dependency.getType();
+        return stringArray;
     }
 
     public String getAddWizardWindowTitle() {
@@ -63,38 +67,4 @@
     public String getWizardFirstPageDescription() {
         return CommonMessages.wizardPageDescription_Dependency;
     }
-    
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.st.ui.wizards.AbstractTableWizard#performFinish()
-     */
-    public boolean performFinish() {
-        DynamicWizardPage page = (DynamicWizardPage) getPages()[0];
-
-        if (eObject == null) {
-            eObject = getEFactory().create(Dependency.class);
-            JAXBElement plan = section.getPlan();
-
-            Environment environment = null;
-          	environment = JAXBModelUtils.getEnvironment(plan, isServerEnvironment);
-            if (environment == null) {
-                environment = (Environment)getEFactory().create(Environment.class);
-                JAXBModelUtils.setEnvironment (plan, environment, isServerEnvironment);
-            }
-
-            Dependencies dependencies = environment.getDependencies();
-            if (dependencies == null) {
-                dependencies = (Dependencies)getEFactory().create(Dependencies.class);
-                environment.setDependencies (dependencies);
-            }
-            dependencies.getDependency().add((Dependency)eObject);
-        }
-
-        processEAttributes (page);
-
-        if (section.getTableViewer().getInput() == null) {
-            section.getTableViewer().setInput(section.getInput());
-        }
-
-        return true;
-    }
 }



Mime
View raw message