*** empty log message ***
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java index 20eb5b2..8d2ae49 100644 --- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Configuration.java +++ b/plugins/org.eclipse.jst.server.tomcat.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 @@ 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())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java index 824d2d2..3dc4210 100644 --- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java +++ b/plugins/org.eclipse.jst.server.tomcat.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 @@ 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())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java index b14caed..1ff47c1 100644 --- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java +++ b/plugins/org.eclipse.jst.server.tomcat.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 @@ 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())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java index 1fea1d0..bbe71a9 100644 --- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java +++ b/plugins/org.eclipse.jst.server.tomcat.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 @@ 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())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java index dc367bf..15be680 100644 --- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java +++ b/plugins/org.eclipse.jst.server.tomcat.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 @@ 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())
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java index f34da65..a35f52f 100644 --- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java +++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
@@ -47,7 +47,7 @@ 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; @@ -55,7 +55,7 @@ /** * TomcatConfiguration constructor comment. */ - public TomcatConfiguration(IPath path) { + public TomcatConfiguration(IFolder path) { super(); this.configPath = path; /*try { @@ -65,7 +65,7 @@ }*/ } - protected IPath getPath() { + protected IFolder getFolder() { return configPath; } @@ -98,10 +98,10 @@ 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 @@ * @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 @@ 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);
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java index 19b2c5a..79514ae 100644 --- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java +++ b/plugins/org.eclipse.jst.server.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 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,15 +107,15 @@ 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) { @@ -123,6 +123,11 @@ } } + 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 @@ 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 @@ } } } - config.save(config.getPath(), true, monitor); + config.save(config.getFolder(), monitor); } } \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java index 5ac0aba..88aaec5 100644 --- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java +++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
@@ -195,6 +195,8 @@ 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); } /**
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java index 158017d..05301b7 100644 --- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerAttributes.java +++ b/plugins/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.
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java index 5208d92..0bc45e1 100644 --- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IServerWorkingCopy.java +++ b/plugins/org.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
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java index 2312f2c..f068760 100644 --- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ResourceManager.java +++ b/plugins/org.eclipse.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 @@ * @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 @@ 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]); - } } }
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java index d4fc79f..3f492a7 100644 --- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java +++ b/plugins/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 @@ /* (non-Javadoc) * @see com.ibm.wtp.server.core.IServer2#getServerConfiguration() */ - public IPath getServerConfiguration() { + public IFolder getServerConfiguration() { return configuration; } @@ -619,8 +621,7 @@ 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 @@ 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 @@ 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);
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java index a982cc8..c7c4d7d 100644 --- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerType.java +++ b/plugins/org.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 @@ 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 @@ 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.
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java index 1ea3aa6..8c1e116 100644 --- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/ServerWorkingCopy.java +++ b/plugins/org.eclipse.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 @@ 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 @@ 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;
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java index 0f591df..eeee2ba 100644 --- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java +++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/model/ServerDelegate.java
@@ -326,4 +326,8 @@ public void importConfiguration(IRuntime runtime, IProgressMonitor monitor) { // do nothing } + + public void saveConfiguration(IProgressMonitor monitor) throws CoreException { + // do nothing + } } \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java index e6d643d..cfa48e3 100644 --- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AddRemoveModulesAction.java +++ b/plugins/org.eclipse.wst.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); }
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java index dc481cb..2b72957 100644 --- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/task/TempSaveServerTask.java +++ b/plugins/org.eclipse.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 @@ workingCopy = server.createWorkingCopy(); workingCopy.setRuntime(runtime); + if (workingCopy.getServerType().hasServerConfiguration()) { + ((Server)workingCopy).importConfiguration(runtime, null); + } getTaskModel().putObject(ITaskModel.TASK_SERVER, workingCopy); } }
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java index d4ffcb5..ecc6873 100644 --- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/tree/SwitchConfigurationAction.java +++ b/plugins/org.eclipse.wst.server.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 void run() { - IPath tempConfig = server.getServerConfiguration(); + IFolder tempConfig = server.getServerConfiguration(); if ((tempConfig == null && config == null) || (tempConfig != null && tempConfig.equals(config))) return;
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java index 7176927..9daaabd 100644 --- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java +++ b/plugins/org.eclipse.wst.server.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 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 @@ 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;