Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui')
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ExternalLaunchConfigurationTabGroup.java48
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericLaunchConfigurationTabGroup.java52
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerComposite.java34
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerCompositeDecorator.java31
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerRuntimeWizardFragment.java190
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerUIMessages.java47
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerUIMessages.properties27
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerWizardFragment.java184
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericUiPlugin.java98
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/InstallableRuntimeDecorator.java76
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/JRESelectDecorator.java158
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/SWTUtil.java431
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerDefinitionTypeAwareWizardFragment.java94
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionDecorator.java207
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionRuntimeDecorator.java53
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionServerDecorator.java53
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/editor/ServerPropertiesEditorSection.java370
-rw-r--r--plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/editor/UpdateServerPropertyOperation.java62
18 files changed, 0 insertions, 2215 deletions
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ExternalLaunchConfigurationTabGroup.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ExternalLaunchConfigurationTabGroup.java
deleted file mode 100644
index 748cbb7d8..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ExternalLaunchConfigurationTabGroup.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
-import org.eclipse.debug.ui.CommonTab;
-import org.eclipse.debug.ui.EnvironmentTab;
-import org.eclipse.debug.ui.ILaunchConfigurationDialog;
-import org.eclipse.debug.ui.ILaunchConfigurationTab;
-import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
-import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
-import org.eclipse.jst.server.generic.internal.core.util.ExtensionPointUtil;
-import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab;
-
-
-public class ExternalLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup{
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog, String)
- */
- public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[5];
- tabs[0] = new ServerLaunchConfigurationTab(getTypeIds());
- tabs[0].setLaunchConfigurationDialog(dialog);
- tabs[1] = new JavaArgumentsTab();
- tabs[1].setLaunchConfigurationDialog(dialog);
- tabs[2] = new SourceLookupTab();
- tabs[2].setLaunchConfigurationDialog(dialog);
- tabs[3] = new EnvironmentTab();
- tabs[3].setLaunchConfigurationDialog(dialog);
- tabs[4] = new CommonTab();
- tabs[4].setLaunchConfigurationDialog(dialog);
- setTabs(tabs);
- }
-
- private String[] getTypeIds()
- {
- return ExtensionPointUtil.getServerTypesFromLaunchConfig( "org.eclipse.jst.server.generic.core.ExternalLaunchConfigurationType" ); //$NON-NLS-1$
- }
-
-
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericLaunchConfigurationTabGroup.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericLaunchConfigurationTabGroup.java
deleted file mode 100644
index aeeae673b..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericLaunchConfigurationTabGroup.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
-import org.eclipse.debug.ui.CommonTab;
-import org.eclipse.debug.ui.EnvironmentTab;
-import org.eclipse.debug.ui.ILaunchConfigurationDialog;
-import org.eclipse.debug.ui.ILaunchConfigurationTab;
-import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
-import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
-import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
-import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
-import org.eclipse.jst.server.generic.internal.core.util.ExtensionPointUtil;
-import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab;
-
-
-public class GenericLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup{
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog, String)
- */
- public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[7];
- tabs[0] = new ServerLaunchConfigurationTab(getTypeIds());
- tabs[0].setLaunchConfigurationDialog(dialog);
- tabs[1] = new JavaArgumentsTab();
- tabs[1].setLaunchConfigurationDialog(dialog);
- tabs[2] = new JavaClasspathTab();
- tabs[2].setLaunchConfigurationDialog(dialog);
- tabs[3] = new SourceLookupTab();
- tabs[3].setLaunchConfigurationDialog(dialog);
- tabs[4] = new EnvironmentTab();
- tabs[4].setLaunchConfigurationDialog(dialog);
- tabs[5] = new JavaJRETab();
- tabs[5].setLaunchConfigurationDialog(dialog);
- tabs[6] = new CommonTab();
- tabs[6].setLaunchConfigurationDialog(dialog);
- setTabs(tabs);
- }
-
- private String[] getTypeIds() {
- return ExtensionPointUtil.getServerTypesFromLaunchConfig( "org.eclipse.jst.server.generic.core.launchConfigurationType" ); //$NON-NLS-1$ }
-
- }
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerComposite.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerComposite.java
deleted file mode 100644
index 699369bd6..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerComposite.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-public class GenericServerComposite extends Composite {
-
- private GenericServerCompositeDecorator[] fDecorators;
- public GenericServerComposite(Composite parent, GenericServerCompositeDecorator[] decorators) {
- super(parent, SWT.NONE);
- fDecorators = decorators;
- GridLayout layout =new GridLayout(3,false);
- setLayout(layout);
- setLayoutData(new GridData(GridData.FILL_BOTH));
- createControl();
- }
-
- private void createControl(){
- for (int i = 0; fDecorators!= null && i < fDecorators.length; i++) {
- fDecorators[i].decorate(this);
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerCompositeDecorator.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerCompositeDecorator.java
deleted file mode 100644
index 2f238c69d..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerCompositeDecorator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-
-/**
- *
- * @author Gorkem Ercan
- */
-public interface GenericServerCompositeDecorator
-{
- /**
- *
- * @param composite
- */
- public abstract void decorate(GenericServerComposite composite);
- /**
- * Called if all the fields are valid. This gives subclasses opportunity to
- * validate and take necessary actions.
- *
- * @return boolean
- */
- public abstract boolean validate();
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerRuntimeWizardFragment.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerRuntimeWizardFragment.java
deleted file mode 100644
index 0a7399673..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerRuntimeWizardFragment.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import java.util.Map;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jst.server.generic.core.internal.GenericServerRuntime;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.core.internal.IInstallableRuntime;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.model.RuntimeDelegate;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-/**
- * A serverDefinitionType aware wizard for defining runtimes.
- *
- * @author Gorkem Ercan
- */
-public class GenericServerRuntimeWizardFragment extends
- ServerDefinitionTypeAwareWizardFragment {
-
- private GenericServerCompositeDecorator[] fDecorators;
-
- /**
- * Constructor
- */
- public GenericServerRuntimeWizardFragment() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.ui.wizard.IWizardFragment#isComplete()
- */
- public boolean isComplete() {
- RuntimeDelegate runtime = getRuntimeDelegate();
- if( runtime == null )
- return false;
- IStatus status = runtime.validate();
- return (status != null && status.isOK());
- }
-
- public void createContent( Composite parent, IWizardHandle handle ) {
- Map properties = null;
- ServerRuntime definition = null;
- if( getRuntimeDelegate() != null )
- {
- properties = getRuntimeDelegate().getServerInstanceProperties();
- definition = getServerTypeDefinition( getServerDefinitionId(),
- properties );
- }
- IInstallableRuntime ir = ServerPlugin
- .findInstallableRuntime( getRuntimeDelegate().getRuntime()
- .getRuntimeType().getId() );
- if( ir != null )
- {
- fDecorators = new GenericServerCompositeDecorator[3];
- fDecorators[0] = new JRESelectDecorator( getRuntimeDelegate(), getWizard() );
- fDecorators[1] = new ServerTypeDefinitionRuntimeDecorator(
- definition, properties, getWizard(), getRuntimeDelegate() );
- fDecorators[2] = new InstallableRuntimeDecorator( getWizard(),
- getRuntimeDelegate() );
- } else
- {
- fDecorators = new GenericServerCompositeDecorator[2];
- fDecorators[0] = new JRESelectDecorator( getRuntimeDelegate(), getWizard() );
- fDecorators[1] = new ServerTypeDefinitionRuntimeDecorator(
- definition, properties, getWizard(), getRuntimeDelegate() );
- }
-
- new GenericServerComposite( parent, fDecorators );
- }
-
- private String getServerDefinitionId() {
- String currentDefinition = null;
- if( getRuntimeDelegate() != null )
- currentDefinition = getRuntimeDelegate().getRuntime()
- .getRuntimeType().getId();
- if( currentDefinition != null && currentDefinition.length() > 0 )
- {
- return currentDefinition;
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.server.ui.wizard.IWizardFragment#enter()
- */
- public void enter() {
- if( getRuntimeDelegate() != null )
- getRuntimeDelegate().getRuntimeWorkingCopy().setName( createName() );
-
- for( int i = 0; i < fDecorators.length; i++ )
- {
- if( fDecorators[i].validate() )//failed do not continue
- return;
- }
- }
-
- public void exit() {
- // validate to save latest values
- for( int i = 0; i < fDecorators.length; i++ )
- {
- if( fDecorators[i].validate() )//failed do not continue
- return;
- }
- }
-
- private String createName() {
- RuntimeDelegate dl = getRuntimeDelegate();
- IRuntimeType runtimeType = dl.getRuntime().getRuntimeType();
- String name = GenericServerUIMessages.bind(
- GenericServerUIMessages.runtimeName, runtimeType.getName() );
- IRuntime[] list = ServerCore.getRuntimes();
- int suffix = 1;
- String suffixName = name;
- for( int i = 0; i < list.length; i++ )
- {
- if( (list[i].getName().equals( name ) || list[i].getName().equals(
- suffixName ))
- && !list[i].equals( dl.getRuntime() ) )
- suffix++;
- suffixName = name + ' ' + suffix;
- }
-
- if( suffix > 1 )
- return suffixName;
- return name;
- }
-
- private GenericServerRuntime getRuntimeDelegate() {
- IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) getTaskModel()
- .getObject( TaskModel.TASK_RUNTIME );
- if( wc == null )
- return null;
- return (GenericServerRuntime) wc.loadAdapter(
- GenericServerRuntime.class, new NullProgressMonitor() );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.server.generic.internal.ui.ServerDefinitionTypeAwareWizardFragment#description()
- */
- public String description() {
- String rName = getRuntimeName();
- if( rName == null || rName.length() < 1 )
- rName = "Generic"; //$NON-NLS-1$
- return GenericServerUIMessages.bind(
- GenericServerUIMessages.runtimeWizardDescription, rName );
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.server.generic.internal.ui.ServerDefinitionTypeAwareWizardFragment#title()
- */
- public String title() {
- String rName = getRuntimeName();
- if( rName == null || rName.length() < 1 )
- rName = "Generic"; //$NON-NLS-1$
- return GenericServerUIMessages.bind(
- GenericServerUIMessages.runtimeWizardTitle, rName );
- }
-
- private String getRuntimeName() {
- if( getRuntimeDelegate() != null
- && getRuntimeDelegate().getRuntime() != null )
- return getRuntimeDelegate().getRuntime().getName();
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerUIMessages.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerUIMessages.java
deleted file mode 100644
index 11f6c252e..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerUIMessages.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Helper class to get messages
- *
- * @author Gorkem Ercan
- */
-public class GenericServerUIMessages extends NLS{
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.jst.server.generic.ui.internal.GenericServerUIMessages";//$NON-NLS-1$
- public static String ServerEditorSectionDescription;
- public static String ServerEditorSectionTitle;
- public static String serverRunningCanNotSave;
- public static String serverTypeGroup_label_browse;
- public static String runtimeName;
- public static String runtimeWizardDescription;
- public static String runtimeWizardTitle;
- public static String serverName;
- public static String serverWizardDescription;
- public static String serverWizardTitle;
- public static String installed_jre_link;
- public static String jre_select_label;
- public static String defaultJRE;
- public static String invalidPath;
- public static String installServerButton;
- public static String installationDirectory;
-
- static{
- NLS.initializeMessages(RESOURCE_BUNDLE, GenericServerUIMessages.class);
- }
-
- public static String emptyPath;
- public static String UpdateOperationDescription;
-
-
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerUIMessages.properties b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerUIMessages.properties
deleted file mode 100644
index 99174c1ea..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerUIMessages.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-##################################################################################################
-# Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
-# accompanying materials are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors: Gorkem Ercan - initial API and implementation
-#
-###################################################################################################
-serverWizardTitle=New {0} Server
-serverWizardDescription=Create a new {0} server
-serverRunningCanNotSave=The server must be stopped before a change to the settings can be saved.
-runtimeWizardTitle=New {0} Runtime
-runtimeWizardDescription=Define a new {0} runtime
-serverTypeGroup_label_browse=Browse...
-serverName = {0}
-runtimeName= {0}
-installed_jre_link = You can use <a>Installed JRE preferences</a> to create a new JRE
-installServerButton=Install Server
-installationDirectory=Select installation directory
-jre_select_label= &JRE:
-defaultJRE = Default JRE
-invalidPath = {0} is not valid
-emptyPath=Specify a valid path
-ServerEditorSectionTitle=Server Properties
-ServerEditorSectionDescription=Modify settings for the server.
-UpdateOperationDescription=Update generic server property
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerWizardFragment.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerWizardFragment.java
deleted file mode 100644
index c3aaf56b9..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericServerWizardFragment.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jst.server.generic.core.internal.GenericServer;
-import org.eclipse.jst.server.generic.core.internal.GenericServerRuntime;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-/**
- *
- *
- * @author Gorkem Ercan
- */
-public class GenericServerWizardFragment extends
- ServerDefinitionTypeAwareWizardFragment {
- private GenericServerCompositeDecorator[] fDecorators;
-
- /**
- *
- */
- public boolean isComplete() {
-
- ServerRuntime serverRuntime = getServerTypeDefinitionFor( getServer() );
- if( serverRuntime == null )
- return false;
-
- IServerWorkingCopy server = getServer();
- GenericServer dl = (GenericServer) server.loadAdapter(
- GenericServer.class, null );
-
- IStatus status = dl.validate();
- return (status != null && status.isOK());
-
- }
-
- public void createContent( Composite parent, IWizardHandle handle ) {
- IServerWorkingCopy server = getServer();
- GenericServer dl = (GenericServer) server.loadAdapter(
- GenericServer.class, null );
- ServerRuntime definition = getServerTypeDefinitionFor( server );
- fDecorators = new GenericServerCompositeDecorator[1];
- fDecorators[0] = new ServerTypeDefinitionServerDecorator( definition,
- null, getWizard(), dl );
- new GenericServerComposite( parent, fDecorators );
-
- }
-
- /**
- * @param server
- * @return
- */
- private ServerRuntime getServerTypeDefinitionFor( IServerWorkingCopy server ) {
- GenericServerRuntime runtime = (GenericServerRuntime) server
- .getRuntime().getAdapter( GenericServerRuntime.class );
- if( runtime == null )
- {
- IRuntime wc = (IRuntime) getTaskModel().getObject(
- TaskModel.TASK_RUNTIME );
- runtime = (GenericServerRuntime) wc
- .getAdapter( GenericServerRuntime.class );
- if( runtime == null )
- runtime = (GenericServerRuntime) wc.loadAdapter(
- GenericServerRuntime.class, new NullProgressMonitor() );
- }
- String serverTyepId = server.getServerType().getId();
- String runtimeTypeId = runtime.getRuntime().getRuntimeType().getId();
- if( runtimeTypeId == null )
- {
- return null;
- }
- Map runtimeProperties = runtime.getServerInstanceProperties();
- ServerRuntime definition = getServerTypeDefinition( serverTyepId,
- runtimeTypeId, runtimeProperties );
- return definition;
- }
-
- /**
- * @return
- */
- private IServerWorkingCopy getServer() {
- IServerWorkingCopy server = (IServerWorkingCopy) getTaskModel()
- .getObject( TaskModel.TASK_SERVER );
- return server;
- }
-
- private boolean isNameInUse( String name ) {
- IServer[] servers = ServerCore.getServers();
- for( int i = 0; i < servers.length; i++ )
- {
- if( !servers[i].equals( getServer().getOriginal() )
- && (servers[i].getName().equals( name )) )
- return true;
- }
- return false;
- }
-
- private String createName() {
- String name = GenericServerUIMessages.bind(
- GenericServerUIMessages.serverName, getServerTypeDefinitionFor(
- getServer() ).getName() );
- int suffix = 1;
- String suffixName = name;
- while( isNameInUse( suffixName ) )
- {
- suffixName = name + ' ' + suffix;
- suffix++;
- }
- return suffixName;
- }
-
- public void enter() {
- if(fDecorators == null ){
- return;
- }
- getServer().setName( createName() );
- for( int i = 0; i < fDecorators.length; i++ )
- {
- if( fDecorators[i].validate() )//failed do not continue
- return;
- }
- }
-
- public void exit() {
- if(fDecorators == null ){
- return;
- }
- // validate needed to save the latest values.
- for( int i = 0; i < fDecorators.length; i++ )
- {
- if( fDecorators[i].validate() )//failed do not continue
- return;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.server.generic.internal.ui.ServerDefinitionTypeAwareWizardFragment#description()
- */
- public String description() {
- String sName = getServerName();
- if( sName == null || sName.length() < 1 )
- sName = "Generic"; //$NON-NLS-1$
- return GenericServerUIMessages.bind(
- GenericServerUIMessages.serverWizardDescription, sName );
- }
-
- private String getServerName() {
- if( getServer() != null && getServer().getRuntime() != null )
- return getServer().getRuntime().getRuntimeType().getName();
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.server.generic.internal.ui.ServerDefinitionTypeAwareWizardFragment#title()
- */
- public String title() {
- String sName = getServerName();
- if( sName == null || sName.length() < 1 )
- sName = "Generic"; //$NON-NLS-1$
- return GenericServerUIMessages.bind(
- GenericServerUIMessages.serverWizardTitle, sName );
- }
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericUiPlugin.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericUiPlugin.java
deleted file mode 100644
index d56c2199e..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/GenericUiPlugin.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.ui.plugin.*;
-import org.osgi.framework.BundleContext;
-import java.util.*;
-
-/**
- * The main plugin class to be used in the desktop.
- *
- * @author Gorkem Ercan
- */
-public class GenericUiPlugin extends AbstractUIPlugin {
-
- /**
- * Plug-in ID
- */
- public static final String PLUGIN_ID = "org.eclipse.jst.server.generic.ui"; //$NON-NLS-1$
-
- public static final String WIZBAN_IMAGE = "genericlogo"; //$NON-NLS-1$
- //The shared instance.
- private static GenericUiPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
-
- /**
- * The constructor.
- */
- public GenericUiPlugin() {
- super();
- plugin = this;
- try {
- resourceBundle = ResourceBundle.getBundle("org.eclipse.jst.server.generic.ui.GenericUiPluginResources"); //$NON-NLS-1$
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- /**
- * Returns the shared instance.
- */
- public static GenericUiPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = GenericUiPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- protected ImageRegistry createImageRegistry() {
- ImageRegistry registry = new ImageRegistry();
- ImageDescriptor desc = ImageDescriptor.createFromURL(getDefault().getBundle().getEntry("/icons/wizban/new_server_wiz.png")); //$NON-NLS-1$
- registry.put(WIZBAN_IMAGE, desc);
- return registry;
- }
- public ImageDescriptor imageDescriptor(String key){
- return getImageRegistry().getDescriptor(key);
- }
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/InstallableRuntimeDecorator.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/InstallableRuntimeDecorator.java
deleted file mode 100644
index 1a4ccd5ef..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/InstallableRuntimeDecorator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.jst.server.generic.ui.internal;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jst.server.generic.core.internal.GenericServerRuntime;
-import org.eclipse.jst.server.generic.core.internal.Trace;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.wst.server.core.internal.IInstallableRuntime;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-public class InstallableRuntimeDecorator implements
- GenericServerCompositeDecorator {
-
- private GenericServerRuntime fRuntime;
- private IWizardHandle fWizard;
-
- public InstallableRuntimeDecorator(IWizardHandle wizard, GenericServerRuntime runtime) {
- fRuntime = runtime;
- fWizard = wizard;
- }
-
- public void decorate(final GenericServerComposite composite) {
- final IInstallableRuntime ir = ServerPlugin
- .findInstallableRuntime(fRuntime.getRuntime().getRuntimeType()
- .getId());
-
- Button install = SWTUtil.createButton(composite, GenericServerUIMessages.installServerButton);
- install.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent se) {
- DirectoryDialog dialog = new DirectoryDialog(composite
- .getShell());
- dialog.setMessage(GenericServerUIMessages.installationDirectory);
- final String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
-
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException,
- InterruptedException {
- try {
- ir.install(new Path(selectedDirectory),
- new NullProgressMonitor());
- } catch (CoreException e) {
- Trace.trace(Trace.SEVERE,
- "Error installing runtime", e); //$NON-NLS-1$
- }
- }
- };
-
- try {
- fWizard.run(true, false, runnable);
-
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE,
- "Error installing runtime", e); //$NON-NLS-1$
- }
-
- }
- }
- });
- }
-
- public boolean validate() {
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/JRESelectDecorator.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/JRESelectDecorator.java
deleted file mode 100644
index 18cd22587..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/JRESelectDecorator.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.IVMInstallType;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jst.server.generic.core.internal.GenericServerRuntime;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-
-public class JRESelectDecorator implements GenericServerCompositeDecorator {
- private List installedJREs;
- private String[] jreNames;
- private GenericServerRuntime fRuntime;
- private IWizardHandle fWizard;
- public JRESelectDecorator(GenericServerRuntime runtime, IWizardHandle wizardHandle){
- super();
- fRuntime = runtime;
- fWizard = wizardHandle;
- }
-
- public void decorate(final GenericServerComposite composite) {
- updateJREs();
- Link link = new Link(composite,SWT.NONE);
- link.setLayoutData(new GridData(SWT.FILL,SWT.NONE,true,false,3,1));
- link.setText(GenericServerUIMessages.installed_jre_link);
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(GenericServerUIMessages.jre_select_label);
-
- final Combo combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
- combo.setItems(jreNames);
- GridData data = new GridData(SWT.FILL,SWT.NONE,false,false,2,1);
-
- combo.setLayoutData(data);
-
- combo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- int sel = combo.getSelectionIndex();
- IVMInstall vmInstall = null;
- if (sel > 0)
- vmInstall = (IVMInstall) installedJREs.get(sel - 1);
-
- fRuntime.setVMInstall(vmInstall);
- validate();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- link.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- String currentVM = combo.getText();
- if (showPreferencePage(composite)) {
- updateJREs();
- combo.setItems(jreNames);
- combo.setText(currentVM);
- if (combo.getSelectionIndex() == -1)
- combo.select(0);
- }
- }
- });
-
- if (fRuntime!=null){
- if(fRuntime.isUsingDefaultJRE()){
- combo.select(0);
- }else{
- combo.setText(fRuntime.getVMInstall().getName());
- }
- }
- }
-
-
- protected boolean showPreferencePage(GenericServerComposite composite) {
- PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
- IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode("org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"); //$NON-NLS-1$//$NON-NLS-2$
- PreferenceManager manager2 = new PreferenceManager();
- manager2.addToRoot(node);
- final PreferenceDialog dialog = new PreferenceDialog(composite.getShell(), manager2);
- final boolean[] result = new boolean[] { false };
- BusyIndicator.showWhile(composite.getDisplay(), new Runnable() {
- public void run() {
- dialog.create();
- if (dialog.open() == Window.OK)
- result[0] = true;
- }
- });
- return result[0];
- }
-
- protected void updateJREs() {
- installedJREs = new ArrayList();
- IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
- int size = vmInstallTypes.length;
- for (int i = 0; i < size; i++) {
- IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
- int size2 = vmInstalls.length;
- for (int j = 0; j < size2; j++) {
- installedJREs.add(vmInstalls[j]);
- }
- }
-
- size = installedJREs.size();
- jreNames = new String[size+1];
- jreNames[0] = GenericServerUIMessages.defaultJRE;
- for (int i = 0; i < size; i++) {
- IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
- jreNames[i+1] = vmInstall.getName();
- }
- }
-
-
-
- public boolean validate() {
- IStatus status = fRuntime.validate();
- if( status.getSeverity() != IStatus.OK )
- {
- fWizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
- fWizard.update();
- return true;
- }
- else
- {
- fWizard.setMessage("", IMessageProvider.NONE); //$NON-NLS-1$
- fWizard.update();
- return false;
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/SWTUtil.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/SWTUtil.java
deleted file mode 100644
index 394b3edc8..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/SWTUtil.java
+++ /dev/null
@@ -1,431 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-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.DirectoryDialog;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * SWT Utilities.
- *
- * @author Gorkem Ercan
- */
-public class SWTUtil {
- private static FontMetrics fontMetrics;
-
- protected static void initializeDialogUnits(Control testControl) {
- // Compute and store a font metric
- GC gc = new GC(testControl);
- gc.setFont(JFaceResources.getDialogFont());
- fontMetrics = gc.getFontMetrics();
- gc.dispose();
- }
-
- /**
- * Returns a width hint for a button control.
- */
- protected static int getButtonWidthHint(Button button) {
- int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
- IDialogConstants.BUTTON_WIDTH);
- return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT,
- true).x);
- }
-
- /**
- * Create a new button with the standard size.
- *
- * @param comp
- * the component to add the button to
- * @param label
- * the button label
- * @return a button
- */
- public static Button createButton(Composite comp, String label) {
- Button b = new Button(comp, SWT.PUSH);
- b.setText(label);
- if (fontMetrics == null)
- initializeDialogUnits(comp);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_BEGINNING);
- data.widthHint = getButtonWidthHint(b);
- b.setLayoutData(data);
- return b;
- }
-
- /**
- * Convert DLUs to pixels.
- *
- * @param comp
- * a component
- * @param x
- * pixels
- * @return dlus
- */
- public static int convertHorizontalDLUsToPixels(Composite comp, int x) {
- if (fontMetrics == null)
- initializeDialogUnits(comp);
- return Dialog.convertHorizontalDLUsToPixels(fontMetrics, x);
- }
-
- /**
- * Convert DLUs to pixels.
- *
- * @param comp
- * a component
- * @param y
- * pixels
- * @return dlus
- */
- public static int convertVerticalDLUsToPixels(Composite comp, int y) {
- if (fontMetrics == null)
- initializeDialogUnits(comp);
- return Dialog.convertVerticalDLUsToPixels(fontMetrics, y);
- }
-
- /**
- * Creates a label, text and a button to open a directory dialog.
- *
- * @param title
- * @param value
- * @param parent
- * @return Text that holds value
- *
- */
- public static Text createLabeledPath(String title, String value, final Composite parent) {
- return SWTUtil.createLabeledPath(title, value, parent, null);
- }
-
- /**
- * Creates a label, text and a button to open a directoty dialog. This
- * method creates Forum UI compatible widgets.
- *
- * @param title
- * @param value
- * @param parent
- * @param toolkit
- * @return Text that holds value
- */
- public static Text createLabeledPath(String title, String value, final Composite parent, FormToolkit toolkit) {
- Label label = null;
- Text cText = null;
- Button button = null;
-
- if (toolkit == null) {
- label = new Label(parent, SWT.WRAP);
- label.setText(title);
- cText = new Text(parent, SWT.SHADOW_IN | SWT.BORDER);
- button = SWTUtil.createButton(parent,
- GenericServerUIMessages.serverTypeGroup_label_browse);
- } else {
- createFormLabel(title, parent, toolkit);
- cText = toolkit.createText(parent, value);
- button = toolkit.createButton(parent,
- GenericServerUIMessages.serverTypeGroup_label_browse,
- SWT.PUSH);
- }
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 1;
-
- final Text text = cText;
- text.setLayoutData(gridData);
- text.setText(value);
- button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog dlg = new DirectoryDialog(parent.getShell());
- dlg.setFilterPath(text.getText().replace('\\', '/'));
- String res = dlg.open();
- if (res != null) {
- text.setText(res.replace('\\', '/'));
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- });
-
- return text;
- }
-
- /**
- * Creates a label, text and a button thats opens a file dialog
- *
- * @param title
- * @param value
- * @param parent
- * @return Text that holds the value
- */
- public static Text createLabeledFile(String title, String value, final Composite parent) {
- return SWTUtil.createLabeledFile(title, value, parent, null);
- }
-
- /**
- * Creates a label, text and a button thats opens a file dialog. This method
- * is used for creating Form UI compatible widgets
- *
- * @param title
- * @param value
- * @param parent
- * @param toolkit
- * @return
- */
- public static Text createLabeledFile(String title, String value, final Composite parent, FormToolkit toolkit) {
-
- Label label;
- Text cText;
- Button button;
- if (toolkit == null) {
- label = new Label(parent, SWT.WRAP);
- label.setText(title);
- cText = new Text(parent, SWT.SHADOW_IN | SWT.BORDER);
- button = SWTUtil.createButton(parent,
- GenericServerUIMessages.serverTypeGroup_label_browse);
- } else {
- createFormLabel(title, parent, toolkit);
- cText = toolkit.createText(parent, value);
- button = toolkit.createButton(parent,
- GenericServerUIMessages.serverTypeGroup_label_browse,
- SWT.PUSH);
- }
- final Text text = cText;
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 1;
- text.setLayoutData(gridData);
- text.setText(value);
- button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- FileDialog dlg = new FileDialog(parent.getShell());
- dlg.setFileName(text.getText().replace('\\', '/'));
- String res = dlg.open();
- if (res != null) {
- text.setText(res.replace('\\', '/'));
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- });
-
- return text;
- }
-
- /**
- * Creates a label and a text
- *
- * @param title
- * @param value
- * @param parent
- * @return Text object that holds the value
- */
- public static Text createLabeledText(String title, String value, Composite parent) {
- return SWTUtil.createLabeledText( title, value, parent, null );
- }
-
- /**
- * Creates a label and a text. This method created form ui compatible
- * widgets
- *
- * @param title
- * @param value
- * @param parent
- * @param toolkit
- * @return Text control that holds the value
- */
- public static Text createLabeledText(String title, String value, Composite parent, FormToolkit toolkit) {
-
- Label label;
- Text text;
- if (toolkit == null) {
- label = new Label(parent, SWT.WRAP);
- label.setText(title);
- text = new Text(parent, SWT.SHADOW_IN | SWT.BORDER);
- } else {
- createFormLabel(title, parent, toolkit);
- text = toolkit.createText(parent, value);
- }
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 2;
- text.setLayoutData(gridData);
- text.setText(value);
-
- return text;
- }
-
- /**
- * Creates a CHECK style button and label
- *
- * @param title
- * @param value
- * @param parent
- * @return Check Button
- */
- public static Button createLabeledCheck(String title, boolean value, Composite parent) {
- return SWTUtil.createLabeledCheck(title, value, parent, null);
- }
-
- /**
- * Creates a CHECK style button and label. This method is form ui compatible
- *
- * @param title
- * @param value
- * @param parent
- * @param toolkit
- * @return
- */
- public static Button createLabeledCheck(String title, boolean value, Composite parent, FormToolkit toolkit) {
- Label label;
- Button button;
- if (toolkit == null) {
- label = new Label(parent, SWT.WRAP);
- label.setText(title);
- button = new Button(parent, SWT.CHECK);
- } else {
- createFormLabel(title, parent, toolkit);
- button = toolkit.createButton(parent, null, SWT.CHECK);
- }
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 2;
- button.setLayoutData(gridData);
- button.setSelection(value);
- return button;
- }
-
- /**
- * Creates a label and an editable Combo.
- *
- * @param title
- * @param values
- * @param parent
- * @return Combo
- */
- public static Combo createLabeledCombo(String title, String[] values,Composite parent) {
- return SWTUtil.createLabeledCombo(title, values, parent, null);
- }
-
- /**
- * Creates a label and an editable Combo
- *
- * @param title
- * @param values
- * @param parent
- * @param toolkit
- * @return Combo
- */
- public static Combo createLabeledCombo(String title, String[] values, Composite parent, FormToolkit toolkit) {
-
- Label label;
-
- if (toolkit == null) {
- label = new Label(parent, SWT.WRAP);
- label.setText(title);
- } else {
- createFormLabel(title, parent, toolkit);
- }
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- if (toolkit != null) {
- toolkit.adapt(combo, true, true);
- }
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 2;
- combo.setLayoutData(gridData);
-
- for (int i = 0; i < values.length; i++) {
- combo.add(values[i]);
- }
- if (combo.getItemCount() > 0)
- combo.select(0);
- return combo;
- }
-
- /**
- * Creates a label and an editable Combo.
- *
- * @param title
- * @param values
- * @param parent
- * @return Combo
- */
- public static Combo createLabeledEditableCombo(String title, String[] values,String value,Composite parent) {
- return SWTUtil.createLabeledEditableCombo(title, values,value, parent, null);
- }
-
- /**
- * Creates a label and an editable Combo
- *
- * @param title
- * @param values
- * @param parent
- * @param toolkit
- * @return Combo
- */
- public static Combo createLabeledEditableCombo(String title, String[] values,String value, Composite parent, FormToolkit toolkit) {
-
- Label label;
-
- if (toolkit == null) {
- label = new Label(parent, SWT.WRAP);
- label.setText(title);
- } else {
- createFormLabel(title, parent, toolkit);
- }
- Combo combo = new Combo(parent, SWT.SHADOW_IN | SWT.BORDER);
- if (toolkit != null) {
- toolkit.adapt(combo, true, true);
- }
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL
- | GridData.GRAB_HORIZONTAL);
- gridData.horizontalSpan = 2;
- combo.setLayoutData(gridData);
-
- for (int i = 0; i < values.length; i++) {
- combo.add(values[i]);
- }
- if (combo.getItemCount() > 0)
- combo.select(0);
- combo.setText(value);
- return combo;
- }
-
- private static Label createFormLabel(String title, Composite parent, FormToolkit toolkit) {
- Label label;
- label = toolkit.createLabel(parent, title);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- return label;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerDefinitionTypeAwareWizardFragment.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerDefinitionTypeAwareWizardFragment.java
deleted file mode 100644
index 113288498..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerDefinitionTypeAwareWizardFragment.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import java.util.Map;
-
-import org.eclipse.jst.server.generic.core.internal.CorePlugin;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-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;
-
-/**
- * A wizard fragment that provides support for serverdef files.
- *
- * @author Gorkem Ercan
- */
-public abstract class ServerDefinitionTypeAwareWizardFragment extends WizardFragment {
-
- private IWizardHandle fWizard;
-
- public boolean hasComposite() {
- return true;
- }
-
- public Composite createComposite(Composite parent, IWizardHandle handle) {
-
- this.fWizard = handle;
- Composite container = new Composite(parent, SWT.NONE);
- GridLayout grid = new GridLayout(1,false);
- grid.marginWidth=0;
- container.setLayout(grid);
- container.setLayoutData(new GridData(GridData.FILL_BOTH));
- handle.setImageDescriptor(GenericUiPlugin.getDefault().imageDescriptor(GenericUiPlugin.WIZBAN_IMAGE));
- handle.setTitle(title());
- handle.setDescription(description());
- createContent(container,handle);
- return container;
- }
- public IWizardHandle getWizard(){
- return fWizard;
- }
- /**
- * Returns the description to be displayed on the wizard head.
- * @return
- */
- public abstract String description();
- /**
- * Returns the title of the wizard.
- * @return
- */
- public abstract String title();
- /**
- * Create the real content
- * @param parent
- * @param handle
- */
- public abstract void createContent(Composite parent, IWizardHandle handle);
-
- /**
- * Retuns the ServerRuntime.
- * @param definitionID
- * @param properties
- * @return
- */
- protected ServerRuntime getServerTypeDefinition(String definitionID, Map properties)
- {
- return CorePlugin.getDefault().getServerTypeDefinitionManager().getServerRuntimeDefinition(definitionID,properties);
- }
-
- /**
- * Retuns the ServerRuntime.
- * @param serverTypeId
- * @param runtimeTypeId
- * @param properties
- * @return
- */
- protected ServerRuntime getServerTypeDefinition(String serverTypeId, String runtimeTypeId, Map properties)
- {
- return CorePlugin.getDefault().getServerTypeDefinitionManager().getServerRuntimeDefinition(serverTypeId, runtimeTypeId, properties);
- }
-
-}
-
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionDecorator.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionDecorator.java
deleted file mode 100644
index 5bc96d707..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionDecorator.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jst.server.generic.servertype.definition.Property;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.Text;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-/**
- * Provides the UI objects for gathering user information
- * for server properties.
- *
- * @author Gorkem Ercan
- */
-public abstract class ServerTypeDefinitionDecorator implements GenericServerCompositeDecorator {
-
- protected static final String CONTEXT_RUNTIME = Property.CONTEXT_RUNTIME;
- protected static final String CONTEXT_SERVER = Property.CONTEXT_SERVER;
- private ServerRuntime fDefinition;
- private Map fProperties;
- private String fContext;
- private String fLastMessage;
- protected IWizardHandle fWizard;
- private List fPropertyControls= new ArrayList();
-
- private final class PathModifyListener implements ModifyListener {
- public void modifyText(ModifyEvent e) {
- String path = ((Text) e.widget).getText();
-
- if(path.length()<1)
- {
- fLastMessage = GenericServerUIMessages.emptyPath;
- fWizard.setMessage(fLastMessage,IMessageProvider.ERROR);
- }
- else if(!pathExist(path)){
- fLastMessage = NLS.bind(GenericServerUIMessages.invalidPath,path);
- fWizard.setMessage(fLastMessage,IMessageProvider.ERROR);
- }else{
- if(fLastMessage!=null && fLastMessage.equals(fWizard.getMessage())){
- fLastMessage=null;
- fWizard.setMessage(null,IMessageProvider.NONE);
- }
- validate();
- }
- }
- private boolean pathExist(String path){
- File f = new File(path);
- return f.exists();
- }
- }
-
- /**
- * Constructor
- *
- * @param definition
- * @param initialProperties
- * @param context
- * @param handle
- */
- public ServerTypeDefinitionDecorator(ServerRuntime definition, Map initialProperties, String context, IWizardHandle handle) {
- super();
- fDefinition = definition;
- fProperties = initialProperties;
- fContext = context;
- fWizard = handle;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.server.generic.ui.internal.GenericServerCompositeDecorator#decorate(org.eclipse.jst.server.generic.ui.internal.GenericServerComposite)
- */
- public void decorate(GenericServerComposite composite) {
-
- List properties =null;
- if(fDefinition==null){
- properties= new ArrayList(0);
- }
- else{
- properties= fDefinition.getProperty();
- }
- for (int i = 0; i < properties.size(); i++) {
- Property property = (Property) properties.get(i);
- if (this.fContext.equals(property.getContext()))
- createPropertyControl(composite, property);
- }
- Dialog.applyDialogFont(composite);
- }
-
-
- private void createPropertyControl(Composite parent, Property property){
- if( Property.TYPE_DIRECTORY.equals(property.getType())) {
- Text path = SWTUtil.createLabeledPath(property.getLabel(),getPropertyValue(property),parent);
- path.setData(property);
- path.addModifyListener(new PathModifyListener());
- registerControl(path);
- } else if( Property.TYPE_FILE.equals(property.getType())) {
- Text file = SWTUtil.createLabeledFile(property.getLabel(),getPropertyValue(property),parent);
- file.setData(property);
- file.addModifyListener(new PathModifyListener());
- registerControl(file);
- } else if( Property.TYPE_BOOLEAN.equals(property.getType())) {
- Button bool =SWTUtil.createLabeledCheck(property.getLabel(),("true".equals( getPropertyValue(property))), parent); //$NON-NLS-1$
- bool.setData(property);
- registerControl(bool);
- }else if(Property.TYPE_SELECT.equals(property.getType())) {
- StringTokenizer tokenizer = new StringTokenizer(property.getDefault(),","); //$NON-NLS-1$
- int tokenCount = tokenizer.countTokens();
- String[] values = new String[tokenCount];
- int i =0;
- while(tokenizer.hasMoreTokens() && i<tokenCount){
- values[i]=tokenizer.nextToken();
- i++;
- }
- Combo combo = SWTUtil.createLabeledCombo(property.getLabel(),values, parent);
- combo.setData(property);
- registerControl(combo);
- }else if(Property.TYPE_SELECT_EDIT.equals(property.getType())) {
- StringTokenizer tokenizer = new StringTokenizer(property.getDefault(),","); //$NON-NLS-1$
- int tokenCount = tokenizer.countTokens();
- String[] values = new String[tokenCount];
- int i =0;
- while(tokenizer.hasMoreTokens() && i<tokenCount){
- values[i]=tokenizer.nextToken();
- i++;
- }
- Combo combo = SWTUtil.createLabeledEditableCombo(property.getLabel(),values,getPropertyValue(property), parent);
- combo.setData(property);
- registerControl(combo);
- }
- else {//default is TEXT
- Text defaultText= SWTUtil.createLabeledText(property.getLabel(),getPropertyValue(property),parent);
- defaultText.setData(property);
- registerControl(defaultText);
- }
- }
-
- private void registerControl(Control control)
- {
- fPropertyControls.add(control);
- }
-
- private String getPropertyValue(Property property){
- if(fProperties!=null && fProperties.isEmpty()==false){
- //user properties exist use those
- return fDefinition.getResolver().resolveProperties((String)fProperties.get(property.getId()));
- }
- if(Property.TYPE_SELECT_EDIT.equals(property.getType())){
- StringTokenizer tokenizer = new StringTokenizer(property.getDefault(),","); //$NON-NLS-1$
- if( tokenizer.hasMoreTokens())
- return fDefinition.getResolver().resolveProperties(tokenizer.nextToken());
- else
- return "";
- }else
- return fDefinition.getResolver().resolveProperties(property.getDefault());
- }
-
- /**
- * Returns the property name/value pairs.
- * @return Map containing the values collected from the user
- */
- public Map getValues(){
- Map propertyMap = new HashMap();
- for(int i=0; i<fPropertyControls.size();i++){
- Property prop = (Property)((Control)fPropertyControls.get(i)).getData();
- if(fPropertyControls.get(i)instanceof Button){
- Button button = (Button)fPropertyControls.get(i);
- propertyMap.put(prop.getId(),Boolean.toString(button.getSelection()));
- }
- else if(fPropertyControls.get(i) instanceof Combo){
- Combo combo = (Combo)fPropertyControls.get(i);
- int index = combo.getSelectionIndex();
- if ( index > 0 ){//is there a selection?
- propertyMap.put(prop.getId(),combo.getItem(index));
- }
- else{
- propertyMap.put(prop.getId(),combo.getText());
- }
-
- }else{
- Text text = (Text)fPropertyControls.get(i);
- propertyMap.put(prop.getId(),text.getText());
- }
- }
- return propertyMap;
- }
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionRuntimeDecorator.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionRuntimeDecorator.java
deleted file mode 100644
index 50cedca0e..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionRuntimeDecorator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jst.server.generic.core.internal.GenericServerRuntime;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-public class ServerTypeDefinitionRuntimeDecorator extends ServerTypeDefinitionDecorator {
-
- private GenericServerRuntime fRuntime;
- public ServerTypeDefinitionRuntimeDecorator(ServerRuntime definition, Map initialProperties, IWizardHandle wizard, GenericServerRuntime runtime) {
- super(definition, initialProperties,CONTEXT_RUNTIME,wizard);
- fRuntime=runtime;
- }
-
- public boolean validate(){
-
- if(fRuntime==null)
- return false;
- fRuntime.setServerDefinitionId(fRuntime.getRuntime().getRuntimeType().getId());
- fRuntime.setServerInstanceProperties(getValues());
-
- IStatus status = fRuntime.validate();
-
- if (status == null || status.isOK()){
-
- fWizard.setMessage(null, IMessageProvider.NONE);
- fWizard.update();
- String wDir = fRuntime.getServerTypeDefinition().getResolver().resolveProperties(fRuntime.getServerTypeDefinition().getStart().getWorkingDirectory());
- fRuntime.getRuntimeWorkingCopy().setLocation(new Path(wDir));
-
- return false;
- }else
- {
- fWizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
- fWizard.update();
- return true;
- }
- }
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionServerDecorator.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionServerDecorator.java
deleted file mode 100644
index 71a8ca9df..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/ServerTypeDefinitionServerDecorator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Gorkem Ercan - initial API and implementation
- *
- **************************************************************************************************/
-package org.eclipse.jst.server.generic.ui.internal;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jst.server.generic.core.internal.GenericServer;
-import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-/**
- * Server properties decorator.
- * @author Gorkem Ercan
- */
-public class ServerTypeDefinitionServerDecorator extends
- ServerTypeDefinitionDecorator {
-
- private GenericServer fServer;
- public ServerTypeDefinitionServerDecorator(ServerRuntime definition, Map initialProperties,IWizardHandle wizard,GenericServer server) {
- super(definition, initialProperties,CONTEXT_SERVER, wizard);
- fServer=server;
- }
-
- public boolean validate() {
- IStatus status = null;
- if(fServer!=null)
- {
- fServer.setServerInstanceProperties(getValues());
- status = fServer.validate();
- }
- if(status==null || status.isOK())
- {
- fWizard.setMessage(null, IMessageProvider.NONE);
- fWizard.update();
- }
- else
- {
- fWizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
- fWizard.update();
- return true;
- }
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/editor/ServerPropertiesEditorSection.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/editor/ServerPropertiesEditorSection.java
deleted file mode 100644
index acc7274b1..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/editor/ServerPropertiesEditorSection.java
+++ /dev/null
@@ -1,370 +0,0 @@
-package org.eclipse.jst.server.generic.ui.internal.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.ILaunchesListener2;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jst.server.generic.core.internal.GenericServer;
-import org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour;
-import org.eclipse.jst.server.generic.core.internal.GenericServerRuntime;
-import org.eclipse.jst.server.generic.servertype.definition.Property;
-import org.eclipse.jst.server.generic.ui.internal.GenericServerUIMessages;
-import org.eclipse.jst.server.generic.ui.internal.GenericUiPlugin;
-import org.eclipse.jst.server.generic.ui.internal.SWTUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.wst.server.ui.editor.ServerEditorSection;
-
-public class ServerPropertiesEditorSection extends ServerEditorSection{
- private static final String MESSAGE_ID_SERVER_RUNNING = "server_running"; //$NON-NLS-1$
- private GenericServer fServer;
- private PropertyChangeListener fPropertyChangeListener;
- private ILaunchesListener2 fLaunchListener;
- private Map fControls = new HashMap();
- private boolean fUpdating;
-
-
- public void init(final IEditorSite site, IEditorInput input) {
- super.init(site, input);
- if(server!=null){
- fServer = (GenericServer)server.loadAdapter(GenericServer.class, new NullProgressMonitor());
- }
- fPropertyChangeListener = new PropertyChangeListener(){
-
- public void propertyChange( PropertyChangeEvent evt ) {
- if(evt.getPropertyName().equals( GenericServerRuntime.SERVER_INSTANCE_PROPERTIES ))
- {
- if ( !fUpdating ){
- fUpdating = true;
- updateControls();
- fUpdating = false;
- }
- }
- }
- };
- server.addPropertyChangeListener( fPropertyChangeListener );
- fLaunchListener = new ILaunchesListener2() {
-
- public void launchesRemoved(ILaunch[] launches) {
- }
-
- private ILaunchConfiguration getServerLaunchConfig(ILaunch[] launches){
- for (int i=0; i< launches.length; i++)
- {
- ILaunchConfiguration launchConfig = launches[i].getLaunchConfiguration();
- if (launchConfig != null) {
- String serverId;
- try {
- serverId = launchConfig.getAttribute( GenericServerBehaviour.ATTR_SERVER_ID, (String) null);
- if (fServer.getServer().getId().equals(serverId)) {
- return launchConfig;
- }
- } catch (CoreException e) {
- }
-
- }
- }
- return null;
-
- }
- public void launchesChanged(ILaunch[] launches) {
- }
-
- public void launchesAdded(ILaunch[] launches) {
- ILaunchConfiguration lc = getServerLaunchConfig(launches);
- try {
- if( lc != null){
- if ("true".equals(lc.getAttribute(GenericServerBehaviour.ATTR_STOP, "false"))){ //$NON-NLS-1$ //$NON-NLS-2$
- site.getWorkbenchWindow().getWorkbench().getDisplay().asyncExec( new Runnable() {
- public void run() {
- getManagedForm().getMessageManager().removeMessage(MESSAGE_ID_SERVER_RUNNING);
- getManagedForm().getMessageManager().update();
-
- }
-
- });
- }
- else{
- site.getWorkbenchWindow().getWorkbench().getDisplay().asyncExec( new Runnable() {
- public void run() {
- getManagedForm().getMessageManager().addMessage(MESSAGE_ID_SERVER_RUNNING,GenericServerUIMessages.serverRunningCanNotSave , null, IMessageProvider.WARNING);
-
- }
-
- });
-
- }
- }
- } catch (CoreException e) {
- GenericUiPlugin.getDefault().getLog().log(e.getStatus());
- }
- }
-
- public void launchesTerminated(ILaunch[] launches) {
- if(getServerLaunchConfig(launches) != null )
- {
- site.getWorkbenchWindow().getWorkbench().getDisplay().asyncExec( new Runnable() {
-
- public void run() {
- getManagedForm().getMessageManager().removeMessage(MESSAGE_ID_SERVER_RUNNING);
- }
- });
- }
-
- }
-
- };
-
- getLaunchManager().addLaunchListener(fLaunchListener);
-
- }
-
- protected void updateControls() {
- List props = fServer.getServerDefinition().getProperty();
- for (Iterator iter = props.iterator(); iter.hasNext();) {
- Property property = (Property) iter.next();
- if(property.getContext().equals(Property.CONTEXT_SERVER))
- {
- if( Property.TYPE_BOOLEAN.equals(property.getType()) ){
- Button b = (Button)fControls.get( property.getId() );
- b.setSelection( "true".equals( getPropertyValue( property ) ) ); //$NON-NLS-1$
- }
- else if( Property.TYPE_SELECT.equals( property.getType() ) || Property.TYPE_SELECT_EDIT.equals( property.getType() )){
- Combo c = (Combo)fControls.get( property.getId() );
- String value = getPropertyValue( property )==null ? "": getPropertyValue( property ); //$NON-NLS-1$
- //c.setText( getPropertyValue( property ) );
- // responding to "value not used" msg, I'm assuming value
- // should be used as in following block.
- c.setText( value );
- }
- else{
- Text t = (Text)fControls.get( property.getId() );
- String value = getPropertyValue( property )==null ? "": getPropertyValue( property ); //$NON-NLS-1$
- t.setText( value );
- }
- }
- }
- }
-
- public void createSection(Composite parent) {
- super.createSection(parent);
- FormToolkit formToolkit = getFormToolkit(parent.getDisplay());
- Section section = formToolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
- | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
- section.setText(GenericServerUIMessages.ServerEditorSectionTitle);
- section.setDescription(GenericServerUIMessages.ServerEditorSectionDescription);
- section.setLayoutData(new GridData(SWT.FILL,SWT.NONE,true,false));
-
- Composite composite = formToolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.numColumns=3;
- layout.marginHeight = 5;
- layout.marginWidth = 10;
- layout.verticalSpacing = 5;
- layout.horizontalSpacing = 15;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(SWT.FILL,SWT.NONE,true,false));
-
- List props = fServer.getServerDefinition().getProperty();
- for (Iterator iter = props.iterator(); iter.hasNext();) {
- Property property = (Property) iter.next();
- if(property.getContext().equals(Property.CONTEXT_SERVER))
- createPropertyControl(composite, property,formToolkit);
- }
-
- formToolkit.paintBordersFor(composite);
- section.setClient(composite);
-
-
- if ( getExistingLaunch() != null ){
- getManagedForm().getMessageManager().addMessage(MESSAGE_ID_SERVER_RUNNING,GenericServerUIMessages.serverRunningCanNotSave , null, IMessageProvider.WARNING);
- }
- }
-
- private void executeUpdateOperation(String propertyName, String propertyValue)
- {
- if( !fUpdating )
- {
- fUpdating = true;
- execute( new UpdateServerPropertyOperation( server,
- GenericServerUIMessages.UpdateOperationDescription, propertyName,
- propertyValue ) );
- fUpdating = false;
- }
- }
-
- private void createPropertyControl(Composite parent, final Property property, FormToolkit toolkit){
-
- if( Property.TYPE_DIRECTORY.equals(property.getType())) {
- final Text path = SWTUtil.createLabeledPath(property.getLabel(),getPropertyValue(property),parent,toolkit);
- fControls.put( property.getId(), path );
- path.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- executeUpdateOperation(property.getId(),path.getText());
- }
- });
- } else if( Property.TYPE_FILE.equals(property.getType())) {
-
- final Text file = SWTUtil.createLabeledFile(property.getLabel(),getPropertyValue(property),parent,toolkit);
- fControls.put( property.getId(), file );
- file.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- executeUpdateOperation(property.getId(),file.getText());
- }
- });
- }else if( Property.TYPE_BOOLEAN.equals(property.getType())) {
- final Button bool = SWTUtil.createLabeledCheck(property.getLabel(),("true".equals( getPropertyValue(property))),parent,toolkit); //$NON-NLS-1$
- fControls.put( property.getId(), bool );
- bool.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- executeUpdateOperation(property.getId(), Boolean.toString(bool.getSelection()));
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- // Do Nothing
- }
- });
- }else if(Property.TYPE_SELECT.equals(property.getType())) {
- StringTokenizer tokenizer = new StringTokenizer(property.getDefault(),","); //$NON-NLS-1$
- int tokenCount = tokenizer.countTokens();
- String[] values = new String[tokenCount];
- int i =0;
- while(tokenizer.hasMoreTokens() && i<tokenCount){
- values[i]=tokenizer.nextToken();
- i++;
- }
- final Combo combo = SWTUtil.createLabeledCombo(property.getLabel(), values, parent,toolkit);
- fControls.put( property.getId(), combo );
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- executeUpdateOperation(property.getId(),combo.getText());
- }
- });
- combo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- executeUpdateOperation(property.getId(),combo.getText());
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- // nothing to do
- }
- });
- }else if(Property.TYPE_SELECT_EDIT.equals(property.getType())) {
- StringTokenizer tokenizer = new StringTokenizer(property.getDefault(),","); //$NON-NLS-1$
- int tokenCount = tokenizer.countTokens();
- String[] values = new String[tokenCount];
- int i =0;
- while(tokenizer.hasMoreTokens() && i<tokenCount){
- values[i]=tokenizer.nextToken();
- i++;
- }
- final Combo combo = SWTUtil.createLabeledEditableCombo(property.getLabel(), values,getPropertyValue(property), parent,toolkit);
- fControls.put( property.getId(), combo );
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- executeUpdateOperation(property.getId(),combo.getText());
- }
- });
- combo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- executeUpdateOperation(property.getId(),combo.getText());
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- // nothing to do
- }
- });
- }
- else {// Property.TYPE_TEXT
- final Text defaultText= SWTUtil.createLabeledText(property.getLabel(),getPropertyValue(property),parent,toolkit);
- fControls.put( property.getId(), defaultText );
- defaultText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- executeUpdateOperation(property.getId(), defaultText.getText());
- }
- });
- }
- }
-
- private String getPropertyValue(Property property) {
- return(String) fServer.getServerInstanceProperties().get(property.getId());
- }
-
- public void dispose() {
- super.dispose();
- if( server!= null )
- server.removePropertyChangeListener( fPropertyChangeListener );
-
- getLaunchManager().removeLaunchListener( fLaunchListener );
- }
-
-
- public ILaunch getExistingLaunch() {
- ILaunchManager launchManager = getLaunchManager();
-
- ILaunch[] launches = launchManager.getLaunches();
- int size = launches.length;
- for (int i = 0; i < size; i++) {
- ILaunchConfiguration launchConfig = launches[i].getLaunchConfiguration();
- try {
- if (launchConfig != null) {
- String serverId = launchConfig.getAttribute(GenericServerBehaviour.ATTR_SERVER_ID, (String) null);
- if (fServer.getServer().getId().equals(serverId)) {
- if (!launches[i].isTerminated())
- return launches[i];
- }
- }
- } catch (CoreException e) {
- // ignore
- }
- }
- return null;
- }
-
- private ILaunchManager getLaunchManager() {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- return launchManager;
- }
-
- private IStatus validate(){
- if (getExistingLaunch() != null){
- return new Status(IStatus.WARNING,GenericUiPlugin.PLUGIN_ID, GenericServerUIMessages.serverRunningCanNotSave); //$NON-NLS-1$
- }
- return null;
-
- }
-
- public IStatus[] getSaveStatus() {
- IStatus status = validate();
- if (status != null ){
- IStatus[] statusArray = {status};
- return statusArray;
- }
- return super.getSaveStatus();
- }
-}
diff --git a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/editor/UpdateServerPropertyOperation.java b/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/editor/UpdateServerPropertyOperation.java
deleted file mode 100644
index eb58bbf79..000000000
--- a/plugins/org.eclipse.jst.server.generic.ui/src/org/eclipse/jst/server/generic/ui/internal/editor/UpdateServerPropertyOperation.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- */
-package org.eclipse.jst.server.generic.ui.internal.editor;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.AbstractOperation;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.server.generic.core.internal.GenericServer;
-import org.eclipse.jst.server.generic.ui.internal.GenericUiPlugin;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-
-public class UpdateServerPropertyOperation extends AbstractOperation {
- private GenericServer fGenericServer;
- private String fPropertyName;
- private String fPRopertyValue;
- private String fOldValue;
-
- public UpdateServerPropertyOperation(IServerWorkingCopy server, String name, String propertyName, String propertyValue) {
- super(name);
- if(server!=null){
- fGenericServer = (GenericServer)server.loadAdapter(GenericServer.class, new NullProgressMonitor());
- }
- fPropertyName=propertyName;
- fPRopertyValue=propertyValue;
- }
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Map map = new HashMap( fGenericServer.getServerInstanceProperties() );
- if(map.containsKey(fPropertyName))
- {
- fOldValue = ( String )map.get( fPropertyName );
- map.put(fPropertyName, fPRopertyValue);
- fGenericServer.setServerInstanceProperties( map );
- return null;
- }
- return new Status(IStatus.ERROR,GenericUiPlugin.PLUGIN_ID,0,"Property does not exist",null);
- }
-
-
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- return execute(monitor,info);
- }
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Map map = new HashMap(fGenericServer.getServerInstanceProperties());
- if(map.containsKey(fPropertyName))
- {
- map.put(fPropertyName, fOldValue);
- fGenericServer.setServerInstanceProperties(map);
- return null;
- }
- return new Status(IStatus.ERROR,GenericUiPlugin.PLUGIN_ID,0,"Property does not exist",null);
- }
-} \ No newline at end of file

Back to the top