Simplified the properties of the ArtifactWrapper metaclass 1. Merge two createArtifacts method into a same one 2. Remove fields path and identifier from class ArtifactWrapper 3. Add a new field internalResolver for class ArtifactWrapper Change-Id: I72b62d570083a6080fa07b38b876a179bfe75c2e
diff --git a/bundles/org.eclipse.capra.core/src/org/eclipse/capra/core/adapters/IArtifactMetaModelAdapter.java b/bundles/org.eclipse.capra.core/src/org/eclipse/capra/core/adapters/IArtifactMetaModelAdapter.java index a48e92e..c85111d 100644 --- a/bundles/org.eclipse.capra.core/src/org/eclipse/capra/core/adapters/IArtifactMetaModelAdapter.java +++ b/bundles/org.eclipse.capra.core/src/org/eclipse/capra/core/adapters/IArtifactMetaModelAdapter.java
@@ -16,7 +16,6 @@ import java.util.List; import org.eclipse.capra.core.handlers.IArtifactHandler; -import org.eclipse.core.runtime.IPath; import org.eclipse.emf.ecore.EObject; /** @@ -48,40 +47,16 @@ * artifact with the same handler and URI. If found, the existing artifact is * returned, otherwise a new artifact is created. * - * TODO: The implementation of this method delegates to the other methods with - * the same name. It exists to enable implementing objects to work with both the - * old and the new API during a transition period. This implementation uses the - * artifacts URI as its unique identifier. - * - * @param artifactModel - * @param artifactHandler - * @param artifactUri - * @param artifactId - * @param artifactName - * @param artifactFilePath - * @return - */ - default EObject createArtifact(EObject artifactModel, String artifactHandler, String artifactUri, - String artifactName, String artifactFilePath) { - return createArtifact(artifactModel, artifactHandler, artifactUri, artifactUri, artifactName, artifactFilePath); - } - - /** - * Create a new artifact. The list of artifacts is searched for an existing - * artifact with the same handler and URI. If found, the existing artifact is - * returned, otherwise a new artifact is created. - * * @param artifactModel the artifact model to add the artifact to * @param artifactHandler the handler responsible for dealing with the artifact * @param artifactUri the URI of the artifact - * @param artifactId the unique identifier of the artifact + * @param internalResolver the internal information for resolving artifacts * @param artifactName the name of the artifact - * @param artifactFilePath the file path to the artifact * @return a newly created artifact or an existing artifact with the same * handler and URI */ - EObject createArtifact(EObject artifactModel, String artifactHandler, String artifactUri, String artifactId, - String artifactName, String artifactFilePath); + EObject createArtifact(EObject artifactModel, String artifactHandler, String artifactUri, String internalResolver, + String artifactName); /** * Gets the artifact with the given handler and URI. @@ -130,20 +105,10 @@ String getArtifactUri(EObject artifact); /** - * @return An internal string that handlers use to locate and reconstruct the - * artifact. + * @return A string contains internal information that handlers use to locate + * and reconstruct the artifact */ - default String getArtifactIdentifier(EObject artifact) { - return getArtifactUri(artifact); - } - - /** - * Get the path of the given artifact. - * - * @param artifact - * @return path of the file, referenced by the artifact - */ - IPath getArtifactPath(EObject artifact); + String getArtifactInternalResolver(EObject artifact); /** * Get an instance of the artifact handler.
diff --git a/bundles/org.eclipse.capra.generic.artifactmodel/model/artifact.xcore b/bundles/org.eclipse.capra.generic.artifactmodel/model/artifact.xcore index 3c5c972..57645da 100644 --- a/bundles/org.eclipse.capra.generic.artifactmodel/model/artifact.xcore +++ b/bundles/org.eclipse.capra.generic.artifactmodel/model/artifact.xcore
@@ -6,9 +6,8 @@ } class ArtifactWrapper { - String path String uri String name - String identifier String ArtifactHandler + String internalResolver } \ No newline at end of file
diff --git a/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/ArtifactWrapper.java b/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/ArtifactWrapper.java index 8bc4d74..28d0757 100644 --- a/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/ArtifactWrapper.java +++ b/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/ArtifactWrapper.java
@@ -13,11 +13,10 @@ * The following features are supported: * </p> * <ul> - * <li>{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getPath <em>Path</em>}</li> * <li>{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getUri <em>Uri</em>}</li> * <li>{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getIdentifier <em>Identifier</em>}</li> * <li>{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getArtifactHandler <em>Artifact Handler</em>}</li> + * <li>{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getInternalResolver <em>Internal Resolver</em>}</li> * </ul> * * @see org.eclipse.capra.generic.artifactmodel.ArtifactmodelPackage#getArtifactWrapper() @@ -26,28 +25,6 @@ */ public interface ArtifactWrapper extends EObject { /** - * Returns the value of the '<em><b>Path</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the value of the '<em>Path</em>' attribute. - * @see #setPath(String) - * @see org.eclipse.capra.generic.artifactmodel.ArtifactmodelPackage#getArtifactWrapper_Path() - * @model unique="false" - * @generated - */ - String getPath(); - - /** - * Sets the value of the '{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getPath <em>Path</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Path</em>' attribute. - * @see #getPath() - * @generated - */ - void setPath(String value); - - /** * Returns the value of the '<em><b>Uri</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -92,28 +69,6 @@ void setName(String value); /** - * Returns the value of the '<em><b>Identifier</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the value of the '<em>Identifier</em>' attribute. - * @see #setIdentifier(String) - * @see org.eclipse.capra.generic.artifactmodel.ArtifactmodelPackage#getArtifactWrapper_Identifier() - * @model unique="false" - * @generated - */ - String getIdentifier(); - - /** - * Sets the value of the '{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getIdentifier <em>Identifier</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Identifier</em>' attribute. - * @see #getIdentifier() - * @generated - */ - void setIdentifier(String value); - - /** * Returns the value of the '<em><b>Artifact Handler</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -135,4 +90,26 @@ */ void setArtifactHandler(String value); + /** + * Returns the value of the '<em><b>Internal Resolver</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the value of the '<em>Internal Resolver</em>' attribute. + * @see #setInternalResolver(String) + * @see org.eclipse.capra.generic.artifactmodel.ArtifactmodelPackage#getArtifactWrapper_InternalResolver() + * @model unique="false" + * @generated + */ + String getInternalResolver(); + + /** + * Sets the value of the '{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getInternalResolver <em>Internal Resolver</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Internal Resolver</em>' attribute. + * @see #getInternalResolver() + * @generated + */ + void setInternalResolver(String value); + } // ArtifactWrapper
diff --git a/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/ArtifactmodelPackage.java b/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/ArtifactmodelPackage.java index 7a4bcd1..aa39443 100644 --- a/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/ArtifactmodelPackage.java +++ b/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/ArtifactmodelPackage.java
@@ -104,22 +104,13 @@ int ARTIFACT_WRAPPER = 1; /** - * The feature id for the '<em><b>Path</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARTIFACT_WRAPPER__PATH = 0; - - /** * The feature id for the '<em><b>Uri</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int ARTIFACT_WRAPPER__URI = 1; + int ARTIFACT_WRAPPER__URI = 0; /** * The feature id for the '<em><b>Name</b></em>' attribute. @@ -128,16 +119,7 @@ * @generated * @ordered */ - int ARTIFACT_WRAPPER__NAME = 2; - - /** - * The feature id for the '<em><b>Identifier</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ARTIFACT_WRAPPER__IDENTIFIER = 3; + int ARTIFACT_WRAPPER__NAME = 1; /** * The feature id for the '<em><b>Artifact Handler</b></em>' attribute. @@ -146,7 +128,16 @@ * @generated * @ordered */ - int ARTIFACT_WRAPPER__ARTIFACT_HANDLER = 4; + int ARTIFACT_WRAPPER__ARTIFACT_HANDLER = 2; + + /** + * The feature id for the '<em><b>Internal Resolver</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ARTIFACT_WRAPPER__INTERNAL_RESOLVER = 3; /** * The number of structural features of the '<em>Artifact Wrapper</em>' class. @@ -155,7 +146,7 @@ * @generated * @ordered */ - int ARTIFACT_WRAPPER_FEATURE_COUNT = 5; + int ARTIFACT_WRAPPER_FEATURE_COUNT = 4; /** * The number of operations of the '<em>Artifact Wrapper</em>' class. @@ -199,17 +190,6 @@ EClass getArtifactWrapper(); /** - * Returns the meta object for the attribute '{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getPath <em>Path</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Path</em>'. - * @see org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getPath() - * @see #getArtifactWrapper() - * @generated - */ - EAttribute getArtifactWrapper_Path(); - - /** * Returns the meta object for the attribute '{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getUri <em>Uri</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -232,17 +212,6 @@ EAttribute getArtifactWrapper_Name(); /** - * Returns the meta object for the attribute '{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getIdentifier <em>Identifier</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Identifier</em>'. - * @see org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getIdentifier() - * @see #getArtifactWrapper() - * @generated - */ - EAttribute getArtifactWrapper_Identifier(); - - /** * Returns the meta object for the attribute '{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getArtifactHandler <em>Artifact Handler</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -254,6 +223,17 @@ EAttribute getArtifactWrapper_ArtifactHandler(); /** + * Returns the meta object for the attribute '{@link org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getInternalResolver <em>Internal Resolver</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Internal Resolver</em>'. + * @see org.eclipse.capra.generic.artifactmodel.ArtifactWrapper#getInternalResolver() + * @see #getArtifactWrapper() + * @generated + */ + EAttribute getArtifactWrapper_InternalResolver(); + + /** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -305,14 +285,6 @@ EClass ARTIFACT_WRAPPER = eINSTANCE.getArtifactWrapper(); /** - * The meta object literal for the '<em><b>Path</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ARTIFACT_WRAPPER__PATH = eINSTANCE.getArtifactWrapper_Path(); - - /** * The meta object literal for the '<em><b>Uri</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -329,14 +301,6 @@ EAttribute ARTIFACT_WRAPPER__NAME = eINSTANCE.getArtifactWrapper_Name(); /** - * The meta object literal for the '<em><b>Identifier</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ARTIFACT_WRAPPER__IDENTIFIER = eINSTANCE.getArtifactWrapper_Identifier(); - - /** * The meta object literal for the '<em><b>Artifact Handler</b></em>' attribute feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -344,6 +308,14 @@ */ EAttribute ARTIFACT_WRAPPER__ARTIFACT_HANDLER = eINSTANCE.getArtifactWrapper_ArtifactHandler(); + /** + * The meta object literal for the '<em><b>Internal Resolver</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute ARTIFACT_WRAPPER__INTERNAL_RESOLVER = eINSTANCE.getArtifactWrapper_InternalResolver(); + } } //ArtifactmodelPackage
diff --git a/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/impl/ArtifactWrapperImpl.java b/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/impl/ArtifactWrapperImpl.java index aaf917a..bd8d24d 100644 --- a/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/impl/ArtifactWrapperImpl.java +++ b/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/impl/ArtifactWrapperImpl.java
@@ -20,37 +20,16 @@ * The following features are implemented: * </p> * <ul> - * <li>{@link org.eclipse.capra.generic.artifactmodel.impl.ArtifactWrapperImpl#getPath <em>Path</em>}</li> * <li>{@link org.eclipse.capra.generic.artifactmodel.impl.ArtifactWrapperImpl#getUri <em>Uri</em>}</li> * <li>{@link org.eclipse.capra.generic.artifactmodel.impl.ArtifactWrapperImpl#getName <em>Name</em>}</li> - * <li>{@link org.eclipse.capra.generic.artifactmodel.impl.ArtifactWrapperImpl#getIdentifier <em>Identifier</em>}</li> * <li>{@link org.eclipse.capra.generic.artifactmodel.impl.ArtifactWrapperImpl#getArtifactHandler <em>Artifact Handler</em>}</li> + * <li>{@link org.eclipse.capra.generic.artifactmodel.impl.ArtifactWrapperImpl#getInternalResolver <em>Internal Resolver</em>}</li> * </ul> * * @generated */ public class ArtifactWrapperImpl extends MinimalEObjectImpl.Container implements ArtifactWrapper { /** - * The default value of the '{@link #getPath() <em>Path</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPath() - * @generated - * @ordered - */ - protected static final String PATH_EDEFAULT = null; - - /** - * The cached value of the '{@link #getPath() <em>Path</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getPath() - * @generated - * @ordered - */ - protected String path = PATH_EDEFAULT; - - /** * The default value of the '{@link #getUri() <em>Uri</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -91,26 +70,6 @@ protected String name = NAME_EDEFAULT; /** - * The default value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getIdentifier() - * @generated - * @ordered - */ - protected static final String IDENTIFIER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getIdentifier() - * @generated - * @ordered - */ - protected String identifier = IDENTIFIER_EDEFAULT; - - /** * The default value of the '{@link #getArtifactHandler() <em>Artifact Handler</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -131,6 +90,26 @@ protected String artifactHandler = ARTIFACT_HANDLER_EDEFAULT; /** + * The default value of the '{@link #getInternalResolver() <em>Internal Resolver</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInternalResolver() + * @generated + * @ordered + */ + protected static final String INTERNAL_RESOLVER_EDEFAULT = null; + + /** + * The cached value of the '{@link #getInternalResolver() <em>Internal Resolver</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getInternalResolver() + * @generated + * @ordered + */ + protected String internalResolver = INTERNAL_RESOLVER_EDEFAULT; + + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -154,27 +133,6 @@ * <!-- end-user-doc --> * @generated */ - public String getPath() { - return path; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setPath(String newPath) { - String oldPath = path; - path = newPath; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ArtifactmodelPackage.ARTIFACT_WRAPPER__PATH, oldPath, path)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ public String getUri() { return uri; } @@ -217,27 +175,6 @@ * <!-- end-user-doc --> * @generated */ - public String getIdentifier() { - return identifier; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setIdentifier(String newIdentifier) { - String oldIdentifier = identifier; - identifier = newIdentifier; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ArtifactmodelPackage.ARTIFACT_WRAPPER__IDENTIFIER, oldIdentifier, identifier)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ public String getArtifactHandler() { return artifactHandler; } @@ -259,19 +196,38 @@ * <!-- end-user-doc --> * @generated */ + public String getInternalResolver() { + return internalResolver; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setInternalResolver(String newInternalResolver) { + String oldInternalResolver = internalResolver; + internalResolver = newInternalResolver; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ArtifactmodelPackage.ARTIFACT_WRAPPER__INTERNAL_RESOLVER, oldInternalResolver, internalResolver)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { - case ArtifactmodelPackage.ARTIFACT_WRAPPER__PATH: - return getPath(); case ArtifactmodelPackage.ARTIFACT_WRAPPER__URI: return getUri(); case ArtifactmodelPackage.ARTIFACT_WRAPPER__NAME: return getName(); - case ArtifactmodelPackage.ARTIFACT_WRAPPER__IDENTIFIER: - return getIdentifier(); case ArtifactmodelPackage.ARTIFACT_WRAPPER__ARTIFACT_HANDLER: return getArtifactHandler(); + case ArtifactmodelPackage.ARTIFACT_WRAPPER__INTERNAL_RESOLVER: + return getInternalResolver(); } return super.eGet(featureID, resolve, coreType); } @@ -284,21 +240,18 @@ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { - case ArtifactmodelPackage.ARTIFACT_WRAPPER__PATH: - setPath((String)newValue); - return; case ArtifactmodelPackage.ARTIFACT_WRAPPER__URI: setUri((String)newValue); return; case ArtifactmodelPackage.ARTIFACT_WRAPPER__NAME: setName((String)newValue); return; - case ArtifactmodelPackage.ARTIFACT_WRAPPER__IDENTIFIER: - setIdentifier((String)newValue); - return; case ArtifactmodelPackage.ARTIFACT_WRAPPER__ARTIFACT_HANDLER: setArtifactHandler((String)newValue); return; + case ArtifactmodelPackage.ARTIFACT_WRAPPER__INTERNAL_RESOLVER: + setInternalResolver((String)newValue); + return; } super.eSet(featureID, newValue); } @@ -311,21 +264,18 @@ @Override public void eUnset(int featureID) { switch (featureID) { - case ArtifactmodelPackage.ARTIFACT_WRAPPER__PATH: - setPath(PATH_EDEFAULT); - return; case ArtifactmodelPackage.ARTIFACT_WRAPPER__URI: setUri(URI_EDEFAULT); return; case ArtifactmodelPackage.ARTIFACT_WRAPPER__NAME: setName(NAME_EDEFAULT); return; - case ArtifactmodelPackage.ARTIFACT_WRAPPER__IDENTIFIER: - setIdentifier(IDENTIFIER_EDEFAULT); - return; case ArtifactmodelPackage.ARTIFACT_WRAPPER__ARTIFACT_HANDLER: setArtifactHandler(ARTIFACT_HANDLER_EDEFAULT); return; + case ArtifactmodelPackage.ARTIFACT_WRAPPER__INTERNAL_RESOLVER: + setInternalResolver(INTERNAL_RESOLVER_EDEFAULT); + return; } super.eUnset(featureID); } @@ -338,16 +288,14 @@ @Override public boolean eIsSet(int featureID) { switch (featureID) { - case ArtifactmodelPackage.ARTIFACT_WRAPPER__PATH: - return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path); case ArtifactmodelPackage.ARTIFACT_WRAPPER__URI: return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri); case ArtifactmodelPackage.ARTIFACT_WRAPPER__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); - case ArtifactmodelPackage.ARTIFACT_WRAPPER__IDENTIFIER: - return IDENTIFIER_EDEFAULT == null ? identifier != null : !IDENTIFIER_EDEFAULT.equals(identifier); case ArtifactmodelPackage.ARTIFACT_WRAPPER__ARTIFACT_HANDLER: return ARTIFACT_HANDLER_EDEFAULT == null ? artifactHandler != null : !ARTIFACT_HANDLER_EDEFAULT.equals(artifactHandler); + case ArtifactmodelPackage.ARTIFACT_WRAPPER__INTERNAL_RESOLVER: + return INTERNAL_RESOLVER_EDEFAULT == null ? internalResolver != null : !INTERNAL_RESOLVER_EDEFAULT.equals(internalResolver); } return super.eIsSet(featureID); } @@ -362,16 +310,14 @@ if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); - result.append(" (path: "); - result.append(path); - result.append(", uri: "); + result.append(" (uri: "); result.append(uri); result.append(", name: "); result.append(name); - result.append(", identifier: "); - result.append(identifier); result.append(", ArtifactHandler: "); result.append(artifactHandler); + result.append(", internalResolver: "); + result.append(internalResolver); result.append(')'); return result.toString(); }
diff --git a/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/impl/ArtifactmodelPackageImpl.java b/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/impl/ArtifactmodelPackageImpl.java index d113c11..b47af08 100644 --- a/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/impl/ArtifactmodelPackageImpl.java +++ b/bundles/org.eclipse.capra.generic.artifactmodel/src-gen/org/eclipse/capra/generic/artifactmodel/impl/ArtifactmodelPackageImpl.java
@@ -132,7 +132,7 @@ * <!-- end-user-doc --> * @generated */ - public EAttribute getArtifactWrapper_Path() { + public EAttribute getArtifactWrapper_Uri() { return (EAttribute)artifactWrapperEClass.getEStructuralFeatures().get(0); } @@ -141,7 +141,7 @@ * <!-- end-user-doc --> * @generated */ - public EAttribute getArtifactWrapper_Uri() { + public EAttribute getArtifactWrapper_Name() { return (EAttribute)artifactWrapperEClass.getEStructuralFeatures().get(1); } @@ -150,7 +150,7 @@ * <!-- end-user-doc --> * @generated */ - public EAttribute getArtifactWrapper_Name() { + public EAttribute getArtifactWrapper_ArtifactHandler() { return (EAttribute)artifactWrapperEClass.getEStructuralFeatures().get(2); } @@ -159,7 +159,7 @@ * <!-- end-user-doc --> * @generated */ - public EAttribute getArtifactWrapper_Identifier() { + public EAttribute getArtifactWrapper_InternalResolver() { return (EAttribute)artifactWrapperEClass.getEStructuralFeatures().get(3); } @@ -168,15 +168,6 @@ * <!-- end-user-doc --> * @generated */ - public EAttribute getArtifactWrapper_ArtifactHandler() { - return (EAttribute)artifactWrapperEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ public ArtifactmodelFactory getArtifactmodelFactory() { return (ArtifactmodelFactory)getEFactoryInstance(); } @@ -204,11 +195,10 @@ createEReference(artifactWrapperContainerEClass, ARTIFACT_WRAPPER_CONTAINER__ARTIFACTS); artifactWrapperEClass = createEClass(ARTIFACT_WRAPPER); - createEAttribute(artifactWrapperEClass, ARTIFACT_WRAPPER__PATH); createEAttribute(artifactWrapperEClass, ARTIFACT_WRAPPER__URI); createEAttribute(artifactWrapperEClass, ARTIFACT_WRAPPER__NAME); - createEAttribute(artifactWrapperEClass, ARTIFACT_WRAPPER__IDENTIFIER); createEAttribute(artifactWrapperEClass, ARTIFACT_WRAPPER__ARTIFACT_HANDLER); + createEAttribute(artifactWrapperEClass, ARTIFACT_WRAPPER__INTERNAL_RESOLVER); } /** @@ -248,11 +238,10 @@ initEReference(getArtifactWrapperContainer_Artifacts(), this.getArtifactWrapper(), null, "artifacts", null, 0, -1, ArtifactWrapperContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(artifactWrapperEClass, ArtifactWrapper.class, "ArtifactWrapper", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getArtifactWrapper_Path(), theEcorePackage.getEString(), "path", null, 0, 1, ArtifactWrapper.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getArtifactWrapper_Uri(), theEcorePackage.getEString(), "uri", null, 0, 1, ArtifactWrapper.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getArtifactWrapper_Name(), theEcorePackage.getEString(), "name", null, 0, 1, ArtifactWrapper.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getArtifactWrapper_Identifier(), theEcorePackage.getEString(), "identifier", null, 0, 1, ArtifactWrapper.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getArtifactWrapper_ArtifactHandler(), theEcorePackage.getEString(), "ArtifactHandler", null, 0, 1, ArtifactWrapper.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getArtifactWrapper_InternalResolver(), theEcorePackage.getEString(), "internalResolver", null, 0, 1, ArtifactWrapper.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); // Create resource createResource(eNS_URI);
diff --git a/bundles/org.eclipse.capra.generic.artifactmodel/src/org/eclipse/capra/generic/artifactmodel/GenericArtifactMetaModelAdapter.java b/bundles/org.eclipse.capra.generic.artifactmodel/src/org/eclipse/capra/generic/artifactmodel/GenericArtifactMetaModelAdapter.java index d62c97a..a3b9d26 100644 --- a/bundles/org.eclipse.capra.generic.artifactmodel/src/org/eclipse/capra/generic/artifactmodel/GenericArtifactMetaModelAdapter.java +++ b/bundles/org.eclipse.capra.generic.artifactmodel/src/org/eclipse/capra/generic/artifactmodel/GenericArtifactMetaModelAdapter.java
@@ -1,4 +1,5 @@ package org.eclipse.capra.generic.artifactmodel; + /******************************************************************************* * Copyright (c) 2016, 2019 Chalmers | University of Gothenburg, rt-labs and others. * All rights reserved. This program and the accompanying materials @@ -17,8 +18,6 @@ import org.eclipse.capra.core.adapters.AbstractArtifactMetaModelAdapter; import org.eclipse.capra.core.helpers.EditingDomainHelper; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.RecordingCommand; @@ -51,8 +50,8 @@ } @Override - public EObject createArtifact(EObject artifactModel, String artifactHandler, String artifactUri, String artifactId, - String artifactName, String artifactPath) { + public EObject createArtifact(EObject artifactModel, String artifactHandler, String artifactUri, + String internalResolver, String artifactName) { ArtifactWrapperContainer container = getContainer(artifactModel); EObject existingWrapper = getArtifact(artifactModel, artifactHandler, artifactUri); if (existingWrapper != null) @@ -62,8 +61,7 @@ wrapper.setArtifactHandler(artifactHandler); wrapper.setUri(artifactUri); wrapper.setName(artifactName); - wrapper.setPath(artifactPath); - wrapper.setIdentifier(artifactId); + wrapper.setInternalResolver(internalResolver); TransactionalEditingDomain editingDomain = EditingDomainHelper.getEditingDomain(); // We're saving the trace model and the artifact model in the same transaction @@ -113,20 +111,12 @@ } @Override - public String getArtifactIdentifier(EObject artifact) { + public String getArtifactInternalResolver(EObject artifact) { if (artifact instanceof ArtifactWrapper) { ArtifactWrapper wrapper = (ArtifactWrapper) artifact; - return wrapper.getIdentifier(); + return wrapper.getInternalResolver(); } - return null; - } - @Override - public IPath getArtifactPath(EObject artifact) { - if (artifact instanceof ArtifactWrapper) { - ArtifactWrapper wrapper = (ArtifactWrapper) artifact; - return new Path(wrapper.getPath()); - } return null; }
diff --git a/bundles/org.eclipse.capra.generic.persistence/src/org/eclipse/capra/generic/persistence/GenericPersistenceAdapter.java b/bundles/org.eclipse.capra.generic.persistence/src/org/eclipse/capra/generic/persistence/GenericPersistenceAdapter.java index 9870bdb..50df8f6 100644 --- a/bundles/org.eclipse.capra.generic.persistence/src/org/eclipse/capra/generic/persistence/GenericPersistenceAdapter.java +++ b/bundles/org.eclipse.capra.generic.persistence/src/org/eclipse/capra/generic/persistence/GenericPersistenceAdapter.java
@@ -150,6 +150,7 @@ private String getModelVersion(String projectName, String modelName) { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); IFile file = project.getFile(modelName); + String strVersion = null; try (BufferedReader bufferedReader = new BufferedReader(
diff --git a/bundles/org.eclipse.capra.handler.cdt/src/org/eclipse/capra/handler/cdt/CDTHandler.java b/bundles/org.eclipse.capra.handler.cdt/src/org/eclipse/capra/handler/cdt/CDTHandler.java index 6855473..d008d29 100644 --- a/bundles/org.eclipse.capra.handler.cdt/src/org/eclipse/capra/handler/cdt/CDTHandler.java +++ b/bundles/org.eclipse.capra.handler.cdt/src/org/eclipse/capra/handler/cdt/CDTHandler.java
@@ -17,8 +17,8 @@ import java.util.List; import org.apache.http.client.utils.URIBuilder; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.handlers.AnnotationException; import org.eclipse.capra.core.handlers.IAnnotateArtifact; @@ -56,20 +56,19 @@ String typePrefix = type == null ? "" : type.getName() + "/"; // TODO: This does not take C++ function overloading on argument types - // into account when - // constructing the URI + // into account when constructing the URI String uri = new URIBuilder().setScheme("platform").setPath("/resource" + element.getPath()) .setFragment(typePrefix + element.getElementName()).toString(); IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); return adapter.createArtifact(artifactModel, this.getClass().getName(), uri, element.getHandleIdentifier(), - element.getElementName(), element.getPath().toString()); + element.getElementName()); } @Override public ICElement resolveWrapper(EObject wrapper) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); - return CoreModel.create(adapter.getArtifactIdentifier(wrapper)); + return CoreModel.create(adapter.getArtifactInternalResolver(wrapper)); } @Override
diff --git a/bundles/org.eclipse.capra.handler.cdt/src/org/eclipse/capra/handler/cdt/notification/CElementChangeListener.java b/bundles/org.eclipse.capra.handler.cdt/src/org/eclipse/capra/handler/cdt/notification/CElementChangeListener.java index e755d1a..2f863e0 100644 --- a/bundles/org.eclipse.capra.handler.cdt/src/org/eclipse/capra/handler/cdt/notification/CElementChangeListener.java +++ b/bundles/org.eclipse.capra.handler.cdt/src/org/eclipse/capra/handler/cdt/notification/CElementChangeListener.java
@@ -114,7 +114,7 @@ String affectedElementUri = affectedElement.getHandleIdentifier(); if (affectedElementUri != null) { for (EObject aw : cArtifacts) { - String artifactId = artifactAdapter.getArtifactIdentifier(aw); + String artifactId = artifactAdapter.getArtifactInternalResolver(aw); // If the change type is "CHANGED", meaning that the element // wasn't deleted, renamed, added or moved, only consider // making a marker if the URI of the affected element is the @@ -165,7 +165,7 @@ HashMap<String, String> markerInfo = new HashMap<>(); // Properties from the C/C++ element in the wrapper (all elements) - String oldArtifactUri = artifactAdapter.getArtifactIdentifier(aw); + String oldArtifactUri = artifactAdapter.getArtifactInternalResolver(aw); String oldArtifactName = artifactAdapter.getArtifactName(aw); // Properties from the affected C/C++ element before the change.
diff --git a/bundles/org.eclipse.capra.handler.featureide/src/org/eclipse/capra/handler/featureide/FeatureIdeHandler.java b/bundles/org.eclipse.capra.handler.featureide/src/org/eclipse/capra/handler/featureide/FeatureIdeHandler.java index 0fa3630..0d0f0f9 100644 --- a/bundles/org.eclipse.capra.handler.featureide/src/org/eclipse/capra/handler/featureide/FeatureIdeHandler.java +++ b/bundles/org.eclipse.capra.handler.featureide/src/org/eclipse/capra/handler/featureide/FeatureIdeHandler.java
@@ -17,8 +17,8 @@ import java.util.Collections; import java.util.List; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.helpers.ExtensionPointHelper; import org.eclipse.core.resources.IFile; @@ -27,7 +27,6 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import de.ovgu.featureide.fm.core.base.IFeature; @@ -50,18 +49,15 @@ final IPath path = Path.fromOSString(feature.getFeatureModel().getSourceFile().toString()); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IFile file = root.getFileForLocation(path); - String uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true).toPlatformString(false); - - return adapter.createArtifact(artifactModel, this.getClass().getName(), uri, - Long.toString(feature.getInternalId()), feature.getName(), - feature.getFeatureModel().getSourceFile().toString()); + String uri = feature.getFeatureModel().getSourceFile().toString(); + return adapter.createArtifact(artifactModel, this.getClass().getName(), uri, null, feature.getName()); } @Override public IFeature resolveWrapper(EObject wrapper) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); FileHandler<IFeatureModel> fileHandler = FeatureModelManager - .getFileHandler(FileSystems.getDefault().getPath(adapter.getArtifactPath(wrapper).toOSString())); + .getFileHandler(FileSystems.getDefault().getPath(adapter.getArtifactUri(wrapper))); return fileHandler.getObject().getFeature(adapter.getArtifactName(wrapper)); }
diff --git a/bundles/org.eclipse.capra.handler.file/src/org/eclipse/capra/handler/file/FileHandler.java b/bundles/org.eclipse.capra.handler.file/src/org/eclipse/capra/handler/file/FileHandler.java index 8292926..2a2bb24 100644 --- a/bundles/org.eclipse.capra.handler.file/src/org/eclipse/capra/handler/file/FileHandler.java +++ b/bundles/org.eclipse.capra.handler.file/src/org/eclipse/capra/handler/file/FileHandler.java
@@ -16,8 +16,8 @@ import java.util.Collections; import java.util.List; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.helpers.ExtensionPointHelper; import org.eclipse.core.resources.IFile; @@ -36,12 +36,10 @@ public EObject createWrapper(IFile file, EObject artifactModel) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); String uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true).toPlatformString(false); - return adapter.createArtifact(artifactModel, this.getClass().getName(), uri, file.getName(), - file.getFullPath().toString()); + return adapter.createArtifact(artifactModel, this.getClass().getName(), uri, null, file.getName()); } @Override - public IFile resolveWrapper(EObject wrapper) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); String uri = adapter.getArtifactUri(wrapper);
diff --git a/bundles/org.eclipse.capra.handler.hudson/src/org/eclipse/capra/handler/hudson/BuildElementHandler.java b/bundles/org.eclipse.capra.handler.hudson/src/org/eclipse/capra/handler/hudson/BuildElementHandler.java index 6bbda51..12357d6 100644 --- a/bundles/org.eclipse.capra.handler.hudson/src/org/eclipse/capra/handler/hudson/BuildElementHandler.java +++ b/bundles/org.eclipse.capra.handler.hudson/src/org/eclipse/capra/handler/hudson/BuildElementHandler.java
@@ -16,8 +16,8 @@ import java.util.Collections; import java.util.List; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.helpers.ExtensionPointHelper; import org.eclipse.core.resources.IResourceDelta; @@ -33,8 +33,7 @@ @Override public EObject createWrapper(BuildElement build, EObject artifactModel) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); - return adapter.createArtifact(artifactModel, this.getClass().getName(), build.getUrl(), build.getLabel(), - build.getUrl()); + return adapter.createArtifact(artifactModel, this.getClass().getName(), build.getUrl(), null, build.getLabel()); } @Override
diff --git a/bundles/org.eclipse.capra.handler.hudson/src/org/eclipse/capra/handler/hudson/TestElementHandler.java b/bundles/org.eclipse.capra.handler.hudson/src/org/eclipse/capra/handler/hudson/TestElementHandler.java index 3b163c5..80f9b6d 100644 --- a/bundles/org.eclipse.capra.handler.hudson/src/org/eclipse/capra/handler/hudson/TestElementHandler.java +++ b/bundles/org.eclipse.capra.handler.hudson/src/org/eclipse/capra/handler/hudson/TestElementHandler.java
@@ -16,8 +16,8 @@ import java.util.Collections; import java.util.List; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.helpers.ExtensionPointHelper; import org.eclipse.core.resources.IResourceDelta; @@ -35,7 +35,7 @@ public EObject createWrapper(TestElement test, EObject artifactModel) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); return adapter.createArtifact(artifactModel, this.getClass().getName(), - EcoreUtil.getURI(test).toPlatformString(false), test.getLabel(), test.getLabel()); + EcoreUtil.getURI(test).toPlatformString(false), null, test.getLabel()); } @Override
diff --git a/bundles/org.eclipse.capra.handler.jdt/src/org/eclipse/capra/handler/jdt/JavaElementHandler.java b/bundles/org.eclipse.capra.handler.jdt/src/org/eclipse/capra/handler/jdt/JavaElementHandler.java index 3f294e6..5be075f 100644 --- a/bundles/org.eclipse.capra.handler.jdt/src/org/eclipse/capra/handler/jdt/JavaElementHandler.java +++ b/bundles/org.eclipse.capra.handler.jdt/src/org/eclipse/capra/handler/jdt/JavaElementHandler.java
@@ -20,8 +20,8 @@ import java.util.stream.Collectors; import org.apache.http.client.utils.URIBuilder; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.handlers.AnnotationException; import org.eclipse.capra.core.handlers.IAnnotateArtifact; @@ -78,13 +78,15 @@ String displayName = (type == null ? "" : (type.getElementName() + ".")) + element.getElementName(); return adapter.createArtifact(artifactModel, this.getClass().getName(), uriBuilder.toString(), - element.getHandleIdentifier(), displayName, element.getPath().toString()); + element.getHandleIdentifier(), displayName); } @Override public IJavaElement resolveWrapper(EObject wrapper) { +// IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); +// return JavaCore.create(adapter.getArtifactIdentifier(wrapper)); IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); - return JavaCore.create(adapter.getArtifactIdentifier(wrapper)); + return JavaCore.create(adapter.getArtifactInternalResolver(wrapper)); } @Override
diff --git a/bundles/org.eclipse.capra.handler.jdt/src/org/eclipse/capra/handler/jdt/notification/JavaElementChangeListener.java b/bundles/org.eclipse.capra.handler.jdt/src/org/eclipse/capra/handler/jdt/notification/JavaElementChangeListener.java index f8f3cce..06a4ef8 100644 --- a/bundles/org.eclipse.capra.handler.jdt/src/org/eclipse/capra/handler/jdt/notification/JavaElementChangeListener.java +++ b/bundles/org.eclipse.capra.handler.jdt/src/org/eclipse/capra/handler/jdt/notification/JavaElementChangeListener.java
@@ -121,7 +121,7 @@ String affectedElementUri = delta.getElement().getHandleIdentifier(); if (affectedElementUri != null) { for (EObject aw : javaArtifacts) { - String artifactId = artifactAdapter.getArtifactIdentifier(aw); + String artifactId = artifactAdapter.getArtifactInternalResolver(aw); // Only create a marker if a signature of a // method/variable/class... has changed inside of a source // file. @@ -175,7 +175,7 @@ HashMap<String, String> markerInfo = new HashMap<>(); // Properties from the Java element in the wrapper (all elements) - String oldArtifactUri = artifactAdapter.getArtifactIdentifier(aw); + String oldArtifactUri = artifactAdapter.getArtifactInternalResolver(aw); String oldArtifactName = artifactAdapter.getArtifactName(aw); // Properties from the affected Java element with its former path
diff --git a/bundles/org.eclipse.capra.handler.marker/src/org/eclipse/capra/handler/marker/MarkerHandler.java b/bundles/org.eclipse.capra.handler.marker/src/org/eclipse/capra/handler/marker/MarkerHandler.java index e1e6b74..4c8bba1 100644 --- a/bundles/org.eclipse.capra.handler.marker/src/org/eclipse/capra/handler/marker/MarkerHandler.java +++ b/bundles/org.eclipse.capra.handler.marker/src/org/eclipse/capra/handler/marker/MarkerHandler.java
@@ -16,8 +16,8 @@ import java.util.Collections; import java.util.List; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.handlers.IArtifactUnpacker; import org.eclipse.capra.core.helpers.ExtensionPointHelper; @@ -41,15 +41,15 @@ IResource resource = artifact.getResource(); return adapter.createArtifact(artifactModel, this.getClass().getName(), resource.getLocationURI().toString(), - Long.toString(artifact.getId()), this.getDisplayName(artifact), resource.getFullPath().toString()); + Long.toString(artifact.getId()), this.getDisplayName(artifact)); } @Override public IMarker resolveWrapper(EObject wrapper) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); IResource target = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() - .findMember(adapter.getArtifactPath(wrapper)); - Long id = Long.getLong(adapter.getArtifactIdentifier(wrapper)); + .findMember(adapter.getArtifactUri(wrapper)); + Long id = Long.getLong(adapter.getArtifactInternalResolver(wrapper)); return target.getMarker(id); }
diff --git a/bundles/org.eclipse.capra.handler.mylyn/src/org/eclipse/capra/handler/mylyn/MylynHandler.java b/bundles/org.eclipse.capra.handler.mylyn/src/org/eclipse/capra/handler/mylyn/MylynHandler.java index 10e235a..4909cb2 100644 --- a/bundles/org.eclipse.capra.handler.mylyn/src/org/eclipse/capra/handler/mylyn/MylynHandler.java +++ b/bundles/org.eclipse.capra.handler.mylyn/src/org/eclipse/capra/handler/mylyn/MylynHandler.java
@@ -39,8 +39,7 @@ public EObject createWrapper(ITask task, EObject artifactModel) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); - return adapter.createArtifact(artifactModel, this.getClass().getName(), task.getUrl(), task.getSummary(), - task.getUrl()); + return adapter.createArtifact(artifactModel, this.getClass().getName(), task.getUrl(), null, task.getSummary()); } @Override
diff --git a/bundles/org.eclipse.capra.handler.office/src/org/eclipse/capra/handler/office/OfficeHandler.java b/bundles/org.eclipse.capra.handler.office/src/org/eclipse/capra/handler/office/OfficeHandler.java index 1b5a1c6..5960cba 100644 --- a/bundles/org.eclipse.capra.handler.office/src/org/eclipse/capra/handler/office/OfficeHandler.java +++ b/bundles/org.eclipse.capra.handler.office/src/org/eclipse/capra/handler/office/OfficeHandler.java
@@ -21,8 +21,8 @@ import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.helpers.ExtensionPointHelper; import org.eclipse.capra.ui.office.Activator; @@ -43,8 +43,8 @@ // Returns the EObject corresponding to the input object if the input is // an EObject, or if it is Adaptable to an EObject IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); - return adapter.createArtifact(artifactModel, this.getClass().getName(), officeObject.getUri().toString(), - this.getDisplayName(officeObject), officeObject.getUri().toString()); + return adapter.createArtifact(artifactModel, this.getClass().getName(), officeObject.getUri().toString(), null, + this.getDisplayName(officeObject)); } @Override
diff --git a/bundles/org.eclipse.capra.handler.php/src/org/eclipse/capra/handler/php/PhpHandler.java b/bundles/org.eclipse.capra.handler.php/src/org/eclipse/capra/handler/php/PhpHandler.java index 5aa77a8..37b7ddb 100644 --- a/bundles/org.eclipse.capra.handler.php/src/org/eclipse/capra/handler/php/PhpHandler.java +++ b/bundles/org.eclipse.capra.handler.php/src/org/eclipse/capra/handler/php/PhpHandler.java
@@ -16,8 +16,8 @@ import java.util.Collections; import java.util.List; -import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.adapters.Connection; +import org.eclipse.capra.core.adapters.IArtifactMetaModelAdapter; import org.eclipse.capra.core.handlers.AbstractArtifactHandler; import org.eclipse.capra.core.helpers.ExtensionPointHelper; import org.eclipse.core.resources.IResourceDelta; @@ -31,7 +31,7 @@ public EObject createWrapper(IModelElement artifact, EObject artifactModel) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().orElseThrow(); return adapter.createArtifact(artifactModel, this.getClass().getName(), artifact.getHandleIdentifier(), - artifact.getElementName(), artifact.getPath().toString()); + artifact.getHandleIdentifier(), artifact.getElementName()); } @Override
diff --git a/bundles/org.eclipse.capra.ui.notification/src/org/eclipse/capra/ui/notification/RenameOrMoveQuickFix.java b/bundles/org.eclipse.capra.ui.notification/src/org/eclipse/capra/ui/notification/RenameOrMoveQuickFix.java index c1713f3..da2604e 100644 --- a/bundles/org.eclipse.capra.ui.notification/src/org/eclipse/capra/ui/notification/RenameOrMoveQuickFix.java +++ b/bundles/org.eclipse.capra.ui.notification/src/org/eclipse/capra/ui/notification/RenameOrMoveQuickFix.java
@@ -76,8 +76,8 @@ if (artifactAdapter.getArtifactUri(aw).equals(oldArtifactUri)) { String newArtifactUri = marker.getAttribute(CapraNotificationHelper.NEW_URI, null); artifactAdapter.createArtifact(artifactModel, artifactAdapter.getArtifactHandler(aw), - newArtifactUri, marker.getAttribute(CapraNotificationHelper.NEW_NAME, null), - newArtifactUri); + newArtifactUri, artifactAdapter.getArtifactInternalResolver(aw), + marker.getAttribute(CapraNotificationHelper.NEW_NAME, null)); break; } }
diff --git a/tests/org.eclipse.capra.handler.cdt.tests/src/org/eclipse/capra/handler/cdt/CDTAnnotateTest.java b/tests/org.eclipse.capra.handler.cdt.tests/src/org/eclipse/capra/handler/cdt/CDTAnnotateTest.java index 0fcfdce..da2e0f6 100644 --- a/tests/org.eclipse.capra.handler.cdt.tests/src/org/eclipse/capra/handler/cdt/CDTAnnotateTest.java +++ b/tests/org.eclipse.capra.handler.cdt.tests/src/org/eclipse/capra/handler/cdt/CDTAnnotateTest.java
@@ -26,7 +26,7 @@ import org.junit.Test; /** - * Tests the annotate capability of the CDTHandler. + * Tests the annotate capability of the CDTHandler. */ public class CDTAnnotateTest { @@ -52,13 +52,13 @@ } /** - * An annotation appears on a function without a previous comment. + * An annotation appears on a function without a previous comment. */ @Test public void shouldAnnotateMethod() throws Exception { - String source = "" + - "int foo() { return 0; }" + NL + - ""; + String source = "" + + "int foo() { return 0; }" + NL + + ""; ITranslationUnit tu = TestUtil.createTranslationUnit(project.getProject(), "bar.c", source); @@ -67,24 +67,24 @@ handler.annotateArtifact(wrapper, "annotation"); String actual = tu.getBuffer().getContents(); - String expected = "" + - "/**" + NL + - " * @req annotation" + NL + - " */" + NL + - "int foo() { return 0; }" + NL + - ""; + String expected = "" + + "/**" + NL + + " * @req annotation" + NL + + " */" + NL + + "int foo() { return 0; }" + NL + + ""; assertEquals(expected, actual); } - + @Test public void shouldReplaceAnnotation() throws Exception { - String source = "" + - "/**" + NL + - " * @req annotation1" + NL + - " */" + NL + - "int foo() { return 0; }" + NL + - ""; + String source = "" + + "/**" + NL + + " * @req annotation1" + NL + + " */" + NL + + "int foo() { return 0; }" + NL + + ""; ITranslationUnit tu = TestUtil.createTranslationUnit(project.getProject(), "bar2.c", source); @@ -93,12 +93,12 @@ handler.annotateArtifact(wrapper, "annotation2"); String actual = tu.getBuffer().getContents(); - String expected = "" + - "/**" + NL + - " * @req annotation2" + NL + - " */" + NL + - "int foo() { return 0; }" + NL + - ""; + String expected = "" + + "/**" + NL + + " * @req annotation2" + NL + + " */" + NL + + "int foo() { return 0; }" + NL + + ""; // Will fail, doesn't replace annotation assertEquals(expected, actual); @@ -106,12 +106,12 @@ @Test public void shouldPreserveComments() throws Exception { - String source = "" + - "/**" + NL + - " * Comment" + NL + - " */" + NL + - "int foo() { return 0; }" + NL + - ""; + String source = "" + + "/**" + NL + + " * Comment" + NL + + " */" + NL + + "int foo() { return 0; }" + NL + + ""; ITranslationUnit tu = TestUtil.createTranslationUnit(project.getProject(), "bar3.c", source); @@ -120,13 +120,13 @@ handler.annotateArtifact(wrapper, "annotation"); String actual = tu.getBuffer().getContents(); - String expected = "" + - "/**" + NL + - " * Comment" + NL + - " * @req annotation" + NL + - " */" + NL + - "int foo() { return 0; }" + NL + - ""; + String expected = "" + + "/**" + NL + + " * Comment" + NL + + " * @req annotation" + NL + + " */" + NL + + "int foo() { return 0; }" + NL + + ""; assertEquals(expected, actual); }
diff --git a/tests/org.eclipse.capra.handler.cdt.tests/src/org/eclipse/capra/handler/cdt/TestUtil.java b/tests/org.eclipse.capra.handler.cdt.tests/src/org/eclipse/capra/handler/cdt/TestUtil.java index f0f7b57..fc723ab 100644 --- a/tests/org.eclipse.capra.handler.cdt.tests/src/org/eclipse/capra/handler/cdt/TestUtil.java +++ b/tests/org.eclipse.capra.handler.cdt.tests/src/org/eclipse/capra/handler/cdt/TestUtil.java
@@ -101,7 +101,7 @@ public static EObject createWrapper(EObject artifactModel, String uri, String name) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().get(); - return adapter.createArtifact(artifactModel, "org.eclipse.capra.handler.cdt.CDTHandler", uri, name, uri); + return adapter.createArtifact(artifactModel, "org.eclipse.capra.handler.cdt.CDTHandler", uri, uri, name); } }
diff --git a/tests/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/JDTAnnotateTest.java b/tests/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/JDTAnnotateTest.java index ff40ae2..a04669d 100644 --- a/tests/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/JDTAnnotateTest.java +++ b/tests/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/JDTAnnotateTest.java
@@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.capra.handler.jdt; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import org.eclipse.capra.handler.jdt.preferences.JDTPreferences; import org.eclipse.core.resources.IProject; @@ -44,10 +44,10 @@ @Test public void shouldAnnotateClass() throws Exception { - String source = "" + - "package jdt\n" + - "public class bar {\n" + - "};\n"; + String source = "" + + "package jdt\n" + + "public class bar {\n" + + "};\n"; ICompilationUnit cu = TestUtil.createCompilationUnit(project, "bar.java", source); @@ -56,24 +56,24 @@ handler.annotateArtifact(wrapper, "annotation"); String actual = cu.getSource(); - String expected = "" + - "package jdt\n" + - "/**\n" + - " * @req annotation\n" + - " */\n" + - "public class bar {\n" + - "};\n"; + String expected = "" + + "package jdt\n" + + "/**\n" + + " * @req annotation\n" + + " */\n" + + "public class bar {\n" + + "};\n"; assertEquals(expected, actual); } @Test public void shouldAnnotateMethod() throws Exception { - String source = "" + - "package jdt\n" + - "public class bar {\n" + - "int foo() { return 0; }\n" + - "};\n"; + String source = "" + + "package jdt\n" + + "public class bar {\n" + + "int foo() { return 0; }\n" + + "};\n"; ICompilationUnit cu = TestUtil.createCompilationUnit(project, "bar.java", source); @@ -82,28 +82,28 @@ handler.annotateArtifact(wrapper, "annotation"); String actual = cu.getSource(); - String expected = "" + - "package jdt\n" + - "public class bar {\n" + - "/**\n" + - " * @req annotation\n" + - " */\n" + - "int foo() { return 0; }\n" + - "};\n"; + String expected = "" + + "package jdt\n" + + "public class bar {\n" + + "/**\n" + + " * @req annotation\n" + + " */\n" + + "int foo() { return 0; }\n" + + "};\n"; assertEquals(expected, actual); } @Test public void shouldReplaceAnnotation() throws Exception { - String source = "" + - "package jdt\n" + - "public class bar {\n" + - "/**\n" + - " * @req annotation1\n" + - " */\n" + - "int foo() { return 0; }\n" + - "};\n"; + String source = "" + + "package jdt\n" + + "public class bar {\n" + + "/**\n" + + " * @req annotation1\n" + + " */\n" + + "int foo() { return 0; }\n" + + "};\n"; ICompilationUnit cu = TestUtil.createCompilationUnit(project, "bar.java", source); @@ -112,28 +112,27 @@ handler.annotateArtifact(wrapper, "annotation2"); String actual = cu.getSource(); - String expected = "" + - "package jdt\n" + - "public class bar {\n" + - "/**\n" + - " * @req annotation2\n" + - " */\n" + - "int foo() { return 0; }\n" + - "};\n"; + String expected = "" + + "package jdt\n" + + "public class bar {\n" + + "/**\n" + + " * @req annotation2\n" + + " */\n" + + "int foo() { return 0; }\n" + + "};\n"; assertEquals(expected, actual); } @Test public void shouldPreserveComments() throws Exception { - String source = "" + - "package jdt\n" + - "public class bar {\n" + - "/**\n" + - " * Comment\n" + - " */\n" + - "int foo() { return 0; }\n" + - "};\n"; + String source = "" + + "package jdt\n" + + "public class bar {\n" + + "/**\n" + " * Comment\n" + + " */\n" + + "int foo() { return 0; }\n" + + "};\n"; ICompilationUnit cu = TestUtil.createCompilationUnit(project, "bar.java", source); @@ -142,15 +141,15 @@ handler.annotateArtifact(wrapper, "annotation"); String actual = cu.getSource(); - String expected = "" + - "package jdt\n" + - "public class bar {\n" + - "/**\n" + - " * Comment\n" + - " * @req annotation\n" + - " */\n" + - "int foo() { return 0; }\n" + - "};\n"; + String expected = "" + + "package jdt\n" + + "public class bar {\n" + + "/**\n" + + " * Comment\n" + + " * @req annotation\n" + + " */\n" + + "int foo() { return 0; }\n" + + "};\n"; assertEquals(expected, actual); }
diff --git a/tests/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/TestUtil.java b/tests/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/TestUtil.java index 8648c04..c4fad08 100644 --- a/tests/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/TestUtil.java +++ b/tests/org.eclipse.capra.handler.jdt.tests/src/org/eclipse/capra/handler/jdt/TestUtil.java
@@ -136,7 +136,8 @@ public static EObject createWrapper(EObject artifactModel, String uri, String name) { IArtifactMetaModelAdapter adapter = ExtensionPointHelper.getArtifactMetaModelAdapter().get(); - return adapter.createArtifact(artifactModel, "org.eclipse.capra.handler.jdt.JavaElementHandler", uri, name,uri); + return adapter.createArtifact(artifactModel, "org.eclipse.capra.handler.jdt.JavaElementHandler", uri, uri, + name); } }