geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r938593 [5/8] - in /geronimo/devtools/eclipse-plugin/trunk: plugins/org.apache.geronimo.st.ui/ plugins/org.apache.geronimo.st.v21.ui/ plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ plugins/org.ap...
Date Tue, 27 Apr 2010 18:20:24 GMT
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/ClassFilterWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/ClassFilterWizard.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/ClassFilterWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/ClassFilterWizard.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,112 @@
+/*
+ * 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.v30.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.AbstractTableSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v30.ui.sections.ClassFilterSection;
+import org.apache.geronimo.jee.deployment.ClassFilter;
+import org.apache.geronimo.jee.deployment.Environment;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClassFilterWizard extends AbstractTableWizard {
+
+    protected boolean isServerEnvironment;
+    
+    public ClassFilterWizard(AbstractTableSection section, boolean isServerEnvironment) {
+        super(section);
+        this.isServerEnvironment = isServerEnvironment;
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "Value" };
+    }
+
+    public void addPages() {
+        addPage(new ClassFilterWizardPage("Page0"));
+    }
+    
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_Dependency;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_Dependency;
+    }
+
+    public class ClassFilterWizardPage extends AbstractTableWizardPage {
+        public ClassFilterWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_Dependency;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_Dependency;
+        }
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.st.ui.wizards.AbstractTableWizard#performFinish()
+     */
+    public boolean performFinish() {
+        AbstractTableWizardPage page = (AbstractTableWizardPage) getPages()[0];
+
+        if (eObject == null) {
+            eObject = new String();
+            JAXBElement plan = section.getPlan();
+
+            Environment environment = null;
+            environment = JAXBModelUtils.getEnvironment(plan, isServerEnvironment);
+            if (environment == null) {
+                environment = (Environment)getEFactory().create(Environment.class);
+                JAXBModelUtils.setEnvironment (plan, environment, isServerEnvironment);
+            }
+
+            ClassFilter filter = ((ClassFilterSection)section).getClassFilter();
+            if (filter == null) {
+                filter = (ClassFilter)getEFactory().create(ClassFilter.class);
+                ((ClassFilterSection)section).setClassFilter (filter);
+            }
+            filter.getFilter().add(page.getTextEntry(0).getText());
+        }
+        else {
+            ClassFilter filter = ((ClassFilterSection)section).getClassFilter();
+            filter.getFilter().set(filter.getFilter().indexOf(eObject), page.getTextEntry(0).getText());
+        }
+
+        if (section.getViewer().getInput() == null) {
+            section.getViewer().setInput(section.getInput());
+        }
+
+        return true;
+    }
+}

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

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

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/DBPoolWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/DBPoolWizard.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/DBPoolWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/DBPoolWizard.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,945 @@
+/*
+ * 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.v30.ui.wizards;
+
+import java.util.ArrayList;
+import javax.xml.bind.JAXBElement;
+import org.apache.geronimo.jee.application.Application;
+import org.apache.geronimo.jee.application.ExtModule;
+import org.apache.geronimo.jee.application.Path;
+import org.apache.geronimo.jee.connector.ConfigPropertySetting;
+import org.apache.geronimo.jee.connector.ConnectionDefinition;
+import org.apache.geronimo.jee.connector.ConnectiondefinitionInstance;
+import org.apache.geronimo.jee.connector.Connectionmanager;
+import org.apache.geronimo.jee.connector.Connector;
+import org.apache.geronimo.jee.connector.OutboundResourceadapter;
+import org.apache.geronimo.jee.connector.Resourceadapter;
+import org.apache.geronimo.jee.connector.Singlepool;
+import org.apache.geronimo.jee.connector.Xatransaction;
+import org.apache.geronimo.jee.deployment.Dependencies;
+import org.apache.geronimo.jee.deployment.Dependency;
+import org.apache.geronimo.jee.deployment.Environment;
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.apache.geronimo.jee.openejb.OpenejbJar;
+import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.ui.Activator;
+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.v30.core.jaxb.JAXBObjectFactoryImpl;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DBPoolWizard extends AbstractTableWizard {
+
+    protected ImageDescriptor descriptor = Activator.imageDescriptorFromPlugin(
+        "org.apache.geronimo.st.ui", "icons/bigG.gif");
+
+    public DBPoolWizard(AbstractTableSection section) {
+    super(section);
+    }
+
+    @Override
+    public JAXBObjectFactory getEFactory() {
+    return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    @Override
+    public String[] getTableColumnEAttributes() {
+    return new String[] {};
+    }
+
+    @Override
+    protected String getAddWizardWindowTitle() {
+    return "New Database Pool";// TODO put into message
+    }
+
+    @Override
+    protected String getEditWizardWindowTitle() {
+    return "Edit Database Pool";// TODO put into message
+    }
+
+    public void addPages() {
+    ExternalPathPage page0 = new ExternalPathPage("Page0");
+    page0.setImageDescriptor(descriptor);
+    addPage(page0);
+
+    DBPoolBasicPage page1 = new DBPoolBasicPage("Page1");
+    page1.setImageDescriptor(descriptor);
+    addPage(page1);
+
+    DBPoolAdvancedPage page2 = new DBPoolAdvancedPage("Page2");
+    page2.setImageDescriptor(descriptor);
+    addPage(page2);
+
+    ConnectionPoolPage page3 = new ConnectionPoolPage("Page3");
+    page3.setImageDescriptor(descriptor);
+    addPage(page3);
+    }
+
+    public boolean performFinish() {
+    JAXBElement plan = this.section.getPlan();
+
+    // all pages
+    ExternalPathPage page0 = (ExternalPathPage) getPages()[0];
+    DBPoolBasicPage page1 = (DBPoolBasicPage) getPages()[1];
+    DBPoolAdvancedPage page2 = (DBPoolAdvancedPage) getPages()[2];
+    ConnectionPoolPage page3 = (ConnectionPoolPage) getPages()[3];
+
+    // check necessary info has been filled
+    if (page1.getPoolName() == null
+        || page1.getPoolName().trim().length() == 0
+        || page1.getPoolName().contains(" ")) {
+        MessageDialog.openWarning(this.getShell(), "Pool Name Invalid",
+            "Pool name specified is invalid");
+        return false;
+    }
+    if (page1.getDBPooolType() == null
+        || page1.getDBPooolType().trim().length() == 0) {
+        MessageDialog.openWarning(this.getShell(), "Pool type invalid",
+            "Pool type specified is invalid");
+        return false;
+    }
+    if (page1.getDBName() == null || page1.getDBName().trim().length() == 0
+        || page1.getDBName().contains(" ")) {
+        MessageDialog.openWarning(this.getShell(), "Database name invalid",
+            "Database name specified is invalid");
+        return false;
+    }
+    if (page1.getDrivers() == null || page1.getDrivers().length == 0) {
+        MessageDialog.openWarning(this.getShell(), "Driver invalid",
+            "You havent selected a driver");
+        return false;
+    }
+
+    // add the dependencies and ext-module to plan
+    if (Application.class.isInstance(plan.getValue())) {
+        Application application = (Application) plan.getValue();
+        Environment env = application.getEnvironment();
+        if (env == null) {
+        env = new Environment();
+        application.setEnvironment(env);
+        }
+        Dependencies dependencies = env.getDependencies();
+        if (dependencies == null) {
+        dependencies = new Dependencies();
+        env.setDependencies(dependencies);
+        }
+
+        // if there are no same dependencies in plan,then add them
+        for (int i = 0; i < page1.getDrivers().length; i++) {
+        Dependency selectedDependency = (Dependency) page1.getDrivers()[i];
+        if (!dependencies.getDependency().contains(selectedDependency)) {
+            dependencies.getDependency().add(selectedDependency);
+        }
+        }
+
+        ExtModule extModule;
+        if (eObject == null) {
+        eObject = getEFactory().create(ExtModule.class);
+        extModule = (ExtModule) eObject;
+        java.util.List<ExtModule> extModuleList = application
+            .getExtModule();
+        extModuleList.add(extModule);
+        } else {
+        extModule = (ExtModule) eObject;
+        }
+
+        // NOTE!! this replaces the call to processEAttributes (page);
+        Path path = (Path) getEFactory().create(Path.class);
+        path.setValue(page0.text[0].getText());
+        extModule.setConnector(path);
+
+        Pattern pattern = (Pattern) getEFactory().create(Pattern.class);
+        extModule.setExternalPath(pattern);
+        pattern.setGroupId(page0.text[1].getText());
+        pattern.setArtifactId(page0.text[2].getText());
+        //empty version element will cause deploy failure
+        String version = page0.text[3].getText();
+        if (version!=null && version.length()!=0)
+            pattern.setVersion(page0.text[3].getText());
+        pattern.setType(page0.text[4].getText().trim());
+
+        Connector conn = new Connector();
+        // attention here <connector/> is unmashalled as a JAXBElement
+        JAXBElement<Connector> connElement = (new org.apache.geronimo.jee.connector.ObjectFactory())
+            .createConnector(conn);
+        extModule.setAny(connElement);
+        Resourceadapter adapter = new Resourceadapter();
+        conn.getResourceadapter().add(adapter);
+
+        OutboundResourceadapter outboundAdpater = new OutboundResourceadapter();
+        ConnectionDefinition definition = new ConnectionDefinition();
+        definition.setConnectionfactoryInterface("javax.sql.DataSource");
+        ConnectiondefinitionInstance instance = new ConnectiondefinitionInstance();
+        instance.setName(page1.getPoolName());
+
+        String[] loginData = page2.getLoginData();
+        if (!loginData[1].equals(loginData[2])) {
+        Status status = new Status(IStatus.WARNING, "Login Error", 0,
+            "Password provided in both fiels do not match", null);
+        ErrorDialog.openError(this.getShell(), "Login Error",
+            "Invalid Login Details", status);
+        return false;
+        }
+        ConfigPropertySetting setting1 = new ConfigPropertySetting();
+        setting1.setName("Password");
+        setting1.setValue(loginData[1]);
+        instance.getConfigPropertySetting().add(setting1);
+        ConfigPropertySetting setting2 = new ConfigPropertySetting();
+        setting2.setName("LoginTimeout");
+        setting2.setValue(page2.getLoginTimeout());
+        instance.getConfigPropertySetting().add(setting2);
+        ConfigPropertySetting setting3 = new ConfigPropertySetting();
+        setting3.setName("DatabaseName");
+        setting3.setValue(page1.getDBName());
+        instance.getConfigPropertySetting().add(setting3);
+        ConfigPropertySetting setting4 = new ConfigPropertySetting();
+        setting4.setName("CreateDatabase");
+        setting4.setValue(page2.getCreateDatabase());
+        instance.getConfigPropertySetting().add(setting4);
+        ConfigPropertySetting setting5 = new ConfigPropertySetting();
+        setting5.setName("UserName");
+        setting5.setValue(loginData[0]);
+        instance.getConfigPropertySetting().add(setting5);
+
+        instance.setConnectionmanager(page3.getConnectionManager());
+        definition.getConnectiondefinitionInstance().add(instance);
+        outboundAdpater.getConnectionDefinition().add(definition);
+        adapter.setOutboundResourceadapter(outboundAdpater);
+
+        if (section.getViewer().getInput() == section.getPlan()) {
+        section.getViewer().setInput(section.getInput());
+        }
+        return true;
+    }
+
+    return true;
+    }
+
+    public class ExternalPathPage extends AbstractTableWizardPage {
+    Text[] text = new Text[5];
+
+    protected ExternalPathPage(String pageName) {
+        super(pageName);
+    }
+
+    @Override
+    public void createControl(Composite parent) {
+        Composite composite = createComposite(parent);
+
+        GridData groupGridData1;
+        GridData groupGridData2;
+        GridData textGridData;
+        GridLayout gridLayout1;
+        GridLayout gridLayout2;
+        Label label;
+
+        Group group = new Group(composite, SWT.NONE);
+        gridLayout1 = new GridLayout();
+        gridLayout1.numColumns = 2;
+        group.setLayout(gridLayout1);
+        groupGridData1 = new GridData();
+        groupGridData1.horizontalAlignment = GridData.FILL;
+        groupGridData1.grabExcessHorizontalSpace = true;
+        groupGridData1.horizontalSpan = 2;
+        group.setLayoutData(groupGridData1);
+
+        label = new Label(group, SWT.LEFT);
+        label.setText("Connector:");
+
+        text[0] = new Text(group, SWT.SINGLE | SWT.BORDER);
+        textGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+            | GridData.VERTICAL_ALIGN_FILL);
+        textGridData.grabExcessHorizontalSpace = true;
+        textGridData.widthHint = 100;
+        text[0].setLayoutData(textGridData);
+
+        Group group2 = new Group(composite, SWT.NONE);
+        gridLayout2 = new GridLayout();
+        gridLayout2.numColumns = 2;
+        group2.setLayout(gridLayout2);
+        groupGridData2 = new GridData();
+        groupGridData2.horizontalAlignment = GridData.FILL;
+        groupGridData2.grabExcessHorizontalSpace = true;
+        groupGridData2.horizontalSpan = 2;
+        groupGridData2.verticalAlignment = GridData.FILL;
+        group2.setLayoutData(groupGridData2);
+        group2.setText("External Path");
+
+        label = new Label(group2, SWT.LEFT);
+        label.setText("Group Id:");
+        text[1] = new Text(group2, SWT.SINGLE | SWT.BORDER);
+        text[1].setLayoutData(textGridData);
+
+        label = new Label(group2, SWT.LEFT);
+        label.setText("Artifact Id:");
+        text[2] = new Text(group2, SWT.SINGLE | SWT.BORDER);
+        text[2].setLayoutData(textGridData);
+
+        label = new Label(group2, SWT.LEFT);
+        label.setText("Version:");
+        text[3] = new Text(group2, SWT.SINGLE | SWT.BORDER);
+        text[3].setLayoutData(textGridData);
+
+        label = new Label(group2, SWT.LEFT);
+        label.setText("Type:");
+        text[4] = new Text(group2, SWT.SINGLE | SWT.BORDER);
+        text[4].setLayoutData(textGridData);
+
+        // if edit a pool,the info must be filled into wizard
+        if (eObject != null && ExtModule.class.isInstance(eObject)) {
+        ExtModule extModule = (ExtModule) eObject;
+        if (extModule.getConnector() != null) {
+            text[0].setText(extModule.getConnector().getValue());
+        }
+        if (extModule.getExternalPath() != null) {
+            text[1]
+                .setText(extModule.getExternalPath().getGroupId() == null ? ""
+                    : extModule.getExternalPath().getGroupId());
+            text[2]
+                .setText(extModule.getExternalPath()
+                    .getArtifactId() == null ? "" : extModule
+                    .getExternalPath().getArtifactId());
+            text[3]
+                .setText(extModule.getExternalPath().getVersion() == null ? ""
+                    : extModule.getExternalPath().getVersion());
+            text[4]
+                .setText(extModule.getExternalPath().getType() == null ? ""
+                    : extModule.getExternalPath().getType());
+        }
+        }
+
+        setControl(composite);
+    }
+
+    @Override
+    protected String getWizardPageDescription() {
+        return "Specify the connector rar in the repository";
+    }
+
+    @Override
+    protected String getWizardPageTitle() {
+        return "External Path";
+    }
+
+    }
+
+    public class DBPoolBasicPage extends AbstractTableWizardPage {
+
+    Text text[] = new Text[2];
+    Combo combo;
+    ListViewer listViewer;
+    ArrayList<Dependency> dependencies = new ArrayList<Dependency>();
+
+    protected DBPoolBasicPage(String pageName) {
+        super(pageName);
+        setTitle(CommonMessages.wizardBasicPageTitle_DBPool);
+        setDescription(CommonMessages.wizardBasicPageDescription_DBPool);
+    }
+
+    protected Object[] getDrivers() {
+        StructuredSelection sel = (StructuredSelection) listViewer
+            .getSelection();
+        return sel.toArray();
+    }
+
+    protected String getPoolName() {
+        return text[0].getText();
+    }
+
+    protected String getDBName() {
+        return text[1].getText();
+    }
+
+    protected String getDBPooolType() {
+        if (combo.getSelectionIndex() == -1) {
+        return null;
+        }
+        return combo.getItem(combo.getSelectionIndex());
+    }
+
+    public void createControl(Composite parent) {
+        Composite composite = new Composite(parent, SWT.NULL);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        composite.setLayout(layout);
+        GridData data = new GridData();
+        // data.verticalAlignment = GridData.FILL;
+        data.horizontalAlignment = GridData.FILL;
+        data.widthHint = 300;
+        composite.setLayoutData(data);
+
+        Group basicGroup = new Group(composite, SWT.NONE);
+        basicGroup.setText(CommonMessages.basicGroup);
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.numColumns = 4;
+        data = new GridData();
+        data.horizontalAlignment = GridData.FILL;
+        data.grabExcessHorizontalSpace = true;
+        // data.grabExcessVerticalSpace = true;
+        data.horizontalSpan = 2;
+        basicGroup.setLayout(layout);
+        data.grabExcessHorizontalSpace = true;
+        basicGroup.setLayoutData(data);
+        Label label = new Label(basicGroup, SWT.LEFT);
+        label.setText(CommonMessages.poolName);
+        GridData labelData = new GridData();
+        labelData.horizontalAlignment = GridData.FILL;
+        label.setLayoutData(labelData);
+        text[0] = new Text(basicGroup, SWT.BORDER);
+        GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+            | GridData.VERTICAL_ALIGN_FILL);
+        textData.grabExcessHorizontalSpace = true;
+        textData.widthHint = 100;
+        text[0].setLayoutData(textData);
+        label = new Label(basicGroup, SWT.LEFT);
+        label.setText(CommonMessages.dbType);
+        label.setLayoutData(labelData);
+        combo = new Combo(basicGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
+        combo.setLayoutData(textData);
+        combo.add("Derby Embedded");
+        combo.add("Derby Embedded XA");
+        combo.select(1);
+        label = new Label(basicGroup, SWT.LEFT);
+        label.setText(CommonMessages.dbName);
+        label.setLayoutData(labelData);
+        text[1] = new Text(basicGroup, SWT.BORDER);
+        text[1].setLayoutData(textData);
+
+        Group driverGroup = new Group(composite, SWT.NONE);
+        driverGroup.setText(CommonMessages.driverGroup);
+        driverGroup.setLayout(layout);
+        driverGroup.setLayoutData(data);
+        List list = new List(driverGroup, SWT.BORDER | SWT.MULTI
+            | SWT.V_SCROLL);
+        GridData listData = new GridData(SWT.FILL, SWT.FILL, true, true);
+        list.setLayoutData(listData);
+        listViewer = new ListViewer(list);
+        listViewer.setContentProvider(new IStructuredContentProvider() {
+        public Object[] getElements(Object element) {
+            return ((java.util.List<?>) element).toArray();
+        }
+
+        public void dispose() {
+        }
+
+        public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+        }
+        });
+        listViewer.setInput(getInput());
+        MenuManager popupMenu = new MenuManager();
+        Action helpAction = new Action("Add New Driver") { //$NON-NLS-1$
+        public void run() {
+            DriverDialog dialog = new DriverDialog(Display.getCurrent()
+                .getActiveShell());
+            dialog.open();
+            if (dialog.getReturnCode() == 0) {
+            if (dialog.getDependency() != null) {
+                dependencies.add(dialog.getDependency());
+                listViewer.refresh();
+            }
+            }
+        }
+        };
+        popupMenu.add(helpAction);
+        Menu menu = popupMenu.createContextMenu(list);
+        list.setMenu(menu);
+
+        // if edit a pool,the info must be filled into wizard
+        if (eObject != null && ExtModule.class.isInstance(eObject)) {
+        ExtModule extModule = (ExtModule) eObject;
+
+        try {
+            ConnectiondefinitionInstance conndefInstance = ((JAXBElement<Connector>) extModule
+                .getAny()).getValue().getResourceadapter().get(0)
+                .getOutboundResourceadapter()
+                .getConnectionDefinition().get(0)
+                .getConnectiondefinitionInstance().get(0);
+            text[0].setText(conndefInstance.getName());
+            java.util.List<ConfigPropertySetting> configPropertySettingList = conndefInstance
+                .getConfigPropertySetting();
+            for (ConfigPropertySetting cps : configPropertySettingList) {
+            if (cps.getName().equals("DatabaseName")) {
+                text[1].setText(cps.getValue());
+            }
+            }
+
+            // there need some improvement
+            list.setSelection(new int[] { 0 });
+            listViewer.refresh();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        }
+
+        setControl(composite);
+
+    }
+
+    public Object getInput() {
+        // to be obtained dynamically
+        Dependency dependency = new Dependency();
+        dependency.setArtifactId("system-database");
+        dependency.setGroupId("org.apache.geronimo.configs");
+        dependency.setVersion("");
+        dependency.setType("car");
+        dependencies.add(dependency);
+        return dependencies;
+    }
+
+    @Override
+    protected String getWizardPageDescription() {
+        return "";
+    }
+
+    @Override
+    protected String getWizardPageTitle() {
+        return "";
+    }
+
+    }
+
+    public class DBPoolAdvancedPage extends AbstractTableWizardPage {
+
+    Button createDatabase;
+    Text text[] = new Text[4];
+
+    protected String[] getLoginData() {
+        return new String[] { text[1].getText(), text[2].getText(),
+            text[3].getText() };
+    }
+
+    protected String getCreateDatabase() {
+        return createDatabase.getSelection() ? "true" : "false";
+    }
+
+    protected String getLoginTimeout() {
+        return text[0].getText();
+    }
+
+    protected DBPoolAdvancedPage(String pageName) {
+        super(pageName);
+        setTitle(CommonMessages.wizardAdvancedPageTitle__DBPool);
+        setDescription(CommonMessages.wizardAdvancedPageDescription__DBPool);
+    }
+
+    public void createControl(Composite parent) {
+        Composite composite = new Composite(parent, SWT.NULL);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        composite.setLayout(layout);
+        GridData data = new GridData();
+        data.verticalAlignment = GridData.FILL;
+        data.horizontalAlignment = GridData.FILL;
+        data.widthHint = 300;
+        composite.setLayoutData(data);
+
+        Group advancedGroup = createGroup(composite,
+            CommonMessages.advancedGroup, 2);
+        createDatabase = new Button(advancedGroup, SWT.CHECK);
+        createDatabase.setText(CommonMessages.createDatabase);
+        createDatabase.setLayoutData(new GridData(GridData.FILL,
+            GridData.FILL, true, false, 4, 1));
+        createDatabase.setSelection(true);
+        createLabel(advancedGroup, CommonMessages.loginTimeout, 2);
+        text[0] = createText(advancedGroup, 2);
+
+        Group userGroup = createGroup(composite, CommonMessages.loginGroup,
+            2);
+        createLabel(userGroup, CommonMessages.username, 2);
+        text[1] = createText(userGroup, 2);
+        text[1].setText("system");
+        createLabel(userGroup, CommonMessages.password, 2);
+        text[2] = createText(userGroup, 2);
+        text[2].setEchoChar('*');
+        text[2].setText("manager");
+        createLabel(userGroup, CommonMessages.confirmPassword, 2);
+        text[3] = createText(userGroup, 2);
+        text[3].setEchoChar('*');
+        text[3].setText("manager");
+
+        // if edit a pool,the info must be filled into wizard
+        if (eObject != null && ExtModule.class.isInstance(eObject)) {
+        ExtModule extModule = (ExtModule) eObject;
+        try {
+            ConnectiondefinitionInstance conndefInstance = ((JAXBElement<Connector>) extModule
+                .getAny()).getValue().getResourceadapter().get(0)
+                .getOutboundResourceadapter()
+                .getConnectionDefinition().get(0)
+                .getConnectiondefinitionInstance().get(0);
+            java.util.List<ConfigPropertySetting> configPropertySettingList = conndefInstance
+                .getConfigPropertySetting();
+            for (ConfigPropertySetting cps : configPropertySettingList) {
+            if (cps.getName().equals("CreateDatabase")) {
+                if (cps.getValue().equals("true"))
+                createDatabase.setSelection(true);
+                else
+                createDatabase.setSelection(false);
+            } else if (cps.getName().equals("LoginTimeout")) {
+                text[0].setText(cps.getValue());
+            } else if (cps.getName().equals("UserName")) {
+                text[1].setText(cps.getValue());
+            } else if (cps.getName().equals("Password")) {
+                text[2].setEchoChar('*');
+                text[2].setText(cps.getValue());
+                text[3].setEchoChar('*');
+                text[3].setText(cps.getValue());
+            }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        }
+
+        setControl(composite);
+
+    }
+
+    protected Group createGroup(Composite composite, String value, int span) {
+        Group group = new Group(composite, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 4;
+        GridData data = new GridData();
+        data.horizontalAlignment = GridData.FILL;
+        data.grabExcessHorizontalSpace = true;
+        data.horizontalSpan = span;
+        group.setLayout(layout);
+        group.setLayoutData(data);
+        group.setText(value);
+        return group;
+    }
+
+    protected Label createLabel(Composite composite, String value, int span) {
+        Label label = new Label(composite, SWT.NONE);
+        label.setText(value);
+        GridData labelData = new GridData();
+        labelData.horizontalAlignment = GridData.FILL;
+        labelData.horizontalSpan = span;
+        label.setLayoutData(labelData);
+        return label;
+    }
+
+    protected Text createText(Composite composite, int span) {
+        Text text = new Text(composite, SWT.BORDER);
+        GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+            | GridData.VERTICAL_ALIGN_FILL);
+        textData.grabExcessHorizontalSpace = true;
+        textData.widthHint = 100;
+        textData.horizontalSpan = span;
+        text.setLayoutData(textData);
+        return text;
+    }
+
+    @Override
+    protected String getWizardPageDescription() {
+        return "";
+    }
+
+    @Override
+    protected String getWizardPageTitle() {
+        return "";
+    }
+
+    }
+
+    public class ConnectionPoolPage extends AbstractTableWizardPage {
+
+    Combo combo;
+    Text text[] = new Text[4];
+
+    protected ConnectionPoolPage(String pageName) {
+        super(pageName);
+        setTitle(CommonMessages.wizardConnectionPageTitle__DBPool);
+        setDescription(CommonMessages.wizardConnectionPageDescription__DBPool);
+    }
+
+    protected Connectionmanager getConnectionManager() {
+        Connectionmanager manager = new Connectionmanager();
+
+        // add the pool's transaction type into plan
+        int poolTypeIndex = combo.getSelectionIndex();
+        // pool type is XA
+        if (poolTypeIndex == 0) {
+        Xatransaction xaTransaction = new Xatransaction();
+        xaTransaction
+            .setTransactionCaching(new org.apache.geronimo.jee.connector.Empty());
+        manager.setXaTransaction(xaTransaction);
+        }
+        // pool type is LOCAL
+        else if (poolTypeIndex == 1) {
+        manager
+            .setLocalTransaction(new org.apache.geronimo.jee.connector.Empty());
+        }
+        // pool type is NONE
+        else if (poolTypeIndex == 2) {
+        manager
+            .setNoTransaction(new org.apache.geronimo.jee.connector.Empty());
+        }
+
+        Singlepool pool = new Singlepool();
+        pool.setMinSize(text[0].getText().trim().length() == 0 ? 0
+            : new Integer(text[0].getText()));
+        pool.setMaxSize(text[1].getText().trim().length() == 0 ? 10
+            : new Integer(text[1].getText()));
+        pool.setBlockingTimeoutMilliseconds(text[2].getText().trim()
+            .length() == 0 ? null : new Integer(text[2].getText()));
+        pool
+            .setIdleTimeoutMinutes(text[3].getText().trim().length() == 0 ? null
+                : new Integer(text[3].getText()));
+        pool.setMatchOne(new org.apache.geronimo.jee.connector.Empty());
+        manager.setSinglePool(pool);
+        return manager;
+    }
+
+    public void createControl(Composite parent) {
+        Composite composite = new Composite(parent, SWT.NULL);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        composite.setLayout(layout);
+        GridData data = new GridData();
+        data.verticalAlignment = GridData.FILL;
+        data.horizontalAlignment = GridData.FILL;
+        data.widthHint = 300;
+        composite.setLayoutData(data);
+
+        Group connectionGroup = createGroup(composite,
+            CommonMessages.wizardConnectionPageTitle__DBPool, 2);
+        createLabel(connectionGroup, CommonMessages.transactionType, 2);
+        combo = new Combo(connectionGroup, SWT.NONE | SWT.READ_ONLY);
+        combo.add("XA");
+        combo.add("LOCAL");
+        combo.add("NONE");
+        combo.select(0);
+        GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+            | GridData.VERTICAL_ALIGN_FILL);
+        textData.grabExcessHorizontalSpace = true;
+        textData.horizontalSpan = 2;
+        textData.widthHint = 100;
+        combo.setLayoutData(textData);
+        createLabel(connectionGroup, CommonMessages.minPoolSize, 2);
+        text[0] = createText(connectionGroup, 2);
+        text[0].setText("0");
+        createLabel(connectionGroup, CommonMessages.maxPoolSize, 2);
+        text[1] = createText(connectionGroup, 2);
+        text[1].setText("10");
+        createLabel(connectionGroup, CommonMessages.blockingTimeout, 2);
+        text[2] = createText(connectionGroup, 2);
+        createLabel(connectionGroup, CommonMessages.idleTimeout, 2);
+        text[3] = createText(connectionGroup, 2);
+
+        // if edit a pool,the info must be filled into wizard
+        if (eObject != null && ExtModule.class.isInstance(eObject)) {
+        ExtModule extModule = (ExtModule) eObject;
+        try {
+            ConnectiondefinitionInstance conndefInstance = ((JAXBElement<Connector>) extModule
+                .getAny()).getValue().getResourceadapter().get(0)
+                .getOutboundResourceadapter()
+                .getConnectionDefinition().get(0)
+                .getConnectiondefinitionInstance().get(0);
+
+            Connectionmanager connManager = conndefInstance
+                .getConnectionmanager();
+            if (connManager.getXaTransaction() != null) {
+            combo.select(0);
+            } else if (connManager.getLocalTransaction() != null) {
+            combo.select(1);
+            } else if (connManager.getNoTransaction() != null) {
+            combo.select(2);
+            }
+            Singlepool singlepool = connManager.getSinglePool();
+            if (singlepool != null) {
+            text[0].setText(singlepool.getMaxSize() == null ? ""
+                : singlepool.getMaxSize().toString());
+            text[1].setText(singlepool.getMinSize() == null ? ""
+                : singlepool.getMinSize().toString());
+            text[2].setText(singlepool
+                .getBlockingTimeoutMilliseconds() == null ? ""
+                : singlepool.getBlockingTimeoutMilliseconds()
+                    .toString());
+            text[3]
+                .setText(singlepool.getIdleTimeoutMinutes() == null ? ""
+                    : singlepool.getIdleTimeoutMinutes()
+                        .toString());
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        }
+
+        setControl(composite);
+
+    }
+
+    protected Group createGroup(Composite composite, String value, int span) {
+        Group group = new Group(composite, SWT.NONE);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 4;
+        GridData data = new GridData();
+        data.horizontalAlignment = GridData.FILL;
+        data.grabExcessHorizontalSpace = true;
+        data.horizontalSpan = span;
+        group.setLayout(layout);
+        group.setLayoutData(data);
+        group.setText(value);
+        return group;
+    }
+
+    protected Label createLabel(Composite composite, String value, int span) {
+        Label label = new Label(composite, SWT.NONE);
+        label.setText(value);
+        GridData labelData = new GridData();
+        labelData.horizontalAlignment = GridData.FILL;
+        labelData.horizontalSpan = span;
+        label.setLayoutData(labelData);
+        return label;
+    }
+
+    protected Text createText(Composite composite, int span) {
+        Text text = new Text(composite, SWT.BORDER);
+        GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+            | GridData.VERTICAL_ALIGN_FILL);
+        textData.grabExcessHorizontalSpace = true;
+        textData.widthHint = 100;
+        textData.horizontalSpan = span;
+        text.setLayoutData(textData);
+        return text;
+    }
+
+    @Override
+    protected String getWizardPageDescription() {
+        return "";
+    }
+
+    @Override
+    protected String getWizardPageTitle() {
+        return "";
+    }
+
+    }
+
+}
+
+class DriverDialog extends Dialog {
+
+    String data[] = new String[4];
+    Text text[] = new Text[4];
+
+    public DriverDialog(Shell parent) {
+    super(parent);
+    }
+
+    public Dependency getDependency() {
+    if (data[0].trim().length() == 0 || data[1].trim().length() == 0
+        || data[2].trim().length() == 0 || data[3].trim().length() == 0) {
+        return null;
+    }
+    Dependency dependency = new Dependency();
+    dependency.setGroupId(data[0]);
+    dependency.setArtifactId(data[1]);
+    dependency.setVersion(data[2]);
+    dependency.setType(data[3]);
+    return dependency;
+    }
+
+    protected Control createContents(Composite parent) {
+    Composite composite = new Composite(parent, SWT.NULL);
+    GridLayout layout = new GridLayout();
+    layout.numColumns = 2;
+    composite.setLayout(layout);
+    GridData data = new GridData();
+    data.verticalAlignment = GridData.FILL;
+    data.horizontalAlignment = GridData.FILL;
+    data.widthHint = 300;
+    composite.setLayoutData(data);
+
+    createLabel(composite, CommonMessages.groupId, 2);
+    text[0] = createText(composite, 2);
+    createLabel(composite, CommonMessages.artifactId, 2);
+    text[1] = createText(composite, 2);
+    createLabel(composite, CommonMessages.version, 2);
+    text[2] = createText(composite, 2);
+    createLabel(composite, CommonMessages.artifactType, 2);
+    text[3] = createText(composite, 2);
+
+    createButtonBar(parent);
+
+    return composite;
+    }
+
+    protected void okPressed() {
+    for (int i = 0; i < text.length; i++) {
+        data[i] = text[i].getText();
+    }
+    super.okPressed();
+    }
+
+    protected Label createLabel(Composite composite, String value, int span) {
+    Label label = new Label(composite, SWT.NONE);
+    label.setText(value);
+    GridData labelData = new GridData();
+    labelData.horizontalAlignment = GridData.FILL;
+    labelData.horizontalSpan = span;
+    label.setLayoutData(labelData);
+    return label;
+    }
+
+    protected Text createText(Composite composite, int span) {
+    Text text = new Text(composite, SWT.BORDER);
+    GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+        | GridData.VERTICAL_ALIGN_FILL);
+    textData.grabExcessHorizontalSpace = true;
+    textData.widthHint = 100;
+    textData.horizontalSpan = span;
+    text.setLayoutData(textData);
+    return text;
+    }
+
+}
+
+

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

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

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/DependencyWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/DependencyWizard.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/DependencyWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/DependencyWizard.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,166 @@
+/*
+ * 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.v30.ui.wizards;
+
+import java.util.List;
+
+import org.apache.geronimo.jee.deployment.Dependency;
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBObjectFactoryImpl;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DependencyWizard extends AbstractTableWizard {
+
+    private Table dependencyTable;
+    private TabFolder tabFolder;
+
+    public DependencyWizard(AbstractTableSection section) {
+        super(section);
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "GroupId", "ArtifactId", "Version", "Type" };
+    }
+
+    protected String[] dependencyToStringArray(Dependency dependency) {
+        String[] stringArray = new String[getTableColumnEAttributes().length];
+        stringArray[0] = dependency.getGroupId();
+        stringArray[1] = dependency.getArtifactId();
+        stringArray[2] = dependency.getVersion();
+        stringArray[3] = dependency.getType();
+        return stringArray;
+    }
+
+    public void addPages() {
+        addPage(new DependencyWizardPage("AddDependencyPage"));
+    }
+
+    public class DependencyWizardPage extends AbstractTableWizardPage {
+
+        public DependencyWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public void createControl(Composite parent) {
+            parent.setLayoutData(createGridData());
+
+            Composite composite = createComposite(parent);
+            tabFolder = new TabFolder(composite, SWT.NONE);
+            tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+            TabItem item1 = new TabItem(tabFolder, SWT.NONE);
+            item1.setText(CommonMessages.wizardTabManual_Dependency);
+            Composite addManuallyComposite = createComposite(tabFolder);
+            createEditFields(addManuallyComposite);
+            item1.setControl(addManuallyComposite);
+
+            if (eObject == null) {
+                TabItem item2 = new TabItem(tabFolder, SWT.NONE);
+                item2.setText(CommonMessages.wizardTabServer_Dependency);
+                int columnWidths[] = { 80, 220, 50, 65 };
+                dependencyTable = createTable(tabFolder, section.getTableColumnNames(), columnWidths);
+                populateTable();
+                item2.setControl(dependencyTable);
+            }
+            tabFolder.pack();
+            doCustom(composite);
+            setControl(composite);
+        }
+
+        public GridData createGridData() {
+            GridData data = new GridData();
+            data.verticalAlignment = GridData.FILL;
+            data.horizontalAlignment = GridData.FILL;
+            data.grabExcessVerticalSpace = true;
+            data.grabExcessHorizontalSpace = true;
+            data.heightHint = 230;
+            data.widthHint = 300;
+            return data;
+        }
+
+        public void populateTable() {
+            List<Dependency> serverList = GeronimoServerInfo.getInstance().getCommonLibs();
+            List<Dependency> alreadyAddedDependencies = (List<Dependency>) section.getObjectContainer();
+            serverList.removeAll(alreadyAddedDependencies);
+            for (int i = 0; i < serverList.size(); ++i) {
+                TableItem tabItem = new TableItem(dependencyTable, SWT.NONE);
+                Dependency dependency = serverList.get(i);
+                tabItem.setData(dependency);
+                tabItem.setText(dependencyToStringArray(dependency));
+            }
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_Dependency;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_Dependency;
+        }
+    }
+
+    public boolean performFinish() {
+        switch (tabFolder.getSelectionIndex()) {
+        case -1:
+            // no item selected!
+            return false;
+        case 0:
+            // Adding Manually
+            if (eObject == null) {
+                eObject = new Dependency();
+                section.getObjectContainer().add(eObject);
+            }
+            processEAttributes(getPages()[0]);
+            break;
+        case 1:
+            // Adding from Server
+            TableItem[] selectedItems = dependencyTable.getSelection();
+            for (int i = 0; i < selectedItems.length; i++) {
+                TableItem selectedItem = selectedItems[i];
+                Dependency dependency = (Dependency) selectedItem.getData();
+                section.getObjectContainer().add(dependency);
+            }
+            break;
+        }
+        return true;
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_Dependency;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_Dependency;
+    }
+}

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

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

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbLocalRefWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbLocalRefWizard.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbLocalRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbLocalRefWizard.java Tue Apr 27 18:20:22 2010
@@ -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.v30.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.v30.core.jaxb.JAXBObjectFactoryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbLocalRefWizard extends AbstractTableWizard {
+
+    public EjbLocalRefWizard(AbstractTableSection section) {
+        super(section);
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "RefName", "EjbLink" };
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_EjbLocalRef;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_EjbLocalRef;
+    }
+    
+    public void addPages() {
+        addPage(new EjbLocalRefWizardPage("Page0"));
+    }
+
+    public class EjbLocalRefWizardPage extends AbstractTableWizardPage {
+        public EjbLocalRefWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_EjbLocalRef;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_EjbLocalRef;
+        }
+    }
+}

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

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

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbRefWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbRefWizard.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbRefWizard.java Tue Apr 27 18:20:22 2010
@@ -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.v30.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.v30.core.jaxb.JAXBObjectFactoryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbRefWizard extends AbstractTableWizard {
+
+    public EjbRefWizard(AbstractTableSection section) {
+        super(section);
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String[] getTableColumnEAttributes() {
+        return new String[] { "RefName", "EjbLink" };
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_EjbRef;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_EjbRef;
+    }
+    
+    public void addPages() {
+        addPage(new EjbRefWizardPage("Page0"));
+    }
+
+    public class EjbRefWizardPage extends AbstractTableWizardPage {
+        public EjbRefWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_EjbRef;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_EjbRef;
+        }
+    }
+}

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

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

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbRelationWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbRelationWizard.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbRelationWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/EjbRelationWizard.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,223 @@
+/*
+ * 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.v30.ui.wizards;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.openejb.EjbRelation;
+import org.apache.geronimo.jee.openejb.EjbRelationshipRole;
+import org.apache.geronimo.jee.openejb.Relationships;
+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.v30.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v30.ui.sections.EjbRelationSection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbRelationWizard extends AbstractTreeWizard {
+
+    private final int EJB_RELATION = 0;
+    private final int RELATIONSHIP_ROLE = 1;
+    private final int CMR_FIELD_MAPPING = 2;
+
+    public EjbRelationWizard(AbstractTreeSection section) {
+        super(section, 3, 3);
+        elementTypes[EJB_RELATION] = "EJB Relation";
+        elementTypes[RELATIONSHIP_ROLE] = "EJB Relationship Role";
+        elementTypes[CMR_FIELD_MAPPING] = "CMR Field Mapping";
+    }
+
+    public class EjbRelationWizardPage extends AbstractTreeWizardPage {
+
+        public EjbRelationWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        protected void initControl () {
+            if (eObject == null) {
+                element.select(EJB_RELATION);
+                if (EjbRelation.class.isInstance(((EjbRelationSection)section).getSelectedObject())) {
+                    element.remove(elementTypes[CMR_FIELD_MAPPING]);
+                }
+                else if (EjbRelationshipRole.class.isInstance(((EjbRelationSection)section).getSelectedObject())) {
+                    element.select(CMR_FIELD_MAPPING);
+                    element.setEnabled(false);
+                }
+                else {
+                    element.setEnabled(false);
+                }
+            }
+            else {
+                if (EjbRelation.class.isInstance(eObject)) {
+                    textList.get(0).setText(((EjbRelation)eObject).getEjbRelationName());
+                    textList.get(1).setText(((EjbRelation)eObject).getManyToManyTableName());
+                    element.select(EJB_RELATION);
+                }
+                else if (EjbRelationshipRole.class.isInstance(eObject)) {
+                    EjbRelationshipRole role = (EjbRelationshipRole)eObject;
+                    textList.get(0).setText(role.getEjbRelationshipRoleName());
+                    textList.get(1).setText(role.getRelationshipRoleSource().getEjbName());
+                    textList.get(2).setText(role.getCmrField().getCmrFieldName());
+                    element.select(RELATIONSHIP_ROLE);
+                }
+                else if (EjbRelationshipRole.RoleMapping.CmrFieldMapping.class.isInstance(eObject)) {
+                    EjbRelationshipRole.RoleMapping.CmrFieldMapping fieldMapping =
+                            (EjbRelationshipRole.RoleMapping.CmrFieldMapping)eObject;
+                    textList.get(0).setText(fieldMapping.getKeyColumn());
+                    textList.get(1).setText(fieldMapping.getForeignKeyColumn());
+                    element.select(CMR_FIELD_MAPPING);
+                }
+                element.setEnabled(false);
+            }
+        }
+        
+        protected void toggleFields (boolean clearFields) {
+            if (element.getText().equals(elementTypes[EJB_RELATION])) {
+                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.mtmTableName);
+                // if we are doing an add, then we need to make sure that the longest
+                // text can be handled
+                labelList.get(2).setText(CommonMessages.foreignKeyColumn);
+            }
+            else if (element.getText().equals(elementTypes[RELATIONSHIP_ROLE])) {
+                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.ejbSourceName);
+                labelList.get(2).setText(CommonMessages.cmrFieldName);
+            }
+            else if (element.getText().equals(elementTypes[CMR_FIELD_MAPPING])) {
+                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.keyColumn);
+                labelList.get(1).setText(CommonMessages.foreignKeyColumn);
+            }
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_EjbRelation;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_EjbRelation;
+        }
+    }
+
+    @Override
+    public void addPages() {
+        addPage(new EjbRelationWizardPage("Page0"));
+    }
+
+    @Override
+    public boolean performFinish() {
+        EjbRelation relation;
+        if (element.getText().equals(elementTypes[EJB_RELATION])) {
+            relation = (EjbRelation)eObject;
+            if (relation == null) {
+                relation = (EjbRelation)getEFactory().create(EjbRelation.class);
+                JAXBElement plan = section.getPlan();
+                
+                if (JAXBModelUtils.getEjbRelationships(plan) == null) {
+                    Relationships relationships = (Relationships)getEFactory().create(Relationships.class);
+
+                    JAXBModelUtils.setEjbRelationships(plan, relationships);
+                    ((EjbRelationSection)section).resetInput(relationships);
+                }
+                JAXBModelUtils.getEjbRelationships(plan).add(relation);
+            }
+            relation.setEjbRelationName(textList.get(0).getText());
+            relation.setManyToManyTableName(textList.get(1).getText());
+        }
+        else if (element.getText().equals(elementTypes[RELATIONSHIP_ROLE])) {
+            if (isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            EjbRelationshipRole role = (EjbRelationshipRole)eObject;
+            if (role == null) {
+                role = (EjbRelationshipRole)getEFactory().create(EjbRelationshipRole.class);
+                relation = (EjbRelation)((EjbRelationSection)section).getSelectedObject();
+                relation.getEjbRelationshipRole().add(role);
+            }
+            role.setEjbRelationshipRoleName(textList.get(0).getText());
+            EjbRelationshipRole.RelationshipRoleSource source = role.getRelationshipRoleSource();
+            if (source == null) {
+                source = (EjbRelationshipRole.RelationshipRoleSource)getEFactory().create(EjbRelationshipRole.RelationshipRoleSource.class);
+                role.setRelationshipRoleSource(source);
+            }
+            source.setEjbName(textList.get(1).getText());
+            EjbRelationshipRole.CmrField cmrField = role.getCmrField();
+            if (cmrField == null) {
+                cmrField = (EjbRelationshipRole.CmrField)getEFactory().create(EjbRelationshipRole.CmrField.class);
+                role.setCmrField(cmrField);
+            }
+            cmrField.setCmrFieldName(textList.get(2).getText());
+        }
+        else if (element.getText().equals(elementTypes[CMR_FIELD_MAPPING])) { 
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            EjbRelationshipRole.RoleMapping.CmrFieldMapping fieldMapping =
+                    (EjbRelationshipRole.RoleMapping.CmrFieldMapping)eObject;
+            if (fieldMapping == null) {
+                fieldMapping = (EjbRelationshipRole.RoleMapping.CmrFieldMapping)getEFactory().create(EjbRelationshipRole.RoleMapping.CmrFieldMapping.class);
+                EjbRelationshipRole role = (EjbRelationshipRole)((EjbRelationSection)section).getSelectedObject();
+                EjbRelationshipRole.RoleMapping roleMapping = role.getRoleMapping();
+                if (roleMapping == null) {
+                    roleMapping = (EjbRelationshipRole.RoleMapping)getEFactory().create(EjbRelationshipRole.RoleMapping.class);
+                    role.setRoleMapping(roleMapping);
+                }
+                role.getRoleMapping().getCmrFieldMapping().add(fieldMapping);
+            }
+            fieldMapping.setKeyColumn(textList.get(0).getText());
+            fieldMapping.setForeignKeyColumn(textList.get(1).getText());
+        }
+        return true;
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_EjbRelation;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_EjbRelation;
+    }
+}

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

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

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/ExtModuleWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/ExtModuleWizard.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/ExtModuleWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/ExtModuleWizard.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,332 @@
+/*
+ * 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.v30.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.v30.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.jee.application.Application;
+import org.apache.geronimo.jee.application.ExtModule;
+import org.apache.geronimo.jee.application.Path;
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.eclipse.jface.dialogs.MessageDialog;
+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.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @version $Rev$ $Date$
+ */
+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;
+            ExtModule extModule = (ExtModule)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) {
+                        Pattern pattern = extModule.getExternalPath();
+                        String 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];
+        Path path;
+        ExtModule extModule;
+
+        if (eObject == null) {
+            eObject = getEFactory().create(ExtModule.class);
+            JAXBElement plan = section.getPlan();
+            extModule = (ExtModule)eObject;
+            //This is the extModule field in plan(Application Type)
+            List<ExtModule> extModuleList = ((Application)plan.getValue()).getExtModule();
+            extModuleList.add(extModule);
+        }
+        else {
+            extModule = (ExtModule)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 = (Path)getEFactory().create(Path.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()) {
+            Pattern pattern = (Pattern)getEFactory().create(Pattern.class);
+            extModule.setExternalPath(pattern);
+            for (int i = 2; i < 6; i++) {
+                String value = page.getTextEntry(i).getText();
+                String attribute = getTableColumnEAttributes()[i + 1];
+                try {
+                    JAXBUtils.setValue(pattern, attribute, value);
+                } catch (Exception e) {
+                    MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+                }
+            }
+            extModule.setInternalPath(null);
+        }
+
+        if (section.getViewer().getInput() == section.getPlan()) {
+            section.getViewer().setInput(section.getInput());
+        }
+
+        return true;
+    }
+}

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

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

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



Mime
View raw message