You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by de...@apache.org on 2010/03/10 09:31:32 UTC
svn commit: r921247 [9/11] - in /geronimo/devtools/eclipse-plugin/trunk: ./
features/org.apache.geronimo.v30.feature/
plugins/org.apache.geronimo.runtime.v30/
plugins/org.apache.geronimo.runtime.v30/META-INF/
plugins/org.apache.geronimo.st.v30.core/ pl...
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/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/v21/ui/wizards/ExtModuleWizard.java?rev=921247&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ExtModuleWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ExtModuleWizard.java Wed Mar 10 08:31:28 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.v21.ui.wizards;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.st.v21.core.jaxb.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/v21/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/v21/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/v21/ui/wizards/ExtModuleWizard.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/v21/ui/wizards/FacetInstallPage.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/v21/ui/wizards/FacetInstallPage.java?rev=921247&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/FacetInstallPage.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/FacetInstallPage.java Wed Mar 10 08:31:28 2010
@@ -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.v21.ui.wizards;
+
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.v21.core.DeploymentPlanInstallConfig;
+import org.apache.geronimo.st.v21.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);
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/FacetInstallPage.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/v21/ui/wizards/FacetInstallPage.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/v21/ui/wizards/FacetInstallPage.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/v21/ui/wizards/GBeanRefWizard.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/v21/ui/wizards/GBeanRefWizard.java?rev=921247&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanRefWizard.java Wed Mar 10 08:31:28 2010
@@ -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.v21.ui.wizards;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.naming.GbeanRef;
+import org.apache.geronimo.jee.naming.ObjectFactory;
+import org.apache.geronimo.jee.naming.Pattern;
+import org.apache.geronimo.jee.web.WebApp;
+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;
+
+/**
+ * @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);
+ GbeanRef gbeanRef = (GbeanRef)section.getSelectedObject();
+ if (gbeanRef == null) {
+ element.setEnabled(false);
+ }
+ }
+ else {
+ if (JAXBElement.class.isInstance(eObject)) {
+ eObject = ((JAXBElement)eObject).getValue();
+ }
+ if (GbeanRef.class.isInstance(eObject)) {
+ textList.get(0).setText(((GbeanRef)eObject).getRefName());
+ element.select(GBEAN_REF);
+ }
+ else if (String.class.isInstance(eObject)) {
+ textList.get(0).setText(((String)eObject));
+ element.select(GBEAN_TYPE);
+ }
+ else if (Pattern.class.isInstance(eObject)) {
+ textList.get(0).setText(((Pattern)eObject).getName());
+ textList.get(1).setText(((Pattern)eObject).getGroupId());
+ textList.get(2).setText(((Pattern)eObject).getArtifactId());
+ textList.get(3).setText(((Pattern)eObject).getVersion());
+ textList.get(4).setText(((Pattern)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() {
+ GbeanRef gbeanRef;
+ if (element.getText().equals(elementTypes[GBEAN_REF])) {
+ if (isEmpty(textList.get(0).getText())) {
+ return false;
+ }
+ gbeanRef = (GbeanRef)eObject;
+ if (gbeanRef == null) {
+ gbeanRef = (GbeanRef)getEFactory().create(GbeanRef.class);
+ JAXBElement plan = section.getPlan();
+
+ // if we have a WebApp, add the JAXBElement of the GBeanRef, not the GBeanRef
+ if (WebApp.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 = (GbeanRef)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;
+ }
+ Pattern pattern = (Pattern)eObject;
+ if (pattern == null) {
+ pattern = (Pattern)getEFactory().create(Pattern.class);
+ gbeanRef = (GbeanRef)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;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanRefWizard.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/v21/ui/wizards/GBeanRefWizard.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/v21/ui/wizards/GBeanRefWizard.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/v21/ui/wizards/GBeanWizard.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/v21/ui/wizards/GBeanWizard.java?rev=921247&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.java Wed Mar 10 08:31:28 2010
@@ -0,0 +1,279 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.ui.wizards;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.deployment.Attribute;
+import org.apache.geronimo.jee.deployment.Gbean;
+import org.apache.geronimo.jee.deployment.ObjectFactory;
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.apache.geronimo.jee.deployment.Reference;
+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;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GBeanWizard extends AbstractTreeWizard {
+
+ private final int GBEAN = 0;
+ private final int ATTRIBUTE = 1;
+ private final int DEPENDENCY = 2;
+ private final int REFERENCE = 3;
+
+ public GBeanWizard(AbstractTreeSection section) {
+ super(section, 4, 7);
+ elementTypes[GBEAN] = "GBean";
+ elementTypes[ATTRIBUTE] = "Attribute";
+ elementTypes[DEPENDENCY] = "Dependency";
+ elementTypes[REFERENCE] = "Reference";
+ }
+
+ public class GBeanWizardPage extends AbstractTreeWizardPage {
+
+ public GBeanWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ protected void initControl() {
+ if (eObject == null) {
+ element.select(GBEAN);
+ if (section.getSelectedObject() == null) {
+ element.setEnabled(false);
+ }
+ }
+ else {
+ // change eObject to be the value of the JAXBElement
+ eObject = ((JAXBElement)eObject).getValue();
+ if (Gbean.class.isInstance(eObject)) {
+ textList.get(0).setText(((Gbean)eObject).getName());
+ textList.get(1).setText(((Gbean)eObject).getClazz());
+ element.select(GBEAN);
+ }
+ else if (Attribute.class.isInstance(eObject)) {
+ textList.get(0).setText(((Attribute)eObject).getName());
+ textList.get(1).setText(((Attribute)eObject).getType());
+ textList.get(2).setText(((Attribute)eObject).getValue());
+ element.select(ATTRIBUTE);
+ }
+ else if (Pattern.class.isInstance(eObject)) {
+ textList.get(0).setText(((Pattern)eObject).getGroupId());
+ textList.get(1).setText(((Pattern)eObject).getArtifactId());
+ textList.get(2).setText(((Pattern)eObject).getVersion());
+ textList.get(3).setText(((Pattern)eObject).getModule());
+ textList.get(4).setText(((Pattern)eObject).getType());
+ textList.get(5).setText(((Pattern)eObject).getCustomFoo());
+ element.select(DEPENDENCY);
+ }
+ else if (Reference.class.isInstance(eObject)) {
+ textList.get(0).setText(((Reference)eObject).getName());
+ textList.get(1).setText(((Reference)eObject).getGroupId());
+ textList.get(2).setText(((Reference)eObject).getArtifactId());
+ textList.get(3).setText(((Reference)eObject).getVersion());
+ textList.get(4).setText(((Reference)eObject).getModule());
+ textList.get(5).setText(((Reference)eObject).getType());
+ textList.get(6).setText(((Reference)eObject).getCustomFoo());
+ element.select(REFERENCE);
+ }
+ element.setEnabled(false);
+ }
+ }
+
+ protected void toggleFields (boolean clearFields) {
+ int selection = element.getSelectionIndex();
+ switch (selection) {
+ case GBEAN:
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(i < 2 ? true : false);
+ textList.get(i).setVisible(i < 2 ? true : false);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.name);
+ labelList.get(1).setText(CommonMessages.className);
+ // if we are doing an add, then we need to make sure that the longest
+ // text can be handled
+ labelList.get(2).setText(CommonMessages.groupId);
+ labelList.get(3).setText(CommonMessages.artifactId);
+ labelList.get(4).setText(CommonMessages.moduleId);
+ labelList.get(5).setText(CommonMessages.artifactType);
+ labelList.get(6).setText(CommonMessages.customName);
+ break;
+ case ATTRIBUTE:
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(i < 3 ? true : false);
+ textList.get(i).setVisible(i < 3 ? true : false);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.name);
+ labelList.get(1).setText(CommonMessages.type);
+ labelList.get(2).setText(CommonMessages.value);
+ break;
+ case DEPENDENCY:
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(i < 6 ? true : false);
+ textList.get(i).setVisible(i < 6 ? true : false);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.groupId);
+ labelList.get(1).setText(CommonMessages.artifactId);
+ labelList.get(2).setText(CommonMessages.version);
+ labelList.get(3).setText(CommonMessages.moduleId);
+ labelList.get(4).setText(CommonMessages.artifactType);
+ labelList.get(5).setText(CommonMessages.customName);
+ break;
+ case REFERENCE:
+ for (int i = 0; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(true);
+ textList.get(i).setVisible(true);
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ labelList.get(0).setText(CommonMessages.name);
+ labelList.get(1).setText(CommonMessages.groupId);
+ labelList.get(2).setText(CommonMessages.artifactId);
+ labelList.get(3).setText(CommonMessages.version);
+ labelList.get(4).setText(CommonMessages.moduleId);
+ labelList.get(5).setText(CommonMessages.artifactType);
+ labelList.get(6).setText(CommonMessages.customName);
+ break;
+ }
+ }
+
+ public String getWizardPageTitle() {
+ return CommonMessages.wizardEditTitle_GBean;
+ }
+
+ public String getWizardPageDescription() {
+ return CommonMessages.wizardPageTitle_GBean;
+ }
+ }
+
+ @Override
+ public void addPages() {
+ addPage(new GBeanWizardPage("Page0"));
+ }
+
+ @Override
+ public boolean performFinish() {
+ Gbean gbean;
+ switch (element.getSelectionIndex()) {
+ case GBEAN:
+ if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+ return false;
+ }
+ gbean = (Gbean)eObject;
+ if (gbean == null) {
+ gbean = (Gbean)getEFactory().create(Gbean.class);
+ JAXBElement plan = section.getPlan();
+
+ // add the JAXBElement of a GBean, not the GBean
+ ObjectFactory objectFactory = new ObjectFactory();
+ JAXBModelUtils.getGbeans(plan).add(objectFactory.createGbean((Gbean)gbean));
+ }
+ gbean.setName(textList.get(0).getText());
+ gbean.setClazz(textList.get(1).getText());
+ break;
+
+ case ATTRIBUTE:
+ if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+ return false;
+ }
+ Attribute attribute = (Attribute)eObject;
+ if (attribute == null) {
+ attribute = (Attribute)getEFactory().create(Attribute.class);
+ gbean = (Gbean)section.getSelectedObject();
+
+ // add the JAXBElement of an Attribute, not the Attribute
+ ObjectFactory objectFactory = new ObjectFactory();
+ gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanAttribute(attribute));
+ }
+ attribute.setName(textList.get(0).getText());
+ attribute.setType(textList.get(1).getText());
+ attribute.setValue(textList.get(2).getText());
+ break;
+
+ case DEPENDENCY:
+ if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+ return false;
+ }
+ Pattern dependency = (Pattern)eObject;
+ if (dependency == null) {
+ dependency = (Pattern)getEFactory().create(Pattern.class);
+ gbean = (Gbean)section.getSelectedObject();
+
+ // add the JAXBElement of a Dependency, not the Dependency
+ ObjectFactory objectFactory = new ObjectFactory();
+ gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanDependency(dependency));
+ }
+ dependency.setGroupId(textList.get(0).getText());
+ dependency.setArtifactId(textList.get(1).getText());
+ dependency.setVersion(textList.get(2).getText());
+ dependency.setModule(textList.get(3).getText());
+ dependency.setType(textList.get(4).getText());
+ dependency.setCustomFoo(textList.get(5).getText());
+ break;
+
+ case REFERENCE:
+ if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText()) ||
+ isEmpty(textList.get(2).getText())) {
+ return false;
+ }
+ Reference reference = (Reference)eObject;
+ if (reference == null) {
+ reference = (Reference)getEFactory().create(Reference.class);
+ gbean = (Gbean)section.getSelectedObject();
+
+ // add the JAXBElement of a Dependency, not the Dependency
+ ObjectFactory objectFactory = new ObjectFactory();
+ gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanReference(reference));
+ }
+ reference.setName(textList.get(0).getText());
+ reference.setGroupId(textList.get(1).getText());
+ reference.setArtifactId(textList.get(2).getText());
+ reference.setVersion(textList.get(3).getText());
+ reference.setModule(textList.get(4).getText());
+ reference.setType(textList.get(5).getText());
+ reference.setCustomFoo(textList.get(6).getText());
+ break;
+ }
+ return true;
+ }
+
+ public JAXBObjectFactory getEFactory() {
+ return JAXBObjectFactoryImpl.getInstance();
+ }
+
+ public String getAddWizardWindowTitle() {
+ return CommonMessages.wizardNewTitle_GBean;
+ }
+
+ public String getEditWizardWindowTitle() {
+ return CommonMessages.wizardEditTitle_GBean;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.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/v21/ui/wizards/GBeanWizard.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/v21/ui/wizards/GBeanWizard.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/v21/ui/wizards/LicenseWizard.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/v21/ui/wizards/LicenseWizard.java?rev=921247&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java Wed Mar 10 08:31:28 2010
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.ui.wizards;
+
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.wizards.AbstractWizard;
+import org.apache.geronimo.system.plugin.model.LicenseType;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LicenseWizard extends AbstractWizard {
+
+ protected LicenseType license;
+
+ protected Text licenseName;
+
+ protected Combo osiApproved;
+
+ public LicenseWizard (LicenseType oldLicense) {
+ super();
+ license = oldLicense;
+ }
+
+ public String getAddWizardWindowTitle() {
+ return CommonMessages.wizardNewTitle_License;
+ }
+
+ public String getEditWizardWindowTitle() {
+ return CommonMessages.wizardEditTitle_License;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.IWizard#addPages()
+ */
+ public void addPages() {
+ addPage(new MessageDestWizardPage("Page0"));
+ }
+
+ // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+ // the values are brought in properly.
+ public class MessageDestWizardPage extends AbstractWizardPage {
+ public MessageDestWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = createComposite(parent);
+ createLabel (composite, CommonMessages.license);
+ licenseName = createTextField (composite, "");
+ createLabel (composite, CommonMessages.osiApproved);
+ String[] values = {"true", "false"};
+ osiApproved = createCombo (composite, values, false);
+
+ if (license != null) {
+ licenseName.setText(license.getValue());
+ osiApproved.setText(String.valueOf(license.isOsiApproved()));
+ }
+ setControl(composite);
+ }
+
+ public String getWizardPageTitle() {
+ return CommonMessages.wizardPageTitle_License;
+ }
+
+ public String getWizardPageDescription() {
+ return CommonMessages.wizardPageDescription_License;
+ }
+ }
+
+ public boolean performFinish() {
+ license = new LicenseType();
+ license.setValue(licenseName.getText());
+ license.setOsiApproved(Boolean.parseBoolean(osiApproved.getText()));
+
+ return true;
+ }
+
+ public LicenseType getLicense() {
+ return license;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.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/v21/ui/wizards/LicenseWizard.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/v21/ui/wizards/LicenseWizard.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/v21/ui/wizards/MessageDestWizard.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/v21/ui/wizards/MessageDestWizard.java?rev=921247&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/MessageDestWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/MessageDestWizard.java Wed Mar 10 08:31:28 2010
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.ui.wizards;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.st.v21.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.jee.naming.MessageDestination;
+import org.apache.geronimo.jee.naming.Pattern;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MessageDestWizard extends AbstractTableWizard {
+
+ public MessageDestWizard(AbstractTableSection section) {
+ super(section);
+ }
+
+ public JAXBObjectFactory getEFactory() {
+ return JAXBObjectFactoryImpl.getInstance();
+ }
+
+ public String[] getTableColumnEAttributes() {
+ return new String[] { "MessageDestinationName", "AdminObjectModule", "AdminObjectLink",
+ "GroupId", "ArtifactId", "Version", "Module", "Name"};
+ }
+
+ public String getAddWizardWindowTitle() {
+ return CommonMessages.wizardNewTitle_MessageDest;
+ }
+
+ public String getEditWizardWindowTitle() {
+ return CommonMessages.wizardEditTitle_MessageDest;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.IWizard#addPages()
+ */
+ public void addPages() {
+ addPage(new MessageDestWizardPage("Page0"));
+ }
+
+ // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+ // the values are brought in properly.
+ public class MessageDestWizardPage extends AbstractTableWizardPage {
+ public MessageDestWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = createComposite(parent);
+ for (int i = 0; i < section.getTableColumnNames().length; i++) {
+ Label label = new Label(composite, SWT.LEFT);
+ String columnName = section.getTableColumnNames()[i];
+ if (!columnName.endsWith(":"))
+ columnName = columnName.concat(":");
+ label.setText(columnName);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ label.setLayoutData(data);
+
+ Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ data.grabExcessHorizontalSpace = true;
+ data.widthHint = 100;
+ text.setLayoutData(data);
+ if (eObject != null) {
+ if (i > 2) {
+ // get the pattern value
+ Pattern pattern = ((MessageDestination) eObject).getPattern();
+ String value = null;
+ try {
+ value = (String) JAXBUtils.getValue(pattern,getTableColumnEAttributes()[i]);
+ } catch (Exception e) {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+ }
+ if (value != null) {
+ text.setText(value);
+ }
+ }
+ else
+ {
+ String value = null;
+ try {
+ value = (String) JAXBUtils.getValue(eObject,getTableColumnEAttributes()[i]);
+ } catch (Exception e) {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+ }
+ if (value != null) {
+ text.setText(value);
+ }
+ }
+ }
+ textEntries[i] = text;
+ }
+
+ doCustom(composite);
+ setControl(composite);
+ textEntries[0].setFocus();
+ }
+
+ public String getWizardPageTitle() {
+ return CommonMessages.wizardPageTitle_MessageDest;
+ }
+
+ public String getWizardPageDescription() {
+ return CommonMessages.wizardPageDescription_MessageDest;
+ }
+ }
+
+ public boolean performFinish() {
+ AbstractTableWizardPage page = (AbstractTableWizardPage) getPages()[0];
+ Pattern msgPattern;
+ MessageDestination messageDest;
+
+ if (eObject == null) {
+ eObject = getEFactory().create(MessageDestination.class);
+ JAXBElement plan = section.getPlan();
+
+ messageDest = (MessageDestination)eObject;
+ msgPattern = (Pattern)getEFactory().create(Pattern.class);
+ messageDest.setPattern(msgPattern);
+
+ List msgDestList = JAXBModelUtils.getMessageDestinations(plan);
+ if (msgDestList == null) {
+ msgDestList = (List)getEFactory().create(MessageDestination.class);
+ }
+ msgDestList.add(eObject);
+ }
+
+ // NOTE!! this replaces the call to processEAttributes (page);
+ messageDest =(MessageDestination) eObject;
+ msgPattern = messageDest.getPattern();
+ for (int i = 0; i < 8; i++) {
+ String value = page.getTextEntry(i).getText();
+ String attribute = getTableColumnEAttributes()[i];
+ if (i < 3)
+ try {
+ JAXBUtils.setValue(eObject, attribute, value);
+ } catch (Exception e) {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+ }
+ else
+ try {
+ JAXBUtils.setValue(msgPattern, attribute, value);
+ } catch (Exception e) {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+ }
+ }
+
+ if (section.getViewer().getInput() == section.getPlan()) {
+ section.getViewer().setInput(section.getInput());
+ }
+
+ return true;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/MessageDestWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/MessageDestWizard.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/MessageDestWizard.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/v21/ui/wizards/ModuleWizard.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/v21/ui/wizards/ModuleWizard.java?rev=921247&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ModuleWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ModuleWizard.java Wed Mar 10 08:31:28 2010
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.ui.wizards;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.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.jee.application.Application;
+import org.apache.geronimo.jee.application.Module;
+import org.apache.geronimo.jee.application.Path;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/*
+ * @version $Rev$ $Date$
+ */
+public class ModuleWizard extends AbstractTableWizard {
+
+ public ModuleWizard(AbstractTableSection section) {
+ super(section);
+ }
+
+ public JAXBObjectFactory getEFactory() {
+ return JAXBObjectFactoryImpl.getInstance();
+ }
+
+ public String[] getTableColumnEAttributes() {
+ return new String[] { "ModuleType", "Path", "AltDd" };
+ }
+
+ public String getAddWizardWindowTitle() {
+ return CommonMessages.wizardNewTitle_Module;
+ }
+
+ public String getEditWizardWindowTitle() {
+ return CommonMessages.wizardEditTitle_Module;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.IWizard#addPages()
+ */
+ public void addPages() {
+ addPage(new ModuleWizardPage("Page0"));
+ }
+
+ // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+ // the values are brought in properly.
+ public class ModuleWizardPage extends AbstractTableWizardPage {
+ protected Button[] buttonList = new Button[4];
+
+ public ModuleWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = createComposite(parent);
+ GridData data;
+ Module module = (Module)eObject;
+
+ // First we need a set of radio buttons to determine what kind of module we are
+ // dealing with.
+ Group group = new Group (composite, SWT.NONE);
+ Button button = new Button (group, SWT.RADIO);
+ button.setText(CommonMessages.connector);
+ buttonList[0] = button;
+ button = new Button (group, SWT.RADIO);
+ button.setText(CommonMessages.ejb);
+ buttonList[1] = button;
+ button = new Button (group, SWT.RADIO);
+ button.setText(CommonMessages.java);
+ buttonList[2] = button;
+ button = new Button (group, SWT.RADIO);
+ button.setText(CommonMessages.web);
+ buttonList[3] = button;
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.type = SWT.HORIZONTAL;
+ group.setLayout(fillLayout);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalSpan = 2;
+ group.setLayoutData(data);
+
+ for (int i = 1; i < section.getTableColumnNames().length; i++) {
+ Label label = new Label(composite, SWT.LEFT);
+ String columnName = section.getTableColumnNames()[i];
+ if (!columnName.endsWith(":"))
+ columnName = columnName.concat(":");
+ label.setText(columnName);
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ label.setLayoutData(data);
+
+ Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ data.grabExcessHorizontalSpace = true;
+ data.widthHint = 100;
+ text.setLayoutData(data);
+ if (module != null) {
+ if (i == 1) {
+ if (module.getConnector() != null) {
+ text.setText(module.getConnector().getValue());
+ buttonList[0].setSelection(true);
+ }
+ else if (module.getEjb() != null) {
+ text.setText(module.getEjb().getValue());
+ buttonList[1].setSelection(true);
+ }
+ else if (module.getJava() != null) {
+ text.setText(module.getJava().getValue());
+ buttonList[2].setSelection(true);
+ }
+ else if (module.getWeb() != null) {
+ text.setText(module.getWeb().getValue());
+ buttonList[3].setSelection(true);
+ }
+ }
+ else if (i == 2 && module.getAltDd() != null) {
+ text.setText(module.getAltDd().getValue());
+ }
+ }
+ textEntries[i - 1] = text;
+ }
+
+ doCustom(composite);
+ setControl(composite);
+ textEntries[0].setFocus();
+ }
+
+ public String getWizardPageTitle() {
+ return CommonMessages.wizardPageTitle_Module;
+ }
+
+ public String getWizardPageDescription() {
+ return CommonMessages.wizardPageDescription_Module;
+ }
+ }
+
+ public boolean performFinish() {
+ AbstractTableWizardPage page = (AbstractTableWizardPage) getPages()[0];
+ Path path;
+ Module module;
+
+ if (eObject == null) {
+ eObject = getEFactory().create(Module.class);
+ JAXBElement plan = section.getPlan();
+
+ module = (Module)eObject;
+
+ List moduleList = ((Application)plan.getValue()).getModule();
+ if (moduleList == null) {
+ moduleList = (List)getEFactory().create(Module.class);
+ }
+ moduleList.add(eObject);
+ }
+ else {
+ module = (Module)eObject;
+ module.setConnector(null);
+ module.setEjb(null);
+ module.setJava(null);
+ module.setWeb(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())
+ module.setConnector(path);
+ else if (((ModuleWizardPage)page).buttonList[1].getSelection())
+ module.setEjb(path);
+ else if (((ModuleWizardPage)page).buttonList[2].getSelection())
+ module.setJava(path);
+ else if (((ModuleWizardPage)page).buttonList[3].getSelection())
+ module.setWeb(path);
+
+ String altDD = page.getTextEntry(1).getText();
+ path = (Path)getEFactory().create(Path.class);
+ path.setValue(altDD);
+ module.setAltDd(path);
+
+ 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/v21/ui/wizards/ModuleWizard.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/v21/ui/wizards/ModuleWizard.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/v21/ui/wizards/ModuleWizard.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/v21/ui/wizards/PersContextRefWizard.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/v21/ui/wizards/PersContextRefWizard.java?rev=921247&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/PersContextRefWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/PersContextRefWizard.java Wed Mar 10 08:31:28 2010
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.ui.wizards;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.naming.PersistenceContextRef;
+import org.apache.geronimo.jee.naming.PersistenceContextType;
+import org.apache.geronimo.jee.naming.ObjectFactory;
+import org.apache.geronimo.jee.naming.Pattern;
+import org.apache.geronimo.jee.naming.Property;
+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.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PersContextRefWizard extends AbstractTreeWizard {
+
+ private final int CONTEXT = 0;
+ private final int PROPERTY = 1;
+
+ private final String[] CONTEXT_TYPES = {
+ "Extended", "Transactional" };
+ protected Combo contextType;
+ protected Button specifyUnit;
+ protected Button specifyPattern;
+
+ public PersContextRefWizard(AbstractTreeSection section) {
+ super(section, 2, 8);
+ elementTypes[CONTEXT] = "Persistence Context";
+ elementTypes[PROPERTY] = "Property";
+ }
+
+ public JAXBObjectFactory getEFactory() {
+ return JAXBObjectFactoryImpl.getInstance();
+ }
+
+ public String getAddWizardWindowTitle() {
+ return CommonMessages.wizardNewTitle_PersContextRef;
+ }
+
+ public String getEditWizardWindowTitle() {
+ return CommonMessages.wizardEditTitle_PersContextRef;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.IWizard#addPages()
+ */
+ public void addPages() {
+ addPage(new PersContextRefWizardPage("Page0"));
+ }
+
+ // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+ // the values are brought in properly.
+ public class PersContextRefWizardPage extends AbstractTreeWizardPage {
+ public PersContextRefWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Label label;
+ Text text;
+ Composite composite = createComposite(parent);
+ createLabel(composite, CommonMessages.element);
+ element = createCombo(composite, elementTypes, false);
+ for (int i = 0; i < maxTextFields; i++) {
+ label = createLabel(composite, "");
+ labelList.add(label);
+ if (i == 1) {
+ contextType = createCombo(composite, CONTEXT_TYPES, false);
+ textList.add (null);
+ specifyUnit = createButton(composite, CommonMessages.useUnitName);
+ }
+ else {
+ text = createTextField(composite, "");
+ textList.add(text);
+ if (i == 2) {
+ specifyPattern = createButton(composite, CommonMessages.usePattern);
+ }
+ }
+ }
+ element.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent arg0) {
+ toggleFields(true);
+ }
+ });
+ specifyUnit.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent arg0) {
+ toggleFields(false);
+ }
+ });
+ specifyPattern.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent arg0) {
+ toggleFields(false);
+ }
+ });
+
+ initControl();
+ toggleFields(false);
+ setControl(composite);
+ }
+
+ protected void initControl () {
+ if (eObject == null) {
+ element.select(CONTEXT);
+ PersistenceContextRef contextRef = (PersistenceContextRef)section.getSelectedObject();
+ if (contextRef == null) {
+ element.setEnabled(false);
+ }
+ }
+ else {
+ if (JAXBElement.class.isInstance(eObject)) {
+ eObject = ((JAXBElement)eObject).getValue();
+ PersistenceContextRef contextRef = (PersistenceContextRef)eObject;
+ textList.get(0).setText(contextRef .getPersistenceContextRefName());
+ contextType.setText(contextRef .getPersistenceContextType().value());
+ if (contextRef .getPersistenceUnitName() != null)
+ textList.get(2).setText(contextRef .getPersistenceUnitName());
+ if (contextRef .getPattern() != null) {
+ specifyPattern.setSelection(true);
+ textList.get(3).setText(contextRef.getPattern().getName());
+ if (contextRef .getPattern().getGroupId() != null)
+ textList.get(4).setText(contextRef .getPattern().getGroupId());
+ if (contextRef .getPattern().getArtifactId() != null)
+ textList.get(5).setText(contextRef .getPattern().getArtifactId());
+ if (contextRef .getPattern().getVersion() != null)
+ textList.get(6).setText(contextRef .getPattern().getVersion());
+ if (contextRef .getPattern().getModule() != null)
+ textList.get(7).setText(contextRef .getPattern().getModule());
+ }
+ element.select(CONTEXT);
+ }
+ else if (Property.class.isInstance(eObject)) {
+ textList.get(0).setText(((Property)eObject).getKey());
+ textList.get(2).setText(((Property)eObject).getValue());
+ element.select(PROPERTY);
+ }
+ element.setEnabled(false);
+ }
+ }
+
+ protected void toggleFields (boolean clearFields) {
+ if (element.getText().equals(elementTypes[CONTEXT])) {
+ labelList.get(0).setText(CommonMessages.contextName);
+ labelList.get(2).setText(CommonMessages.unitName);
+ textList.get(2).setEnabled(specifyUnit.getSelection());
+ labelList.get(1).setVisible(true);
+ contextType.setVisible(true);
+ specifyUnit.setVisible(true);
+ specifyPattern.setVisible(true);
+ }
+ else {
+ labelList.get(0).setText(CommonMessages.name);
+ labelList.get(2).setText(CommonMessages.value);
+ textList.get(2).setEnabled(true);
+ labelList.get(1).setVisible(false);
+ contextType.setVisible(false);
+ specifyUnit.setVisible(false);
+ specifyPattern.setVisible(false);
+ }
+ labelList.get(1).setText(CommonMessages.type);
+ labelList.get(3).setText(CommonMessages.name);
+ labelList.get(4).setText(CommonMessages.groupId);
+ labelList.get(5).setText(CommonMessages.artifactId);
+ labelList.get(6).setText(CommonMessages.version);
+ labelList.get(7).setText(CommonMessages.moduleId);
+ for (int i = 3; i < maxTextFields; i++) {
+ labelList.get(i).setVisible(element.getText().equals(elementTypes[CONTEXT]));
+ textList.get(i).setVisible(element.getText().equals(elementTypes[CONTEXT]));
+ textList.get(i).setEnabled(specifyPattern.getSelection());
+ if (clearFields == true) {
+ textList.get(i).setText("");
+ }
+ }
+ }
+
+ public String getWizardPageTitle() {
+ return CommonMessages.wizardPageTitle_PersContextRef;
+ }
+
+ public String getWizardPageDescription() {
+ return CommonMessages.wizardPageDescription_PersContextRef;
+ }
+ }
+
+ @Override
+ public boolean performFinish() {
+ PersistenceContextRef contextRef;
+ if (element.getText().equals(elementTypes[CONTEXT])) {
+ if (isEmpty(textList.get(0).getText()) ||
+ isEmpty(textList.get(2).getText()) && isEmpty(textList.get(3).getText())) {
+ return false;
+ }
+ contextRef = (PersistenceContextRef)eObject;
+ ObjectFactory objectFactory = new ObjectFactory();
+ if (contextRef == null) {
+ contextRef = (PersistenceContextRef)getEFactory().create(PersistenceContextRef.class);
+ JAXBElement plan = section.getPlan();
+
+ // add the JAXBElement of the PersistenceContextRef
+ JAXBModelUtils.getGbeanRefs(plan).add(objectFactory.createPersistenceContextRef(contextRef));
+ section.getObjectContainer().add(objectFactory.createPersistenceContextRef(contextRef));
+ }
+ contextRef.setPersistenceContextRefName(textList.get(0).getText());
+ contextRef.setPersistenceContextType(PersistenceContextType.fromValue(contextType.getText()));
+ if (specifyUnit.getSelection() == true) {
+ contextRef.setPersistenceUnitName(textList.get(2).getText());
+ contextRef.setPattern(null);
+ }
+ else {
+ contextRef.setPersistenceUnitName(null);
+ Pattern pattern = contextRef.getPattern();
+ if (pattern == null) {
+ pattern = objectFactory.createPattern();
+ }
+ pattern.setName(textList.get(3).getText());
+ pattern.setGroupId(textList.get(4).getText());
+ pattern.setArtifactId(textList.get(5).getText());
+ pattern.setVersion(textList.get(6).getText());
+ pattern.setModule(textList.get(7).getText());
+ contextRef.setPattern(pattern);
+ }
+ }
+ else if (element.getText().equals(elementTypes[PROPERTY])) {
+ if (isEmpty(textList.get(0).getText())) {
+ return false;
+ }
+ Property property = (Property)eObject;
+ if (property == null) {
+ property = (Property)getEFactory().create(Property.class);
+ contextRef = (PersistenceContextRef)section.getSelectedObject();
+ contextRef.getProperty().add(property);
+ }
+ property.setKey(textList.get(0).getText());
+ property.setValue(textList.get(2).getText());
+ }
+ return true;
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/PersContextRefWizard.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/v21/ui/wizards/PersContextRefWizard.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/v21/ui/wizards/PersContextRefWizard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain