You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2008/06/20 23:13:50 UTC

svn commit: r670063 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/ org.apache.geronim...

Author: mcconne
Date: Fri Jun 20 14:13:50 2008
New Revision: 670063

URL: http://svn.apache.org/viewvc?rev=670063&view=rev
Log:
GERONIMODEVTOOLS-391 Allow support for message destination(s) editing in the various GEP deployment plan editors -- Thanks BJ Reed for the patch!!

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/MessageDestSection.java   (with props)
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/MessageDestWizard.java   (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java?rev=670063&r1=670062&r2=670063&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java Fri Jun 20 14:13:50 2008
@@ -145,6 +145,9 @@
     public static String editorSectionServerDependenciesTitle;
     public static String editorSectionServerDependenciesDescription;
     //
+    public static String editorSectionMessageDestTitle;
+    public static String editorSectionMessageDestDescription;
+    //
     public static String editorSectionImportTitle;
     public static String editorSectionImportDescription;
     //
@@ -227,6 +230,9 @@
     public static String artifactId;
     public static String version;
     public static String type;
+    public static String messageDestinationName;
+    public static String adminModule;
+    public static String adminLink;
     //
     public static String wizardNewTitle_Import;
     public static String wizardEditTitle_Import;
@@ -238,6 +244,11 @@
     public static String wizardPageTitle_GBean;
     public static String wizardPageDescription_GBean;
     //
+    public static String wizardNewTitle_MessageDest;
+    public static String wizardEditTitle_MessageDest;
+    public static String wizardPageTitle_MessageDest;
+    public static String wizardPageDescription_MessageDest;
+    //
     public static String wizardNewTitle_SecurityRole;
     public static String wizardEditTitle_SecurityRole;
     public static String wizardPageTitle_SecurityRole;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties?rev=670063&r1=670062&r2=670063&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties Fri Jun 20 14:13:50 2008
@@ -46,6 +46,9 @@
 editorSectionServerDependenciesTitle=Server Dependencies
 editorSectionServerDependenciesDescription=The following server dependencies are defined as common libraries.
 
+editorSectionMessageDestTitle=Message Destinations
+editorSectionMessageDestDescription=The following message destinations are defined:
+
 editorSectionImportTitle=Imports
 editorSectionImportDescription=The following configurations are imported into this plan.
 
@@ -176,6 +179,11 @@
 wizardPageTitle_GBean=Gbean Details
 wizardPageDescription_GBean=Provide details for this gbean.
 
+wizardNewTitle_MessageDest=New Message Destination
+wizardEditTitle_MessageDest=Edit Message Destination
+wizardPageTitle_MessageDest=Message Destination Details
+wizardPageDescription_MessageDest=Provide details for this message destination.
+
 doasCurrentCaller=Do as current caller
 useContextHandler=Use context handler
 defaultRole=Default Role:
@@ -186,6 +194,10 @@
 version=Version
 type=Artifact Type
 
+messageDestinationName=Message Destination Name
+adminModule=Admin Module
+adminLink=Admin Link
+
 editorTabGeneral=General
 editorTabNaming=Naming
 editorTabSecurity=Security

Modified: geronimo/devtools/eclipse-plugin/trunk/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/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java?rev=670063&r1=670062&r2=670063&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBModelUtils.java Fri Jun 20 14:13:50 2008
@@ -169,4 +169,17 @@
         return null;
     }
 
+    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 null;
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java?rev=670063&r1=670062&r2=670063&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/jaxb/JAXBObjectFactoryImpl.java Fri Jun 20 14:13:50 2008
@@ -25,6 +25,8 @@
 import org.apache.geronimo.jee.naming.EjbRef;
 import org.apache.geronimo.jee.naming.EjbLocalRef;
 import org.apache.geronimo.jee.naming.GbeanRef;
+import org.apache.geronimo.jee.naming.MessageDestination;
+import org.apache.geronimo.jee.naming.Pattern;
 import org.apache.geronimo.jee.naming.ResourceEnvRef;
 import org.apache.geronimo.jee.naming.ResourceRef;
 import org.apache.geronimo.jee.naming.ServiceRef;
