geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From de...@apache.org
Subject svn commit: r817996 [21/23] - in /geronimo/devtools/eclipse-plugin/trunk: assembly/ assembly/src/main/assembly/ features/ features/org.apache.geronimo.v22.feature/ plugins/ plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/ plugins/org.apache.geronimo.j2e...
Date Wed, 23 Sep 2009 08:04:34 GMT
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/WebContainerSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/WebContainerSection.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/WebContainerSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/WebContainerSection.java Wed Sep 23 08:04:12 2009
@@ -0,0 +1,261 @@
+/*
+ * 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.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractSectionPart;
+import org.apache.geronimo.xml.ns.j2ee.web_1.WebAppType;
+import org.apache.geronimo.xml.ns.naming_1.GbeanLocatorType;
+import org.apache.geronimo.xml.ns.naming_1.ObjectFactory;
+import org.apache.geronimo.xml.ns.naming_1.PatternType;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebContainerSection extends AbstractSectionPart {
+
+    protected Text gBeanLink;
+
+    protected Text artifact;
+
+    protected Text group;
+
+    protected Text module;
+
+    protected Text name;
+
+    protected Text version;
+
+    protected Button specifyAsLink;
+
+    protected Button specifyAsPattern;
+
+    WebAppType plan;
+    
+    private ObjectFactory namingFactory;
+
+    /**
+     * @param parent
+     * @param toolkit
+     * @param style
+     * @param plan
+     */
+    public WebContainerSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+        super(parent, toolkit, style, plan);
+        this.plan = (WebAppType) plan.getValue();
+        namingFactory = new ObjectFactory();
+        createClient();
+    }
+
+    protected void createClient() {
+        Section section = getSection();
+
+        section.setText(CommonMessages.webContainerSection);
+        section.setDescription(CommonMessages.webContainerSectionDescription);
+        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+
+        Composite composite = toolkit.createComposite(section);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.marginHeight = 5;
+        layout.marginWidth = 10;
+        layout.verticalSpacing = 5;
+        layout.horizontalSpacing = 15;
+        composite.setLayout(layout);
+        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+        section.setClient(composite);
+
+        specifyAsLink = toolkit.createButton(composite, CommonMessages.useGBeanLink, SWT.RADIO);
+        GridData data = new GridData();
+        data.horizontalSpan = 2;
+        specifyAsLink.setLayoutData(data);
+
+        GbeanLocatorType wc = plan.getWebContainer();
+
+        toolkit.createLabel(composite, CommonMessages.gBeanLink);
+        String value = wc != null ? wc.getGbeanLink() : null;
+        gBeanLink = toolkit.createText(composite, value, SWT.BORDER);
+        gBeanLink.setLayoutData(createTextFieldGridData());
+        gBeanLink.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getGBeanLocator().setGbeanLink(gBeanLink.getText());
+                markDirty();
+            }
+        });
+
+        specifyAsPattern = toolkit.createButton(composite, CommonMessages.useGBeanPattern, SWT.RADIO);
+        specifyAsPattern.setLayoutData(data);
+
+        toolkit.createLabel(composite, CommonMessages.groupId);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getGroupId()
+                : null;
+        group = toolkit.createText(composite, value, SWT.BORDER);
+        group.setLayoutData(createTextFieldGridData());
+        group.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setGroupId(group.getText());
+                markDirty();
+            }
+        });
+
+        toolkit.createLabel(composite, CommonMessages.artifactId);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getArtifactId()
+                : null;
+        artifact = toolkit.createText(composite, value, SWT.BORDER);
+        artifact.setLayoutData(createTextFieldGridData());
+        artifact.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setArtifactId(artifact.getText());
+                markDirty();
+            }
+        });
+
+        toolkit.createLabel(composite, CommonMessages.moduleId);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getModule()
+                : null;
+        module = toolkit.createText(composite, value, SWT.BORDER);
+        module.setLayoutData(createTextFieldGridData());
+        module.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setModule(module.getText());
+                markDirty();
+            }
+        });
+
+        toolkit.createLabel(composite, CommonMessages.name);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getName()
+                : null;
+        name = toolkit.createText(composite, value, SWT.BORDER);
+        name.setLayoutData(createTextFieldGridData());
+        name.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setName(name.getText());
+                markDirty();
+            }
+        });
+
+        toolkit.createLabel(composite, CommonMessages.version);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getVersion()
+                : null;
+        version = toolkit.createText(composite, value, SWT.BORDER);
+        version.setLayoutData(createTextFieldGridData());
+        version.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setVersion(version.getText());
+                markDirty();
+            }
+        });
+
+        specifyAsLink.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (specifyAsLink.getSelection()) {
+                    getGBeanLocator().setPattern(null);
+                    if (gBeanLink.getText().length() > 0) {
+                        plan.getWebContainer().setGbeanLink(gBeanLink.getText());
+                    }
+                    markDirty();
+                    toggle();
+                }
+            }
+        });
+ 
+        specifyAsPattern.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (specifyAsPattern.getSelection()) {
+                	if (plan.getWebContainer() != null) {
+                	    plan.getWebContainer().setGbeanLink (null);
+                	}
+                    if (group.getText().length() > 0) {
+                        getPattern().setGroupId(group.getText());
+                    }
+                    if (artifact.getText().length() > 0) {
+                        getPattern().setArtifactId(artifact.getText());
+                    }
+                    if (module.getText().length() > 0) {
+                        getPattern().setModule(module.getText());
+                    }
+                    if (name.getText().length() > 0) {
+                        getPattern().setName(name.getText());
+                    }
+                    if (version.getText().length() > 0) {
+                        getPattern().setVersion(version.getText());
+                    }
+                    markDirty();
+                    toggle();
+                }
+            }
+        });
+
+        if (wc != null) {
+            if (wc.getGbeanLink() != null) {
+                specifyAsLink.setSelection(true);
+            } else if (wc.getPattern() != null) {
+                specifyAsPattern.setSelection(true);
+            }
+        }
+
+        toggle();
+    }
+
+    public void toggle() {
+        gBeanLink.setEnabled(specifyAsLink.getSelection());
+        artifact.setEnabled(specifyAsPattern.getSelection());
+        group.setEnabled(specifyAsPattern.getSelection());
+        module.setEnabled(specifyAsPattern.getSelection());
+        name.setEnabled(specifyAsPattern.getSelection());
+        version.setEnabled(specifyAsPattern.getSelection());
+    }
+
+    /**
+     * @return
+     */
+    private GbeanLocatorType getGBeanLocator() {
+    	GbeanLocatorType wc = plan.getWebContainer();
+        if (wc == null) {
+            wc = namingFactory.createGbeanLocatorType();
+            plan.setWebContainer(wc);
+        }
+        return wc;
+    }
+
+    /**
+     * @return
+     */
+    private PatternType getPattern() {
+        GbeanLocatorType locator = getGBeanLocator();
+        PatternType pattern = locator.getPattern();
+        if (pattern == null) {
+            pattern = namingFactory.createPatternType();
+            locator.setPattern(pattern);
+        }
+        return pattern;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/WebGeneralSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/WebGeneralSection.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/WebGeneralSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/WebGeneralSection.java Wed Sep 23 08:04:12 2009
@@ -0,0 +1,88 @@
+/*
+ * 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.sections;
+
+import javax.xml.bind.JAXBElement;
+
+//import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.xml.ns.j2ee.web_1.WebAppType;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebGeneralSection extends CommonGeneralSection {
+
+	protected Text contextRoot;
+
+    protected Text workDir;
+
+    protected Text securityRealmName;
+
+	WebAppType plan;
+
+	public WebGeneralSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+		super(parent, toolkit, style, plan);
+		this.plan = (WebAppType) plan.getValue();
+		createClient();
+	}
+
+	protected void createClient() {
+		super.createClient();
+		Composite composite = (Composite) getSection().getClient();
+
+		createLabel(composite, CommonMessages.editorContextRoot);
+
+        contextRoot = toolkit.createText(composite, plan.getContextRoot(), SWT.BORDER);
+        contextRoot.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        contextRoot.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setContextRoot(contextRoot.getText());
+                markDirty();
+            }
+        });
+
+        createLabel(composite, CommonMessages.editorWorkDir);
+
+//        workDir = toolkit.createText(composite, plan.getWorkDir(), SWT.BORDER);
+//        workDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+//        workDir.addModifyListener(new ModifyListener() {
+//            public void modifyText(ModifyEvent e) {
+//                plan.setWorkDir(workDir.getText());
+//                markDirty();
+//            }
+//        });
+
+        createLabel(composite, CommonMessages.editorSecurityRealmName);
+
+        securityRealmName = toolkit.createText(composite, plan.getSecurityRealmName(), SWT.BORDER);
+        securityRealmName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        securityRealmName.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setSecurityRealmName(securityRealmName.getText());
+                markDirty();
+            }
+        });
+	}
+}

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

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/ClassFilterWizard.java Wed Sep 23 08:04:12 2009
@@ -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.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.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.st.v11.ui.sections.ClassFilterSection;
+import org.apache.geronimo.xml.ns.deployment_1.ClassFilterType;
+import org.apache.geronimo.xml.ns.deployment_1.EnvironmentType;
+
+/**
+ * @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
+ */
+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();
+
+            EnvironmentType environment = null;
+          	environment = JAXBModelUtils.getEnvironment(plan, isServerEnvironment);
+            if (environment == null) {
+                environment = (EnvironmentType)getEFactory().create(EnvironmentType.class);
+                JAXBModelUtils.setEnvironment (plan, environment, isServerEnvironment);
+            }
+
+            ClassFilterType filter = ((ClassFilterSection)section).getClassFilter();
+            if (filter == null) {
+                filter = (ClassFilterType)getEFactory().create(ClassFilterType.class);
+                ((ClassFilterSection)section).setClassFilter (filter);
+            }
+            filter.getFilter().add(page.getTextEntry(0).getText());
+        }
+        else {
+        	ClassFilterType 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;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/DependencyWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/DependencyWizard.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/DependencyWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/DependencyWizard.java Wed Sep 23 08:04:12 2009
@@ -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.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.AbstractTableSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.st.v11.core.GeronimoServerInfo;
+import org.apache.geronimo.st.v11.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.xml.ns.deployment_1.DependencyType;
+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(DependencyType 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<DependencyType> serverList = GeronimoServerInfo.getInstance().getCommonLibs();
+            List<DependencyType> alreadyAddedDependencies = (List<DependencyType>) section.getObjectContainer();
+            serverList.removeAll(alreadyAddedDependencies);
+            for (int i = 0; i < serverList.size(); ++i) {
+                TableItem tabItem = new TableItem(dependencyTable, SWT.NONE);
+                DependencyType 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 DependencyType();
+                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];
+                DependencyType dependency = (DependencyType) selectedItem.getData();
+                section.getObjectContainer().add(dependency);
+            }
+            break;
+        }
+        return true;
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_Dependency;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_Dependency;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbLocalRefWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbLocalRefWizard.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbLocalRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbLocalRefWizard.java Wed Sep 23 08:04:12 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 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;
+        }
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbRefWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbRefWizard.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbRefWizard.java Wed Sep 23 08:04:12 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 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;
+        }
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/EjbRelationWizard.java Wed Sep 23 08:04:12 2009
@@ -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.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.v11.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v11.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v11.ui.sections.EjbRelationSection;
+import org.openejb.xml.ns.openejb_jar_2.EjbRelationType;
+import org.openejb.xml.ns.openejb_jar_2.EjbRelationshipRoleType;
+import org.openejb.xml.ns.openejb_jar_2.RelationshipsType;
+
+/**
+ * @version $Rev: 720616 $ $Date: 2008-11-26 05:49:55 +0800 (Wed, 26 Nov 2008) $
+ */
+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 (EjbRelationType.class.isInstance(((EjbRelationSection)section).getSelectedObject())) {
+                    element.remove(elementTypes[CMR_FIELD_MAPPING]);
+                }
+                else if (EjbRelationshipRoleType.class.isInstance(((EjbRelationSection)section).getSelectedObject())) {
+                    element.select(CMR_FIELD_MAPPING);
+                    element.setEnabled(false);
+                }
+                else {
+                    element.setEnabled(false);
+                }
+            }
+            else {
+                if (EjbRelationType.class.isInstance(eObject)) {
+                    textList.get(0).setText(((EjbRelationType)eObject).getEjbRelationName());
+                    textList.get(1).setText(((EjbRelationType)eObject).getManyToManyTableName());
+                    element.select(EJB_RELATION);
+                }
+                else if (EjbRelationshipRoleType.class.isInstance(eObject)) {
+                	EjbRelationshipRoleType role = (EjbRelationshipRoleType)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 (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping.class.isInstance(eObject)) {
+                	EjbRelationshipRoleType.RoleMapping.CmrFieldMapping fieldMapping =
+                            (EjbRelationshipRoleType.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() {
+        EjbRelationType relation;
+        if (element.getText().equals(elementTypes[EJB_RELATION])) {
+            relation = (EjbRelationType)eObject;
+            if (relation == null) {
+                relation = (EjbRelationType)getEFactory().create(EjbRelationType.class);
+                JAXBElement plan = section.getPlan();
+                
+                if (JAXBModelUtils.getEjbRelationships(plan) == null) {
+                	RelationshipsType relationships = (RelationshipsType)getEFactory().create(RelationshipsType.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;
+            }
+            EjbRelationshipRoleType role = (EjbRelationshipRoleType)eObject;
+            if (role == null) {
+                role = (EjbRelationshipRoleType)getEFactory().create(EjbRelationshipRoleType.class);
+                relation = (EjbRelationType)((EjbRelationSection)section).getSelectedObject();
+                relation.getEjbRelationshipRole().add(role);
+            }
+            role.setEjbRelationshipRoleName(textList.get(0).getText());
+            EjbRelationshipRoleType.RelationshipRoleSource source = role.getRelationshipRoleSource();
+            if (source == null) {
+                source = (EjbRelationshipRoleType.RelationshipRoleSource)getEFactory().create(EjbRelationshipRoleType.RelationshipRoleSource.class);
+                role.setRelationshipRoleSource(source);
+            }
+            source.setEjbName(textList.get(1).getText());
+            EjbRelationshipRoleType.CmrField cmrField = role.getCmrField();
+            if (cmrField == null) {
+                cmrField = (EjbRelationshipRoleType.CmrField)getEFactory().create(EjbRelationshipRoleType.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;
+            }
+            EjbRelationshipRoleType.RoleMapping.CmrFieldMapping fieldMapping =
+                    (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping)eObject;
+            if (fieldMapping == null) {
+                fieldMapping = (EjbRelationshipRoleType.RoleMapping.CmrFieldMapping)getEFactory().create(EjbRelationshipRoleType.RoleMapping.CmrFieldMapping.class);
+                EjbRelationshipRoleType role = (EjbRelationshipRoleType)((EjbRelationSection)section).getSelectedObject();
+                EjbRelationshipRoleType.RoleMapping roleMapping = role.getRoleMapping();
+                if (roleMapping == null) {
+                    roleMapping = (EjbRelationshipRoleType.RoleMapping)getEFactory().create(EjbRelationshipRoleType.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;
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/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/org/apache/geronimo/st/v11/ui/wizards/ExtModuleWizard.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/ExtModuleWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/ExtModuleWizard.java Wed Sep 23 08:04:12 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/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/org/apache/geronimo/st/v11/ui/wizards/FacetInstallPage.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/FacetInstallPage.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/FacetInstallPage.java Wed Sep 23 08:04:12 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/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/org/apache/geronimo/st/v11/ui/wizards/GBeanRefWizard.java?rev=817996&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/GBeanRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/wizards/GBeanRefWizard.java Wed Sep 23 08:04:12 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;
+    }
+}



Mime
View raw message