[104036] Adding reference to module
diff --git a/plugins/org.eclipse.wst.common.modulecore/model/componentCore.ecore b/plugins/org.eclipse.wst.common.modulecore/model/componentCore.ecore
index 51e3ab4..890a455 100644
--- a/plugins/org.eclipse.wst.common.modulecore/model/componentCore.ecore
+++ b/plugins/org.eclipse.wst.common.modulecore/model/componentCore.ecore
@@ -11,7 +11,7 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="componentType" unique="false"
lowerBound="1" eType="#//ComponentType" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="referencedComponents" unique="false"
- upperBound="-1" eType="#//ReferencedComponent"/>
+ upperBound="-1" eType="#//ReferencedComponent" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ComponentResource">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="sourcePath" lowerBound="1"
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ComponentcorePackage.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ComponentcorePackage.java
index dae2807..54bf8b4 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ComponentcorePackage.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ComponentcorePackage.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: ComponentcorePackage.java,v 1.4 2005/09/12 19:06:15 cbridgha Exp $
+ * $Id: ComponentcorePackage.java,v 1.5 2005/09/12 20:56:53 cbridgha Exp $
*/
package org.eclipse.wst.common.componentcore.internal;
@@ -99,7 +99,7 @@
int WORKBENCH_COMPONENT__COMPONENT_TYPE = 2;
/**
- * The feature id for the '<em><b>Referenced Components</b></em>' reference list.
+ * The feature id for the '<em><b>Referenced Components</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -439,10 +439,10 @@
EReference getWorkbenchComponent_ComponentType();
/**
- * Returns the meta object for the reference list '{@link org.eclipse.wst.common.componentcore.internal.WorkbenchComponent#getReferencedComponents <em>Referenced Components</em>}'.
+ * Returns the meta object for the containment reference list '{@link org.eclipse.wst.common.componentcore.internal.WorkbenchComponent#getReferencedComponents <em>Referenced Components</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Referenced Components</em>'.
+ * @return the meta object for the containment reference list '<em>Referenced Components</em>'.
* @see org.eclipse.wst.common.componentcore.internal.WorkbenchComponent#getReferencedComponents()
* @see #getWorkbenchComponent()
* @generated
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModulecorePlugin.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModulecorePlugin.java
index f9f7003..4f2575b 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModulecorePlugin.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ModulecorePlugin.java
@@ -12,6 +12,7 @@
import org.eclipse.wst.common.componentcore.internal.impl.WTPModulesInit;
import org.eclipse.wst.common.componentcore.internal.util.ArtifactEditAdapterFactory;
import org.eclipse.wst.common.componentcore.internal.util.ModuleCoreEclipseAdapterFactory;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.osgi.framework.BundleContext;
/**
@@ -43,6 +44,7 @@
manager.registerAdapters(new ModuleCoreEclipseAdapterFactory(), ModuleStructuralModel.class);
manager.registerAdapters(new ArtifactEditAdapterFactory(), ArtifactEditModel.class);
manager.registerAdapters(new ArtifactEditAdapterFactory(), ArtifactEdit.class);
+ manager.registerAdapters(new ArtifactEditAdapterFactory(), IVirtualComponent.class);
manager.registerAdapters(new ModuleCoreEclipseAdapterFactory(), IResource.class);
PlatformURLModuleConnection.startup();
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/WorkbenchComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/WorkbenchComponent.java
index 6cc0448..22425a5 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/WorkbenchComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/WorkbenchComponent.java
@@ -108,7 +108,7 @@
void setComponentType(ComponentType value);
/**
- * Returns the value of the '<em><b>Referenced Components</b></em>' reference list.
+ * Returns the value of the '<em><b>Referenced Components</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.wst.common.componentcore.internal.ReferencedComponent}.
* <!-- begin-user-doc -->
* <p>
@@ -116,9 +116,9 @@
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Referenced Components</em>' reference list.
+ * @return the value of the '<em>Referenced Components</em>' containment reference list.
* @see org.eclipse.wst.common.componentcore.internal.ComponentcorePackage#getWorkbenchComponent_ReferencedComponents()
- * @model type="org.eclipse.wst.common.componentcore.internal.ReferencedComponent"
+ * @model type="org.eclipse.wst.common.componentcore.internal.ReferencedComponent" containment="true"
* @generated
*/
EList getReferencedComponents();
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentcorePackageImpl.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentcorePackageImpl.java
index 4a2618d..7999524 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentcorePackageImpl.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentcorePackageImpl.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: ComponentcorePackageImpl.java,v 1.5 2005/09/12 19:06:15 cbridgha Exp $
+ * $Id: ComponentcorePackageImpl.java,v 1.6 2005/09/12 20:56:54 cbridgha Exp $
*/
package org.eclipse.wst.common.componentcore.internal.impl;
@@ -531,7 +531,7 @@
initEAttribute(getWorkbenchComponent_Name(), ecorePackage.getEString(), "name", "", 1, 1, WorkbenchComponent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getWorkbenchComponent_Resources(), this.getComponentResource(), this.getComponentResource_Component(), "resources", null, 0, -1, WorkbenchComponent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getWorkbenchComponent_ComponentType(), this.getComponentType(), null, "componentType", null, 1, 1, WorkbenchComponent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getWorkbenchComponent_ReferencedComponents(), this.getReferencedComponent(), null, "referencedComponents", null, 0, -1, WorkbenchComponent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getWorkbenchComponent_ReferencedComponents(), this.getReferencedComponent(), null, "referencedComponents", null, 0, -1, WorkbenchComponent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(componentResourceEClass, ComponentResource.class, "ComponentResource", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getComponentResource_SourcePath(), this.getIPath(), "sourcePath", null, 1, 1, ComponentResource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
index bb17c08..1e1f1b4 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/WorkbenchComponentImpl.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: WorkbenchComponentImpl.java,v 1.5 2005/09/12 19:06:15 cbridgha Exp $
+ * $Id: WorkbenchComponentImpl.java,v 1.6 2005/09/12 20:56:54 cbridgha Exp $
*/
package org.eclipse.wst.common.componentcore.internal.impl;
@@ -21,8 +21,8 @@
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
-import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.wst.common.componentcore.internal.ComponentResource;
@@ -87,7 +87,7 @@
protected ComponentType componentType = null;
/**
- * The cached value of the '{@link #getReferencedComponents() <em>Referenced Components</em>}' reference list.
+ * The cached value of the '{@link #getReferencedComponents() <em>Referenced Components</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReferencedComponents()
@@ -236,7 +236,7 @@
*/
public EList getReferencedComponents() {
if (referencedComponents == null) {
- referencedComponents = new EObjectResolvingEList(ReferencedComponent.class, this, ComponentcorePackage.WORKBENCH_COMPONENT__REFERENCED_COMPONENTS);
+ referencedComponents = new EObjectContainmentEList(ReferencedComponent.class, this, ComponentcorePackage.WORKBENCH_COMPONENT__REFERENCED_COMPONENTS);
}
return referencedComponents;
}
@@ -270,6 +270,8 @@
return ((InternalEList)getResources()).basicRemove(otherEnd, msgs);
case ComponentcorePackage.WORKBENCH_COMPONENT__COMPONENT_TYPE:
return basicSetComponentType(null, msgs);
+ case ComponentcorePackage.WORKBENCH_COMPONENT__REFERENCED_COMPONENTS:
+ return ((InternalEList)getReferencedComponents()).basicRemove(otherEnd, msgs);
default:
return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
index 7a1bc97..ed890fc 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualComponent.java
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.internal.ComponentType;
import org.eclipse.wst.common.componentcore.internal.ComponentcoreFactory;
@@ -325,6 +326,9 @@
public ComponentHandle getComponentHandle() {
return componentHandle;
}
+ public Object getAdapter(Class adapterType) {
+ return Platform.getAdapterManager().getAdapter(this, adapterType);
+ }
public IVirtualFolder getRootFolder() {
return rootFolder;
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ArtifactEditAdapterFactory.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ArtifactEditAdapterFactory.java
index 80bd829..36f4101 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ArtifactEditAdapterFactory.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ArtifactEditAdapterFactory.java
@@ -26,6 +26,7 @@
import org.eclipse.wst.common.componentcore.internal.impl.ArtifactEditModelFactory;
import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil;
import org.eclipse.wst.common.componentcore.resources.ComponentHandle;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
/**
* <p>
@@ -65,6 +66,11 @@
if (anAdapterType == ArtifactEdit.ADAPTER_TYPE) {
if (anAdaptableObject instanceof ArtifactEditModel)
return new ArtifactEdit((ArtifactEditModel) anAdaptableObject);
+ if (anAdaptableObject instanceof IVirtualComponent) {
+ ArtifactEditRegistryReader reader = ArtifactEditRegistryReader.instance();
+ IArtifactEditFactory factory = reader.getArtifactEdit(((IVirtualComponent)anAdaptableObject).getComponentTypeId());
+ return factory.createArtifactEditForRead((IVirtualComponent)anAdaptableObject);
+ }
}
return null;
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/HRefTranslator.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/HRefTranslator.java
index 4b259d8..c73e002 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/HRefTranslator.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/HRefTranslator.java
@@ -3,7 +3,13 @@
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.wst.common.componentcore.ArtifactEdit;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.internal.emf.resource.Translator;
import org.eclipse.wst.common.internal.emf.resource.TranslatorPath;
@@ -49,9 +55,11 @@
* org.eclipse.emf.ecore.EObject)
*/
public Object convertStringToValue(String aValue, EObject anOwner) {
- //Resource res = getApplicationResource()
- //getModuleFromID(res,aValue);
- return aValue;
+ WorkbenchComponent earComp = (WorkbenchComponent)anOwner.eContainer();
+ IVirtualComponent virtualComp = ComponentCore.createComponent(StructureEdit.getContainingProject(earComp),earComp.getName());
+ ArtifactEdit edit = (ArtifactEdit)virtualComp.getAdapter(ArtifactEdit.class);
+ Resource res = edit.getContentModelRoot().eResource();
+ return res.getEObject(aValue);
}
/*
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/WTPModulesTranslator.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/WTPModulesTranslator.java
index 9620671..e794794 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/WTPModulesTranslator.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/WTPModulesTranslator.java
@@ -1,6 +1,5 @@
package org.eclipse.wst.common.componentcore.internal.util;
-import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.wst.common.componentcore.internal.ComponentcorePackage;
import org.eclipse.wst.common.internal.emf.resource.GenericTranslator;
@@ -93,13 +92,6 @@
return result;
}
- private static Translator createDepObjectTranslator(EReference afeature) {
- GenericTranslator result = new GenericTranslator(DEP_OBJECT, afeature);
- result.setChildren(new Translator[] {
- IDTranslator.INSTANCE
- });
- return result;
- }
private static Translator createWBResourceTranslator(EStructuralFeature afeature) {
GenericTranslator result = new GenericTranslator(COMPONENT_RESOURCE, afeature);
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualComponent.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualComponent.java
index c271f13..7078463 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualComponent.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/IVirtualComponent.java
@@ -13,6 +13,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -28,7 +29,7 @@
* </p>
* @plannedfor 1.0
*/
-public interface IVirtualComponent {
+public interface IVirtualComponent extends IAdaptable {
IPath ROOT = new Path("/");