*** empty log message ***
diff --git a/plugins/org.eclipse.jst.server.generic.core/plugin.xml b/plugins/org.eclipse.jst.server.generic.core/plugin.xml
index 4323f76..9ee1bb8 100644
--- a/plugins/org.eclipse.jst.server.generic.core/plugin.xml
+++ b/plugins/org.eclipse.jst.server.generic.core/plugin.xml
@@ -16,12 +16,12 @@
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources" />
- <import plugin="org.eclipse.debug.core" />
- <import plugin="org.eclipse.jdt.core" />
- <import plugin="org.eclipse.jdt.launching" />
- <import plugin="org.eclipse.wst.server.core" />
- <import plugin="org.eclipse.jst.server.core" />
+ <import plugin="org.eclipse.core.resources" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.debug.core" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.jdt.core" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.jdt.launching" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.wst.server.core" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.jst.server.core" version="3.0.0" match="equivalent"/>
<import plugin="org.eclipse.debug.ui"/>
<import plugin="org.eclipse.ant.core"/>
<import plugin="org.eclipse.ant.ui"/>
@@ -78,13 +78,15 @@
monitorable="true"
name="J2EE Generic server support"
launchModes="run,debug"
- configurationTypeId="org.eclipse.jst.server.generic">
+ configurationTypeId="org.eclipse.jst.server.generic.configuration"
+ >
+
</serverType>
</extension>
<extension point="org.eclipse.wst.server.core.serverConfigurationTypes">
<serverConfigurationType
- id="org.eclipse.jst.server.generic"
+ id="org.eclipse.jst.server.generic.configuration"
name="J2EE Generic server configuration"
description="Lomboz like server configuration"
isFolder="true"
diff --git a/plugins/org.eclipse.jst.server.generic.ui/plugin.xml b/plugins/org.eclipse.jst.server.generic.ui/plugin.xml
index 7ec5282..a3a3a82 100644
--- a/plugins/org.eclipse.jst.server.generic.ui/plugin.xml
+++ b/plugins/org.eclipse.jst.server.generic.ui/plugin.xml
@@ -17,11 +17,11 @@
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.wst.server.ui"/>
- <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.debug.ui"/>
<import plugin="org.eclipse.jdt.debug.ui"/>
<import plugin="org.eclipse.jst.server.generic.core"/>
- <import plugin="org.eclipse.wst.server.core" />
- <import plugin="org.eclipse.jst.server.core" />
+ <import plugin="org.eclipse.wst.server.core" version="3.0.0" match="equivalent"/>
+ <import plugin="org.eclipse.jst.server.core" version="3.0.0" match="equivalent"/>
</requires>
<extension
@@ -29,9 +29,16 @@
<fragment
id="org.eclipse.jst.server.generic.runtime"
typeIds="org.eclipse.jst.server.generic.runtime"
- class="org.eclipse.jst.server.generic.internal.ui.GenericServerWizardFragment"/>
+ class="org.eclipse.jst.server.generic.internal.ui.GenericServerRuntimeWizardFragment"/>
</extension>
+<!-- <extension
+ point="org.eclipse.wst.server.ui.wizardFragments">
+ <fragment
+ id="org.eclipse.jst.server.generic.server"
+ typeIds="org.eclipse.jst.server.generic.configuration"
+ class="org.eclipse.jst.server.generic.internal.ui.GenericServerWizardFragment"/>
+ </extension>-->
<extension point="org.eclipse.wst.server.ui.editorPages">
<page
id="org.eclipse.jst.server.generic.configuration.editor.webmodule"
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/GenericServerRuntimeWizardFragment.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/GenericServerRuntimeWizardFragment.java
new file mode 100644
index 0000000..7fd8a7d
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/GenericServerRuntimeWizardFragment.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2004 Eteration Bilisim A.S.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Gorkem Ercan - initial API and implementation
+ * Naci M. Dai
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Eteration Bilisim A.S. For more
+ * information on eteration, please see
+ * <http://www.eteration.com/>.
+ ***************************************************************************/
+package org.eclipse.jst.server.generic.internal.ui;
+
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jst.server.generic.internal.core.GenericServerRuntime;
+import org.eclipse.jst.server.generic.internal.xml.ServerTypeDefinition;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.wst.server.core.IElement;
+import org.eclipse.wst.server.core.IResourceManager;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.ITaskModel;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+
+/**
+ * A serverDefinitionType aware wizard for defining runtimes.
+ *
+ * @author Gorkem Ercan
+ */
+public class GenericServerRuntimeWizardFragment extends ServerDefinitionTypeAwareWizardFragment {
+
+ private Group selectionBar;
+ private Combo fServerCombo;
+ private ServerTypeDefinitionGroup fServerPanel;
+ private IRuntimeWorkingCopy fRuntimeWC;
+
+ /**
+ * Constructor
+ */
+ public GenericServerRuntimeWizardFragment() {
+ super();
+ }
+ /* (non-Javadoc)
+ * @see com.ibm.wtp.server.ui.wizard.IWizardFragment#isComplete()
+ */
+ public boolean isComplete() {
+ IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_RUNTIME);
+ if (runtime == null)
+ return false;
+ IStatus status = runtime.validate();
+ return (status != null && status.isOK());
+ }
+
+ public void createContent(Composite parent, IWizardHandle handle) {
+ fRuntimeWC=null;
+ createSelectionBar(parent);
+ createServerDefinitionTypeComposite(parent);
+ }
+
+
+ private void swapBody()
+ {
+ String selected = fServerCombo == null ? null : fServerCombo
+ .getItem(fServerCombo.getSelectionIndex());
+ if (getServerDefinitionId() != null)
+ selected = getServerDefinitionId();
+ Map properties = null;
+ if (getRuntimeWorkingCopy() != null)
+ properties = getRuntimeWorkingCopy()
+ .getAttribute(
+ GenericServerRuntime.SERVER_INSTANCE_PROPERTIES,
+ (Map) null);
+ ServerTypeDefinition definition = getServerTypeDefinition(selected,
+ properties);
+
+ fServerPanel.reset(definition,
+ ServerTypeDefinitionGroup.CONTEXT_RUNTIME, properties);
+ }
+ /**
+ * @param selected
+ */
+ private void createServerDefinitionTypeComposite(Composite parent) {
+ String selected = fServerCombo==null?null:fServerCombo.getItem(fServerCombo.getSelectionIndex());
+ if(getServerDefinitionId()!=null)
+ selected=getServerDefinitionId();
+ Map properties= null;
+ if(getRuntimeWorkingCopy()!=null)
+ properties = getRuntimeWorkingCopy().getAttribute(GenericServerRuntime.SERVER_INSTANCE_PROPERTIES,(Map)null);
+ ServerTypeDefinition definition = getServerTypeDefinition(selected,properties);
+ fServerPanel = new ServerTypeDefinitionGroup(definition,ServerTypeDefinitionGroup.CONTEXT_RUNTIME,properties,parent,SWT.NONE);
+ }
+ private void createSelectionBar(Composite content) {
+ selectionBar = new Group(content, SWT.SHADOW_ETCHED_IN);
+ selectionBar.setLayout(new GridLayout(2,false));
+ selectionBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label label = new Label(selectionBar, SWT.NONE);
+ label.setText("Server types:");
+ label.setLayoutData(new GridData());
+ fServerCombo = new Combo(selectionBar, SWT.BORDER |SWT.READ_ONLY);
+ ServerTypeDefinition[] servers = getAllServerDefinitionTypes();
+ for(int i=0; i<servers.length; i++){
+ fServerCombo.add(servers[i].getName());
+ }
+ fServerCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ if(fServerCombo.getItemCount()>0)
+ fServerCombo.select(0);
+
+ fServerCombo.addSelectionListener(
+ new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ swapBody();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {}
+ }
+ );
+ }
+
+
+ private String getServerDefinitionId()
+ {
+ String currentDefinition= null;
+ if(getRuntimeWorkingCopy()!=null)
+ currentDefinition = getRuntimeWorkingCopy().getAttribute(GenericServerRuntime.SERVER_DEFINITION_ID,"");
+ if(currentDefinition!= null && currentDefinition.length()>0)
+ {
+ return currentDefinition;
+ }
+ return null;
+ }
+
+ private void selectServerDefinition()
+ {
+ String currentDefinition = getServerDefinitionId();
+ int selectIndex = 0;
+ if(currentDefinition != null)
+ {
+ selectIndex = fServerCombo.indexOf(currentDefinition);
+ if(selectIndex<0)
+ selectIndex =0;
+ }
+ fServerCombo.select(selectIndex);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.ui.wizard.IWizardFragment#enter()
+ */
+ public void enter() {
+ String serverDefinition = getServerDefinitionId();
+ if(serverDefinition!=null && serverDefinition.length()>0)
+ {
+ selectServerDefinition();
+ swapBody();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.ui.wizard.IWizardFragment#exit()
+ */
+ public void exit() {
+ String selected = fServerCombo.getItem(fServerCombo.getSelectionIndex());
+ Map properties = fServerPanel.getProperties();
+ IRuntimeWorkingCopy wc = getRuntimeWorkingCopy();
+
+ wc.setAttribute(GenericServerRuntime.SERVER_DEFINITION_ID, selected);
+ wc.setAttribute(GenericServerRuntime.SERVER_INSTANCE_PROPERTIES,properties);
+ wc.setName(createName());
+ fRuntimeWC=null;
+ }
+ private String createName()
+ {
+ String selected = fServerCombo.getItem(fServerCombo.getSelectionIndex());
+ IRuntimeWorkingCopy wc = getRuntimeWorkingCopy();
+ IRuntimeType runtimeType = wc.getRuntimeType();
+ String name = selected+" ("+runtimeType.getName()+")";
+
+ IResourceManager rm = ServerCore.getResourceManager();
+ List list = rm.getRuntimes(runtimeType);
+ Iterator iterator = list.iterator();
+ int suffix = 1;
+ String suffixName=name;
+ while(iterator.hasNext())
+ {
+
+ IElement el = (IElement)iterator.next();
+ if(el.getName().equals(name)|| el.getName().equals(suffixName))
+ suffix++;
+ suffixName= name+" "+suffix;
+ }
+
+ if(suffix>1)
+ return suffixName;
+ return name;
+ }
+
+ private IRuntimeWorkingCopy getRuntimeWorkingCopy()
+ {
+ if(fRuntimeWC == null)
+ fRuntimeWC = (IRuntimeWorkingCopy)getTaskModel().getObject(ITaskModel.TASK_RUNTIME);
+ return fRuntimeWC;
+ }
+}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/GenericServerWizardFragment.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/GenericServerWizardFragment.java
index 85468d8..3d0c6c0 100644
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/GenericServerWizardFragment.java
+++ b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/GenericServerWizardFragment.java
@@ -30,236 +30,66 @@
***************************************************************************/
package org.eclipse.jst.server.generic.internal.ui;
-
import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jst.server.generic.core.CorePlugin;
import org.eclipse.jst.server.generic.internal.core.GenericServerRuntime;
import org.eclipse.jst.server.generic.internal.xml.ServerTypeDefinition;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IServerConfigurationWorkingCopy;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ITaskModel;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-
/**
- * A serverDefinitionType aware wizard for defining runtimes.
*
+ *
* @author Gorkem Ercan
*/
-public class GenericServerWizardFragment extends WizardFragment {
-
- private Group selectionBar;
- private Combo fServerCombo;
- private Composite propertyBody;
- private Composite fContent;
- private ServerRuntimePropertyComposite fServerPanel;
- private IRuntimeWorkingCopy fRuntimeWC;
-
- /**
- *
- */
- public GenericServerWizardFragment() {
- super();
- }
+public class GenericServerWizardFragment extends ServerDefinitionTypeAwareWizardFragment
+{
+
+ private ServerTypeDefinitionGroup fComposite;
+ private boolean flag=false;
/* (non-Javadoc)
* @see com.ibm.wtp.server.ui.wizard.IWizardFragment#isComplete()
*/
public boolean isComplete() {
- IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(ITaskModel.TASK_RUNTIME);
- if (runtime == null)
- return false;
- IStatus status = runtime.validate();
- return (status != null && status.isOK());
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.wizard.IWizardFragment#createComposite(org.eclipse.swt.widgets.Composite, org.eclipse.wst.server.ui.wizard.IWizardHandle)
- */
- public Composite createComposite(Composite parent, IWizardHandle handle) {
+// IServerWorkingCopy serverWorkingCopy = (IServerWorkingCopy)getTaskModel().getObject(ITaskModel.TASK_SERVER);
- fRuntimeWC=null;
- fContent = createContainer(parent);
- createSelectionBar(fContent);
- createBody(fContent);
- return fContent;
+ //TODO implement
+ return flag;
}
-
- private void swapBody(Composite content) {
- content.layout(true);
- if(propertyBody!=null)
- {
- propertyBody.dispose();
- propertyBody=null;
- }
- propertyBody = new Composite(content, SWT.NONE);
- propertyBody.setLayout(new GridLayout(1,true));
- propertyBody.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
- String selected = fServerCombo.getItem(fServerCombo.getSelectionIndex());
- if(getServerDefinitionId()!=null&& getServerDefinitionId().equals(selected))
- {
- fServerPanel = new ServerRuntimePropertyComposite(getRuntimeWorkingCopy(),propertyBody,SWT.NONE);
- }
- else
- {
- fServerPanel = new ServerRuntimePropertyComposite(selected,propertyBody,SWT.NONE);
- }
- propertyBody.layout(true);
- propertyBody.setRedraw(true);
- content.redraw();
- content.pack(true);
-
- }
-
-
- private void createBody(Composite content) {
-// ScrolledComposite scrolls = new ScrolledComposite(content, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SHADOW_ETCHED_IN);
-// scrolls.setAlwaysShowScrollBars(true);
-// scrolls.setLayoutData(new GridData(GridData.FILL_BOTH));
-// scrolls.setLayout(new GridLayout(1,false));
-// Composite c= new Composite(scrolls,SWT.NONE);
-// scrolls.setContent(c);
-// c.setLayoutData(new GridData(GridData.FILL_BOTH));
-// c.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_RED));
-//
-// Button b = new Button(c,SWT.CHECK);
-// b.setText("My marvelous button");
-// scrolls.setMinSize(c.computeSize(SWT.DEFAULT,SWT.DEFAULT));
-
- propertyBody = new Composite(content, SWT.NONE);
- propertyBody.setLayout(new GridLayout(1,true));
- propertyBody.setLayoutData(new GridData(GridData.FILL_BOTH));
- if(getServerDefinitionId()==null)
- {
- String selected = fServerCombo.getItem(fServerCombo.getSelectionIndex());
- fServerPanel = new ServerRuntimePropertyComposite(selected,propertyBody,SWT.NONE);
- }
- else
- {
- fServerPanel = new ServerRuntimePropertyComposite(getRuntimeWorkingCopy(),propertyBody,SWT.NONE);
- }
- propertyBody.layout(true);
- propertyBody.setRedraw(true);
- content.redraw();
- content.layout(true);
- }
-
- private void createSelectionBar(Composite content) {
- selectionBar = new Group(content, SWT.NONE);
- selectionBar.setLayout(new GridLayout(2,false));
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- selectionBar.setLayoutData(gridData);
- Label label = new Label(selectionBar, SWT.NONE);
- label.setText("Server types:");
- label.setLayoutData(new GridData());
- fServerCombo = new Combo(selectionBar, SWT.BORDER |SWT.READ_ONLY);
- ServerTypeDefinition[] servers = CorePlugin.getDefault().getServerTypeDefinitionManager().getServerTypeDefinitions();
- for(int i=0; i<servers.length; i++){
- fServerCombo.add(servers[i].getName());
- }
- fServerCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- if(fServerCombo.getItemCount()>0)
- fServerCombo.select(0);
-
- fServerCombo.addSelectionListener(
- new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
-
- swapBody(fContent);
-
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {}
- }
- );
- }
-
-
- private String getServerDefinitionId()
+ public void createContent(Composite parent, IWizardHandle handle)
{
- String currentDefinition= null;
- if(getRuntimeWorkingCopy()!=null)
- currentDefinition = getRuntimeWorkingCopy().getAttribute(GenericServerRuntime.SERVER_DEFINITION_ID,"");
- if(currentDefinition!= null && currentDefinition.length()>0)
- {
- return currentDefinition;
- }
- return null;
+ createBody(parent,handle);
}
-
- private void selectServerDefinition()
- {
- String currentDefinition = getServerDefinitionId();
- int selectIndex = 0;
- if(currentDefinition != null)
- {
- selectIndex = fServerCombo.indexOf(currentDefinition);
- if(selectIndex<0)
- selectIndex =0;
- }
- fServerCombo.select(selectIndex);
- }
-
-
- private Composite createContainer(Composite parent) {
- Composite container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
-
- layout.numColumns = 1;
- layout.makeColumnsEqualWidth = false;
- layout.verticalSpacing=0;
- container.setLayout(layout);
- GridData gridData =
- new GridData(
- GridData.FILL_BOTH
- | GridData.GRAB_VERTICAL
- | GridData.GRAB_HORIZONTAL);
- container.setLayoutData(gridData);
- return container;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.wizard.IWizardFragment#enter()
+ /**
+ *
*/
+ private void createBody(Composite parent, IWizardHandle handle)
+ {
+ IServerWorkingCopy server = (IServerWorkingCopy)getTaskModel().getObject(ITaskModel.TASK_SERVER);
+ String ID = server.getRuntime().getAttribute(GenericServerRuntime.SERVER_DEFINITION_ID,(String)null);
+ Map runtimeProperties = server.getRuntime().getAttribute(GenericServerRuntime.SERVER_INSTANCE_PROPERTIES,(Map)null);
+ ServerTypeDefinition definition = getServerTypeDefinition(ID,runtimeProperties);
+ fComposite = new ServerTypeDefinitionGroup(definition,ServerTypeDefinitionGroup.CONTEXT_SERVER, null,parent,SWT.NONE);
+ flag=true;
+
+ }
+
public void enter() {
- String serverDefinition = getServerDefinitionId();
- if(serverDefinition!=null && serverDefinition.length()>0)
- {
- selectServerDefinition();
- swapBody(fContent);
- }
+ // TODO Auto-generated method stub
+ super.enter();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.wizard.IWizardFragment#exit()
- */
public void exit() {
- String selected = fServerCombo.getItem(fServerCombo.getSelectionIndex());
- Map properties = fServerPanel.getProperties();
- IRuntimeWorkingCopy wc = getRuntimeWorkingCopy();
- wc.setAttribute(GenericServerRuntime.SERVER_DEFINITION_ID, selected);
- wc.setAttribute(GenericServerRuntime.SERVER_INSTANCE_PROPERTIES,properties);
- fRuntimeWC=null;
- }
-
-
- private IRuntimeWorkingCopy getRuntimeWorkingCopy()
- {
- if(fRuntimeWC == null)
- fRuntimeWC = (IRuntimeWorkingCopy)getTaskModel().getObject(ITaskModel.TASK_RUNTIME);
- return fRuntimeWC;
- }
-
- public boolean hasComposite() {
- return true;
+ IServerConfigurationWorkingCopy serverConfigWorkingCopy = (IServerConfigurationWorkingCopy)getTaskModel().getObject(ITaskModel.TASK_SERVER_CONFIGURATION);
+ serverConfigWorkingCopy.setAttribute("lomboz",fComposite.getProperties());
+// try {
+// serverWorkingCopy.save(new NullProgressMonitor());
+// } catch (CoreException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+
}
}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerDefinitionTypeAwareWizardFragment.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerDefinitionTypeAwareWizardFragment.java
new file mode 100644
index 0000000..b30f4f9
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerDefinitionTypeAwareWizardFragment.java
@@ -0,0 +1,53 @@
+/*
+ * Created on Oct 19, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.eclipse.jst.server.generic.internal.ui;
+
+import java.util.Map;
+
+import org.eclipse.jst.server.generic.core.CorePlugin;
+import org.eclipse.jst.server.generic.internal.xml.ServerTypeDefinition;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+/**
+ *
+ *
+ * @author Gorkem Ercan
+ */
+public abstract class ServerDefinitionTypeAwareWizardFragment extends WizardFragment {
+
+ public boolean hasComposite() {
+ return true;
+ }
+
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+
+ Composite container = new Composite(parent, SWT.NONE);
+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout grid = new GridLayout(1,false);
+ container.setLayout(grid);
+ createContent(container,handle);
+ return container;
+ }
+
+ public abstract void createContent(Composite parent, IWizardHandle handle);
+
+ protected ServerTypeDefinition getServerTypeDefinition(String definitionID, Map properties)
+ {
+ return CorePlugin.getDefault().getServerTypeDefinitionManager().getServerRuntimeDefinition(definitionID,properties);
+ }
+
+ protected ServerTypeDefinition[] getAllServerDefinitionTypes()
+ {
+ return CorePlugin.getDefault().getServerTypeDefinitionManager().getServerTypeDefinitions();
+ }
+
+}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerRuntimePropertyComposite.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerRuntimePropertyComposite.java
deleted file mode 100644
index 5d4b62a..0000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerRuntimePropertyComposite.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 Eteration Bilisim A.S.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Gorkem Ercan - initial API and implementation
- * Naci M. Dai
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL ETERATION A.S. OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Eteration Bilisim A.S. For more
- * information on eteration, please see
- * <http://www.eteration.com/>.
- ***************************************************************************/
-package org.eclipse.jst.server.generic.internal.ui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.jst.server.generic.core.CorePlugin;
-import org.eclipse.jst.server.generic.internal.core.GenericServerRuntime;
-import org.eclipse.jst.server.generic.internal.core.ServerTypeDefinitionManager;
-import org.eclipse.jst.server.generic.internal.xml.ServerTypeDefinition;
-import org.eclipse.jst.server.generic.internal.xml.ServerTypeDefinitionProperty;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.DirectoryDialog;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-/**
- * A composite that renders ServerTypeDefinition.
- *
- * @author Gorkem Ercan
- */
-public class ServerRuntimePropertyComposite extends Composite
-{
- private ServerTypeDefinition fServerDefinition;
- private IRuntimeWorkingCopy fRuntime;
- private Map fPropertyMap =new HashMap();
- private List propertyControls = new ArrayList();
-
- public ServerRuntimePropertyComposite(String serverDefinitionId, Composite parent, int style)
- {
- super(parent,style);
- this.fServerDefinition = getServerTypeDefinitionManager().getServerRuntimeDefinition(serverDefinitionId);
- createControl(parent);
- }
-
- public ServerRuntimePropertyComposite(IRuntimeWorkingCopy runtime, Composite parent, int style)
- {
- super(parent,style);
- this.fRuntime = runtime;
- this.fServerDefinition = getServerTypeDefinitionManager().getServerRuntimeDefinition(runtime.getAttribute(GenericServerRuntime.SERVER_DEFINITION_ID,""));
- fPropertyMap = runtime.getAttribute(GenericServerRuntime.SERVER_INSTANCE_PROPERTIES,new HashMap());
- createControl(parent);
- }
-
- private ServerTypeDefinitionManager getServerTypeDefinitionManager()
- {
- return CorePlugin.getDefault().getServerTypeDefinitionManager();
- }
-
-
-
-
- /**
- *
- */
- private void createControl(Composite parent) {
-
- Group defPanel = new Group(parent, SWT.NONE);
- defPanel.setText(fServerDefinition.getName());
- GridLayout layout = new GridLayout(3, false);
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- defPanel.setLayout(layout);
-// gridData.widthHint = convertWidthInCharsToPixels(100);
- defPanel.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL| GridData.GRAB_HORIZONTAL));
- createPropertyControls(defPanel);
- defPanel.layout(true);
- defPanel.redraw();
- defPanel.pack(true);
-
-// parent.getShell().setSize(defPanel.getSize());
-// parent.setSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-// parent.layout(true);
-
-
- }
-
- public Map getProperties()
- {
- for(int i=0; i<propertyControls.size();i++)
- {
- if(propertyControls.get(i)instanceof Button)
- {
- Button button = (Button)propertyControls.get(i);
- ServerTypeDefinitionProperty prop = (ServerTypeDefinitionProperty)button.getData();
- fPropertyMap.put(prop.getId(),Boolean.toString(button.getSelection()));
- }
- else
- {
- Text text = (Text)propertyControls.get(i);
- ServerTypeDefinitionProperty prop = (ServerTypeDefinitionProperty)text.getData();
- fPropertyMap.put(prop.getId(),text.getText());
- }
- }
- return fPropertyMap;
- }
-
- private void createPropertyControls(Composite parent)
- {
- List properties = fServerDefinition.getProperties();
- for(int i = 0; i<properties.size(); i++)
- {
- createPropertyControl(parent,(ServerTypeDefinitionProperty)properties.get(i));
- }
- }
-
- private void createPropertyControl(Composite parent, ServerTypeDefinitionProperty property)
- {
- switch (property.getType()) {
- case ServerTypeDefinitionProperty.TYPE_DIRECTORY :
- Text path = createLabeledPath(property.getLabel(),getPropertyValue(property),parent);
- path.setData(property);
- propertyControls.add(path);
- break;
- case ServerTypeDefinitionProperty.TYPE_FILE :
- Text file = createLabeledFile(property.getLabel(),getPropertyValue(property),parent);
- file.setData(property);
- propertyControls.add(file);
- break;
- case ServerTypeDefinitionProperty.TYPE_STRING :
- Text str = createLabeledText(property.getLabel(),getPropertyValue(property),parent);
- str.setData(property);
- propertyControls.add(str);
- break;
- case ServerTypeDefinitionProperty.TYPE_BOOLEAN :
- Button bool =createLabeledCheck(property.getLabel(),("true".equals( getPropertyValue(property))), parent);
- bool.setData(property);
- propertyControls.add(bool);
- break;
- default :
- Text defaultText= createLabeledText(property.getLabel(),getPropertyValue(property),parent);
- defaultText.setData(property);
- propertyControls.add(defaultText);
- break;
- }
- }
- private String getPropertyValue(ServerTypeDefinitionProperty property)
- {
- String value = (String)fPropertyMap.get(property.getId());
- if(value==null)
- value=property.getDefaultValue();
- return value;
- }
-
- protected Text createLabeledText(String title, String value,
- Composite defPanel) {
- GridData gridData;
- Label label = new Label(defPanel, SWT.WRAP);
- gridData = new GridData();
- label.setLayoutData(gridData);
- label.setText(title);
-
- Text fText = new Text(defPanel, SWT.SHADOW_IN | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 2;
- fText.setLayoutData(gridData);
- fText.setText(value);
- return fText;
- }
-
- protected Button createLabeledCheck(String title, boolean value,
- Composite defPanel) {
- GridData gridData;
- Label label = new Label(defPanel, SWT.WRAP);
- gridData = new GridData();
- label.setLayoutData(gridData);
- label.setText(title);
-
- Button fButton = new Button(defPanel, SWT.CHECK);
- gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 2;
- fButton.setLayoutData(gridData);
- fButton.setSelection(value);
- return fButton;
- }
-
- protected Text createLabeledPath(String title, String value,
- Composite parent) {
- GridData gridData;
- Label label = new Label(parent, SWT.WRAP);
- gridData = new GridData();
- //gridData.horizontalSpan = 1;
- label.setLayoutData(gridData);
- label.setText(title);
-
- final Text fText = new Text(parent, SWT.SHADOW_IN | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 1;
- fText.setLayoutData(gridData);
- fText.setText(value);
- final String fpath = value;
- Button fButton = new Button(parent, SWT.PUSH);
- fButton.setText("...");
- fButton.setLayoutData(new GridData());
- fButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog dlg = new DirectoryDialog(getShell());
- dlg.setFilterPath(fText.getText());
- String res = dlg.open();
- if (res != null) {
- fText.setText(res);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- });
-
- return fText;
- }
-
-
- protected Text createLabeledFile(String title, String value,
- Composite defPanel) {
- GridData gridData;
- Label label = new Label(defPanel, SWT.WRAP);
- gridData = new GridData();
- //gridData.horizontalSpan = 1;
- label.setLayoutData(gridData);
- label.setText(title);
-
- final Text fText = new Text(defPanel, SWT.SHADOW_IN | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 1;
- fText.setLayoutData(gridData);
- fText.setText(value);
-
- Button fButton = new Button(defPanel, SWT.PUSH);
- fButton.setText("...");
- fButton.setLayoutData(new GridData());
- fButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- FileDialog dlg = new FileDialog(getShell());
- dlg.setFileName(fText.getText());
- String res = dlg.open();
- if (res != null) {
- fText.setText(res);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- });
-
- return fText;
- }
-
-
-
-
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerTypeDefinitionGroup.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerTypeDefinitionGroup.java
new file mode 100644
index 0000000..f52bfab
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/internal/ui/ServerTypeDefinitionGroup.java
@@ -0,0 +1,276 @@
+package org.eclipse.jst.server.generic.internal.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.jst.server.generic.internal.xml.ServerTypeDefinition;
+import org.eclipse.jst.server.generic.internal.xml.ServerTypeDefinitionProperty;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Renders a ServerTypeDefinion inside a Group.
+ *
+ * @author Gorkem Ercan
+ */
+public class ServerTypeDefinitionGroup
+{
+ public static final String CONTEXT_SERVER = ServerTypeDefinitionProperty.CONTEXT_SERVER;
+ public static final String CONTEXT_RUNTIME = ServerTypeDefinitionProperty.CONTEXT_RUNTIME;
+
+ private ServerTypeDefinition fServerTypeDefinition;
+ private List fPropertyControls = new ArrayList();
+ private Map fPropertyMap =new HashMap();
+ private String fContext="undefined";
+ private Group fDefinitionGroup;
+
+ /**
+ * Construct a composite for the given ServerTypeDefinition
+ *
+ * @param definition
+ * @param initialProperties initial values null means use default
+ * @param parent
+ * @param style
+ */
+ public ServerTypeDefinitionGroup(ServerTypeDefinition definition, String context, Map initialProperties, Composite parent, int style)
+ {
+ initServerTypeDefinition(definition,context,initialProperties);
+ createControl(parent);
+ }
+ private void initProperties(Map initialProperties)
+ {
+ if(initialProperties!= null)
+ this.fPropertyMap=initialProperties;
+ else
+ fPropertyMap=new HashMap();
+ }
+ /**
+ * Changes the values with the given ones. Renders the UI
+ * with the given new values.
+ *
+ * @param definition
+ * @param context
+ * @param initialProperties
+ */
+ public void reset(ServerTypeDefinition definition, String context, Map initialProperties)
+ {
+ initServerTypeDefinition(definition, context, initialProperties);
+ fDefinitionGroup.setText(definition.getName());
+ Control[] allControls = fDefinitionGroup.getChildren();
+ for(int i= 0; i<allControls.length;i++)
+ {
+ Control c = allControls[i];
+ c.dispose();
+ }
+ fPropertyControls.clear();
+ createPropertyControls(fDefinitionGroup);
+ fDefinitionGroup.layout(true);
+ }
+
+ /**
+ * @param definition
+ * @param context
+ * @param initialProperties
+ */
+ private void initServerTypeDefinition(ServerTypeDefinition definition, String context, Map initialProperties) {
+ fServerTypeDefinition = definition;
+ initProperties(initialProperties);
+ this.fContext = context;
+ }
+ /**
+ * @param parent
+ */
+ private void createControl(Composite parent) {
+
+ fDefinitionGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ fDefinitionGroup.setText(fServerTypeDefinition.getName());
+ fDefinitionGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+ fDefinitionGroup.setLayout(new GridLayout(3,false));
+ createPropertyControls(fDefinitionGroup);
+ }
+ /**
+ * @param defPanel
+ */
+ private void createPropertyControls(Composite definitionComposite) {
+ List properties = fServerTypeDefinition.getProperties();
+ for(int i = 0; i<properties.size(); i++)
+ {
+ ServerTypeDefinitionProperty property = (ServerTypeDefinitionProperty)properties.get(i);
+// if(this.fContext.equals(property.getContext()))
+ createPropertyControl(definitionComposite,property);
+ }
+
+ }
+
+ private void createPropertyControl(Composite parent, ServerTypeDefinitionProperty property)
+ {
+ switch (property.getType()) {
+ case ServerTypeDefinitionProperty.TYPE_DIRECTORY :
+ Text path = createLabeledPath(property.getLabel(),getPropertyValue(property),parent);
+ path.setData(property);
+ fPropertyControls.add(path);
+ break;
+ case ServerTypeDefinitionProperty.TYPE_FILE :
+ Text file = createLabeledFile(property.getLabel(),getPropertyValue(property),parent);
+ file.setData(property);
+ fPropertyControls.add(file);
+ break;
+ case ServerTypeDefinitionProperty.TYPE_STRING :
+ Text str = createLabeledText(property.getLabel(),getPropertyValue(property),parent);
+ str.setData(property);
+ fPropertyControls.add(str);
+ break;
+ case ServerTypeDefinitionProperty.TYPE_BOOLEAN :
+ Button bool =createLabeledCheck(property.getLabel(),("true".equals( getPropertyValue(property))), parent);
+ bool.setData(property);
+ fPropertyControls.add(bool);
+ break;
+ default :
+ Text defaultText= createLabeledText(property.getLabel(),getPropertyValue(property),parent);
+ defaultText.setData(property);
+ fPropertyControls.add(defaultText);
+ break;
+ }
+ }
+ private String getPropertyValue(ServerTypeDefinitionProperty property)
+ {
+ String value = property.getDefaultValue();
+ if(fPropertyMap!=null && fPropertyMap.isEmpty()==false)
+ value=(String)fPropertyMap.get(property.getId());
+ return value;
+ }
+ protected Button createLabeledCheck(String title, boolean value,
+ Composite defPanel) {
+ GridData gridData;
+ Label label = new Label(defPanel, SWT.WRAP);
+ gridData = new GridData();
+ label.setLayoutData(gridData);
+ label.setText(title);
+
+ Button fButton = new Button(defPanel, SWT.CHECK);
+ gridData = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.GRAB_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+ fButton.setLayoutData(gridData);
+ fButton.setSelection(value);
+ return fButton;
+ }
+ protected Text createLabeledFile(String title, String value,
+ Composite defPanel) {
+ GridData gridData;
+ Label label = new Label(defPanel, SWT.WRAP);
+ gridData = new GridData();
+ label.setLayoutData(gridData);
+ label.setText(title);
+
+ final Text fText = new Text(defPanel, SWT.SHADOW_IN | SWT.BORDER);
+ gridData = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.GRAB_HORIZONTAL);
+ gridData.horizontalSpan = 1;
+ fText.setLayoutData(gridData);
+ fText.setText(value);
+
+ Button fButton = new Button(defPanel, SWT.PUSH);
+ fButton.setText("...");
+ fButton.setLayoutData(new GridData());
+ fButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dlg = new FileDialog(fDefinitionGroup.getShell());
+ dlg.setFileName(fText.getText());
+ String res = dlg.open();
+ if (res != null) {
+ fText.setText(res);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ });
+
+ return fText;
+ }
+ protected Text createLabeledPath(String title, String value,
+ Composite parent) {
+ GridData gridData;
+ Label label = new Label(parent, SWT.WRAP);
+ gridData = new GridData();
+ label.setLayoutData(gridData);
+ label.setText(title);
+
+ final Text fText = new Text(parent, SWT.SHADOW_IN | SWT.BORDER);
+ gridData = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.GRAB_HORIZONTAL);
+ gridData.horizontalSpan = 1;
+ fText.setLayoutData(gridData);
+ fText.setText(value);
+ Button fButton = new Button(parent, SWT.PUSH);
+ fButton.setText("...");
+ fButton.setLayoutData(new GridData());
+ fButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dlg = new DirectoryDialog(fDefinitionGroup.getShell());
+ dlg.setFilterPath(fText.getText());
+ String res = dlg.open();
+ if (res != null) {
+ fText.setText(res);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ });
+
+ return fText;
+ }
+ protected Text createLabeledText(String title, String value,
+ Composite defPanel) {
+ GridData gridData;
+ Label label = new Label(defPanel, SWT.WRAP);
+ gridData = new GridData();
+ label.setLayoutData(gridData);
+ label.setText(title);
+
+ Text fText = new Text(defPanel, SWT.SHADOW_IN | SWT.BORDER);
+ gridData = new GridData(GridData.FILL_HORIZONTAL
+ | GridData.GRAB_HORIZONTAL);
+ gridData.horizontalSpan = 2;
+ fText.setLayoutData(gridData);
+ fText.setText(value);
+ return fText;
+ }
+ public Map getProperties()
+ {
+ for(int i=0; i<fPropertyControls.size();i++)
+ {
+ if(fPropertyControls.get(i)instanceof Button)
+ {
+ Button button = (Button)fPropertyControls.get(i);
+ ServerTypeDefinitionProperty prop = (ServerTypeDefinitionProperty)button.getData();
+ fPropertyMap.put(prop.getId(),Boolean.toString(button.getSelection()));
+ }
+ else
+ {
+ Text text = (Text)fPropertyControls.get(i);
+ ServerTypeDefinitionProperty prop = (ServerTypeDefinitionProperty)text.getData();
+ fPropertyMap.put(prop.getId(),text.getText());
+ }
+ }
+ return fPropertyMap;
+ }
+}