[126717] Added IModule.exists() check for deleted modules
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule.java
index db7209b..c41c73c 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/IModule.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* 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
@@ -41,12 +41,6 @@
* (optional) project attribute is equal.
* </p>
* <p>This interface is not intended to be implemented by clients.</p>
- * <p>
- * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to
- * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
- * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
- * (repeatedly) as the API evolves.
- * </p>
*
* @since 1.0
*/
@@ -97,6 +91,15 @@
public boolean isExternal();
/**
+ * Returns <code>true</code> if the module exists (e.g. is in the workspace)
+ * and <code>false</code> otherwise (e.g. if the module has been deleted).
+ *
+ * @return <code>true</code> if the module exists,
+ * and <code>false</code> otherwise
+ */
+ public boolean exists();
+
+ /**
* Returns an object which is an instance of the given class
* associated with this object. Returns <code>null</code> if
* no such object can be found, or if the delegate is not
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java
index b26dbc9..4c4c3d3 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/DeletedModule.java
@@ -76,6 +76,10 @@
return false;
}
+ public boolean exists() {
+ return false;
+ }
+
public String toString() {
return "DeletedModule[" + name + "," + id + "]";
}
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java
index 021ff97..8231056 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Module.java
@@ -244,6 +244,13 @@
return false;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.core.IModule#exists()
+ */
+ public boolean exists() {
+ return true;
+ }
+
/**
* Return a string representation of this object.
*
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 a309dd6..4fb4a10 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
@@ -1123,7 +1123,7 @@
// to make the publishing dialog appear, require adaptable to covert String.class
// into "user" string. a bit of a kludge, but works fine for now
- if (info.getAdapter(String.class).equals("user"))
+ if (info != null && info.getAdapter(String.class).equals("user"))
publishJob.setUser(true);
publishJob.schedule();
}