[108681] Changes for Single component
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/emfworkbench/internal/emf2xml/sse/EMF2DOMSSERenderer.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/emfworkbench/internal/emf2xml/sse/EMF2DOMSSERenderer.java
index b27c078..c15ea5d 100644
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/emfworkbench/internal/emf2xml/sse/EMF2DOMSSERenderer.java
+++ b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/emfworkbench/internal/emf2xml/sse/EMF2DOMSSERenderer.java
@@ -354,10 +354,13 @@
if (file == null || !file.exists())
throw new FileNotFoundException((file == null) ? "null" : file.getFullPath().toOSString()); //$NON-NLS-1$
try {
- if (forWrite)
+ if (forWrite) {
setXMLModel((IDOMModel) getModelManager().getModelForEdit(file));
- else
+ }
+ else {
setXMLModel((IDOMModel) getModelManager().getModelForRead(file));
+ }
+ setXMLModelId(getXMLModel().getId());
needsToCreateDOM = false;
} catch (CoreException e) {
org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(e);
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ArtifactEdit.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ArtifactEdit.java
index c4047e4..72c4ecf 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ArtifactEdit.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ArtifactEdit.java
@@ -202,6 +202,8 @@
* {@see IEditModelFactory} and is contained by an accessible project
*/
public static boolean isValidEditableModule(IVirtualComponent aModule) {
+ if (aModule == null)
+ return false;
/* The ComponentType must be non-null, and the moduleTypeId must be non-null */
if (aModule.getComponentTypeId() == null)
return false;
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ComponentCore.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ComponentCore.java
index 37fa958..e57c30e 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ComponentCore.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/ComponentCore.java
@@ -54,18 +54,21 @@
* the given project (aProject). Component names should be unique across a project.
*
* @param aProject A valid, accessible project to contain the component
- * @return A handle to an IVirtualComponent that may or may not exist.
+ * @return A handle to an IVirtualComponent that may or may not exist or null if passed project does not contain ModuleCoreNature.
* @see IVirtualContainer#create(int, IProgressMonitor)
*/
public static IVirtualComponent createComponent(IProject aProject) {
- return new VirtualComponent(aProject, new Path("/")); //$NON-NLS-1$
+ if (!ModuleCoreNature.isFlexibleProject(aProject))
+ return null;
+ else
+ return new VirtualComponent(aProject, new Path("/")); //$NON-NLS-1$
}
/**
* Return an IVirtualComponent with the given name (aComponentName) contained by
* the given project (aProject). Component names should be unique across a project.
*
* @param aProject A valid, accessible project to contain the component
- * @return A handle to an IVirtualComponent that may or may not exist.
+ * @return A handle to an IVirtualComponent that may or may not exist or null if passed project does not contain ModuleCoreNature.
* @deprecated
* @see IVirtualContainer#create(int, IProgressMonitor)
*/
@@ -83,7 +86,6 @@
*/
public static IVirtualComponent createArchiveComponent(IProject aProject, String aComponentName){
return new VirtualArchiveComponent(aProject, aComponentName, new Path("/"));
-
}
/**
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/builder/DependencyGraphManager.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/builder/DependencyGraphManager.java
index ed3ca54..700b641 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/builder/DependencyGraphManager.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/builder/DependencyGraphManager.java
@@ -70,6 +70,7 @@
if (!projects[k].isAccessible() || !addTimeStamp(projects[k]))
continue;
IVirtualComponent component= ComponentCore.createComponent(projects[k]);
+ if (component == null) continue;
addDependencyReference(component);
}
}