geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bjr...@apache.org
Subject svn commit: r705267 - in /geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins: org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/ org.apach...
Date Thu, 16 Oct 2008 15:53:27 GMT
Author: bjreed
Date: Thu Oct 16 08:53:26 2008
New Revision: 705267

URL: http://svn.apache.org/viewvc?rev=705267&view=rev
Log:
GERONIMODEVTOOLS-377.patch for adding Admin Objects to the Connector Deployment Plan Editor

Added:
    geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/AdminObjectSection.java
  (with props)
    geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/AdminObjectWizard.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
    geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java
    geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java
    geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/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/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java?rev=705267&r1=705266&r2=705267&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
Thu Oct 16 08:53:26 2008
@@ -159,6 +159,8 @@
     public static String editorSectionClientNonOverridableTitle;
     public static String editorSectionClientNonOverridableDescription;
     //
+    public static String editorSectionAdminObjectTitle;
+    public static String editorSectionAdminObjectDescription;
     public static String editorSectionMessageDestTitle;
     public static String editorSectionMessageDestDescription;
     //
@@ -174,6 +176,7 @@
     public static String editorSectionGBeanTitle;
     public static String editorSectionGBeanDescription;
     public static String className;
+    public static String interfaceName;
     public static String GbeanName;
     //
     public static String editorResourceRefDescription;
@@ -223,6 +226,11 @@
     public static String wizardPageTitle_ResRef;
     public static String wizardPageDescription_ResRef;
     //
+    public static String wizardNewTitle_AdminObject;
+    public static String wizardEditTitle_AdminObject;
+    public static String wizardPageTitle_AdminObject;
+    public static String wizardPageDescription_AdminObject;
+    //
     public static String wizardNewTitle_GBeanRef;
     public static String wizardEditTitle_GBeanRef;
     public static String wizardPageTitle_GBeanRef;

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/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/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties?rev=705267&r1=705266&r2=705267&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
Thu Oct 16 08:53:26 2008
@@ -55,6 +55,8 @@
 editorSectionClientNonOverridableTitle=Client Non Overridable Classes
 editorSectionClientNonOverridableDescription=The following classes are not overridable in
the client.
 
+editorSectionAdminObjectTitle=Admin Objects
+editorSectionAdminObjectDescription=The following admin objects are defined:
 editorSectionMessageDestTitle=Message Destinations
 editorSectionMessageDestDescription=The following message destinations are defined:
 
@@ -70,6 +72,7 @@
 editorSectionGBeanTitle=GBeans
 editorSectionGBeanDescription=The following gbeans are defined in this plan.
 className=Class
+interfaceName=Interface
 GbeanName=Gbean Name
 
 editorSectionSecurityTitle=Security
@@ -156,6 +159,11 @@
 wizardEditTitle_ResRef=Edit Resource Reference
 wizardPageTitle_ResRef=Resource Reference Details
 wizardPageDescription_ResRef=Provide details for this resource reference.