@@ -57,6 +59,10 @@
             return (new org.apache.geronimo.jee.naming.ObjectFactory()).createEjbRef();
         } else if ( type.equals( GbeanRef.class ) ) {
             return (new org.apache.geronimo.jee.naming.ObjectFactory()).createGbeanRef();
+        } else if ( type.equals( MessageDestination.class ) ) {
+            return (new org.apache.geronimo.jee.naming.ObjectFactory()).createMessageDestination();
+        } else if ( type.equals( Pattern.class ) ) {
+            return (new org.apache.geronimo.jee.naming.ObjectFactory()).createPattern();
         } else if ( type.equals( ServiceRef.class ) ) {
             return (new org.apache.geronimo.jee.naming.ObjectFactory()).createServiceRef();
         } else if ( type.equals( EjbLocalRef.class ) ) {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.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/editors/GeronimoFormContentLoader.java?rev=670063&r1=670062&r2=670063&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java Fri Jun 20 14:13:50 2008
@@ -82,7 +82,7 @@
      */
     public void addOpenEjbPlanPages(FormEditor editor) throws PartInitException {
         editor.addPage(new EjbOverviewPage(editor, "ejboverview", CommonMessages.editorTabGeneral));
-        // TODO Add naming page but broken down for each bean type
+        editor.addPage(createNamingFormPage(editor));
         editor.addPage(new SecurityPage(editor, "securitypage", CommonMessages.editorTabSecurity));
         editor.addPage(createDeploymentFormPage(editor));
     }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java?rev=670063&r1=670062&r2=670063&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java Fri Jun 20 14:13:50 2008
@@ -19,6 +19,7 @@
 import java.util.List;
 
 import org.apache.geronimo.jee.applicationclient.ApplicationClient;
+import org.apache.geronimo.jee.openejb.OpenejbJar;
 import org.apache.geronimo.jee.web.WebApp;
 import org.apache.geronimo.st.ui.CommonMessages;
 import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;
@@ -26,6 +27,7 @@
 import org.apache.geronimo.st.v21.ui.sections.EjbLocalRefSection;
 import org.apache.geronimo.st.v21.ui.sections.EjbRefSection;
 import org.apache.geronimo.st.v21.ui.sections.GBeanRefSection;
+import org.apache.geronimo.st.v21.ui.sections.MessageDestSection;
 import org.apache.geronimo.st.v21.ui.sections.ResourceEnvRefSection;
 import org.apache.geronimo.st.v21.ui.sections.ResourceRefSection;
 import org.apache.geronimo.st.v21.ui.sections.ServiceRefSection;
@@ -45,6 +47,8 @@
     public List gbeanRefs;
 
     public List serviceRefs;
+    
+    public List messageDestinations;
 
     public NamingFormPage(FormEditor editor, String id, String title) {
         super(editor, id, title);
@@ -55,13 +59,20 @@
             ejbRefs = webapp.getEjbRef();
             ejbLocalRefs = webapp.getEjbLocalRef();
             serviceRefs = webapp.getServiceRef();
-        } else if (ApplicationClient.class.isInstance (((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue())) {
+            messageDestinations = webapp.getMessageDestination();
+        }
+        else if (ApplicationClient.class.isInstance (((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue())) {
             ApplicationClient appClient = (ApplicationClient)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
             resRefs = appClient.getResourceRef();
             resEnvRefs = appClient.getResourceEnvRef();
             ejbRefs = appClient.getEjbRef();
             gbeanRefs = appClient.getGbeanRef();
             serviceRefs = appClient.getServiceRef();
+            messageDestinations = appClient.getMessageDestination();
+        }
+        else if (OpenejbJar.class.isInstance (((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue())) {
+            OpenejbJar ejbJar = (OpenejbJar)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
+            messageDestinations = ejbJar.getMessageDestination();
         }
     }
 
@@ -71,15 +82,25 @@
      * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
      */
     protected void fillBody(IManagedForm managedForm) {
-        managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resRefs));
-        managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resEnvRefs));
-        managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), ejbRefs));
         if (WebApp.class.isInstance (getDeploymentPlan().getValue())) {
+            managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resRefs));
+            managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resEnvRefs));
+            managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), ejbRefs));
             managedForm.addPart(new EjbLocalRefSection(getDeploymentPlan(), body, toolkit, getStyle(), ejbLocalRefs));
-        } else if (ApplicationClient.class.isInstance (getDeploymentPlan().getValue())){
+            managedForm.addPart(new ServiceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), serviceRefs));
+            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), messageDestinations));
+        }
+        else if (ApplicationClient.class.isInstance (getDeploymentPlan().getValue())){
+            managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resRefs));
+            managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resEnvRefs));
+            managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), ejbRefs));
             managedForm.addPart(new GBeanRefSection(getDeploymentPlan(), body, toolkit, getStyle(), gbeanRefs));
+            managedForm.addPart(new ServiceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), serviceRefs));
+            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), messageDestinations));
+        }
+        else if (OpenejbJar.class.isInstance (getDeploymentPlan().getValue())){
+            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), messageDestinations));
         }
