Browse files

*** empty log message ***

  • Loading branch information...
1 parent 27d5e0b commit 6c28603e95e3bcd3e5774d17a28dadcd989e0286 deboer committed Dec 2, 2004
Showing with 145 additions and 73 deletions.
  1. +2 −2 ...ver.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java
  2. +2 −2 ...ver.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java
  3. +2 −2 ...ver.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java
  4. +2 −2 ...ver.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
  5. +2 −2 ...ver.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
  6. +11 −9 ...erver.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
  7. +22 −17 ...e.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java
  8. +2 −0 ...ver.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
  9. +2 −1 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java
  10. +2 −2 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java
  11. +2 −6 .../org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java
  12. +7 −6 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
  13. +40 −0 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
  14. +10 −2 ...rg.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
  15. +4 −0 plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java
  16. +2 −2 ...pse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java
  17. +4 −0 ...rg.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java
  18. +6 −10 ...st.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java
  19. +21 −8 ...t.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
View
4 ...at.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java
@@ -56,7 +56,7 @@
/**
* Tomcat32Configuration constructor comment.
*/
- public Tomcat32Configuration(IPath path) {
+ public Tomcat32Configuration(IFolder path) {
super(path);
}
@@ -494,7 +494,7 @@ public void localizeConfiguration(IPath path, TomcatServer serverType, IRuntime
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat32Configuration config = new Tomcat32Configuration(path);
+ Tomcat32Configuration config = new Tomcat32Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 30));
if (monitor.isCanceled())
View
4 ...at.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java
@@ -60,7 +60,7 @@
/**
* Tomcat40Configuration constructor comment.
*/
- public Tomcat40Configuration(IPath path) {
+ public Tomcat40Configuration(IFolder path) {
super(path);
}
@@ -489,7 +489,7 @@ public void localizeConfiguration(IPath path, TomcatServer server2, IProgressMon
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat40Configuration config = new Tomcat40Configuration(path);
+ Tomcat40Configuration config = new Tomcat40Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
if (monitor.isCanceled())
View
4 ...at.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java
@@ -61,7 +61,7 @@
/**
* Tomcat41Configuration constructor comment.
*/
- public Tomcat41Configuration(IPath path) {
+ public Tomcat41Configuration(IFolder path) {
super(path);
}
@@ -506,7 +506,7 @@ public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntim
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat41Configuration config = new Tomcat41Configuration(path);
+ Tomcat41Configuration config = new Tomcat41Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
if (monitor.isCanceled())
View
4 ...at.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
@@ -48,7 +48,7 @@
/**
* Tomcat50Configuration constructor comment.
*/
- public Tomcat50Configuration(IPath path) {
+ public Tomcat50Configuration(IFolder path) {
super(path);
}
@@ -486,7 +486,7 @@ public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntim
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat50Configuration config = new Tomcat50Configuration(path);
+ Tomcat50Configuration config = new Tomcat50Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
if (monitor.isCanceled())
View
4 ...at.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
@@ -48,7 +48,7 @@
/**
* Tomcat55Configuration constructor comment.
*/
- public Tomcat55Configuration(IPath path) {
+ public Tomcat55Configuration(IFolder path) {
super(path);
}
@@ -486,7 +486,7 @@ public void localizeConfiguration(IPath path, TomcatServer server2, TomcatRuntim
monitor = ProgressUtil.getMonitorFor(monitor);
monitor.beginTask(TomcatPlugin.getResource("%updatingConfigurationTask"), 100);
- Tomcat55Configuration config = new Tomcat55Configuration(path);
+ Tomcat55Configuration config = new Tomcat55Configuration(null);
config.load(path, ProgressUtil.getSubMonitorFor(monitor, 40));
if (monitor.isCanceled())
View
20 ...mcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
@@ -47,15 +47,15 @@
public static final String ADD_WEB_MODULE_PROPERTY = "addWebModule";
public static final String REMOVE_WEB_MODULE_PROPERTY = "removeWebModule";
- protected IPath configPath;
+ protected IFolder configPath;
// property change listeners
private transient List propertyListeners;
/**
* TomcatConfiguration constructor comment.
*/
- public TomcatConfiguration(IPath path) {
+ public TomcatConfiguration(IFolder path) {
super();
this.configPath = path;
/*try {
@@ -65,7 +65,7 @@ public TomcatConfiguration(IPath path) {
}*/
}
- protected IPath getPath() {
+ protected IFolder getFolder() {
return configPath;
}
@@ -98,10 +98,10 @@ protected IStatus backupAndPublish(IPath confDir, boolean doBackup, IProgressMon
if (folder != null)
backupFolder(folder, confDir, backup, ms, monitor);
else {
- IPath path = config.getConfigurationDataPath();*/
- backupPath(configPath, confDir, backup, ms, monitor);
+ IPath path = config.getConfigurationDataPath();
+ backupPath(configPath, confDir, backup, ms, monitor);*/
+ backupFolder(getFolder(), confDir, backup, ms, monitor);
//}
-
} catch (Exception e) {
Trace.trace("backupAndPublish() error", e);
IStatus s = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, TomcatPlugin.getResource("%errorPublishConfiguration", new String[] {e.getLocalizedMessage()}), e);
@@ -253,7 +253,9 @@ protected WebModule getWebModule(IModule webModule) {
* @param forceSave boolean
* @exception java.io.IOException
*/
- protected abstract void save(IPath path, boolean forceSave, IProgressMonitor monitor) throws CoreException;
+ //protected abstract void save(IPath path, boolean forceSave, IProgressMonitor monitor) throws CoreException;
+
+ protected abstract void save(IFolder folder, IProgressMonitor monitor) throws CoreException;
protected void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
if (propertyListeners == null)
@@ -304,9 +306,9 @@ public void importFromRuntime(IRuntime runtime, IProgressMonitor monitor) throws
load(runtime.getLocation().append("conf"), monitor);
}*/
- public abstract void load(IPath path, IProgressMonitor monitor) throws CoreException;
+ protected abstract void load(IPath path, IProgressMonitor monitor) throws CoreException;
- //public abstract void load(IFolder folder, IProgressMonitor monitor) throws CoreException;
+ protected abstract void load(IFolder folder, IProgressMonitor monitor) throws CoreException;
public abstract void addWebModule(int index, ITomcatWebModule module);
View
39 ...rver.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java
@@ -15,6 +15,7 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
import org.eclipse.debug.core.model.IProcess;
@@ -72,29 +73,28 @@ public ITomcatConfiguration getServerConfiguration() {
public TomcatConfiguration getTomcatConfiguration() {
if (configuration == null) {
- //IPath path = getServer().getServerConfiguration();
- //if (path == null)
- IPath path = null;
+ IFolder folder = getServer().getServerConfiguration();
+ /*IPath path = null;
if (getServerWC() != null && getServerWC().getRuntime() != null)
path = getServerWC().getRuntime().getLocation().append("conf");
else if (getServer() != null && getServer().getRuntime() != null)
path = getServer().getRuntime().getLocation().append("conf");
else
- return null;
+ return null;*/
String id = getServer().getServerType().getId();
if (id.indexOf("32") > 0)
- configuration = new Tomcat32Configuration(path);
+ configuration = new Tomcat32Configuration(folder);
else if (id.indexOf("40") > 0)
- configuration = new Tomcat40Configuration(path);
+ configuration = new Tomcat40Configuration(folder);
else if (id.indexOf("41") > 0)
- configuration = new Tomcat41Configuration(path);
+ configuration = new Tomcat41Configuration(folder);
else if (id.indexOf("50") > 0)
- configuration = new Tomcat50Configuration(path);
+ configuration = new Tomcat50Configuration(folder);
else if (id.indexOf("55") > 0)
- configuration = new Tomcat55Configuration(path);
+ configuration = new Tomcat55Configuration(folder);
try {
- configuration.load(path, null);
+ configuration.load(folder, null);
} catch (CoreException ce) {
// ignore
}
@@ -107,22 +107,27 @@ public void importConfiguration(IRuntime runtime, IProgressMonitor monitor) {
String id = getServer().getServerType().getId();
if (id.indexOf("32") > 0)
- configuration = new Tomcat32Configuration(path);
+ configuration = new Tomcat32Configuration(null);
else if (id.indexOf("40") > 0)
- configuration = new Tomcat40Configuration(path);
+ configuration = new Tomcat40Configuration(null);
else if (id.indexOf("41") > 0)
- configuration = new Tomcat41Configuration(path);
+ configuration = new Tomcat41Configuration(null);
else if (id.indexOf("50") > 0)
- configuration = new Tomcat50Configuration(path);
+ configuration = new Tomcat50Configuration(null);
else if (id.indexOf("55") > 0)
- configuration = new Tomcat55Configuration(path);
+ configuration = new Tomcat55Configuration(null);
try {
configuration.load(path, monitor);
} catch (CoreException ce) {
// ignore
}
}
+ public void saveConfiguration(IProgressMonitor monitor) throws CoreException {
+ TomcatConfiguration config = getTomcatConfiguration();
+ config.save(getServer().getServerConfiguration(), monitor);
+ }
+
/**
* Return the root URL of this module.
* @param module org.eclipse.wst.server.core.model.IModule
@@ -133,7 +138,7 @@ public URL getModuleRootURL(IModule module) {
if (module == null || !(module instanceof IWebModule))
return null;
- IPath serverConfig = getServer().getServerConfiguration();
+ IFolder serverConfig = getServer().getServerConfiguration();
if (serverConfig == null)
return null;
@@ -495,6 +500,6 @@ public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor moni
}
}
}
- config.save(config.getPath(), true, monitor);
+ config.save(config.getFolder(), monitor);
}
}
View
2 ...at.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
@@ -195,6 +195,8 @@ public void publishModule(IModule[] parents, IModule module, IProgressMonitor mo
IPath from = webModule.getLocation();
IPath to = getServer().getRuntime().getLocation().append("webapps").append(webModule.getContextRoot());
FileUtil.smartCopyDirectory(from.toOSString(), to.toOSString(), monitor);
+
+ setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
}
/**
View
3 ...org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java
@@ -11,6 +11,7 @@
package org.eclipse.wst.server.core;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.*;
/**
* Represents a server instance. Every server is an instance of a
@@ -175,7 +176,7 @@
*
* @return the server configuration, or <code>null</code> if none
*/
- public IPath getServerConfiguration();
+ public IFolder getServerConfiguration();
/**
* Returns the server extension for this server.
View
4 ...rg.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java
@@ -11,8 +11,8 @@
package org.eclipse.wst.server.core;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* A working copy server object used for formulating changes
@@ -78,7 +78,7 @@
*
* @param configuration the server configuration, or <code>null</code> if none
*/
- public void setServerConfiguration(IPath configuration);
+ public void setServerConfiguration(IFolder configuration);
/**
* Returns the server instance that this working copy is
View
8 ...ipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java
@@ -66,8 +66,6 @@
// module events listeners
protected transient List moduleEventListeners;
- protected static List serverProjects = new ArrayList();
-
/**
* Resource listener - tracks changes on server resources so that
* we can reload/drop server instances and configurations that
@@ -119,7 +117,7 @@ public void resourceChanged(IResourceChangeEvent event) {
* @param delta org.eclipse.core.resources.IResourceDelta
*/
protected void projectChanged(IProject project, IResourceDelta delta) {
- if (serverProjects.contains(project)) {
+ if (!ServerCore.getProjectProperties(project).isServerProject()) {
Trace.trace(Trace.RESOURCES, "Not a server project: " + project.getName());
return;
}
@@ -277,10 +275,8 @@ public void childProjectChange(IServerConfiguration configuration) {
if (projects != null) {
int size = projects.length;
for (int i = 0; i < size; i++) {
- if (ServerCore.getProjectProperties(projects[i]).isServerProject()) {
- serverProjects.add(projects[i]);
+ if (ServerCore.getProjectProperties(projects[i]).isServerProject())
loadFromProject(projects[i]);
- }
}
}
View
13 ...s/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
@@ -13,7 +13,9 @@
import java.util.*;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.*;
import org.osgi.framework.Bundle;
@@ -37,7 +39,7 @@
protected ServerBehaviourDelegate behaviourDelegate;
protected IRuntime runtime;
- protected IPath configuration;
+ protected IFolder configuration;
protected String mode;
protected int serverState = STATE_UNKNOWN;
@@ -114,7 +116,7 @@ protected String getRuntimeId() {
/* (non-Javadoc)
* @see com.ibm.wtp.server.core.IServer2#getServerConfiguration()
*/
- public IPath getServerConfiguration() {
+ public IFolder getServerConfiguration() {
return configuration;
}
@@ -619,8 +621,7 @@ protected void firePublishStateChange(IModule[] parents, IModule module) {
public boolean canPublish() {
// can't publish if the server is starting or stopping
int state = getServerState();
- if (state == STATE_STARTING ||
- state == STATE_STOPPING)
+ if (state == STATE_STARTING || state == STATE_STOPPING)
return false;
// can't publish if there is no configuration
@@ -1546,7 +1547,7 @@ protected void resolve() {
String configPath = getAttribute(CONFIGURATION_ID, (String)null);
configuration = null;
if (configPath != null)
- configuration = new Path(configPath);
+ configuration = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(configPath));
}
protected void setInternal(ServerWorkingCopy wc) {
@@ -1567,7 +1568,7 @@ protected void saveState(IMemento memento) {
memento.putString("server-type", serverType.getId());
if (configuration != null)
- memento.putString(CONFIGURATION_ID, configuration.toPortableString());
+ memento.putString(CONFIGURATION_ID, configuration.getFullPath().toString());
else
memento.putString(CONFIGURATION_ID, null);
View
40 ...g.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java
@@ -11,6 +11,10 @@
package org.eclipse.wst.server.core.internal;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -177,6 +181,13 @@ public IServerWorkingCopy createServer(String id, IFile file, IProgressMonitor m
if (runtime != null)
swc.setRuntime(runtime);
+ if (swc.getServerType().hasServerConfiguration()) {
+ // TODO: config
+ ((Server)swc).importConfiguration(runtime, null);
+ IFolder folder = getServerProject().getFolder("cfg");
+ swc.setServerConfiguration(folder);
+ }
+
//TODO: import server config
/* IServerConfigurationWorkingCopy config = null;
if (hasServerConfiguration()) {
@@ -194,6 +205,35 @@ public IServerWorkingCopy createServer(String id, IFile file, IProgressMonitor m
return swc;
}
+ public static IProject getServerProject() {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ if (projects != null) {
+ int size = projects.length;
+ for (int i = 0; i < size; i++) {
+ if (ServerCore.getProjectProperties(projects[i]).isServerProject())
+ return projects[i];
+ }
+ }
+
+ String s = findUnusedServerProjectName();
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(s);
+ }
+
+ /**
+ * Finds an unused project name to use as a server project.
+ *
+ * @return java.lang.String
+ */
+ protected static String findUnusedServerProjectName() {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ String name = ServerPlugin.getResource("%defaultServerProjectName", "");
+ int count = 1;
+ while (root.getProject(name).exists()) {
+ name = ServerPlugin.getResource("%defaultServerProjectName", ++count + "");
+ }
+ return name;
+ }
+
/**
* Return the timeout (in ms) that should be used to wait for the server to start.
* Returns -1 if there is no timeout.
View
12 ...se.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java
@@ -16,6 +16,8 @@
import java.util.Map;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.wst.server.core.*;
import org.eclipse.wst.server.core.model.ServerDelegate;
@@ -111,12 +113,12 @@ public void setHost(String host) {
setAttribute(PROP_HOSTNAME, host);
}
- public void setServerConfiguration(IPath config) {
+ public void setServerConfiguration(IFolder config) {
this.configuration = config;
if (configuration == null)
setAttribute(CONFIGURATION_ID, (String)null);
else
- setAttribute(CONFIGURATION_ID, configuration.toPortableString());
+ setAttribute(CONFIGURATION_ID, configuration.getFullPath().toString());
}
public void setFile(IFile file) {
@@ -177,6 +179,12 @@ public IServer save(boolean force, IProgressMonitor monitor) throws CoreExceptio
server.setInternal(this);
server.doSave(monitor);
+ IFolder folder = getServerConfiguration();
+ if (folder != null && !folder.exists()) {
+ folder.create(IResource.FORCE, true, null);
+ }
+ //ResourcesPlugin.getWorkspace().getRoot().g
+ getDelegate().saveConfiguration(monitor);
wch.setDirty(false);
return server;
View
4 ....eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java
@@ -326,4 +326,8 @@ public boolean isSupportedConfiguration(IPath configuration2) {
public void importConfiguration(IRuntime runtime, IProgressMonitor monitor) {
// do nothing
}
+
+ public void saveConfiguration(IProgressMonitor monitor) throws CoreException {
+ // do nothing
+ }
}
View
4 ...server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java
@@ -13,7 +13,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -32,7 +32,7 @@
public boolean supports(IServer server) {
if (server == null)
return false;
- IPath configuration = server.getServerConfiguration();
+ IFolder configuration = server.getServerConfiguration();
return (!server.getServerType().hasServerConfiguration() || configuration != null);
}
View
4 ...se.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java
@@ -15,6 +15,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.util.Task;
import org.eclipse.wst.server.ui.internal.EclipseUtil;
/**
@@ -46,6 +47,9 @@ public void execute(IProgressMonitor monitor) throws CoreException {
workingCopy = server.createWorkingCopy();
workingCopy.setRuntime(runtime);
+ if (workingCopy.getServerType().hasServerConfiguration()) {
+ ((Server)workingCopy).importConfiguration(runtime, null);
+ }
getTaskModel().putObject(ITaskModel.TASK_SERVER, workingCopy);
}
}
View
16 ...r.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java
@@ -10,7 +10,7 @@
**********************************************************************/
package org.eclipse.wst.server.ui.internal.view.tree;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
@@ -20,31 +20,27 @@
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.internal.EclipseUtil;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.ProgressUtil;
-import org.eclipse.wst.server.ui.internal.ServerLabelProvider;
-import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.*;
import org.eclipse.swt.widgets.Shell;
/**
* Action to add or remove configuration to/from a server.
*/
public class SwitchConfigurationAction extends Action {
protected IServer server;
- protected IPath config;
+ protected IFolder config;
protected Shell shell;
protected IStatus status;
/**
* SwitchConfigurationAction constructor comment.
*/
- public SwitchConfigurationAction(Shell shell, String label, IServer server, IPath config) {
+ public SwitchConfigurationAction(Shell shell, String label, IServer server, IFolder config) {
super(label);
this.shell = shell;
this.server = server;
this.config = config;
- IPath tempConfig = server.getServerConfiguration();
+ IFolder tempConfig = server.getServerConfiguration();
if ((tempConfig == null && config == null) || (tempConfig != null && tempConfig.equals(config)))
setChecked(true);
@@ -60,7 +56,7 @@ public SwitchConfigurationAction(Shell shell, String label, IServer server, IPat
}
public void run() {
- IPath tempConfig = server.getServerConfiguration();
+ IFolder tempConfig = server.getServerConfiguration();
if ((tempConfig == null && config == null) || (tempConfig != null && tempConfig.equals(config)))
return;
View
29 ....ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
+ * Copyright (c) 2003, 2004 IBM Corporation and others.
* 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
@@ -14,6 +14,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
@@ -30,12 +31,9 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.util.SocketUtil;
-import org.eclipse.wst.server.ui.internal.ContextIds;
-import org.eclipse.wst.server.ui.internal.ProgressUtil;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
+import org.eclipse.wst.server.ui.internal.*;
import org.eclipse.wst.server.ui.internal.viewers.ServerTypeComposite;
/**
* Wizard page used to create a server and configuration at the same time.
@@ -131,8 +129,15 @@ public void serverTypeSelected(IServerType type2) {
public void widgetSelected(SelectionEvent e) {
try {
runtime = runtimes[runtimeCombo.getSelectionIndex()];
- if (server != null)
+ if (server != null) {
server.setRuntime(runtime);
+ if (server.getServerType().hasServerConfiguration()) {
+ // TODO: config
+ ((Server)server).importConfiguration(runtime, null);
+ IFolder folder = WizardUtil.getServerProject().getFolder("cfg");
+ server.setServerConfiguration(folder);
+ }
+ }
} catch (Exception ex) {
// ignore
}
@@ -194,8 +199,16 @@ public void run(IProgressMonitor monitor) {
server.setHost(host);
ServerUtil.setServerDefaultName(server);
- if (serverType.hasRuntime() && server.getRuntime() == null)
+ if (serverType.hasRuntime() && server.getRuntime() == null) {
server.setRuntime(runtime);
+
+ if (server.getServerType().hasServerConfiguration()) {
+ // TODO: config
+ ((Server)server).importConfiguration(runtime, null);
+ IFolder folder = WizardUtil.getServerProject().getFolder("cfg");
+ server.setServerConfiguration(folder);
+ }
+ }
}
} catch (CoreException cex) {
ce[0] = cex;

0 comments on commit 6c28603

Please sign in to comment.