*** empty log message ***
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableViewer.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableViewer.java
index fd9a6d9..bf05ecd 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableViewer.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableViewer.java
@@ -86,7 +86,7 @@
for (int i = 0; i < size; i++) {
int size2 = ms.module.length;
IModule[] module = new IModule[size2 + 1];
- System.arraycopy(ms.module, 0, ms2[i].module, 0, size2);
+ System.arraycopy(ms.module, 0, module, 0, size2);
module[size2] = children[i];
ms2[i] = new ModuleServer(ms.server, module);
}
@@ -115,8 +115,22 @@
}
public boolean hasChildren(Object element) {
- if (element instanceof ModuleServer)
- return false;
+ if (element instanceof ModuleServer) {
+ // Check if the module server has child modules.
+ ModuleServer curModuleServer = (ModuleServer)element;
+ IServer curServer = curModuleServer.server;
+ IModule[] curModule = curModuleServer.module;
+ if (curServer != null && curModule != null) {
+ IModule[] curChildModule = curServer.getChildModules(curModule, null);
+ if (curChildModule != null && curChildModule.length > 0) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
IServer server = (IServer) element;
return server.getModules().length > 0;
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
index c5f6aed..32d3afd 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
@@ -70,6 +70,55 @@
protected IModule origNewModule;
protected Map errorMap;
+
+ /**
+ * The key element for the child module map
+ * ChildMapModuleKey
+ */
+ protected class ChildModuleMapKey {
+ private IModule[] moduleTree;
+
+ protected ChildModuleMapKey(IModule curModule) {
+ if (curModule != null) {
+ moduleTree = new IModule[] { curModule };
+ }
+ }
+
+ protected ChildModuleMapKey(IModule[] curModuleTree) {
+ moduleTree = curModuleTree;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ // Same object.
+ return true;
+ }
+
+ boolean result = false;
+ if (obj instanceof ChildModuleMapKey) {
+ IModule[] curCompareModule = ((ChildModuleMapKey)obj).moduleTree;
+ if (curCompareModule == moduleTree) {
+ // The module tree is the same.
+ result = true;
+ } else if (moduleTree == null || curCompareModule == null || moduleTree.length != curCompareModule.length){
+ result = false;
+ } else {
+ // Compare each module.
+ result = true;
+ for (int i=0; result && i<curCompareModule.length; i++) {
+ result &= curCompareModule[i].equals(moduleTree[i]);
+ }
+ }
+ }
+ return result;
+ }
+
+ public int hashCode() {
+ // Force the same hash code on all the instances to makes sure the equals(Object) method
+ // is being used for comparing the objects.
+ return 12345;
+ }
+ }
/**
* Create a new ModifyModulesComposite.
@@ -116,6 +165,7 @@
// add new module
newModule = null;
+ errorMap = new HashMap();
if (origNewModule != null) {
try {
IModule[] parents = server.getRootModules(origNewModule, null);
@@ -123,8 +173,11 @@
newModule = parents[0];
else
newModule = origNewModule;
+ } catch (CoreException ce) {
+ errorMap.put(newModule, ce.getStatus());
+ newModule = null;
} catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find parent module", e);
+ Trace.trace(Trace.WARNING, "Could not find root module", e);
newModule = null;
}
}
@@ -132,7 +185,6 @@
deployed.add(newModule);
// get remaining modules
- errorMap = new HashMap();
IModule[] modules2 = ServerUtil.getModules(server.getServerType().getRuntimeType().getModuleTypes());
if (modules2 != null) {
int size = modules2.length;
@@ -166,7 +218,7 @@
IModule module = (IModule) iterator.next();
try {
IModule[] children = server.getChildModules(new IModule[] { module }, null);
- childModuleMap.put(module, children);
+ childModuleMap.put(new ChildModuleMapKey(module), children);
} catch (Exception e) {
// ignore
}
@@ -177,7 +229,7 @@
IModule module = (IModule) iterator.next();
try {
IModule[] children = server.getChildModules(new IModule[] { module }, null);
- childModuleMap.put(module, children);
+ childModuleMap.put(new ChildModuleMapKey(module), children);
} catch (Exception e) {
// ignore
}
@@ -363,7 +415,7 @@
protected void addChildren(TreeItem item, IModule[] module) {
try {
- IModule[] children = (IModule[]) childModuleMap.get(module);
+ IModule[] children = (IModule[]) childModuleMap.get(new ChildModuleMapKey(module));
if (children != null) {
int size = children.length;
for (int i = 0; i < size; i++) {
@@ -500,7 +552,7 @@
modules2[size2] = module;
map.add(modules2);
- IModule[] children2 = (IModule[]) childModuleMap.get(module);
+ IModule[] children2 = (IModule[]) childModuleMap.get(new ChildModuleMapKey(module));
if (children2 != null)
addChildMap(map, modules2, children2);
}
@@ -514,7 +566,7 @@
IModule module = (IModule) iterator.next();
IModule[] moduleTree = new IModule[] { module };
map.add(moduleTree);
- IModule[] children = (IModule[]) childModuleMap.get(module);
+ IModule[] children = (IModule[]) childModuleMap.get(new ChildModuleMapKey(module));
if (children != null)
addChildMap(map, moduleTree, children);
}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewServerComposite.java
index d106a79..332f155 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewServerComposite.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewServerComposite.java
@@ -12,6 +12,8 @@
import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -332,6 +334,23 @@
wizard.setMessage(NLS.bind(Messages.errorVersionLevel, new Object[] { type, mt.getVersion() }), IMessageProvider.ERROR);
server = null;
}
+ if (wizard.getMessage() == null) {
+ try {
+ server.getRootModules(module, null);
+ } catch (CoreException ce) {
+ IStatus status = ce.getStatus();
+ if (status != null) {
+ if (status.getSeverity() == IStatus.ERROR)
+ wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
+ else if (status.getSeverity() == IStatus.WARNING)
+ wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
+ else if (status.getSeverity() == IStatus.INFO)
+ wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.WARNING, "Could not find root module", e);
+ }
+ }
}
if (existingWC != null) {