-        managedForm.addPart(new ServiceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), serviceRefs));
     }
 
     /*

Added: 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=670063&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/MessageDestSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/MessageDestSection.java Fri Jun 20 14:13:50 2008
@@ -0,0 +1,92 @@
+/*
+ * 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.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.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+public class MessageDestSection extends AbstractTableSection {
+
+    public MessageDestSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style, List messageDest) {
+        super(plan, parent, toolkit, style);
+        this.objectContainer = messageDest;
+        COLUMN_NAMES = new String[] {
+                CommonMessages.messageDestinationName, CommonMessages.adminModule, CommonMessages.adminLink, 
+                CommonMessages.groupId, CommonMessages.artifactId, CommonMessages.version,
+                CommonMessages.moduleId, CommonMessages.name };
+        createClient();
+    }
+
+    public String getTitle() {
+        return CommonMessages.editorSectionMessageDestTitle;
+    }
+
+    public String getDescription() {
+        return CommonMessages.editorSectionMessageDestDescription;
+    }
+
+    public Wizard getWizard() {
+        return new MessageDestWizard(this);
+    }
+
+    public Class getTableEntryObjectType() {
+        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();
+            }
+
+            public String getColumnText(Object element, int columnIndex) {
+                if (MessageDestination.class.isInstance(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();
+                    }
+                }
+                return null;
+            }
+        };
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/MessageDestSection.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/MessageDestSection.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/MessageDestSection.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/wizards/MessageDestWizard.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/MessageDestWizard.java?rev=670063&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/MessageDestWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/MessageDestWizard.java Fri Jun 20 14:13:50 2008
@@ -0,0 +1,169 @@
+/*
+ * 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 javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
+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.naming.MessageDestination;
+import org.apache.geronimo.jee.naming.Pattern;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class MessageDestWizard extends AbstractTableWizard {
+
+    public MessageDestWizard(AbstractTableSection section) {
+        super(section);
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "MessageDestinationName", "AdminObjectModule", "AdminObjectLink",
+                "GroupId", "ArtifactId", "Version", "Module", "Name"};
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_MessageDest;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_MessageDest;
+    }
+
+    public String getWizardFirstPageTitle() {
+        return CommonMessages.wizardPageTitle_MessageDest;
+    }
+
+    public String getWizardFirstPageDescription() {
+        return CommonMessages.wizardPageDescription_MessageDest;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.wizard.IWizard#addPages()
+     */
+    public void addPages() {
+        MessageDestWizardPage page = new MessageDestWizardPage("Page0");
+        page.setImageDescriptor(descriptor);
+        addPage(page);
+    }
+
+    // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+    // the values are brought in properly.
+    public class MessageDestWizardPage extends DynamicWizardPage {
+        public MessageDestWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public void createControl(Composite parent) {
+            Composite composite = createComposite(parent);
+            for (int i = 0; i < section.getTableColumnNames().length; i++) {
+                Label label = new Label(composite, SWT.LEFT);
+                String columnName = section.getTableColumnNames()[i];
+                if (!columnName.endsWith(":"))
+                    columnName = columnName.concat(":");
+                label.setText(columnName);
+                GridData data = new GridData();
+                data.horizontalAlignment = GridData.FILL;
+                label.setLayoutData(data);
+
+                Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
+                data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+                        | GridData.VERTICAL_ALIGN_FILL);
+                data.grabExcessHorizontalSpace = true;
+                data.widthHint = 100;
+                text.setLayoutData(data);
+                if (eObject != null) {
+                    if (i > 2) {
+                        // get the pattern value
+                        Pattern pattern = ((MessageDestination) eObject).getPattern();
+                        String value = (String) JAXBUtils.getValue(pattern,getTableColumnEAttributes()[i]);
+                        if (value != null) {
+                            text.setText(value);
+                        }                        
+                    }
+                    else
+                    {
+                        String value = (String) JAXBUtils.getValue(eObject,getTableColumnEAttributes()[i]);
+                        if (value != null) {
+                            text.setText(value);
+                        }
+                    }
+                }
+                textEntries[i] = text;
+            }
+
+            doCustom(composite);
+            setControl(composite);
+            textEntries[0].setFocus();
+        }
+    }
+    
+    public boolean performFinish() {
+        DynamicWizardPage page = (DynamicWizardPage) getPages()[0];
+        Pattern msgPattern;
+        MessageDestination messageDest;
+
+        if (eObject == null) {
+            eObject = getEFactory().create(MessageDestination.class);
+            JAXBElement plan = section.getPlan();
+
+            messageDest = (MessageDestination)eObject;
+            msgPattern = (Pattern)getEFactory().create(Pattern.class);
+            messageDest.setPattern(msgPattern);
+
+            List msgDestList = JAXBModelUtils.getMessageDestinations(plan); 
+            if (msgDestList == null) {
+                msgDestList = (List)getEFactory().create(MessageDestination.class);
+            }
+            msgDestList.add(eObject);
+        }
+
+        // NOTE!! this replaces the call to processEAttributes (page);
+        messageDest =(MessageDestination) eObject; 
+        msgPattern = messageDest.getPattern();
+        for (int i = 0; i < 8; i++) {
+            String value = page.getTextEntry(i).getText();
+            String attribute = getTableColumnEAttributes()[i];
+            if (i < 3)
+                JAXBUtils.setValue(eObject, attribute, value);
+            else
+                JAXBUtils.setValue(msgPattern, attribute, value);
+        }
+        
+        if (section.getTableViewer().getInput() == section.getPlan()) {
+            section.getTableViewer().setInput(section.getInput());
+        }
+
+        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/MessageDestWizard.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/MessageDestWizard.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/MessageDestWizard.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain