geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From de...@apache.org
Subject svn commit: r818883 [6/7] - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.runtime.v11/ org.apache.geronimo.st.v11.core/ org.apache.geronimo.st.v11.core/src/main/ org.apache.geronimo.st.v11.core/src/main/java/ org.apache.geroni...
Date Fri, 25 Sep 2009 15:26:17 GMT
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ExtModuleWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ExtModuleWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ExtModuleWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ExtModuleWizard.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,333 @@
+/*
+ * 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.v11.ui.wizards;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+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.JAXBObjectFactoryImpl;
+import org.apache.geronimo.xml.ns.j2ee.application_1.ApplicationType;
+import org.apache.geronimo.xml.ns.j2ee.application_1.ExtModuleType;
+import org.apache.geronimo.xml.ns.j2ee.application_1.PathType;
+import org.eclipse.swt.SWT;
+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.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/*
+ * @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
+ */
+public class ExtModuleWizard extends AbstractTableWizard {
+
+    public ExtModuleWizard(AbstractTableSection section) {
+        super(section);
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "ModuleType", "Path", "InternalPath",
+                "GroupId", "ArtifactId", "Version", "Type" };
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_ExtModule;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_ExtModule;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.wizard.IWizard#addPages()
+     */
+    public void addPages() {
+        addPage(new ModuleWizardPage("Page0"));
+    }
+
+    // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+    // the values are brought in properly.
+    public class ModuleWizardPage extends AbstractTableWizardPage {
+        protected Button[] buttonList = new Button[6];
+        
+        public ModuleWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public void createControl(Composite parent) {
+            Composite composite = createComposite(parent);
+            GridData data;
+            ExtModuleType extModule = (ExtModuleType)eObject;
+            
+            // First we need a set of radio buttons to determine what kind of module we are
+            // dealing with.
+            Group group = new Group (composite, SWT.NONE);
+            Button button = new Button (group, SWT.RADIO);
+            button.setText(CommonMessages.connector);
+            buttonList[0] = button;
+            button = new Button (group, SWT.RADIO);
+            button.setText(CommonMessages.ejb);
+            buttonList[1] = button;
+            button = new Button (group, SWT.RADIO);
+            button.setText(CommonMessages.java);
+            buttonList[2] = button;
+            button = new Button (group, SWT.RADIO);
+            button.setText(CommonMessages.web);
+            buttonList[3] = button;
+            GridLayout gridLayout = new GridLayout();
+            gridLayout.numColumns = 4;
+            group.setLayout(gridLayout);
+            data = new GridData();
+            data.horizontalAlignment = GridData.FILL;
+            data.grabExcessHorizontalSpace = true;
+            data.horizontalSpan = 2;
+            group.setLayoutData(data);
+            
+            Group group2 = new Group (composite, SWT.NONE);
+            for (int i = 1; i < section.getTableColumnNames().length; i++) {
+                if (i == 2) {
+                    button = new Button (group2, SWT.RADIO);
+                    button.setText(CommonMessages.internalPath);
+                    buttonList[4] = button;
+                    data = new GridData();
+                    data.horizontalAlignment = GridData.FILL;
+                    data.horizontalSpan = 2;
+                    button.setLayoutData(data);
+                }
+                if (i == 3) {
+                    button = new Button (group2, SWT.RADIO);
+                    button.setText(CommonMessages.externalPath);
+                    buttonList[5] = button;
+                    data = new GridData();
+                    data.horizontalAlignment = GridData.FILL;
+                    data.horizontalSpan = 2;
+                    button.setLayoutData(data);
+                }
+                Text text;
+
+                if (i == 1) {
+                    Label label = new Label(group, SWT.LEFT);
+                    String columnName = section.getTableColumnNames()[i];
+                    if (!columnName.endsWith(":"))
+                        columnName = columnName.concat(":");
+                    label.setText(columnName);
+                    data = new GridData();
+                    data.horizontalAlignment = GridData.FILL;
+                    label.setLayoutData(data);
+
+                    text = new Text(group, SWT.SINGLE | SWT.BORDER);
+                    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+                            | GridData.VERTICAL_ALIGN_FILL);
+                    data.grabExcessHorizontalSpace = true;
+                    data.widthHint = 100;
+                    data.horizontalSpan = 3;
+                    text.setLayoutData(data);
+                }
+                else {
+                    Label label = new Label(group2, SWT.LEFT);
+                    String columnName = section.getTableColumnNames()[i];
+                    if (!columnName.endsWith(":"))
+                        columnName = columnName.concat(":");
+                    label.setText(columnName);
+                    data = new GridData();
+                    data.horizontalAlignment = GridData.FILL;
+                    label.setLayoutData(data);
+
+                    text = new Text(group2, 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 (extModule != null) {
+                    if (i == 1) {
+                        if (extModule.getConnector() != null) {
+                            text.setText(extModule.getConnector().getValue());
+                            buttonList[0].setSelection(true);
+                        }
+                        else if (extModule.getEjb() != null) {
+                            text.setText(extModule.getEjb().getValue());
+                            buttonList[1].setSelection(true);
+                        }
+                        else if (extModule.getJava() != null) {
+                            text.setText(extModule.getJava().getValue());
+                            buttonList[2].setSelection(true);
+                        }
+                        else if (extModule.getWeb() != null) {
+                            text.setText(extModule.getWeb().getValue());
+                            buttonList[3].setSelection(true);
+                        }                        
+                    }
+                    else if (i == 2 && extModule.getInternalPath() != null) {
+                        text.setText(extModule.getInternalPath());
+                    }
+                    else if (i > 2 && extModule.getExternalPath() != null) {
+                        String value= extModule.getExternalPath();
+                        text.setText(value);
+//						try {
+//							value = (String) JAXBUtils.getValue(pattern,getTableColumnEAttributes()[i]);
+//						} catch (Exception e1) {
+//							value = e1.getMessage();
+//						}
+//                        if (value != null) {
+//                            text.setText(value);
+//                        }
+                    }
+                }
+                textEntries[i - 1] = text;
+            }
+            gridLayout = new GridLayout();
+            gridLayout.numColumns = 2;
+            group2.setLayout(gridLayout);
+            data = new GridData();
+            data.horizontalAlignment = GridData.FILL;
+            data.grabExcessHorizontalSpace = true;
+            data.horizontalSpan = 2;
+            group2.setLayoutData(data);
+
+            buttonList[4].addSelectionListener(new SelectionAdapter() {
+                public void widgetSelected(SelectionEvent e) {
+                    if (buttonList[4].getSelection()) {
+                       toggle();
+                    }
+                }
+            });
+            buttonList[5].addSelectionListener(new SelectionAdapter() {
+                public void widgetSelected(SelectionEvent e) {
+                    if (buttonList[5].getSelection()) {
+                        toggle();
+                    }
+                }
+            });
+
+            if (extModule == null) {
+                buttonList[0].setSelection(true);
+                buttonList[4].setSelection(true);
+            }
+            else if (extModule.getInternalPath() != null) {
+                buttonList[4].setSelection(true);
+            }
+            else {
+                buttonList[5].setSelection(true);
+            }
+            toggle();
+
+            doCustom(composite);
+            setControl(composite);
+            textEntries[0].setFocus();
+        }
+        
+        private void toggle () {
+            textEntries[1].setEnabled(buttonList[4].getSelection());
+            textEntries[2].setEnabled(buttonList[5].getSelection());
+            textEntries[3].setEnabled(buttonList[5].getSelection());
+            textEntries[4].setEnabled(buttonList[5].getSelection());
+            textEntries[5].setEnabled(buttonList[5].getSelection());
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_ExtModule;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_ExtModule;
+        }
+    }
+    
+    public boolean performFinish() {
+        ModuleWizardPage page = (ModuleWizardPage) getPages()[0];
+        PathType path;
+        ExtModuleType extModule;
+
+        if (eObject == null) {
+            eObject = getEFactory().create(ExtModuleType.class);
+            JAXBElement plan = section.getPlan();
+
+            extModule = (ExtModuleType)eObject;
+
+            List extModuleList = ((ApplicationType)plan.getValue()).getExtModule();
+            if (extModuleList == null) {
+                extModuleList = (List)getEFactory().create(ExtModuleType.class);
+            }
+            extModuleList.add(eObject);
+        }
+        else {
+            extModule = (ExtModuleType)eObject;
+            extModule.setConnector(null);
+            extModule.setEjb(null);
+            extModule.setJava(null);
+            extModule.setWeb(null);
+            extModule.setExternalPath(null);
+        }
+
+        // NOTE!! this replaces the call to processEAttributes (page);
+        path = (PathType)getEFactory().create(PathType.class);
+        path.setValue(page.getTextEntry(0).getText());
+
+        if (((ModuleWizardPage)page).buttonList[0].getSelection())
+            extModule.setConnector(path);
+        else if (((ModuleWizardPage)page).buttonList[1].getSelection())
+            extModule.setEjb(path);
+        else if (((ModuleWizardPage)page).buttonList[2].getSelection())
+            extModule.setJava(path);
+        else if (((ModuleWizardPage)page).buttonList[3].getSelection())
+            extModule.setWeb(path);
+
+        if (page.buttonList[4].getSelection()) {
+            extModule.setInternalPath (page.getTextEntry(1).getText());
+            extModule.setExternalPath(null);
+        }
+        else if (page.buttonList[5].getSelection()) {
+          
+        	StringBuilder sb = new StringBuilder();
+            for (int i = 2; i < 6; i++) {
+                String value = page.getTextEntry(i).getText();
+               	sb.append(value).append("/");
+            }
+            //remove last "/"
+            sb.deleteCharAt(sb.length()-1);
+            
+            //for 1.1 external path is in this format: groupid/artifactid/version/type
+            extModule.setExternalPath(sb.toString());
+
+            extModule.setInternalPath(null);
+        }
+
+        if (section.getViewer().getInput() == section.getPlan()) {
+            section.getViewer().setInput(section.getInput());
+        }
+
+        return true;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/FacetInstallPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/FacetInstallPage.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/FacetInstallPage.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/FacetInstallPage.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,137 @@
+/*
+ * 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.v11.ui.wizards;
+
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.v21.core.DeploymentPlanInstallConfig;
+import org.apache.geronimo.st.v11.ui.internal.Trace;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FacetInstallPage extends AbstractFacetWizardPage {
+
+	private DeploymentPlanInstallConfig config;
+
+	private Text groupText;
+	private Text artifactText;
+	private Text versionText;
+	private Text typeText;
+	private Button sharedLib;
+
+	public FacetInstallPage() {
+		super("geronimo.plan.install");
+		Trace.trace("Constructor Entry", "FacetInstallPage");
+		
+		setTitle("Geronimo Deployment Plan");
+		setDescription("Configure the geronimo deployment plan.");
+		
+		Trace.trace("Constructor Exit", "FacetInstallPage");
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.common.project.facet.ui.IFacetWizardPage#setConfig(java.lang.Object)
+	 */
+	public void setConfig(Object config) {
+		Trace.trace("Entry", "FacetInstallPage.setConfig", config);
+
+		this.config = (DeploymentPlanInstallConfig) config;
+		
+		Trace.trace("Exit", "FacetInstallPage.setConfig");
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+		Trace.trace("Entry", "FacetInstallPage.createControl", parent);
+		
+		Composite composite = new Composite(parent, SWT.NONE);
+		composite.setLayout(new GridLayout(2, false));
+
+		Label groupLabel = new Label(composite, SWT.NONE);
+		groupLabel.setText(CommonMessages.groupId);
+
+		groupText = new Text(composite, SWT.BORDER);
+		groupText.setLayoutData(createGridData());
+		groupText.setText("default");
+		
+		Label artifactLabel = new Label(composite, SWT.NONE);
+		artifactLabel.setText(CommonMessages.artifactId);
+
+		artifactText = new Text(composite, SWT.BORDER);
+		artifactText.setLayoutData(createGridData());
+		
+		Label versionLabel = new Label(composite, SWT.NONE);
+		versionLabel.setText(CommonMessages.version);
+
+		versionText = new Text(composite, SWT.BORDER);
+		versionText.setLayoutData(createGridData());
+		versionText.setText("1.0");
+		
+		Label typeLabel = new Label(composite, SWT.NONE);
+		typeLabel.setText(CommonMessages.artifactType);
+
+		typeText = new Text(composite, SWT.BORDER);
+		typeText.setLayoutData(createGridData());
+		typeText.setText("car");
+		
+		sharedLib = new Button(composite, SWT.CHECK);
+		GridData data = createGridData();
+		data.horizontalSpan = 2;
+		data.verticalIndent = 5;
+		sharedLib.setLayoutData(data);
+		sharedLib.setText(CommonMessages.addSharedLib);
+		
+		setControl(composite);
+		
+		Trace.trace("Exit", "FacetInstallPage.createControl");		
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage#transferStateToConfig()
+	 */
+	public void transferStateToConfig() {
+		Trace.trace("Entry", "FacetInstallPage.transferStateToConfig");		
+	
+		config.setGroupId(groupText.getText());
+		config.setArtifactId(artifactText.getText());
+		config.setVersion(versionText.getText());
+		config.setType(typeText.getText());
+		config.setSharedLib(sharedLib.getSelection());
+		
+		Trace.trace("Exit", "FacetInstallPage.transferStateToConfig");		
+	}
+
+	private static GridData createGridData() {
+		return new GridData(GridData.FILL_HORIZONTAL);
+	}
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanRefWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanRefWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanRefWizard.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,200 @@
+/*
+ * 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.v11.ui.wizards;
+
+import javax.xml.bind.JAXBElement;
+
+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.JAXBModelUtils;
+import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.xml.ns.j2ee.web_1.WebAppType;
+import org.apache.geronimo.xml.ns.naming_1.ObjectFactory;
+import org.apache.geronimo.xml.ns.naming_1.PatternType;
+import org.apache.geronimo.xml.ns.naming_1.GbeanRefType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GBeanRefWizard extends AbstractTreeWizard {
+
+    private final int GBEAN_REF = 0;
+    private final int GBEAN_TYPE = 1;
+    private final int PATTERN = 2;
+    
+    public GBeanRefWizard(AbstractTreeSection section) {
+        super(section, 3, 5);
+        elementTypes[GBEAN_REF] = "GBean Reference";
+        elementTypes[GBEAN_TYPE] = "Gbean type";
+        elementTypes[PATTERN] = "Pattern";
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_GBeanRef;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_GBeanRef;
+    }
+ 
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.wizard.IWizard#addPages()
+     */
+    public void addPages() {
+        addPage(new GbeanRefWizardPage("Page0"));
+    }
+
+    // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+    // the values are brought in properly.
+    public class GbeanRefWizardPage extends AbstractTreeWizardPage {
+        public GbeanRefWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        protected void initControl () {
+            if (eObject == null) {
+                element.select(GBEAN_REF);
+                GbeanRefType gbeanRef = (GbeanRefType)section.getSelectedObject();
+                if (gbeanRef == null) {
+                    element.setEnabled(false);
+                }
+            }
+            else {
+                if (JAXBElement.class.isInstance(eObject)) {
+                    eObject = ((JAXBElement)eObject).getValue();
+                }
+                if (GbeanRefType.class.isInstance(eObject)) {
+                    textList.get(0).setText(((GbeanRefType)eObject).getRefName());
+                    element.select(GBEAN_REF);
+                }
+                else if (String.class.isInstance(eObject)) {
+                    textList.get(0).setText(((String)eObject));
+                    element.select(GBEAN_TYPE);
+                }
+                else if (PatternType.class.isInstance(eObject)) {
+                    textList.get(0).setText(((org.apache.geronimo.xml.ns.naming_1.PatternType)eObject).getName());
+                    textList.get(1).setText(((PatternType)eObject).getGroupId());
+                    textList.get(2).setText(((PatternType)eObject).getArtifactId());
+                    textList.get(3).setText(((PatternType)eObject).getVersion());
+                    textList.get(4).setText(((PatternType)eObject).getModule());
+                    element.select(PATTERN);
+                }
+                element.setEnabled(false);
+            }
+        }
+        
+        protected void toggleFields (boolean clearFields) {
+            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("");
+                }
+            }
+            if (element.getText().equals(elementTypes[GBEAN_TYPE])) {
+                labelList.get(0).setText(CommonMessages.type);
+            }
+            else {
+                labelList.get(0).setText(CommonMessages.name);
+            }
+            labelList.get(1).setText(CommonMessages.groupId);
+            labelList.get(2).setText(CommonMessages.artifactId);
+            labelList.get(3).setText(CommonMessages.version);
+            labelList.get(4).setText(CommonMessages.moduleId);
+            for (int i = 1; i < maxTextFields; i++) {
+                labelList.get(i).setVisible(element.getText().equals(elementTypes[PATTERN]));
+                textList.get(i).setVisible(element.getText().equals(elementTypes[PATTERN]));
+                if (clearFields == true) {
+                    textList.get(i).setText("");
+                }
+            }
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_GBeanRef;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_GBeanRef;
+        }
+    }
+
+    @Override
+    public boolean performFinish() {
+        GbeanRefType gbeanRef;
+        if (element.getText().equals(elementTypes[GBEAN_REF])) {
+            if (isEmpty(textList.get(0).getText())) {
+                return false;
+            }
+            gbeanRef = (GbeanRefType)eObject;
+            if (gbeanRef == null) {
+                gbeanRef = (GbeanRefType)getEFactory().create(GbeanRefType.class);
+                JAXBElement plan = section.getPlan();
+
+                // if we have a WebApp, add the JAXBElement of the GBeanRef, not the GBeanRef
+                if (WebAppType.class.isInstance(plan.getValue())) {
+                    ObjectFactory objectFactory = new ObjectFactory();
+                    JAXBModelUtils.getGbeanRefs(plan).add(objectFactory.createGbeanRef(gbeanRef));
+                    section.getObjectContainer().add(objectFactory.createGbeanRef(gbeanRef));
+                }
+                else {
+                    JAXBModelUtils.getGbeanRefs(plan).add(gbeanRef);
+                    section.getObjectContainer().add(gbeanRef);
+                }
+            }
+            gbeanRef.setRefName(textList.get(0).getText());
+        }
+        else if (element.getText().equals(elementTypes[GBEAN_TYPE])) {
+            if (isEmpty(textList.get(0).getText())) {
+                return false;
+            }
+            String type = (String)eObject;
+            gbeanRef = (GbeanRefType)section.getSelectedObject();
+            if (type == null) {
+                gbeanRef.getRefType().add(textList.get(0).getText());
+            }
+            else {
+                gbeanRef.getRefType().set(gbeanRef.getRefType().indexOf(type), textList.get(0).getText());
+            }
+        }
+        else if (element.getText().equals(elementTypes[PATTERN])) { 
+            if (isEmpty(textList.get(0).getText())) {
+                return false;
+            }
+            PatternType pattern = (PatternType)eObject;
+            if (pattern == null) {
+                pattern = (PatternType)getEFactory().create(PatternType.class);
+                gbeanRef = (GbeanRefType)section.getSelectedObject();
+                gbeanRef.getPattern().add(pattern);
+            }
+            pattern.setName(textList.get(0).getText());
+            pattern.setGroupId(textList.get(1).getText());
+            pattern.setArtifactId(textList.get(2).getText());
+            pattern.setVersion(textList.get(3).getText());
+            pattern.setModule(textList.get(4).getText());
+        }
+        return true;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/GBeanWizard.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,278 @@
+/*
+ * 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.v11.ui.wizards;
+
+import javax.xml.bind.JAXBElement;
+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.JAXBModelUtils;
+import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.xml.ns.deployment_1.AttributeType;
+import org.apache.geronimo.xml.ns.deployment_1.GbeanType;
+import org.apache.geronimo.xml.ns.deployment_1.ObjectFactory;
+import org.apache.geronimo.xml.ns.deployment_1.PatternType;
+import org.apache.geronimo.xml.ns.deployment_1.ReferenceType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GBeanWizard extends AbstractTreeWizard {
+
+    private final int GBEAN = 0;
+    private final int ATTRIBUTE = 1;
+    private final int DEPENDENCY = 2;
+    private final int REFERENCE = 3;
+
+    public GBeanWizard(AbstractTreeSection section) {
+        super(section, 4, 7);
+        elementTypes[GBEAN] = "GBean";
+        elementTypes[ATTRIBUTE] = "Attribute";
+        elementTypes[DEPENDENCY] = "Dependency";
+        elementTypes[REFERENCE] = "Reference";
+    }
+
+    public class GBeanWizardPage extends AbstractTreeWizardPage {
+
+        public GBeanWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        protected void initControl() {
+            if (eObject == null) {
+                element.select(GBEAN);
+                if (section.getSelectedObject() == null) {
+                    element.setEnabled(false);
+                }
+            }
+            else {
+                // change eObject to be the value of the JAXBElement
+                eObject = ((JAXBElement)eObject).getValue();
+                if (GbeanType.class.isInstance(eObject)) {
+                    textList.get(0).setText(((GbeanType)eObject).getName());
+                    textList.get(1).setText(((GbeanType)eObject).getClazz());
+                    element.select(GBEAN);
+                }
+                else if (AttributeType.class.isInstance(eObject)) {
+                    textList.get(0).setText(((AttributeType)eObject).getName());
+                    textList.get(1).setText(((AttributeType)eObject).getType());
+                    textList.get(2).setText(((AttributeType)eObject).getValue());
+                    element.select(ATTRIBUTE);
+                }
+                else if (PatternType.class.isInstance(eObject)) {
+                    textList.get(0).setText(((PatternType)eObject).getGroupId());
+                    textList.get(1).setText(((PatternType)eObject).getArtifactId());
+                    textList.get(2).setText(((PatternType)eObject).getVersion());
+                    textList.get(3).setText(((PatternType)eObject).getModule());
+                    textList.get(4).setText(((PatternType)eObject).getType());
+                    textList.get(5).setText(((PatternType)eObject).getCustomFoo());
+                    element.select(DEPENDENCY);
+                }
+                else if (ReferenceType.class.isInstance(eObject)) {
+                    textList.get(0).setText(((ReferenceType)eObject).getName());
+                    textList.get(1).setText(((ReferenceType)eObject).getGroupId());
+                    textList.get(2).setText(((ReferenceType)eObject).getArtifactId());
+                    textList.get(3).setText(((ReferenceType)eObject).getVersion());
+                    textList.get(4).setText(((ReferenceType)eObject).getModule());
+                    textList.get(5).setText(((ReferenceType)eObject).getType());
+                    textList.get(6).setText(((ReferenceType)eObject).getCustomFoo());
+                    element.select(REFERENCE);
+                }
+                element.setEnabled(false);
+            }
+        }
+        
+        protected void toggleFields (boolean clearFields) {
+            int selection = element.getSelectionIndex();
+            switch (selection) {
+            case GBEAN:
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(i < 2 ? true : false);
+                    textList.get(i).setVisible(i < 2 ? true : false);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.name);
+                labelList.get(1).setText(CommonMessages.className);
+                // if we are doing an add, then we need to make sure that the longest
+                // text can be handled
+                labelList.get(2).setText(CommonMessages.groupId);
+                labelList.get(3).setText(CommonMessages.artifactId);
+                labelList.get(4).setText(CommonMessages.moduleId);
+                labelList.get(5).setText(CommonMessages.artifactType);
+                labelList.get(6).setText(CommonMessages.customName);
+                break;
+            case ATTRIBUTE:
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(i < 3 ? true : false);
+                    textList.get(i).setVisible(i < 3 ? true : false);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.name);
+                labelList.get(1).setText(CommonMessages.type);
+                labelList.get(2).setText(CommonMessages.value);
+                break;
+            case DEPENDENCY:
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(i < 6 ? true : false);
+                    textList.get(i).setVisible(i < 6 ? true : false);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.groupId);
+                labelList.get(1).setText(CommonMessages.artifactId);
+                labelList.get(2).setText(CommonMessages.version);
+                labelList.get(3).setText(CommonMessages.moduleId);
+                labelList.get(4).setText(CommonMessages.artifactType);
+                labelList.get(5).setText(CommonMessages.customName);
+                break;
+            case REFERENCE:
+                for (int i = 0; i < 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.groupId);
+                labelList.get(2).setText(CommonMessages.artifactId);
+                labelList.get(3).setText(CommonMessages.version);
+                labelList.get(4).setText(CommonMessages.moduleId);
+                labelList.get(5).setText(CommonMessages.artifactType);
+                labelList.get(6).setText(CommonMessages.customName);
+                break;
+            }
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardEditTitle_GBean;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageTitle_GBean;
+        }
+    }
+
+    @Override
+    public void addPages() {
+        addPage(new GBeanWizardPage("Page0"));
+    }
+
+    @Override
+    public boolean performFinish() {
+        GbeanType gbean;
+        switch (element.getSelectionIndex()) {
+        case GBEAN:
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            gbean = (GbeanType)eObject;
+            if (gbean == null) {
+                gbean = (GbeanType)getEFactory().create(GbeanType.class);
+                JAXBElement plan = section.getPlan();
+                
+                // add the JAXBElement of a GBean, not the GBean
+                ObjectFactory objectFactory = new ObjectFactory();
+                JAXBModelUtils.getGbeans(plan).add(objectFactory.createGbean((GbeanType)gbean));
+            }
+            gbean.setName(textList.get(0).getText());
+            gbean.setClazz(textList.get(1).getText());
+            break;
+
+        case ATTRIBUTE:
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            AttributeType attribute = (AttributeType)eObject;
+            if (attribute == null) {
+                attribute = (AttributeType)getEFactory().create(AttributeType.class);
+                gbean = (GbeanType)section.getSelectedObject();
+                
+                // add the JAXBElement of an Attribute, not the Attribute
+                ObjectFactory objectFactory = new ObjectFactory();
+                gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanTypeAttribute(attribute));
+            }
+            attribute.setName(textList.get(0).getText());
+            attribute.setType(textList.get(1).getText());
+            attribute.setValue(textList.get(2).getText());
+            break;
+
+        case DEPENDENCY:
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            PatternType dependency = (PatternType)eObject;
+            if (dependency == null) {
+                dependency = (PatternType)getEFactory().create(PatternType.class);
+                gbean = (GbeanType)section.getSelectedObject();
+
+                // add the JAXBElement of a Dependency, not the Dependency
+                ObjectFactory objectFactory = new ObjectFactory();
+                gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanTypeDependency(dependency));
+            }
+            dependency.setGroupId(textList.get(0).getText());
+            dependency.setArtifactId(textList.get(1).getText());
+            dependency.setVersion(textList.get(2).getText());
+            dependency.setModule(textList.get(3).getText());
+            dependency.setType(textList.get(4).getText());
+            dependency.setCustomFoo(textList.get(5).getText());
+            break;
+
+        case REFERENCE:
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText()) ||
+                    isEmpty(textList.get(2).getText())) {
+                return false;
+            }
+            ReferenceType reference = (ReferenceType)eObject;
+            if (reference == null) {
+                reference = (ReferenceType)getEFactory().create(ReferenceType.class);
+                gbean = (GbeanType)section.getSelectedObject();
+
+                // add the JAXBElement of a Dependency, not the Dependency
+                ObjectFactory objectFactory = new ObjectFactory();
+                gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanTypeReference(reference));
+            }
+            reference.setName(textList.get(0).getText());
+            reference.setGroupId(textList.get(1).getText());
+            reference.setArtifactId(textList.get(2).getText());
+            reference.setVersion(textList.get(3).getText());
+            reference.setModule(textList.get(4).getText());
+            reference.setType(textList.get(5).getText());
+            reference.setCustomFoo(textList.get(6).getText());
+            break;
+        }
+        return true;
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_GBean;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_GBean;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/LicenseWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/LicenseWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/LicenseWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/LicenseWizard.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,101 @@
+///*
+// * 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.v11.ui.wizards;
+//
+//import org.apache.geronimo.st.ui.CommonMessages;
+//import org.apache.geronimo.st.ui.wizards.AbstractWizard;
+//import org.apache.geronimo.system.plugin.model.LicenseType;
+//import org.eclipse.swt.widgets.Composite;
+//import org.eclipse.swt.widgets.Combo;
+//import org.eclipse.swt.widgets.Text;
+//
+///**
+// * @version $Rev: 723874 $ $Date: 2008-12-06 05:30:03 +0800 (Sat, 06 Dec 2008) $
+// */
+//public class LicenseWizard extends AbstractWizard {
+//
+//    protected LicenseType license;
+//    
+//    protected Text licenseName;
+//    
+//    protected Combo osiApproved;
+//    
+//    public LicenseWizard (LicenseType oldLicense) {
+//        super();
+//        license = oldLicense;
+//    }
+//
+//    public String getAddWizardWindowTitle() {
+//        return CommonMessages.wizardNewTitle_License;
+//    }
+//
+//    public String getEditWizardWindowTitle() {
+//        return CommonMessages.wizardEditTitle_License;
+//    }
+//
+//    /*
+//     * (non-Javadoc)
+//     * 
+//     * @see org.eclipse.jface.wizard.IWizard#addPages()
+//     */
+//    public void addPages() {
+//        addPage(new MessageDestWizardPage("Page0"));
+//    }
+//
+//    // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+//    // the values are brought in properly.
+//    public class MessageDestWizardPage extends AbstractWizardPage {
+//        public MessageDestWizardPage(String pageName) {
+//            super(pageName);
+//        }
+//
+//        public void createControl(Composite parent) {
+//            Composite composite = createComposite(parent);
+//            createLabel (composite, CommonMessages.license);
+//            licenseName = createTextField (composite, "");
+//            createLabel (composite, CommonMessages.osiApproved);
+//            String[] values = {"true", "false"};
+//            osiApproved = createCombo (composite, values, false);
+//
+//            if (license != null) {
+//                licenseName.setText(license.getValue());
+//                osiApproved.setText(String.valueOf(license.isOsiApproved()));
+//            }
+//            setControl(composite);
+//        }
+//
+//        public String getWizardPageTitle() {
+//            return CommonMessages.wizardPageTitle_License;
+//        }
+//
+//        public String getWizardPageDescription() {
+//            return CommonMessages.wizardPageDescription_License;
+//        }
+//    }
+//    
+//    public boolean performFinish() {
+//        license = new LicenseType();
+//        license.setValue(licenseName.getText());
+//        license.setOsiApproved(Boolean.parseBoolean(osiApproved.getText()));
+//
+//        return true;
+//    }
+//    
+//    public LicenseType getLicense() {
+//        return license;
+//    }
+//}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/MessageDestWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/MessageDestWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/MessageDestWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/MessageDestWizard.java Fri Sep 25 15:26:14 2009
@@ -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.v11.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.v11.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v11.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.xml.ns.naming_1.MessageDestinationType;
+import org.apache.geronimo.xml.ns.naming_1.PatternType;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
+ */
+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;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.wizard.IWizard#addPages()
+     */
+    public void addPages() {
+        addPage(new MessageDestWizardPage("Page0"));
+    }
+
+    // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+    // the values are brought in properly.
+    public class MessageDestWizardPage extends AbstractTableWizardPage {
+        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
+                        PatternType pattern = ((MessageDestinationType) eObject).getPattern();
+                        String value = null;
+						try {
+							value = (String) JAXBUtils.getValue(pattern,getTableColumnEAttributes()[i]);
+						} catch (Exception e) {
+							MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+						}
+                        if (value != null) {
+                            text.setText(value);
+                        }                        
+                    }
+                    else
+                    {
+                        String value = null;
+						try {
+							value = (String) JAXBUtils.getValue(eObject,getTableColumnEAttributes()[i]);
+						} catch (Exception e) {
+							MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+						}
+                        if (value != null) {
+                            text.setText(value);
+                        }
+                    }
+                }
+                textEntries[i] = text;
+            }
+
+            doCustom(composite);
+            setControl(composite);
+            textEntries[0].setFocus();
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_MessageDest;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_MessageDest;
+        }
+    }
+    
+    public boolean performFinish() {
+        AbstractTableWizardPage page = (AbstractTableWizardPage) getPages()[0];
+        PatternType msgPattern;
+        MessageDestinationType messageDest;
+
+        if (eObject == null) {
+            eObject = getEFactory().create(MessageDestinationType.class);
+            JAXBElement plan = section.getPlan();
+
+            messageDest = (MessageDestinationType)eObject;
+            msgPattern = (PatternType)getEFactory().create(PatternType.class);
+            messageDest.setPattern(msgPattern);
+
+            List msgDestList = JAXBModelUtils.getMessageDestinations(plan); 
+            if (msgDestList == null) {
+                msgDestList = (List)getEFactory().create(MessageDestinationType.class);
+            }
+            msgDestList.add(eObject);
+        }
+
+        // NOTE!! this replaces the call to processEAttributes (page);
+        messageDest =(MessageDestinationType) eObject; 
+        msgPattern = messageDest.getPattern();
+        for (int i = 0; i < 8; i++) {
+            String value = page.getTextEntry(i).getText();
+            String attribute = getTableColumnEAttributes()[i];
+            if (i < 3)
+				try {
+					JAXBUtils.setValue(eObject, attribute, value);
+				} catch (Exception e) {
+					MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+				}
+			else
+				try {
+					JAXBUtils.setValue(msgPattern, attribute, value);
+				} catch (Exception e) {
+					MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+				}
+        }
+        
+        if (section.getViewer().getInput() == section.getPlan()) {
+            section.getViewer().setInput(section.getInput());
+        }
+
+        return true;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ModuleWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ModuleWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ModuleWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ModuleWizard.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,216 @@
+/*
+ * 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.v11.ui.wizards;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+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.JAXBObjectFactoryImpl;
+import org.apache.geronimo.xml.ns.j2ee.application_1.ApplicationType;
+import org.apache.geronimo.xml.ns.j2ee.application_1.ModuleType;
+import org.apache.geronimo.xml.ns.j2ee.application_1.PathType;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/*
+ * @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
+ */
+public class ModuleWizard extends AbstractTableWizard {
+
+    public ModuleWizard(AbstractTableSection section) {
+        super(section);
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "ModuleType", "Path", "AltDd" };
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_Module;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_Module;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.wizard.IWizard#addPages()
+     */
+    public void addPages() {
+        addPage(new ModuleWizardPage("Page0"));
+    }
+
+    // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+    // the values are brought in properly.
+    public class ModuleWizardPage extends AbstractTableWizardPage {
+        protected Button[] buttonList = new Button[4];
+        
+        public ModuleWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public void createControl(Composite parent) {
+            Composite composite = createComposite(parent);
+            GridData data;
+            ModuleType module = (ModuleType)eObject;
+            
+            // First we need a set of radio buttons to determine what kind of module we are
+            // dealing with.
+            Group group = new Group (composite, SWT.NONE);
+            Button button = new Button (group, SWT.RADIO);
+            button.setText(CommonMessages.connector);
+            buttonList[0] = button;
+            button = new Button (group, SWT.RADIO);
+            button.setText(CommonMessages.ejb);
+            buttonList[1] = button;
+            button = new Button (group, SWT.RADIO);
+            button.setText(CommonMessages.java);
+            buttonList[2] = button;
+            button = new Button (group, SWT.RADIO);
+            button.setText(CommonMessages.web);
+            buttonList[3] = button;
+            FillLayout fillLayout = new FillLayout();
+            fillLayout.type = SWT.HORIZONTAL;
+            group.setLayout(fillLayout);
+            data = new GridData();
+            data.horizontalAlignment = GridData.FILL;
+            data.horizontalSpan = 2;
+            group.setLayoutData(data);
+            
+            for (int i = 1; i < section.getTableColumnNames().length; i++) {
+                Label label = new Label(composite, SWT.LEFT);
+                String columnName = section.getTableColumnNames()[i];
+                if (!columnName.endsWith(":"))
+                    columnName = columnName.concat(":");
+                label.setText(columnName);
+                data = new GridData();
+                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 (module != null) {
+                    if (i == 1) {
+                        if (module.getConnector() != null) {
+                            text.setText(module.getConnector().getValue());
+                            buttonList[0].setSelection(true);
+                        }
+                        else if (module.getEjb() != null) {
+                            text.setText(module.getEjb().getValue());
+                            buttonList[1].setSelection(true);
+                        }
+                        else if (module.getJava() != null) {
+                            text.setText(module.getJava().getValue());
+                            buttonList[2].setSelection(true);
+                        }
+                        else if (module.getWeb() != null) {
+                            text.setText(module.getWeb().getValue());
+                            buttonList[3].setSelection(true);
+                        }                        
+                    }
+                    else if (i == 2 && module.getAltDd() != null) {
+                        text.setText(module.getAltDd().getValue());
+                    }
+                }
+                textEntries[i - 1] = text;
+            }
+
+            doCustom(composite);
+            setControl(composite);
+            textEntries[0].setFocus();
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_Module;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_Module;
+        }
+    }
+
+    public boolean performFinish() {
+        AbstractTableWizardPage page = (AbstractTableWizardPage) getPages()[0];
+        PathType path;
+        ModuleType module;
+
+        if (eObject == null) {
+            eObject = getEFactory().create(ModuleType.class);
+            JAXBElement plan = section.getPlan();
+
+            module = (ModuleType)eObject;
+
+            List moduleList = ((ApplicationType)plan.getValue()).getModule();
+            if (moduleList == null) {
+                moduleList = (List)getEFactory().create(ModuleType.class);
+            }
+            moduleList.add(eObject);
+        }
+        else {
+            module = (ModuleType)eObject;
+            module.setConnector(null);
+            module.setEjb(null);
+            module.setJava(null);
+            module.setWeb(null);
+        }
+
+        // NOTE!! this replaces the call to processEAttributes (page);
+        path = (PathType)getEFactory().create(PathType.class);
+        path.setValue(page.getTextEntry(0).getText());
+
+        if (((ModuleWizardPage)page).buttonList[0].getSelection())
+            module.setConnector(path);
+        else if (((ModuleWizardPage)page).buttonList[1].getSelection())
+            module.setEjb(path);
+        else if (((ModuleWizardPage)page).buttonList[2].getSelection())
+            module.setJava(path);
+        else if (((ModuleWizardPage)page).buttonList[3].getSelection())
+            module.setWeb(path);
+        
+        String altDD = page.getTextEntry(1).getText();
+        path = (PathType)getEFactory().create(PathType.class);
+        path.setValue(altDD);
+        module.setAltDd(path);
+        
+        if (section.getViewer().getInput() == section.getPlan()) {
+            section.getViewer().setInput(section.getInput());
+        }
+
+        return true;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceEnvRefWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceEnvRefWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceEnvRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceEnvRefWizard.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,68 @@
+/*
+ * 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.v11.ui.wizards;
+
+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.JAXBObjectFactoryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceEnvRefWizard extends AbstractTableWizard {
+
+ 
+    public ResourceEnvRefWizard(AbstractTableSection section) {
+        super(section);
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "RefName", "MessageDestinationLink" };
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardPageTitle_ResEnvRef;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_ResEnvRef;
+    }
+    
+    public void addPages() {
+        addPage(new ResourceEnvRefWizardPage("Page0"));
+    }
+
+    public class ResourceEnvRefWizardPage extends AbstractTableWizardPage {
+        public ResourceEnvRefWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_ResEnvRef;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_ResEnvRef;
+        }
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceRefWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceRefWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/ResourceRefWizard.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,67 @@
+/*
+ * 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.v11.ui.wizards;
+
+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.JAXBObjectFactoryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceRefWizard extends AbstractTableWizard {
+
+    public ResourceRefWizard(AbstractTableSection section) {
+        super(section);
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "RefName", "ResourceLink" };
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardPageTitle_ResRef;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_ResRef;
+    }
+    
+    public void addPages() {
+        addPage(new ResourceRefWizardPage("Page0"));
+    }
+
+    public class ResourceRefWizardPage extends AbstractTableWizardPage {
+        public ResourceRefWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_ResRef;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_ResRef;
+        }
+    }
+}

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/SecurityRunAsSubjectWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/SecurityRunAsSubjectWizard.java?rev=818883&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/SecurityRunAsSubjectWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/main/java/org/apache/geronimo/st/v11/ui/wizards/SecurityRunAsSubjectWizard.java Fri Sep 25 15:26:14 2009
@@ -0,0 +1,108 @@
+///*
+// * 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.v11.ui.wizards;
+//
+//import org.apache.geronimo.st.ui.CommonMessages;
+//import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+//import org.apache.geronimo.st.ui.wizards.AbstractWizard;
+//import org.apache.geronimo.xml.ns.security_1.RoleType;
+//import org.eclipse.swt.widgets.Combo;
+//import org.eclipse.swt.widgets.Composite;
+//import org.eclipse.swt.widgets.Text;
+//
+///**
+// *  @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
+// */
+//public class SecurityRunAsSubjectWizard extends AbstractWizard {
+//    protected Combo role;
+//    protected Text realm;
+//    protected Text id;
+//    protected AbstractTableSection section;
+//
+//    public SecurityRunAsSubjectWizard(AbstractTableSection section) {
+//        super();
+//        this.section = section;
+//    }
+//
+//    public class SecurityRunAsSubjectAddWizardPage extends AbstractWizardPage {
+//        public SecurityRunAsSubjectAddWizardPage(String pageName) {
+//            super(pageName);
+//        }
+//
+//        public void createControl(Composite parent) {
+//            Composite composite = createComposite(parent);
+//            createLabel(composite, CommonMessages.securityRunAsSubjectRole);
+//           // role = createCombo(composite, ((SecurityAdvancedSection) section).getRolesWithoutRunAsSubject(), false);
+//            createLabel(composite, CommonMessages.securityRunAsSubjectRealm);
+//            realm = createTextField(composite, "");
+//            createLabel(composite, CommonMessages.securityRunAsSubjectId);
+//            id = createTextField(composite, "");
+//            if (eObject != null) {
+//                //TODO  role.setText (((SecurityAdvancedSection) section).);
+//                //role.setEnabled(false);
+//                realm.setText (((RoleType)eObject).getRunAsSubject().getRealm());
+//                id.setText(((RoleType)eObject).getRunAsSubject().getId());
+//            }
+//            setControl(composite);
+//        }
+//
+//        @Override
+//        protected String getWizardPageTitle() {
+//            return CommonMessages.wizardPageTitle_RunAsSubject;
+//        }
+//
+//        @Override
+//        protected String getWizardPageDescription() {
+//            return CommonMessages.wizardPageDescription_RunAsSubject;
+//        }
+//    }
+//
+//    @Override
+//    public void addPages() {
+//        addPage(new SecurityRunAsSubjectAddWizardPage("Page0"));
+//    }
+//
+//    @Override
+//    public boolean performFinish() {
+//        if (isEmpty(realm.getText()) || isEmpty(id.getText())) {
+//            return false;
+//        }
+//        if (eObject == null) {
+//            SubjectInfo subjectInfo = new SubjectInfo();
+//            subjectInfo.setRealm(realm.getText());
+//            subjectInfo.setId(id.getText());
+//            ((SecurityAdvancedSection) section).getRole(role.getText()).setRunAsSubject(subjectInfo);
+//            ((SecurityAdvancedSection) section).activateAddButton();
+//        }
+//        else {
+//            ((Role)eObject).getRunAsSubject().setRealm(realm.getText());
+//            ((Role)eObject).getRunAsSubject().setId(id.getText());
+//        }
+//
+//        return true;
+//    }
+//
+//    @Override
+//    protected String getAddWizardWindowTitle() {
+//        return CommonMessages.wizardNewTitle_RunAsSubject;
+//    }
+//
+//    @Override
+//    protected String getEditWizardWindowTitle() {
+//        return CommonMessages.wizardNewTitle_RunAsSubject;
+//    }
+//}



Mime
View raw message