+
+wizardNewTitle_AdminObject=New Admin Object
+wizardEditTitle_AdminObject=Edit Admin Object
+wizardPageTitle_AdminObject=Admin Object Details
+wizardPageDescription_AdminObject=Provide details for this admin object.
     
 wizardNewTitle_ResEnvRef=New Resource Enviornment Reference
 wizardEditTitle_ResEnvRef=Edit Resource Enviornment Reference

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java?rev=705267&r1=705266&r2=705267&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java
Thu Oct 16 08:53:26 2008
@@ -70,7 +70,7 @@
     
     public static void setSecurity (JAXBElement element, Security security) {
         Object plan = element.getValue();
-        if ( WebApp.class.isInstance( plan ) ) {
+        if (WebApp.class.isInstance (plan)) {
             ((WebApp)plan).setSecurity((new org.apache.geronimo.jee.security.ObjectFactory()).createSecurity(
security ) );
         } else if (Application.class.isInstance(plan)) {
             ((Application)plan).setSecurity((new org.apache.geronimo.jee.security.ObjectFactory()).createSecurity(
security ) );
@@ -87,24 +87,19 @@
         Object plan = element.getValue();
         if (serverEnvironment == true) {
             if (WebApp.class.isInstance (plan)) {
-                return ((WebApp)plan).getEnvironment() == null ? null : ((WebApp)plan).getEnvironment();
-            }
-            else if (Application.class.isInstance (plan)) {
-                return ((Application)plan).getEnvironment() == null ? null : ((Application)plan).getEnvironment();
-            }
-            else if (OpenejbJar.class.isInstance (plan)) {
-                return ((OpenejbJar)plan).getEnvironment() == null ? null : ((OpenejbJar)plan).getEnvironment();
-            }
-            else if (Connector.class.isInstance (plan)) {
-                return ((Connector)plan).getEnvironment() == null ? null : ((Connector)plan).getEnvironment();
-            }
-            else if (ApplicationClient.class.isInstance (plan)) {
-                return ((ApplicationClient)plan).getServerEnvironment() == null ? null :
((ApplicationClient)plan).getServerEnvironment();
+                return ((WebApp)plan).getEnvironment();
+            } else if (Application.class.isInstance (plan)) {
+                return ((Application)plan).getEnvironment();
+            } else if (OpenejbJar.class.isInstance (plan)) {
+                return ((OpenejbJar)plan).getEnvironment();
+            } else if (Connector.class.isInstance (plan)) {
+                return ((Connector)plan).getEnvironment();
+            } else if (ApplicationClient.class.isInstance (plan)) {
+                return ((ApplicationClient)plan).getServerEnvironment();
             }
-        }
-        else {
+        } else {
             if (ApplicationClient.class.isInstance (plan)) {
-                return ((ApplicationClient)plan).getClientEnvironment() == null ? null :
((ApplicationClient)plan).getClientEnvironment();
+                return ((ApplicationClient)plan).getClientEnvironment();
             }
         }
         return null;
@@ -119,21 +114,16 @@
         if (serverEnvironment == true) {
             if (WebApp.class.isInstance (plan)) {
                 ((WebApp)plan).setEnvironment (environment);
-            }
-            else if (Application.class.isInstance (plan)) {
+            } else if (Application.class.isInstance (plan)) {
                 ((Application)plan).setEnvironment (environment);
-            }
-            else if (OpenejbJar.class.isInstance (plan)) {
+            } else if (OpenejbJar.class.isInstance (plan)) {
                 ((OpenejbJar)plan).setEnvironment (environment);
-            }
-            else if (Connector.class.isInstance (plan)) {
+            } else if (Connector.class.isInstance (plan)) {
                 ((Connector)plan).setEnvironment (environment);
-            }
-            else if (ApplicationClient.class.isInstance (plan)) {
+            } else if (ApplicationClient.class.isInstance (plan)) {
                 ((ApplicationClient)plan).setServerEnvironment (environment);
             }
-        }
-        else {
+        } else {
             if (ApplicationClient.class.isInstance (plan)) {
                 ((ApplicationClient)plan).setClientEnvironment (environment);
             }
@@ -143,19 +133,15 @@
     public static List getGbeans (JAXBElement element) {
         Object plan = element.getValue();
         if (WebApp.class.isInstance (plan)) {
-            return ((WebApp)plan).getServiceOrPersistence() == null ? null : ((WebApp)plan).getServiceOrPersistence();
-        }
-        else if (Application.class.isInstance (plan)) {
-            return ((Application)plan).getService() == null ? null : ((Application)plan).getService();
-        }
-        else if (OpenejbJar.class.isInstance (plan)) {
-            return ((OpenejbJar)plan).getService() == null ? null : ((OpenejbJar)plan).getService();
-        }
-        else if (Connector.class.isInstance (plan)) {
-            return ((Connector)plan).getService() == null ? null : ((Connector)plan).getService();
-        }
-        else if (ApplicationClient.class.isInstance (plan)) {
-            return ((ApplicationClient)plan).getService() == null ? null : ((ApplicationClient)plan).getService();
+            return ((WebApp)plan).getServiceOrPersistence();
+        } else if (Application.class.isInstance (plan)) {
+            return ((Application)plan).getService();
+        } else if (OpenejbJar.class.isInstance (plan)) {
+            return ((OpenejbJar)plan).getService();
+        } else if (Connector.class.isInstance (plan)) {
+            return ((Connector)plan).getService();
+        } else if (ApplicationClient.class.isInstance (plan)) {
+            return ((ApplicationClient)plan).getService();
         }
         return null;
     }
@@ -163,10 +149,9 @@
     public static List getGbeanRefs (JAXBElement element) {
         Object plan = element.getValue();
         if (ApplicationClient.class.isInstance (plan)) {
-            return ((ApplicationClient)plan).getGbeanRef() == null ? null : ((ApplicationClient)plan).getGbeanRef();
-        }
-        else if (WebApp.class.isInstance (plan)) {
-            return ((WebApp)plan).getAbstractNamingEntry() == null ? null : ((WebApp)plan).getAbstractNamingEntry();
+            return ((ApplicationClient)plan).getGbeanRef();
+        } else if (WebApp.class.isInstance (plan)) {
+            return ((WebApp)plan).getAbstractNamingEntry();
         }
         return null;
     }
@@ -174,7 +159,7 @@
     public static List getServiceRefs (JAXBElement element) {
         Object plan = element.getValue();
         if (WebApp.class.isInstance (plan)) {
-            return ((WebApp)plan).getServiceRef() == null ? null : ((WebApp)plan).getServiceRef();
+            return ((WebApp)plan).getServiceRef();
         }
         return null;
     }
@@ -197,13 +182,11 @@
     public static List getMessageDestinations (JAXBElement element) {
         Object plan = element.getValue();
         if (WebApp.class.isInstance (plan)) {
-            return ((WebApp)plan).getMessageDestination() == null ? null : ((WebApp)plan).getMessageDestination();
-        }
-        else if (OpenejbJar.class.isInstance (plan)) {
-            return ((OpenejbJar)plan).getMessageDestination() == null ? null : ((OpenejbJar)plan).getMessageDestination();
-        }
-        else if (ApplicationClient.class.isInstance (plan)) {
-            return ((ApplicationClient)plan).getMessageDestination() == null ? null : ((ApplicationClient)plan).getMessageDestination();
+            return ((WebApp)plan).getMessageDestination();
+        } else if (OpenejbJar.class.isInstance (plan)) {
+            return ((OpenejbJar)plan).getMessageDestination();
+        } else if (ApplicationClient.class.isInstance (plan)) {
+            return ((ApplicationClient)plan).getMessageDestination();
         }
         return null;
     }

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/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/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java?rev=705267&r1=705266&r2=705267&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java
Thu Oct 16 08:53:26 2008
@@ -20,6 +20,9 @@
 import org.apache.geronimo.jee.application.ExtModule;
 import org.apache.geronimo.jee.application.Module;
 import org.apache.geronimo.jee.application.Path;
+import org.apache.geronimo.jee.connector.Adminobject;
+import org.apache.geronimo.jee.connector.AdminobjectInstance;
+import org.apache.geronimo.jee.connector.ConfigPropertySetting;
 import org.apache.geronimo.jee.deployment.Artifact;
 import org.apache.geronimo.jee.deployment.Attribute;
 import org.apache.geronimo.jee.deployment.ClassFilter;
@@ -151,6 +154,12 @@
             return (new org.apache.geronimo.jee.openejb.ObjectFactory()).createEjbRelationshipRoleRoleMapping();
         } else if ( type.equals( Relationships.class ) ) {
             return (new org.apache.geronimo.jee.openejb.ObjectFactory()).createRelationships();
+        } else if ( type.equals( Adminobject.class ) ) {
+            return (new org.apache.geronimo.jee.connector.ObjectFactory()).createAdminobject();
+        } else if ( type.equals( AdminobjectInstance.class ) ) {
+            return (new org.apache.geronimo.jee.connector.ObjectFactory()).createAdminobjectInstance();
+        } else if ( type.equals( ConfigPropertySetting.class ) ) {
+            return (new org.apache.geronimo.jee.connector.ObjectFactory()).createConfigPropertySetting();
         }
         
         return null;

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java?rev=705267&r1=705266&r2=705267&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java
Thu Oct 16 08:53:26 2008
@@ -17,11 +17,13 @@
 package org.apache.geronimo.st.v21.ui.pages;
 
 import org.apache.geronimo.jee.application.Application;
+import org.apache.geronimo.jee.connector.Connector;
 import org.apache.geronimo.st.ui.CommonMessages;
 import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;
 import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
 import org.apache.geronimo.st.v21.core.GeronimoServerInfo;
 import org.apache.geronimo.st.v21.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v21.ui.sections.AdminObjectSection;
 import org.apache.geronimo.st.v21.ui.sections.ClassFilterSection;
 import org.apache.geronimo.st.v21.ui.sections.DependencySection;
 import org.apache.geronimo.st.v21.ui.sections.ExtModuleSection;
@@ -55,6 +57,10 @@
             managedForm.addPart(new ModuleSection(getDeploymentPlan(), body, toolkit, getStyle(),
application.getModule()));
             managedForm.addPart(new ExtModuleSection(getDeploymentPlan(), body, toolkit,
getStyle(), application.getExtModule()));
         }
+        if (Connector.class.isInstance(getDeploymentPlan().getValue())) {
+            Connector connector = (Connector)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
+            managedForm.addPart(new AdminObjectSection(getDeploymentPlan(), body, toolkit,
getStyle(), connector.getAdminobject()));
+        }
     }
     
     protected GridLayout getLayout() {

Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/AdminObjectSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/AdminObjectSection.java?rev=705267&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/AdminObjectSection.java
(added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/AdminObjectSection.java
Thu Oct 16 08:53:26 2008
@@ -0,0 +1,163 @@
+/*
+ * 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.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.connector.Adminobject;
+import org.apache.geronimo.jee.connector.AdminobjectInstance;
+import org.apache.geronimo.jee.connector.ConfigPropertySetting;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.v21.ui.Activator;
+import org.apache.geronimo.st.v21.ui.wizards.AdminObjectWizard;
+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$
+ */
+public class AdminObjectSection extends AbstractTreeSection {
+    public AdminObjectSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int
style, List adminObjects) {
+        super(plan, parent, toolkit, style);
+        this.objectContainer = adminObjects;
+        createClient();
+    }
+
+    @Override
+    public String getTitle() {
+        return CommonMessages.editorSectionAdminObjectTitle;
+    }
+
+    @Override
+    public String getDescription() {
+        return CommonMessages.editorSectionAdminObjectDescription;
+    }
+
+    @Override
+    public Wizard getWizard() {
+        return new AdminObjectWizard(this);
+    }
+
+    @Override
+    public Class getTableEntryObjectType() {
+        return Adminobject.class;
+    }
+
+    @Override
+    protected void activateAddButton() {
+        if (tree.getSelectionCount() == 0 || tree.getSelection()[0].getParentItem() == null
||
+            tree.getSelection()[0].getParentItem().getParentItem() == null) {
+            addButton.setEnabled(true);
+        } else {
+            addButton.setEnabled(false);
+        }
+    }
+
+    public Object getSelectedObject () {
+        if (tree.getSelection().length == 0) {
+            return null;
+        }
+        return tree.getSelection()[0].getData();
+    }
+
+    @Override
+    public void removeItem(Object anItem) {
+        if (Adminobject.class.isInstance(anItem)) {
+            getObjectContainer().remove(anItem);
+        }
+        else if (AdminobjectInstance.class.isInstance(anItem)) {
+            Adminobject admin = (Adminobject)tree.getSelection()[0].getParentItem().getData();
+            admin.getAdminobjectInstance().remove(anItem);
+        }
+        else if (ConfigPropertySetting.class.isInstance(anItem)) {
+            AdminobjectInstance aoInstance = (AdminobjectInstance)tree.getSelection()[0].getParentItem().getData();
+            aoInstance.getConfigPropertySetting().remove(anItem);
+        }
+    }
+    
+    @Override
+    public Object getInput() {
+        if (objectContainer != null) {
+            return objectContainer;
+        }
+        return super.getInput();
+    }
+
+    @Override
+    public ITreeContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
+            public Object[] getElements(Object inputElement) {
+                return getChildren(inputElement);
+            }
+
+            @Override
+            public Object[] getChildren(Object parentElement) {
+                if (List.class.isInstance(parentElement)) {
+                    return ((List)parentElement).toArray();
+                }
+                if (Adminobject.class.isInstance(parentElement)) {
+                    Adminobject admin = (Adminobject)parentElement;
+                    return admin.getAdminobjectInstance().toArray();
+                }
+                if (AdminobjectInstance.class.isInstance(parentElement)) {
+                    AdminobjectInstance aoInstance = (AdminobjectInstance)parentElement;
+                    return aoInstance.getConfigPropertySetting().toArray();
+                }
+                return new String[] {};
+            }
+        };
+    }
+
+    @Override
+    public ILabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
+            public String getText(Object element) {
+                if (Adminobject.class.isInstance(element)) {
+                    Adminobject admin = (Adminobject)element;
+                    return "Admin Object: interface = \"" + admin.getAdminobjectInterface()
+
+                            "\", class = \"" + admin.getAdminobjectClass() + "\"";
+                }
+                if (AdminobjectInstance.class.isInstance(element)) {
+                    AdminobjectInstance aoInstance = (AdminobjectInstance)element;
+                    return "Admin Object Instance: message destination name = \"" + aoInstance.getMessageDestinationName()
+ "\"";
+                }
+                if (ConfigPropertySetting.class.isInstance(element)) {
+                    ConfigPropertySetting property = (ConfigPropertySetting)element;
+                    return "Config Property Setting: name = \"" + property.getName() +
+                            "\", value = \"" + property.getValue() + "\"";
+                }
+
+                return null;
+            }
+
+            @Override
+            public Image getImage(Object arg0) {
+                return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee",
+                        "icons/full/obj16/module_web_obj.gif").createImage();
+            }
+        };
+    }
+}

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

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

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

Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/AdminObjectWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/AdminObjectWizard.java?rev=705267&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/AdminObjectWizard.java
(added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/AdminObjectWizard.java
Thu Oct 16 08:53:26 2008
@@ -0,0 +1,190 @@
+/*
+ * 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.connector.Adminobject;
+import org.apache.geronimo.jee.connector.AdminobjectInstance;
+import org.apache.geronimo.jee.connector.ConfigPropertySetting;
+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.AbstractTreeWizard;
+import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v21.ui.sections.AdminObjectSection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AdminObjectWizard extends AbstractTreeWizard {
+
+    private final int ADMIN_OBJECT = 0;
+    private final int ADMIN_OBJECT_INSTANCE = 1;
+    private final int CONFIG_PROPERTY_SETTING = 2;
+
+    public AdminObjectWizard(AbstractTreeSection section) {
+        super(section, 3, 2);
+        elementTypes[ADMIN_OBJECT] = "Admin Object";
+        elementTypes[ADMIN_OBJECT_INSTANCE] = "Admin Object Instance";
+        elementTypes[CONFIG_PROPERTY_SETTING] = "Config Property";
+    }
+
+    public class EjbRelationWizardPage extends AbstractTreeWizardPage {
+
+        public EjbRelationWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        protected void initControl () {
+            if (eObject == null) {
+                element.select(ADMIN_OBJECT);
+                if (Adminobject.class.isInstance(((AdminObjectSection)section).getSelectedObject()))
{
+                    element.remove(elementTypes[CONFIG_PROPERTY_SETTING]);
+                }
+                else if (AdminobjectInstance.class.isInstance(((AdminObjectSection)section).getSelectedObject()))
{
+                    element.select(CONFIG_PROPERTY_SETTING);
+                    element.setEnabled(false);
+                }
+                else {
+                    element.setEnabled(false);
+                }
+            }
+            else {
+                if (Adminobject.class.isInstance(eObject)) {
+                    textList.get(0).setText(((Adminobject)eObject).getAdminobjectInterface());
+                    textList.get(1).setText(((Adminobject)eObject).getAdminobjectClass());
+                    element.select(ADMIN_OBJECT);
+                }
+                else if (AdminobjectInstance.class.isInstance(eObject)) {
+                    textList.get(0).setText(((AdminobjectInstance)eObject).getMessageDestinationName());
+                    element.select(ADMIN_OBJECT_INSTANCE);
+                }
+                else if (ConfigPropertySetting.class.isInstance(eObject)) {
+                    textList.get(0).setText(((ConfigPropertySetting)eObject).getName());
+                    textList.get(1).setText(((ConfigPropertySetting)eObject).getValue());
+                    element.select(CONFIG_PROPERTY_SETTING);
+                }
+                element.setEnabled(false);
+            }
+        }
+        
+        protected void toggleFields (boolean clearFields) {
+            if (element.getText().equals(elementTypes[ADMIN_OBJECT])) {
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(true);
+                    textList.get(i).setVisible(true);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.interfaceName);
+                labelList.get(1).setText(CommonMessages.className);
+            }
+            else if (element.getText().equals(elementTypes[ADMIN_OBJECT_INSTANCE])) {
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(i < 1 ? true : false);
+                    textList.get(i).setVisible(i < 1 ? true : false);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.messageDestinationName);
+            }
+            else if (element.getText().equals(elementTypes[CONFIG_PROPERTY_SETTING])) {
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(true);
+                    textList.get(i).setVisible(true);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.name);
+                labelList.get(1).setText(CommonMessages.value);
+            }
+        }
+    }
+
+    @Override
+    public void addPages() {
+        addPage(new EjbRelationWizardPage("Page0"));
+    }
+
+    @Override
+    public boolean performFinish() {
+        Adminobject admin;
+        if (element.getText().equals(elementTypes[ADMIN_OBJECT])) {
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText()))
{
+                return false;
+            }
+            admin = (Adminobject)eObject;
+            if (admin == null) {
+                admin = (Adminobject)getEFactory().create(Adminobject.class);
+                List objectList = (List)section.getInput();
+                objectList.add (admin);
+            }
+            admin.setAdminobjectInterface(textList.get(0).getText());
+            admin.setAdminobjectClass(textList.get(1).getText());
+        }
+        else if (element.getText().equals(elementTypes[ADMIN_OBJECT_INSTANCE])) {
+            if (isEmpty(textList.get(0).getText())) {
+                return false;
+            }
+            AdminobjectInstance aoInstance = (AdminobjectInstance)eObject;
+            if (aoInstance == null) {
+                aoInstance = (AdminobjectInstance)getEFactory().create(AdminobjectInstance.class);
+                admin = (Adminobject)((AdminObjectSection)section).getSelectedObject();
+                admin.getAdminobjectInstance().add(aoInstance);
+            }
+            aoInstance.setMessageDestinationName(textList.get(0).getText());
+        }
+        else if (element.getText().equals(elementTypes[CONFIG_PROPERTY_SETTING])) { 
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText()))
{
+                return false;
+            }
+            ConfigPropertySetting property = (ConfigPropertySetting)eObject;
+            if (property == null) {
+                property = (ConfigPropertySetting)getEFactory().create(ConfigPropertySetting.class);
+                AdminobjectInstance aoInstance = (AdminobjectInstance)((AdminObjectSection)section).getSelectedObject();
+                aoInstance.getConfigPropertySetting().add(property);
+            }
+            property.setName(textList.get(0).getText());
+            property.setValue(textList.get(1).getText());
+        }
+        return true;
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_AdminObject;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_AdminObject;
+    }
+
+    public String getWizardPageTitle() {
+        return CommonMessages.wizardPageTitle_AdminObject;
+    }
+
+    public String getWizardPageDescription() {
+        return CommonMessages.wizardPageDescription_AdminObject;
+    }
+}

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

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

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



Mime
View raw message