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 2009/09/15 09:21:53 UTC
svn commit: r815191 - in
/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins:
org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/connector/
org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/
org.ap...
Author: delos
Date: Tue Sep 15 07:21:53 2009
New Revision: 815191
URL: http://svn.apache.org/viewvc?rev=815191&view=rev
Log:
GERONIMODEVTOOLS-455 Add Database pool wizard in GEP to enable application specific pools.Thanks Rodger for this patch!
Added:
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/ConnectorPage.java
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DBPoolSection.java
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DBPoolWizard.java
Modified:
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/connector/Connector.java
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java
geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ExtModuleWizard.java
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/connector/Connector.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/connector/Connector.java?rev=815191&r1=815190&r2=815191&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/connector/Connector.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/connector/Connector.java Tue Sep 15 07:21:53 2009
@@ -26,6 +26,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.geronimo.jee.deployment.AbstractService;
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java?rev=815191&r1=815190&r2=815191&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java Tue Sep 15 07:21:53 2009
@@ -123,6 +123,7 @@
public static String editorTabGeneral;
public static String editorTabNaming;
public static String editorTabSecurity;
+ public static String editorTabConnector;
public static String editorTabDeployment;
public static String errorCouldNotOpenFile;
public static String editorTitle;
@@ -358,7 +359,36 @@
public static String wizardEditTitle_SecurityRole;
public static String wizardPageTitle_SecurityRole;
public static String wizardPageDescription_SecurityRole;
+
+ public static String wizardTitle_SecurityRealm;
+ public static String wizardFirstPageTitle_SecurityRealm;
+ public static String wizardSecondPageTitle_SecurityRealm;
+ public static String wizardFirstPageDescription_SecurityRealm;
+ public static String wizardSecondPageDescription_SecurityRealm;
+
+ public static String basicSettings;
+ public static String realmName;
+ public static String realmType;
+ public static String digestAlgorithm;
+ public static String digestEncoding;
+
+ public static String sqlQueries;
+ public static String userSelectSQL;
+ public static String groupSelectSQL;
+
+ public static String dataBasePool;
+ public static String useDataBasePool;
+ public static String useDataBase;
+ public static String dataBasePoolName;
+
+ public static String jdbcDriverClass;
+ public static String jdbcURL;
+ public static String jdbcDriver;
+ public static String jdbcUserName;
+ public static String jdbcPassword;
+ public static String confirmPassword;
//
+
public static String securityCredentialStore;
public static String securityDefaultSubject;
public static String securityDefaultSubjectRealmName;
@@ -371,6 +401,20 @@
public static String securityRunAsSubjectId;
public static String securityRefreshRoles;
+
+ public static String wizardNewTitle_DBpool;
+ public static String wizardBasicPageTitle_DBPool;
+ public static String wizardBasicPageDescription_DBPool;
+ public static String wizardAdvancedPageTitle__DBPool;
+ public static String wizardAdvancedPageDescription__DBPool;
+ public static String wizardConnectionPageTitle__DBPool;
+ public static String wizardConnectionPageDescription__DBPool;
+ //
+ public static String doasCurrentCaller;
+ public static String useContextHandler;
+ public static String defaultRole;
+
+
public static String editorCorrect;
public static String editorDefault;
public static String serverNotStarted;
@@ -418,11 +462,39 @@
public static String ejb;
public static String java;
public static String web;
+
public static String plugin;
public static String pluginActions;
public static String createCustomAssembly;
public static String convertAppsToPlugins;
+
+
+
+
+
+
+
+
+
+
+
+ public static String poolName;
+ public static String dbType;
+ public static String dbName;
+ public static String createDatabase;
+ public static String loginTimeout;
+ public static String blockingTimeout;
+ public static String idleTimeout;
+ public static String minPoolSize;
+ public static String maxPoolSize;
+ public static String transactionType;
+ public static String loginGroup;
+ public static String driverGroup;
+ public static String basicGroup;
+ public static String advancedGroup;
+
+
public static String licenseAgreement;
public static String acceptLicenseAgreement;
public static String rejectLicenseAgreement;
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties?rev=815191&r1=815190&r2=815191&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties Tue Sep 15 07:21:53 2009
@@ -210,6 +210,33 @@
wizardPageTitle_SecurityRole=Security Role Details
wizardPageDescription_SecurityRole=Provide details for this security role.
+wizardTitle_SecurityRealm=Security Realm Configuration
+wizardFirstPageTitle_SecurityRealm=Basic Settings
+wizardSecondPageTitle_SecurityRealm=Data Base related Settings
+wizardFirstPageDescription_SecurityRealm=Edit basic settings for creating new security realm
+wizardSecondPageDescription_SecurityRealm=Edit settings for specifying data source
+
+basicSettings=Basic Settings
+realmName=Realm Name
+realmType=Realm Type
+digestAlgorithm=Digest Algorithm
+digestEncoding=Digest Encoding
+
+sqlQueries=SQL queries
+userSelectSQL=User Select SQL
+groupSelectSQL=Group Select SQL
+
+dataBasePool=Data Base Pool
+useDataBasePool=Use Data Base Pool
+useDataBase=Use Data Base
+dataBasePoolName=Data Base Pool Name
+
+jdbcDriverClass=JDBC Driver Class
+jdbcURL=JDBC URL
+jdbcDriver=JDBC Driver
+jdbcUserName=JDBC User Name
+jdbcPassword=Password
+
wizardNewTitle_Dependency=New Dependency
wizardEditTitle_Dependency=Edit Dependency
wizardPageTitle_Dependency=Dependency Details
@@ -252,11 +279,26 @@
wizardPageTitle_ExtModule=External Module Details
wizardPageDescription_ExtModule=Provide details for this external module.
+
wizardNewTitle_ServiceRef=New Service Reference
wizardEditTitle_ServiceRef=Edit Service Reference
wizardPageTitle_ServiceRef=Service Reference Details
wizardPageDescription_ServiceRef=Provide details for this service reference.
+
+wizardNewTitle_DBpool=New Database Pool Wizard;
+wizardBasicPageTitle_DBPool=Basic Settings
+wizardBasicPageDescription_DBPool=Edit basic settings for creating database pool
+wizardAdvancedPageTitle__DBPool=Advanced Pool Settings
+wizardAdvancedPageDescription__DBPool=Edit advanced settings for creating database pool
+wizardConnectionPageTitle__DBPool=Connection Pool Parameters
+wizardConnectionPageDescription__DBPool=Edit Connection Pool parameters for Database pool
+
+doasCurrentCaller=Do as current caller
+useContextHandler=Use context handler
+defaultRole=Default Role:
+
+
wizardNewTitle_RoleMapping=New Role Mapping
wizardEditTitle_RoleMapping=Edit Role Mapping
wizardPageTitle_RoleMapping=Role Mapping Details
@@ -308,6 +350,7 @@
editorTabGeneral=General
editorTabNaming=Naming
editorTabSecurity=Security
+editorTabConnector=Connector
editorTabDeployment=Deployment
editorTabSource=Source
@@ -421,6 +464,7 @@
ejb=EJB
java=Java
web=Web
+
plugin=Plugin
pluginActions=Plugin actions that can be performed on the server
createCustomAssembly=Create Custom Assembly
@@ -461,3 +505,22 @@
installable=Installable
event=Event
prerequisites=Prerequisites
+
+poolName=Pool Name
+dbType=Database Type
+dbName=Database Name
+createDatabase=Create Database
+confirmPassword=Confirm Password
+loginTimeout=Login Timeout
+blockingTimeout=Blocking Timeout(in ms)
+idleTimeout=Idle Timeout(in mins)
+minPoolSize=Min Size
+maxPoolSize=Max Size
+transactionType=Transaction Type
+loginGroup=Login Details
+driverGroup=Driver Details
+basicGroup=Basic Settings
+advancedGroup=Advanced Settings
+
+
+
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java?rev=815191&r1=815190&r2=815191&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractListSection.java Tue Sep 15 07:21:53 2009
@@ -39,6 +39,7 @@
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
@@ -53,6 +54,7 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
@@ -185,6 +187,7 @@
public void widgetSelected(SelectionEvent e) {
handleDelete();
getViewer().refresh();
+ notifyOthers();
markDirty();
activateButtons();
}
@@ -198,10 +201,11 @@
public void widgetSelected(SelectionEvent e) {
Wizard wizard = getWizard();
if (wizard != null) {
- WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
+ WizardDialog dialog = createWizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.open();
if (dialog.getReturnCode() == Dialog.OK) {
- getViewer().refresh();
+ getViewer().refresh();
+ notifyOthers();
markDirty();
}
}
@@ -210,7 +214,7 @@
addButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}
- protected void createEditButton(Composite buttonComp) {
+ protected void createEditButton(Composite buttonComp) {
editButton = toolkit.createButton(buttonComp, CommonMessages.edit, SWT.NONE);
editButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -221,10 +225,11 @@
if (wizard instanceof AbstractWizard) {
((AbstractWizard) wizard).setEObject(selectedObject);
}
- WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
+ WizardDialog dialog = createWizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.open();
if (dialog.getReturnCode() == Dialog.OK) {
getViewer().refresh();
+ notifyOthers();
markDirty();
}
}
@@ -234,6 +239,23 @@
});
editButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
}
+
+ /**
+ * Implemented by subclass if need to notify other component to refresh
+ */
+ protected void notifyOthers() {
+ //here, do nothing
+ }
+
+ /**
+ * Subclass can override it , if need to use another type of
+ * WizardDialog(like customer implemented WizardDialog to
+ * override some methods).
+ */
+ protected WizardDialog createWizardDialog(Shell parentShell,
+ IWizard newWizard) {
+ return new WizardDialog(parentShell, newWizard);
+ }
protected void activateButtons() {
activateAddButton();
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java?rev=815191&r1=815190&r2=815191&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/sections/AbstractTableSection.java Tue Sep 15 07:21:53 2009
@@ -75,7 +75,7 @@
GridData data = new GridData(SWT.FILL, SWT.FILL, false, true);
data.heightHint = 60;
- data.widthHint = 330;
+ data.widthHint = 660;
//data.grabExcessVerticalSpace = true;
table.setLayoutData(data);
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java?rev=815191&r1=815190&r2=815191&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/editors/GeronimoFormContentLoader.java Tue Sep 15 07:21:53 2009
@@ -31,6 +31,7 @@
import org.apache.geronimo.st.v21.ui.pages.AppClientSecurityPage;
import org.apache.geronimo.st.v21.ui.pages.AppGeneralPage;
import org.apache.geronimo.st.v21.ui.pages.ConnectorOverviewPage;
+import org.apache.geronimo.st.v21.ui.pages.ConnectorPage;
import org.apache.geronimo.st.v21.ui.pages.DeploymentPage;
import org.apache.geronimo.st.v21.ui.pages.EjbOverviewPage;
import org.apache.geronimo.st.v21.ui.pages.NamingFormPage;
@@ -53,6 +54,7 @@
public void addApplicationPlanPages(FormEditor editor) throws PartInitException {
editor.addPage(new AppGeneralPage(editor, "appgeneralpage", CommonMessages.editorTabGeneral));
editor.addPage(new SecurityPage(editor, "securitypage", CommonMessages.editorTabSecurity));
+ editor.addPage(new ConnectorPage(editor,"connectorpage",CommonMessages.editorTabConnector));
editor.addPage(createDeploymentFormPage(editor));
}
Added: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/ConnectorPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/ConnectorPage.java?rev=815191&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/ConnectorPage.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/ConnectorPage.java Tue Sep 15 07:21:53 2009
@@ -0,0 +1,65 @@
+/*
+ * 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.pages;
+
+import org.apache.geronimo.jee.application.Application;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;
+import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
+
+import org.apache.geronimo.st.v21.core.GeronimoServerInfo;
+import org.apache.geronimo.st.v21.ui.sections.DBPoolSection;
+
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+
+/**
+ * This page is added to a editor for
+ * geronimo-application.xml,geronimo-web.xml,openejb-jar.xml It will contain two
+ * sections,Database pool section and JMS resource section
+ */
+public class ConnectorPage extends AbstractGeronimoFormPage {
+
+ public ConnectorPage(FormEditor editor, String id, String title) {
+ super(editor, id, title);
+ }
+
+ @Override
+ protected void fillBody(IManagedForm managedForm) {
+ Application application = (Application) ((AbstractGeronimoDeploymentPlanEditor) getEditor())
+ .getDeploymentPlan().getValue();
+ managedForm.addPart(new DBPoolSection(getDeploymentPlan(), body,
+ toolkit, getStyle(), application.getExtModule()));
+ }
+
+ protected GridLayout getLayout() {
+ GridLayout layout = super.getLayout();
+ layout.numColumns = 1;
+ return layout;
+ }
+
+ public String getFormTitle() {
+ return "Connector";//TODO
+ }
+
+ @Override
+ protected void triggerGeronimoServerInfoUpdate() {
+ GeronimoServerInfo.getInstance().updateInfo();
+ }
+
+}
Added: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DBPoolSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DBPoolSection.java?rev=815191&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DBPoolSection.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/DBPoolSection.java Tue Sep 15 07:21:53 2009
@@ -0,0 +1,176 @@
+package org.apache.geronimo.st.v21.ui.sections;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.application.ExtModule;
+import org.apache.geronimo.jee.connector.Connector;
+import org.apache.geronimo.jee.deployment.Gbean;
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.ui.sections.AbstractListSection.ContentProvider;
+import org.apache.geronimo.st.ui.sections.AbstractListSection.LabelProvider;
+import org.apache.geronimo.st.v21.ui.pages.ConnectorPage;
+import org.apache.geronimo.st.v21.ui.wizards.DBPoolWizard;
+import org.apache.geronimo.st.v21.ui.wizards.ExtModuleWizard;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+public class DBPoolSection extends AbstractTableSection {
+
+ public DBPoolSection(JAXBElement plan, Composite parent,
+ FormToolkit toolkit, int style, List extModules) {
+ super(plan, parent, toolkit, style);
+ this.objectContainer = extModules;
+ COLUMN_NAMES = new String[] { "Connector", "External Path", };// TODO
+ // put
+ // into
+ // message
+ createClient();
+ }
+
+ @Override
+ public String getDescription() {
+ return "The following database pools are defined:";// TODO put into
+ // message
+ }
+
+ @Override
+ public Class getTableEntryObjectType() {
+ return ExtModule.class;// TODO put into message
+ }
+
+ @Override
+ public String getTitle() {
+ return "Database Pools";// TODO put into message
+ }
+
+ @Override
+ protected Wizard getWizard() {
+ return new DBPoolWizard(this);
+ }
+
+ protected void notifyOthers() {
+ notifyExtModuleSectionToRefresh();
+ }
+
+ /*
+ * After add, remove, edit dbpool ext-module, notify the extModuleSection to
+ * refresh. If the deploymentpage has not been initialized, catch a
+ * NullPointerException and just ignore it.
+ */
+ private void notifyExtModuleSectionToRefresh() {
+ try {
+ ConnectorPage connectorPage = (ConnectorPage) this.getManagedForm()
+ .getContainer();
+ FormEditor editor = connectorPage.getEditor();
+ IFormPart[] parts = editor.findPage("deploymentpage")
+ .getManagedForm().getParts();
+ ExtModuleSection extModuleSection = null;
+ for (IFormPart part : parts) {
+ if (ExtModuleSection.class.isInstance(part)) {
+ extModuleSection = (ExtModuleSection) part;
+ }
+ }
+ extModuleSection.getViewer().refresh();
+ } catch (NullPointerException e) {
+ // Ignore, this exception happens when the deployment page hasn't
+ // been initialized
+ }
+ }
+
+ @Override
+ public ITreeContentProvider getContentProvider() {
+ return new ContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ List<ExtModule> result = new ArrayList<ExtModule>();
+ List extModules = getObjectContainer();
+ Iterator it = extModules.iterator();
+ while (it.hasNext()) {
+ ExtModule current = (ExtModule) it.next();
+ if (isDBPoolConnectorExtModule(current)) {
+ result.add(current);
+ }
+ }
+ return result.toArray();
+ }
+ };
+ }
+
+ private boolean isDBPoolConnectorExtModule(ExtModule extModule) {
+ boolean result = false;
+ JAXBElement any = (JAXBElement) extModule.getAny();
+ if (any == null)
+ return false;
+ Object anyValue = any.getValue();
+ if (Connector.class.isInstance(anyValue)) {
+ Connector connector = (Connector) anyValue;
+ try {
+ // if the <ext-module/> contains <connectionfactory-interface/>
+ // which value is "javax.sql.DataSource",then it is a dbpool
+ // ext-module.
+ String connectionfactoryInterface = connector
+ .getResourceadapter().get(0)
+ .getOutboundResourceadapter().getConnectionDefinition()
+ .get(0).getConnectionfactoryInterface();
+ if (connectionfactoryInterface.trim().equals(
+ "javax.sql.DataSource")) {
+ result = true;
+ }
+ } catch (NullPointerException e) {
+ // e.printStackTrace();
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public ITableLabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (ExtModule.class.isInstance(element)) {
+ ExtModule extModule = (ExtModule) element;
+ switch (columnIndex) {
+ case 0:// connector
+ if (extModule.getConnector() != null) {
+ return extModule.getConnector().getValue();
+ }
+ return "";
+ case 1:// external-path
+ Pattern externalPath = extModule.getExternalPath();
+ if (externalPath != null) {
+ String groupId = externalPath.getGroupId() != null ? externalPath
+ .getGroupId()
+ : "";
+ String artifactId = externalPath.getArtifactId() != null ? externalPath
+ .getArtifactId()
+ : "";
+ String version = externalPath.getVersion() != null ? externalPath
+ .getVersion()
+ : "";
+ String type = externalPath.getType() != null ? externalPath
+ .getType()
+ : "";
+ return groupId + "/" + artifactId + "/" + version
+ + "/" + type;
+ }
+ return "";
+ }
+ }
+ return null;
+ }
+ };
+ }
+}
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java?rev=815191&r1=815190&r2=815191&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ExtModuleSection.java Tue Sep 15 07:21:53 2009
@@ -23,10 +23,15 @@
import org.apache.geronimo.jee.application.ExtModule;
import org.apache.geronimo.st.ui.CommonMessages;
import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.v21.ui.pages.ConnectorPage;
+import org.apache.geronimo.st.v21.ui.pages.DeploymentPage;
import org.apache.geronimo.st.v21.ui.wizards.ExtModuleWizard;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.widgets.FormToolkit;
/*
@@ -34,90 +39,121 @@
*/
public class ExtModuleSection extends AbstractTableSection {
- public ExtModuleSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style, List extModules) {
- super(plan, parent, toolkit, style);
- this.objectContainer = extModules;
- COLUMN_NAMES = new String[] {
- CommonMessages.moduleType, CommonMessages.path, CommonMessages.internalPath,
- CommonMessages.groupId, CommonMessages.artifactId, CommonMessages.version, CommonMessages.artifactType };
- createClient();
- }
-
- public String getTitle() {
- return CommonMessages.editorSectionExtModuleTitle;
- }
-
- public String getDescription() {
- return CommonMessages.editorSectionExtModuleDescription;
- }
-
- public Wizard getWizard() {
- return new ExtModuleWizard(this);
- }
-
- public Class getTableEntryObjectType() {
- return ExtModule.class;
- }
-
- @Override
- public ITableLabelProvider getLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getColumnText(Object element, int columnIndex) {
- if (ExtModule.class.isInstance(element)) {
- ExtModule extModule = (ExtModule) element;
- switch (columnIndex) {
- case 0:
- if (extModule.getConnector() != null) {
- return "connector";
- } else if (extModule.getEjb() != null) {
- return "ejb";
- } else if (extModule.getJava() != null) {
- return "java";
- } else if (extModule.getWeb() != null) {
- return "web";
- }
- return "";
- case 1:
- if (extModule.getConnector() != null) {
- return extModule.getConnector().getValue();
- } else if (extModule.getEjb() != null) {
- return extModule.getEjb().getValue();
- } else if (extModule.getJava() != null) {
- return extModule.getJava().getValue();
- } else if (extModule.getWeb() != null) {
- return extModule.getWeb().getValue();
- }
- return "";
- case 2:
- if (extModule.getInternalPath() != null) {
- return extModule.getInternalPath();
- }
- return "";
- case 3:
- if (extModule.getExternalPath() != null) {
- return extModule.getExternalPath().getGroupId();
- }
- return "";
- case 4:
- if (extModule.getExternalPath() != null) {
- return extModule.getExternalPath().getArtifactId();
- }
- return "";
- case 5:
- if (extModule.getExternalPath() != null) {
- return extModule.getExternalPath().getVersion();
- }
- return "";
- case 6:
- if (extModule.getExternalPath() != null) {
- return extModule.getExternalPath().getType();
- }
- return "";
- }
- }
- return null;
- }
- };
- }
+ public ExtModuleSection(JAXBElement plan, Composite parent,
+ FormToolkit toolkit, int style, List extModules) {
+ super(plan, parent, toolkit, style);
+ this.objectContainer = extModules;
+ COLUMN_NAMES = new String[] { CommonMessages.moduleType,
+ CommonMessages.path, CommonMessages.internalPath,
+ CommonMessages.groupId, CommonMessages.artifactId,
+ CommonMessages.version, CommonMessages.artifactType };
+ createClient();
+ }
+
+ public String getTitle() {
+ return CommonMessages.editorSectionExtModuleTitle;
+ }
+
+ public String getDescription() {
+ return CommonMessages.editorSectionExtModuleDescription;
+ }
+
+ public Wizard getWizard() {
+ return new ExtModuleWizard(this);
+ }
+
+ public Class getTableEntryObjectType() {
+ return ExtModule.class;
+ }
+
+ protected void notifyOthers() {
+ notifyDBPoolSectionToRefresh();
+ }
+
+ /*
+ * After add, remove, edit ext-module, notify the dbpoolSection to refresh.
+ * If the connectorpage has not been initialized,then catch a
+ * NullPointerException and just ignore it.
+ */
+ private void notifyDBPoolSectionToRefresh() {
+ try {
+ DeploymentPage deploymentPage = (DeploymentPage) this
+ .getManagedForm().getContainer();
+ FormEditor editor = deploymentPage.getEditor();
+ IFormPart[] parts = editor.findPage("connectorpage")
+ .getManagedForm().getParts();
+ DBPoolSection dbpoolSection = null;
+ for (IFormPart part : parts) {
+ if (DBPoolSection.class.isInstance(part)) {
+ dbpoolSection = (DBPoolSection) part;
+ }
+ }
+ dbpoolSection.getViewer().refresh();
+ } catch (NullPointerException e) {
+ // Ignore, this exception happens when the connectorpage hasn't been
+ // initialized
+ }
+ }
+
+ @Override
+ public ITableLabelProvider getLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (ExtModule.class.isInstance(element)) {
+ ExtModule extModule = (ExtModule) element;
+ switch (columnIndex) {
+ case 0:
+ if (extModule.getConnector() != null) {
+ return "connector";
+ } else if (extModule.getEjb() != null) {
+ return "ejb";
+ } else if (extModule.getJava() != null) {
+ return "java";
+ } else if (extModule.getWeb() != null) {
+ return "web";
+ }
+ return "";
+ case 1:
+ if (extModule.getConnector() != null) {
+ return extModule.getConnector().getValue();
+ } else if (extModule.getEjb() != null) {
+ return extModule.getEjb().getValue();
+ } else if (extModule.getJava() != null) {
+ return extModule.getJava().getValue();
+ } else if (extModule.getWeb() != null) {
+ return extModule.getWeb().getValue();
+ }
+ return "";
+ case 2:
+ if (extModule.getInternalPath() != null) {
+ return extModule.getInternalPath();
+ }
+ return "";
+ case 3:
+ if (extModule.getExternalPath() != null) {
+ return extModule.getExternalPath().getGroupId();
+ }
+ return "";
+ case 4:
+ if (extModule.getExternalPath() != null) {
+ return extModule.getExternalPath().getArtifactId();
+ }
+ return "";
+ case 5:
+ if (extModule.getExternalPath() != null) {
+ return extModule.getExternalPath().getVersion();
+ }
+ return "";
+ case 6:
+ if (extModule.getExternalPath() != null) {
+ return extModule.getExternalPath().getType();
+ }
+ return "";
+ }
+ }
+ return null;
+ }
+ };
+ }
}
Added: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DBPoolWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DBPoolWizard.java?rev=815191&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DBPoolWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DBPoolWizard.java Tue Sep 15 07:21:53 2009
@@ -0,0 +1,973 @@
+package org.apache.geronimo.st.v21.ui.wizards;
+
+import java.util.ArrayList;
+import javax.xml.bind.JAXBElement;
+import org.apache.geronimo.jee.application.Application;
+import org.apache.geronimo.jee.application.ExtModule;
+import org.apache.geronimo.jee.application.Path;
+import org.apache.geronimo.jee.connector.ConfigPropertySetting;
+import org.apache.geronimo.jee.connector.ConnectionDefinition;
+import org.apache.geronimo.jee.connector.ConnectiondefinitionInstance;
+import org.apache.geronimo.jee.connector.Connectionmanager;
+import org.apache.geronimo.jee.connector.Connector;
+import org.apache.geronimo.jee.connector.OutboundResourceadapter;
+import org.apache.geronimo.jee.connector.Resourceadapter;
+import org.apache.geronimo.jee.connector.Singlepool;
+import org.apache.geronimo.jee.connector.Xatransaction;
+import org.apache.geronimo.jee.deployment.Dependencies;
+import org.apache.geronimo.jee.deployment.Dependency;
+import org.apache.geronimo.jee.deployment.Environment;
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.apache.geronimo.jee.openejb.OpenejbJar;
+import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.ui.Activator;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTableWizard;
+import org.apache.geronimo.st.v21.core.jaxb.JAXBObjectFactoryImpl;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class DBPoolWizard extends AbstractTableWizard {
+
+ protected ImageDescriptor descriptor = Activator.imageDescriptorFromPlugin(
+ "org.apache.geronimo.st.ui", "icons/bigG.gif");
+
+ public DBPoolWizard(AbstractTableSection section) {
+ super(section);
+ }
+
+ @Override
+ public JAXBObjectFactory getEFactory() {
+ return JAXBObjectFactoryImpl.getInstance();
+ }
+
+ @Override
+ public String[] getTableColumnEAttributes() {
+ return new String[] {};
+ }
+
+ @Override
+ protected String getAddWizardWindowTitle() {
+ return "New Database Pool";// TODO put into message
+ }
+
+ @Override
+ protected String getEditWizardWindowTitle() {
+ return "Edit Database Pool";// TODO put into message
+ }
+
+ public void addPages() {
+ ExternalPathPage page0 = new ExternalPathPage("Page0");
+ page0.setImageDescriptor(descriptor);
+ addPage(page0);
+
+ DBPoolBasicPage page1 = new DBPoolBasicPage("Page1");
+ page1.setImageDescriptor(descriptor);
+ addPage(page1);
+
+ DBPoolAdvancedPage page2 = new DBPoolAdvancedPage("Page2");
+ page2.setImageDescriptor(descriptor);
+ addPage(page2);
+
+ ConnectionPoolPage page3 = new ConnectionPoolPage("Page3");
+ page3.setImageDescriptor(descriptor);
+ addPage(page3);
+ }
+
+ public boolean performFinish() {
+ JAXBElement plan = this.section.getPlan();
+
+ // all pages
+ ExternalPathPage page0 = (ExternalPathPage) getPages()[0];
+ DBPoolBasicPage page1 = (DBPoolBasicPage) getPages()[1];
+ DBPoolAdvancedPage page2 = (DBPoolAdvancedPage) getPages()[2];
+ ConnectionPoolPage page3 = (ConnectionPoolPage) getPages()[3];
+
+ // check necessary info has been filled
+ if (page1.getPoolName() == null
+ || page1.getPoolName().trim().length() == 0
+ || page1.getPoolName().contains(" ")) {
+ MessageDialog.openWarning(this.getShell(), "Pool Name Invalid",
+ "Pool name specified is invalid");
+ return false;
+ }
+ if (page1.getDBPooolType() == null
+ || page1.getDBPooolType().trim().length() == 0) {
+ MessageDialog.openWarning(this.getShell(), "Pool type invalid",
+ "Pool type specified is invalid");
+ return false;
+ }
+ if (page1.getDBName() == null || page1.getDBName().trim().length() == 0
+ || page1.getDBName().contains(" ")) {
+ MessageDialog.openWarning(this.getShell(), "Database name invalid",
+ "Database name specified is invalid");
+ return false;
+ }
+ if (page1.getDrivers() == null || page1.getDrivers().length == 0) {
+ MessageDialog.openWarning(this.getShell(), "Driver invalid",
+ "You havent selected a driver");
+ return false;
+ }
+
+ // add the dependencies and ext-module to plan
+ if (Application.class.isInstance(plan.getValue())) {
+ Application application = (Application) plan.getValue();
+ Environment env = application.getEnvironment();
+ if (env == null) {
+ env = new Environment();
+ application.setEnvironment(env);
+ }
+ Dependencies dependencies = env.getDependencies();
+ if (dependencies == null) {
+ dependencies = new Dependencies();
+ env.setDependencies(dependencies);
+ }
+
+ // if there are no same dependencies in plan,then add them
+ for (int i = 0; i < page1.getDrivers().length; i++) {
+ Dependency selectedDependency = (Dependency) page1.getDrivers()[i];
+ if (!dependencies.getDependency().contains(selectedDependency)) {
+ dependencies.getDependency().add(selectedDependency);
+ }
+ }
+
+ ExtModule extModule;
+ if (eObject == null) {
+ eObject = getEFactory().create(ExtModule.class);
+ extModule = (ExtModule) eObject;
+ java.util.List<ExtModule> extModuleList = application
+ .getExtModule();
+ extModuleList.add(extModule);
+ } else {
+ extModule = (ExtModule) eObject;
+ }
+
+ // NOTE!! this replaces the call to processEAttributes (page);
+ Path path = (Path) getEFactory().create(Path.class);
+ path.setValue(page0.text[0].getText());
+ extModule.setConnector(path);
+
+ Pattern pattern = (Pattern) getEFactory().create(Pattern.class);
+ extModule.setExternalPath(pattern);
+ pattern.setGroupId(page0.text[1].getText());
+ pattern.setArtifactId(page0.text[2].getText());
+ pattern.setVersion(page0.text[3].getText());
+ pattern.setType(page0.text[4].getText().trim());
+
+ Connector conn = new Connector();
+ // attention here <connector/> is unmashalled as a JAXBElement
+ JAXBElement<Connector> connElement = (new org.apache.geronimo.jee.connector.ObjectFactory())
+ .createConnector(conn);
+ extModule.setAny(connElement);
+ Resourceadapter adapter = new Resourceadapter();
+ conn.getResourceadapter().add(adapter);
+
+ OutboundResourceadapter outboundAdpater = new OutboundResourceadapter();
+ ConnectionDefinition definition = new ConnectionDefinition();
+ definition.setConnectionfactoryInterface("javax.sql.DataSource");
+ ConnectiondefinitionInstance instance = new ConnectiondefinitionInstance();
+ instance.setName(page1.getPoolName());
+
+ String[] loginData = page2.getLoginData();
+ if (!loginData[1].equals(loginData[2])) {
+ Status status = new Status(IStatus.WARNING, "Login Error", 0,
+ "Password provided in both fiels do not match", null);
+ ErrorDialog.openError(this.getShell(), "Login Error",
+ "Invalid Login Details", status);
+ return false;
+ }
+ ConfigPropertySetting setting1 = new ConfigPropertySetting();
+ setting1.setName("Password");
+ setting1.setValue(loginData[1]);
+ instance.getConfigPropertySetting().add(setting1);
+ ConfigPropertySetting setting2 = new ConfigPropertySetting();
+ setting2.setName("LoginTimeout");
+ setting2.setValue(page2.getLoginTimeout());
+ instance.getConfigPropertySetting().add(setting2);
+ ConfigPropertySetting setting3 = new ConfigPropertySetting();
+ setting3.setName("DatabaseName");
+ setting3.setValue(page1.getDBName());
+ instance.getConfigPropertySetting().add(setting3);
+ ConfigPropertySetting setting4 = new ConfigPropertySetting();
+ setting4.setName("CreateDatabase");
+ setting4.setValue(page2.getCreateDatabase());
+ instance.getConfigPropertySetting().add(setting4);
+ ConfigPropertySetting setting5 = new ConfigPropertySetting();
+ setting5.setName("UserName");
+ setting5.setValue(loginData[0]);
+ instance.getConfigPropertySetting().add(setting5);
+
+ instance.setConnectionmanager(page3.getConnectionManager());
+ definition.getConnectiondefinitionInstance().add(instance);
+ outboundAdpater.getConnectionDefinition().add(definition);
+ adapter.setOutboundResourceadapter(outboundAdpater);
+
+ if (section.getViewer().getInput() == section.getPlan()) {
+ section.getViewer().setInput(section.getInput());
+ }
+ return true;
+ }
+
+ return true;
+ }
+
+ public class ExternalPathPage extends AbstractTableWizardPage {
+ Text[] text = new Text[5];
+
+ protected ExternalPathPage(String pageName) {
+ super(pageName);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite composite = createComposite(parent);
+
+ GridData groupGridData1;
+ GridData groupGridData2;
+ GridData textGridData;
+ GridLayout gridLayout1;
+ GridLayout gridLayout2;
+ Label label;
+
+ Group group = new Group(composite, SWT.NONE);
+ gridLayout1 = new GridLayout();
+ gridLayout1.numColumns = 2;
+ group.setLayout(gridLayout1);
+ groupGridData1 = new GridData();
+ groupGridData1.horizontalAlignment = GridData.FILL;
+ groupGridData1.grabExcessHorizontalSpace = true;
+ groupGridData1.horizontalSpan = 2;
+ group.setLayoutData(groupGridData1);
+
+ label = new Label(group, SWT.LEFT);
+ label.setText("Connector:");
+
+ text[0] = new Text(group, SWT.SINGLE | SWT.BORDER);
+ textGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ textGridData.grabExcessHorizontalSpace = true;
+ textGridData.widthHint = 100;
+ text[0].setLayoutData(textGridData);
+
+ Group group2 = new Group(composite, SWT.NONE);
+ gridLayout2 = new GridLayout();
+ gridLayout2.numColumns = 2;
+ group2.setLayout(gridLayout2);
+ groupGridData2 = new GridData();
+ groupGridData2.horizontalAlignment = GridData.FILL;
+ groupGridData2.grabExcessHorizontalSpace = true;
+ groupGridData2.horizontalSpan = 2;
+ groupGridData2.verticalAlignment = GridData.FILL;
+ group2.setLayoutData(groupGridData2);
+ group2.setText("External Path");
+
+ label = new Label(group2, SWT.LEFT);
+ label.setText("Group Id:");
+ text[1] = new Text(group2, SWT.SINGLE | SWT.BORDER);
+ text[1].setLayoutData(textGridData);
+
+ label = new Label(group2, SWT.LEFT);
+ label.setText("Artifact Id:");
+ text[2] = new Text(group2, SWT.SINGLE | SWT.BORDER);
+ text[2].setLayoutData(textGridData);
+
+ label = new Label(group2, SWT.LEFT);
+ label.setText("Version:");
+ text[3] = new Text(group2, SWT.SINGLE | SWT.BORDER);
+ text[3].setLayoutData(textGridData);
+
+ label = new Label(group2, SWT.LEFT);
+ label.setText("Type:");
+ text[4] = new Text(group2, SWT.SINGLE | SWT.BORDER);
+ text[4].setLayoutData(textGridData);
+
+ // if edit a pool,the info must be filled into wizard
+ if (eObject != null && ExtModule.class.isInstance(eObject)) {
+ ExtModule extModule = (ExtModule) eObject;
+ if (extModule.getConnector() != null) {
+ text[0].setText(extModule.getConnector().getValue());
+ }
+ if (extModule.getExternalPath() != null) {
+ text[1]
+ .setText(extModule.getExternalPath().getGroupId() == null ? ""
+ : extModule.getExternalPath().getGroupId());
+ text[2]
+ .setText(extModule.getExternalPath()
+ .getArtifactId() == null ? "" : extModule
+ .getExternalPath().getArtifactId());
+ text[3]
+ .setText(extModule.getExternalPath().getVersion() == null ? ""
+ : extModule.getExternalPath().getVersion());
+ text[4]
+ .setText(extModule.getExternalPath().getType() == null ? ""
+ : extModule.getExternalPath().getType());
+ }
+ }
+
+ setControl(composite);
+ }
+
+ @Override
+ protected String getWizardPageDescription() {
+ return "Specify the connector rar in the repository";
+ }
+
+ @Override
+ protected String getWizardPageTitle() {
+ return "External Path";
+ }
+
+ }
+
+ public class DBPoolBasicPage extends AbstractTableWizardPage {
+
+ Text text[] = new Text[2];
+ Combo combo;
+ ListViewer listViewer;
+ ArrayList<Dependency> dependencies = new ArrayList<Dependency>();
+
+ protected DBPoolBasicPage(String pageName) {
+ super(pageName);
+ setTitle(CommonMessages.wizardBasicPageTitle_DBPool);
+ setDescription(CommonMessages.wizardBasicPageDescription_DBPool);
+ }
+
+ protected Object[] getDrivers() {
+ StructuredSelection sel = (StructuredSelection) listViewer
+ .getSelection();
+ return sel.toArray();
+ }
+
+ protected String getPoolName() {
+ return text[0].getText();
+ }
+
+ protected String getDBName() {
+ return text[1].getText();
+ }
+
+ protected String getDBPooolType() {
+ if (combo.getSelectionIndex() == -1) {
+ return null;
+ }
+ return combo.getItem(combo.getSelectionIndex());
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ // data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = 300;
+ composite.setLayoutData(data);
+
+ Group basicGroup = new Group(composite, SWT.NONE);
+ basicGroup.setText(CommonMessages.basicGroup);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 4;
+ data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ // data.grabExcessVerticalSpace = true;
+ data.horizontalSpan = 2;
+ basicGroup.setLayout(layout);
+ data.grabExcessHorizontalSpace = true;
+ basicGroup.setLayoutData(data);
+ Label label = new Label(basicGroup, SWT.LEFT);
+ label.setText(CommonMessages.poolName);
+ GridData labelData = new GridData();
+ labelData.horizontalAlignment = GridData.FILL;
+ label.setLayoutData(labelData);
+ text[0] = new Text(basicGroup, SWT.BORDER);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ textData.grabExcessHorizontalSpace = true;
+ textData.widthHint = 100;
+ text[0].setLayoutData(textData);
+ label = new Label(basicGroup, SWT.LEFT);
+ label.setText(CommonMessages.dbType);
+ label.setLayoutData(labelData);
+ combo = new Combo(basicGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
+ combo.setLayoutData(textData);
+ combo.add("Derby Embedded");
+ combo.add("Derby Embedded XA");
+ combo.select(1);
+ label = new Label(basicGroup, SWT.LEFT);
+ label.setText(CommonMessages.dbName);
+ label.setLayoutData(labelData);
+ text[1] = new Text(basicGroup, SWT.BORDER);
+ text[1].setLayoutData(textData);
+
+ Group driverGroup = new Group(composite, SWT.NONE);
+ driverGroup.setText(CommonMessages.driverGroup);
+ driverGroup.setLayout(layout);
+ driverGroup.setLayoutData(data);
+ List list = new List(driverGroup, SWT.BORDER | SWT.MULTI
+ | SWT.V_SCROLL);
+ GridData listData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ list.setLayoutData(listData);
+ listViewer = new ListViewer(list);
+ listViewer.setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object element) {
+ return ((java.util.List<?>) element).toArray();
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+ }
+ });
+ listViewer.setInput(getInput());
+ MenuManager popupMenu = new MenuManager();
+ Action helpAction = new Action("Add New Driver") { //$NON-NLS-1$
+ public void run() {
+ DriverDialog dialog = new DriverDialog(Display.getCurrent()
+ .getActiveShell());
+ dialog.open();
+ if (dialog.getReturnCode() == 0) {
+ if (dialog.getDependency() != null) {
+ dependencies.add(dialog.getDependency());
+ listViewer.refresh();
+ }
+ }
+ }
+ };
+ popupMenu.add(helpAction);
+ Menu menu = popupMenu.createContextMenu(list);
+ list.setMenu(menu);
+
+ // if edit a pool,the info must be filled into wizard
+ if (eObject != null && ExtModule.class.isInstance(eObject)) {
+ ExtModule extModule = (ExtModule) eObject;
+
+ try {
+ ConnectiondefinitionInstance conndefInstance = ((JAXBElement<Connector>) extModule
+ .getAny()).getValue().getResourceadapter().get(0)
+ .getOutboundResourceadapter()
+ .getConnectionDefinition().get(0)
+ .getConnectiondefinitionInstance().get(0);
+ text[0].setText(conndefInstance.getName());
+ java.util.List<ConfigPropertySetting> configPropertySettingList = conndefInstance
+ .getConfigPropertySetting();
+ for (ConfigPropertySetting cps : configPropertySettingList) {
+ if (cps.getName().equals("DatabaseName")) {
+ text[1].setText(cps.getValue());
+ }
+ }
+
+ // there need some improvement
+ list.setSelection(new int[] { 0 });
+ listViewer.refresh();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ setControl(composite);
+
+ }
+
+ public Object getInput() {
+ // to be obtained dynamically
+ Dependency dependency = new Dependency();
+ dependency.setArtifactId("system-database");
+ dependency.setGroupId("org.apache.geronimo.configs");
+ dependency.setVersion("");
+ dependency.setType("car");
+ dependencies.add(dependency);
+ return dependencies;
+ }
+
+ @Override
+ protected String getWizardPageDescription() {
+ return "";
+ }
+
+ @Override
+ protected String getWizardPageTitle() {
+ return "";
+ }
+
+ }
+
+ public class DBPoolAdvancedPage extends AbstractTableWizardPage {
+
+ Button createDatabase;
+ Text text[] = new Text[4];
+
+ protected String[] getLoginData() {
+ return new String[] { text[1].getText(), text[2].getText(),
+ text[3].getText() };
+ }
+
+ protected String getCreateDatabase() {
+ return createDatabase.getSelection() ? "true" : "false";
+ }
+
+ protected String getLoginTimeout() {
+ return text[0].getText();
+ }
+
+ protected DBPoolAdvancedPage(String pageName) {
+ super(pageName);
+ setTitle(CommonMessages.wizardAdvancedPageTitle__DBPool);
+ setDescription(CommonMessages.wizardAdvancedPageDescription__DBPool);
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = 300;
+ composite.setLayoutData(data);
+
+ Group advancedGroup = createGroup(composite,
+ CommonMessages.advancedGroup, 2);
+ createDatabase = new Button(advancedGroup, SWT.CHECK);
+ createDatabase.setText(CommonMessages.createDatabase);
+ createDatabase.setLayoutData(new GridData(GridData.FILL,
+ GridData.FILL, true, false, 4, 1));
+ createDatabase.setSelection(true);
+ createLabel(advancedGroup, CommonMessages.loginTimeout, 2);
+ text[0] = createText(advancedGroup, 2);
+
+ Group userGroup = createGroup(composite, CommonMessages.loginGroup,
+ 2);
+ createLabel(userGroup, CommonMessages.username, 2);
+ text[1] = createText(userGroup, 2);
+ text[1].setText("system");
+ createLabel(userGroup, CommonMessages.password, 2);
+ text[2] = createText(userGroup, 2);
+ text[2].setEchoChar('*');
+ text[2].setText("manager");
+ createLabel(userGroup, CommonMessages.confirmPassword, 2);
+ text[3] = createText(userGroup, 2);
+ text[3].setEchoChar('*');
+ text[3].setText("manager");
+
+ // if edit a pool,the info must be filled into wizard
+ if (eObject != null && ExtModule.class.isInstance(eObject)) {
+ ExtModule extModule = (ExtModule) eObject;
+ try {
+ ConnectiondefinitionInstance conndefInstance = ((JAXBElement<Connector>) extModule
+ .getAny()).getValue().getResourceadapter().get(0)
+ .getOutboundResourceadapter()
+ .getConnectionDefinition().get(0)
+ .getConnectiondefinitionInstance().get(0);
+ java.util.List<ConfigPropertySetting> configPropertySettingList = conndefInstance
+ .getConfigPropertySetting();
+ for (ConfigPropertySetting cps : configPropertySettingList) {
+ if (cps.getName().equals("CreateDatabase")) {
+ if (cps.getValue().equals("true"))
+ createDatabase.setSelection(true);
+ else
+ createDatabase.setSelection(false);
+ } else if (cps.getName().equals("LoginTimeout")) {
+ text[0].setText(cps.getValue());
+ } else if (cps.getName().equals("UserName")) {
+ text[1].setText(cps.getValue());
+ } else if (cps.getName().equals("Password")) {
+ text[2].setEchoChar('*');
+ text[2].setText(cps.getValue());
+ text[3].setEchoChar('*');
+ text[3].setText(cps.getValue());
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ setControl(composite);
+
+ }
+
+ protected Group createGroup(Composite composite, String value, int span) {
+ Group group = new Group(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 4;
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalSpan = span;
+ group.setLayout(layout);
+ group.setLayoutData(data);
+ group.setText(value);
+ return group;
+ }
+
+ protected Label createLabel(Composite composite, String value, int span) {
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(value);
+ GridData labelData = new GridData();
+ labelData.horizontalAlignment = GridData.FILL;
+ labelData.horizontalSpan = span;
+ label.setLayoutData(labelData);
+ return label;
+ }
+
+ protected Text createText(Composite composite, int span) {
+ Text text = new Text(composite, SWT.BORDER);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ textData.grabExcessHorizontalSpace = true;
+ textData.widthHint = 100;
+ textData.horizontalSpan = span;
+ text.setLayoutData(textData);
+ return text;
+ }
+
+ @Override
+ protected String getWizardPageDescription() {
+ return "";
+ }
+
+ @Override
+ protected String getWizardPageTitle() {
+ return "";
+ }
+
+ }
+
+ public class ConnectionPoolPage extends AbstractTableWizardPage {
+
+ Combo combo;
+ Text text[] = new Text[4];
+
+ protected ConnectionPoolPage(String pageName) {
+ super(pageName);
+ setTitle(CommonMessages.wizardConnectionPageTitle__DBPool);
+ setDescription(CommonMessages.wizardConnectionPageDescription__DBPool);
+ }
+
+ protected Connectionmanager getConnectionManager() {
+ Connectionmanager manager = new Connectionmanager();
+
+ // add the pool's transaction type into plan
+ int poolTypeIndex = combo.getSelectionIndex();
+ // pool type is XA
+ if (poolTypeIndex == 0) {
+ Xatransaction xaTransaction = new Xatransaction();
+ xaTransaction
+ .setTransactionCaching(new org.apache.geronimo.jee.connector.Empty());
+ manager.setXaTransaction(xaTransaction);
+ }
+ // pool type is LOCAL
+ else if (poolTypeIndex == 1) {
+ manager
+ .setLocalTransaction(new org.apache.geronimo.jee.connector.Empty());
+ }
+ // pool type is NONE
+ else if (poolTypeIndex == 2) {
+ manager
+ .setNoTransaction(new org.apache.geronimo.jee.connector.Empty());
+ }
+
+ Singlepool pool = new Singlepool();
+ pool.setMinSize(text[0].getText().trim().length() == 0 ? 0
+ : new Integer(text[0].getText()));
+ pool.setMaxSize(text[1].getText().trim().length() == 0 ? 10
+ : new Integer(text[1].getText()));
+ pool.setBlockingTimeoutMilliseconds(text[2].getText().trim()
+ .length() == 0 ? null : new Integer(text[2].getText()));
+ pool
+ .setIdleTimeoutMinutes(text[3].getText().trim().length() == 0 ? null
+ : new Integer(text[3].getText()));
+ pool.setMatchOne(new org.apache.geronimo.jee.connector.Empty());
+ manager.setSinglePool(pool);
+ return manager;
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = 300;
+ composite.setLayoutData(data);
+
+ Group connectionGroup = createGroup(composite,
+ CommonMessages.wizardConnectionPageTitle__DBPool, 2);
+ createLabel(connectionGroup, CommonMessages.transactionType, 2);
+ combo = new Combo(connectionGroup, SWT.NONE | SWT.READ_ONLY);
+ combo.add("XA");
+ combo.add("LOCAL");
+ combo.add("NONE");
+ combo.select(0);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ textData.grabExcessHorizontalSpace = true;
+ textData.horizontalSpan = 2;
+ textData.widthHint = 100;
+ combo.setLayoutData(textData);
+ createLabel(connectionGroup, CommonMessages.minPoolSize, 2);
+ text[0] = createText(connectionGroup, 2);
+ text[0].setText("0");
+ createLabel(connectionGroup, CommonMessages.maxPoolSize, 2);
+ text[1] = createText(connectionGroup, 2);
+ text[1].setText("10");
+ createLabel(connectionGroup, CommonMessages.blockingTimeout, 2);
+ text[2] = createText(connectionGroup, 2);
+ createLabel(connectionGroup, CommonMessages.idleTimeout, 2);
+ text[3] = createText(connectionGroup, 2);
+
+ // if edit a pool,the info must be filled into wizard
+ if (eObject != null && ExtModule.class.isInstance(eObject)) {
+ ExtModule extModule = (ExtModule) eObject;
+ try {
+ ConnectiondefinitionInstance conndefInstance = ((JAXBElement<Connector>) extModule
+ .getAny()).getValue().getResourceadapter().get(0)
+ .getOutboundResourceadapter()
+ .getConnectionDefinition().get(0)
+ .getConnectiondefinitionInstance().get(0);
+
+ Connectionmanager connManager = conndefInstance
+ .getConnectionmanager();
+ if (connManager.getXaTransaction() != null) {
+ combo.select(0);
+ } else if (connManager.getLocalTransaction() != null) {
+ combo.select(1);
+ } else if (connManager.getNoTransaction() != null) {
+ combo.select(2);
+ }
+ Singlepool singlepool = connManager.getSinglePool();
+ if (singlepool != null) {
+ text[0].setText(singlepool.getMaxSize() == null ? ""
+ : singlepool.getMaxSize().toString());
+ text[1].setText(singlepool.getMinSize() == null ? ""
+ : singlepool.getMinSize().toString());
+ text[2].setText(singlepool
+ .getBlockingTimeoutMilliseconds() == null ? ""
+ : singlepool.getBlockingTimeoutMilliseconds()
+ .toString());
+ text[3]
+ .setText(singlepool.getIdleTimeoutMinutes() == null ? ""
+ : singlepool.getIdleTimeoutMinutes()
+ .toString());
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ setControl(composite);
+
+ }
+
+ protected Group createGroup(Composite composite, String value, int span) {
+ Group group = new Group(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 4;
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalSpan = span;
+ group.setLayout(layout);
+ group.setLayoutData(data);
+ group.setText(value);
+ return group;
+ }
+
+ protected Label createLabel(Composite composite, String value, int span) {
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(value);
+ GridData labelData = new GridData();
+ labelData.horizontalAlignment = GridData.FILL;
+ labelData.horizontalSpan = span;
+ label.setLayoutData(labelData);
+ return label;
+ }
+
+ protected Text createText(Composite composite, int span) {
+ Text text = new Text(composite, SWT.BORDER);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ textData.grabExcessHorizontalSpace = true;
+ textData.widthHint = 100;
+ textData.horizontalSpan = span;
+ text.setLayoutData(textData);
+ return text;
+ }
+
+ @Override
+ protected String getWizardPageDescription() {
+ return "";
+ }
+
+ @Override
+ protected String getWizardPageTitle() {
+ return "";
+ }
+
+ }
+
+}
+
+class DriverDialog extends Dialog {
+
+ String data[] = new String[4];
+ Text text[] = new Text[4];
+
+ public DriverDialog(Shell parent) {
+ super(parent);
+ }
+
+ public Dependency getDependency() {
+ if (data[0].trim().length() == 0 || data[1].trim().length() == 0
+ || data[2].trim().length() == 0 || data[3].trim().length() == 0) {
+ return null;
+ }
+ Dependency dependency = new Dependency();
+ dependency.setGroupId(data[0]);
+ dependency.setArtifactId(data[1]);
+ dependency.setVersion(data[2]);
+ dependency.setType(data[3]);
+ return dependency;
+ }
+
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ data.widthHint = 300;
+ composite.setLayoutData(data);
+
+ createLabel(composite, CommonMessages.groupId, 2);
+ text[0] = createText(composite, 2);
+ createLabel(composite, CommonMessages.artifactId, 2);
+ text[1] = createText(composite, 2);
+ createLabel(composite, CommonMessages.version, 2);
+ text[2] = createText(composite, 2);
+ createLabel(composite, CommonMessages.artifactType, 2);
+ text[3] = createText(composite, 2);
+
+ createButtonBar(parent);
+
+ return composite;
+ }
+
+ protected void okPressed() {
+ for (int i = 0; i < text.length; i++) {
+ data[i] = text[i].getText();
+ }
+ super.okPressed();
+ }
+
+ protected Label createLabel(Composite composite, String value, int span) {
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(value);
+ GridData labelData = new GridData();
+ labelData.horizontalAlignment = GridData.FILL;
+ labelData.horizontalSpan = span;
+ label.setLayoutData(labelData);
+ return label;
+ }
+
+ protected Text createText(Composite composite, int span) {
+ Text text = new Text(composite, SWT.BORDER);
+ GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_FILL);
+ textData.grabExcessHorizontalSpace = true;
+ textData.widthHint = 100;
+ textData.horizontalSpan = span;
+ text.setLayoutData(textData);
+ return text;
+ }
+
+}
+
+/**
+ * Needn't it, so comment it.
+ */
+/*
+ * class PlanWizard extends Wizard {
+ *
+ * String plan;
+ *
+ * protected ImageDescriptor descriptor = Activator.imageDescriptorFromPlugin(
+ * "org.apache.geronimo.st.ui", "icons/bigG.gif");
+ *
+ * public PlanWizard(String plan) { setWindowTitle("Plan Wizard"); this.plan =
+ * plan; }
+ *
+ * public void addPages() { PlanWizardPage page1 = new PlanWizardPage("Plan",
+ * plan); page1.setImageDescriptor(descriptor); addPage(page1);
+ *
+ * }
+ *
+ * public boolean performFinish() { // =============to
+ * remove==========================================
+ * System.out.println("To Deploy The Plan!======================");
+ * System.out.println(plan); //
+ * ================================================================ return true;
+ * }
+ *
+ * public class PlanWizardPage extends WizardPage {
+ *
+ * String plan;
+ *
+ * protected PlanWizardPage(String pageName, String plan) { super(pageName);
+ * this.plan = plan; setTitle("Plan"); setDescription("Edit plan to Deploy"); }
+ *
+ * public void createControl(Composite parent) { Composite composite = new
+ * Composite(parent, SWT.NULL); GridLayout layout = new GridLayout();
+ * layout.numColumns = 2; composite.setLayout(layout); GridData data = new
+ * GridData(); data.verticalAlignment = GridData.FILL; data.horizontalAlignment
+ * = GridData.FILL; data.widthHint = 300; composite.setLayoutData(data);
+ *
+ * Text text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL |
+ * SWT.V_SCROLL); GridData textData = new GridData(); textData.widthHint = 600;
+ * textData.heightHint = 400; text.setLayoutData(textData); text.setText(plan);
+ *
+ * setControl(composite);
+ *
+ * }
+ *
+ * }
+ *
+ * }
+ */
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ExtModuleWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ExtModuleWizard.java?rev=815191&r1=815190&r2=815191&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ExtModuleWizard.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ExtModuleWizard.java Tue Sep 15 07:21:53 2009
@@ -270,14 +270,10 @@
if (eObject == null) {
eObject = getEFactory().create(ExtModule.class);
JAXBElement plan = section.getPlan();
-
extModule = (ExtModule)eObject;
-
- List extModuleList = ((Application)plan.getValue()).getExtModule();
- if (extModuleList == null) {
- extModuleList = (List)getEFactory().create(ExtModule.class);
- }
- extModuleList.add(eObject);
+ //This is the extModule field in plan(Application Type)
+ List<ExtModule> extModuleList = ((Application)plan.getValue()).getExtModule();
+ extModuleList.add(extModule);
}
else {
extModule = (ExtModule)eObject;