[121460] [modulecore] Behavior when multiple src dirs are mapped to component root
diff --git a/plugins/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF
index b8baef2..657e1ac 100644
--- a/plugins/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@
Require-Bundle: org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.wst.common.modulecore;bundle-version="[1.1.300,2.0.0)",
+ org.eclipse.wst.common.modulecore;bundle-version="[1.2.7,2.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.300,2.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.0,2.0.0)",
org.eclipse.jem.util;bundle-version="[2.0.200,3.0.0)",
diff --git a/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java b/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java
index 685f548..bff1e3b 100644
--- a/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java
+++ b/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/propertypage/AddModuleDependenciesPropertiesPage.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2010 Red Hat
+ * Copyright (c) 2010, 2011 Red Hat 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
@@ -8,6 +8,7 @@
* Contributors:
* Rob Stryker - initial implementation and ongoing maintenance
* Konstantin Komissarchik - misc. UI cleanup
+ * Roberto Sanchez (IBM) - Handle tags in mappings
*
* API in these packages is provisional in this release
******************************************************************************/
@@ -91,6 +92,7 @@
import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
import org.eclipse.wst.common.componentcore.internal.resources.VirtualReference;
import org.eclipse.wst.common.componentcore.internal.util.VirtualReferenceUtilities;
+import org.eclipse.wst.common.componentcore.resources.ITaggedVirtualResource;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
@@ -909,13 +911,13 @@
ComponentResource[] allMappings = findAllExposedMappings();
for( int i = 0; i < allMappings.length; i++ ) {
resourceMappings.add(new ComponentResourceProxy(
- allMappings[i].getSourcePath(), allMappings[i].getRuntimePath()
+ allMappings[i].getSourcePath(), allMappings[i].getRuntimePath(), allMappings[i].getTag()
));
}
ComponentResource[] onlyHiddenMappings = findOnlyHiddenMappings();
for( int i = 0; i < onlyHiddenMappings.length; i++ ) {
hiddenMappings.add(new ComponentResourceProxy(
- onlyHiddenMappings[i].getSourcePath(), onlyHiddenMappings[i].getRuntimePath()
+ onlyHiddenMappings[i].getSourcePath(), onlyHiddenMappings[i].getRuntimePath(), onlyHiddenMappings[i].getTag()
));
}
if(editReferenceButton != null)
@@ -1018,9 +1020,14 @@
public static class ComponentResourceProxy {
public IPath source, runtimePath;
+ public String tag;
public ComponentResourceProxy(IPath source, IPath runtimePath) {
+ this(source, runtimePath, null);
+ }
+ public ComponentResourceProxy(IPath source, IPath runtimePath, String tag) {
this.source = source;
this.runtimePath = runtimePath;
+ this.tag = tag;
}
}
@@ -1040,7 +1047,7 @@
ComponentResource[] allMappings = findAllExposedMappings();
for( int i = 0; i < allMappings.length; i++ ) {
resourceMappings.add(new ComponentResourceProxy(
- allMappings[i].getSourcePath(), allMappings[i].getRuntimePath()
+ allMappings[i].getSourcePath(), allMappings[i].getRuntimePath(), allMappings[i].getTag()
));
}
refresh();
@@ -1108,9 +1115,14 @@
protected boolean addNewResourceMappings() {
ComponentResourceProxy[] proxies = resourceMappings.toArray(new ComponentResourceProxy[resourceMappings.size()]);
IVirtualFolder rootFolder = rootComponent.getRootFolder();
+ IVirtualFolder subFolder = null;
for( int i = 0; i < proxies.length; i++ ) {
- try {
- rootFolder.getFolder(proxies[i].runtimePath).createLink(proxies[i].source, 0, null);
+ try {
+ subFolder= rootFolder.getFolder(proxies[i].runtimePath);
+ subFolder.createLink(proxies[i].source, 0, null);
+ if (subFolder instanceof ITaggedVirtualResource){
+ ((ITaggedVirtualResource) subFolder).tagResource(proxies[i].source, proxies[i].tag, null);
+ }
} catch( CoreException ce ) {
ModuleCoreUIPlugin.logError(ce);
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
index 92fd34d..c91c8f0 100644
--- a/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.modulecore/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %Bundle-Name.0
Bundle-Vendor: %provider
Bundle-SymbolicName: org.eclipse.wst.common.modulecore; singleton:=true
-Bundle-Version: 1.2.6.qualifier
+Bundle-Version: 1.2.7.qualifier
Bundle-Activator: org.eclipse.wst.common.componentcore.internal.ModulecorePlugin
Bundle-Localization: plugin
Export-Package: org.eclipse.wst.common.componentcore,
diff --git a/plugins/org.eclipse.wst.common.modulecore/model/componentCore.ecore b/plugins/org.eclipse.wst.common.modulecore/model/componentCore.ecore
index fccafb8..ec338c4 100644
--- a/plugins/org.eclipse.wst.common.modulecore/model/componentCore.ecore
+++ b/plugins/org.eclipse.wst.common.modulecore/model/componentCore.ecore
@@ -28,6 +28,7 @@
lowerBound="1" eType="#//WorkbenchComponent" eOpposite="#//WorkbenchComponent/resources"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="resourceType" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral=""/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="tag" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="IPath" instanceClassName="org.eclipse.core.runtime.IPath">
<eAnnotations source="keywords">
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ComponentResource.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ComponentResource.java
index efe8adc..cfc715e 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ComponentResource.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/ComponentResource.java
@@ -1,7 +1,7 @@
/**
* <copyright></copyright>
*
- * $Id: ComponentResource.java,v 1.6 2006/04/27 04:17:40 cbridgha Exp $
+ * $Id: ComponentResource.java,v 1.6.24.1 2011/08/03 19:41:59 rsanchez Exp $
*/
package org.eclipse.wst.common.componentcore.internal;
@@ -33,6 +33,7 @@
* <li>{@link org.eclipse.wst.common.componentcore.internal.ComponentResource#getExclusions <em>Exclusions</em>}</li>
* <li>{@link org.eclipse.wst.common.componentcore.internal.ComponentResource#getComponent <em>Component</em>}</li>
* <li>{@link org.eclipse.wst.common.componentcore.internal.ComponentResource#getResourceType <em>Resource Type</em>}</li>
+ * <li>{@link org.eclipse.wst.common.componentcore.internal.ComponentResource#getTag <em>Tag</em>}</li>
* </ul>
* </p>
*
@@ -165,6 +166,32 @@
*/
void setResourceType(String value);
+ /**
+ * Returns the value of the '<em><b>Tag</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Tag</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Tag</em>' attribute.
+ * @see #setTag(String)
+ * @see org.eclipse.wst.common.componentcore.ComponentcorePackage#getComponentResource_Tag()
+ * @model
+ * @generated
+ */
+ String getTag();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.wst.common.componentcore.internal.ComponentResource#getTag <em>Tag</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Tag</em>' attribute.
+ * @see #getTag()
+ * @generated
+ */
+ void setTag(String value);
+
IProject getOwningProject();
void setOwningProject(IProject aProject);
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 e789e75..c2fed1c 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.9 2009/06/09 20:02:04 jsholl Exp $
+ * $Id: ComponentcorePackage.java,v 1.9.4.1 2011/08/03 19:41:59 rsanchez Exp $
*/
package org.eclipse.wst.common.componentcore.internal;
@@ -191,13 +191,22 @@
int COMPONENT_RESOURCE__RESOURCE_TYPE = 4;
/**
+ * The feature id for the '<em><b>Tag</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int COMPONENT_RESOURCE__TAG = 5;
+
+ /**
* The number of structural features of the '<em>Component Resource</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int COMPONENT_RESOURCE_FEATURE_COUNT = 5;
+ int COMPONENT_RESOURCE_FEATURE_COUNT = 6;
/**
* The meta object id for the '{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentTypeImpl <em>Component Type</em>}' class.
@@ -574,6 +583,17 @@
EAttribute getComponentResource_ResourceType();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.wst.common.componentcore.internal.ComponentResource#getTag <em>Tag</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Tag</em>'.
+ * @see org.eclipse.wst.common.componentcore.internal.ComponentResource#getTag()
+ * @see #getComponentResource()
+ * @generated
+ */
+ EAttribute getComponentResource_Tag();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.wst.common.componentcore.internal.ComponentType <em>Component Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -784,7 +804,7 @@
* @return the meta object for data type '<em>IPath</em>'.
* @see org.eclipse.core.runtime.IPath
* @model instanceClass="org.eclipse.core.runtime.IPath"
- * annotation="keywords datatype='null'"
+ * annotation="keywords datatype='null'"
* @generated
*/
EDataType getIPath();
@@ -796,7 +816,7 @@
* @return the meta object for data type '<em>URI</em>'.
* @see org.eclipse.emf.common.util.URI
* @model instanceClass="org.eclipse.emf.common.util.URI"
- * annotation="keywords datatype='null'"
+ * annotation="keywords datatype='null'"
* @generated
*/
EDataType getURI();
@@ -932,6 +952,14 @@
EAttribute COMPONENT_RESOURCE__RESOURCE_TYPE = eINSTANCE.getComponentResource_ResourceType();
/**
+ * The meta object literal for the '<em><b>Tag</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute COMPONENT_RESOURCE__TAG = eINSTANCE.getComponentResource_Tag();
+
+ /**
* The meta object literal for the '{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentTypeImpl <em>Component Type</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
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 e8d7586..58b6899 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
@@ -166,5 +166,7 @@
ComponentResource[] findResourcesBySourcePath(IPath aSourcePath, int resourceFlag);
boolean exists(IPath aSourcePath, int resourceFlag);
+
+ final String DEFAULT_ROOT_SOURCE_TAG = "defaultRootSource";
} // WorkbenchComponent
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentResourceImpl.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentResourceImpl.java
index 84ea36d..b598cd1 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentResourceImpl.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/impl/ComponentResourceImpl.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: ComponentResourceImpl.java,v 1.4 2010/05/13 04:04:35 canderson Exp $
+ * $Id: ComponentResourceImpl.java,v 1.4.4.1 2011/08/03 19:41:59 rsanchez Exp $
*/
package org.eclipse.wst.common.componentcore.internal.impl;
@@ -37,6 +37,7 @@
* <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getExclusions <em>Exclusions</em>}</li>
* <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getComponent <em>Component</em>}</li>
* <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getResourceType <em>Resource Type</em>}</li>
+ * <li>{@link org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl#getTag <em>Tag</em>}</li>
* </ul>
* </p>
*
@@ -91,7 +92,7 @@
* @generated
* @ordered
*/
- protected EList exclusions = null;
+ protected EList exclusions;
/**
* The default value of the '{@link #getResourceType() <em>Resource Type</em>}' attribute.
@@ -113,6 +114,26 @@
*/
protected String resourceType = RESOURCE_TYPE_EDEFAULT;
+ /**
+ * The default value of the '{@link #getTag() <em>Tag</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTag()
+ * @generated
+ * @ordered
+ */
+ protected static final String TAG_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTag() <em>Tag</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTag()
+ * @generated
+ * @ordered
+ */
+ protected String tag = TAG_EDEFAULT;
+
protected IProject owningProject;
protected static final int VIRTUAL = 0;
protected static final int PERSISTED = 1;
@@ -248,6 +269,27 @@
* <!-- end-user-doc -->
* @generated
*/
+ public String getTag() {
+ return tag;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTag(String newTag) {
+ String oldTag = tag;
+ tag = newTag;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ComponentcorePackage.COMPONENT_RESOURCE__TAG, oldTag, tag));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
if (featureID >= 0) {
switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
@@ -315,6 +357,8 @@
return getComponent();
case ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE:
return getResourceType();
+ case ComponentcorePackage.COMPONENT_RESOURCE__TAG:
+ return getTag();
}
return eDynamicGet(eFeature, resolve);
}
@@ -342,6 +386,9 @@
case ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE:
setResourceType((String)newValue);
return;
+ case ComponentcorePackage.COMPONENT_RESOURCE__TAG:
+ setTag((String)newValue);
+ return;
}
eDynamicSet(eFeature, newValue);
}
@@ -368,6 +415,9 @@
case ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE:
setResourceType(RESOURCE_TYPE_EDEFAULT);
return;
+ case ComponentcorePackage.COMPONENT_RESOURCE__TAG:
+ setTag(TAG_EDEFAULT);
+ return;
}
eDynamicUnset(eFeature);
}
@@ -389,6 +439,8 @@
return getComponent() != null;
case ComponentcorePackage.COMPONENT_RESOURCE__RESOURCE_TYPE:
return RESOURCE_TYPE_EDEFAULT == null ? resourceType != null : !RESOURCE_TYPE_EDEFAULT.equals(resourceType);
+ case ComponentcorePackage.COMPONENT_RESOURCE__TAG:
+ return TAG_EDEFAULT == null ? tag != null : !TAG_EDEFAULT.equals(tag);
}
return eDynamicIsSet(eFeature);
}
@@ -410,6 +462,8 @@
result.append(exclusions);
result.append(", resourceType: ");
result.append(resourceType);
+ result.append(", tag: ");
+ result.append(tag);
result.append(')');
return result.toString();
}
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 c04eedd..6fc71bc 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.10 2009/06/09 20:02:04 jsholl Exp $
+ * $Id: ComponentcorePackageImpl.java,v 1.10.4.1 2011/08/03 19:41:59 rsanchez Exp $
*/
package org.eclipse.wst.common.componentcore.internal.impl;
@@ -284,6 +284,15 @@
* <!-- end-user-doc -->
* @generated
*/
+ public EAttribute getComponentResource_Tag() {
+ return (EAttribute)componentResourceEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EClass getComponentType() {
return componentTypeEClass;
}
@@ -510,6 +519,7 @@
createEAttribute(componentResourceEClass, COMPONENT_RESOURCE__EXCLUSIONS);
createEReference(componentResourceEClass, COMPONENT_RESOURCE__COMPONENT);
createEAttribute(componentResourceEClass, COMPONENT_RESOURCE__RESOURCE_TYPE);
+ createEAttribute(componentResourceEClass, COMPONENT_RESOURCE__TAG);
componentTypeEClass = createEClass(COMPONENT_TYPE);
createEAttribute(componentTypeEClass, COMPONENT_TYPE__COMPONENT_TYPE_ID);
@@ -581,6 +591,7 @@
initEAttribute(getComponentResource_Exclusions(), ecorePackage.getEString(), "exclusions", "", 0, -1, ComponentResource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(getComponentResource_Component(), this.getWorkbenchComponent(), this.getWorkbenchComponent_Resources(), "component", null, 1, 1, ComponentResource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEAttribute(getComponentResource_ResourceType(), ecorePackage.getEString(), "resourceType", "", 1, 1, ComponentResource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEAttribute(getComponentResource_Tag(), ecorePackage.getEString(), "tag", null, 0, 1, ComponentResource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEClass(componentTypeEClass, ComponentType.class, "ComponentType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEAttribute(getComponentType_ComponentTypeId(), ecorePackage.getEString(), "componentTypeId", "", 1, 1, ComponentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
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 c8b183a..5e65bab 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
@@ -226,6 +226,17 @@
}
return null;
}
+
+ private IPath getFirstTaggedRootSource(){
+ List res = getResources();
+ for (Iterator iter = res.iterator(); iter.hasNext();) {
+ ComponentResource element = (ComponentResource) iter.next();
+ if (element.getRuntimePath().equals(new Path("/")) && DEFAULT_ROOT_SOURCE_TAG.equals(element.getTag()))
+ return element.getSourcePath();
+ }
+ return null;
+ }
+
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -572,8 +583,13 @@
}
public IPath getDefaultSourceRoot() {
- if (defaultSourceRoot == null)
- defaultSourceRoot = getFirstRootSource();
+ if (defaultSourceRoot == null){
+ defaultSourceRoot = getFirstTaggedRootSource();
+ if (defaultSourceRoot == null)
+ {
+ defaultSourceRoot = getFirstRootSource();
+ }
+ }
return defaultSourceRoot;
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualFolder.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualFolder.java
index b3fa912..7bb0487 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualFolder.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualFolder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 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
@@ -24,12 +24,12 @@
import org.eclipse.wst.common.componentcore.internal.ComponentResource;
import org.eclipse.wst.common.componentcore.internal.StructureEdit;
import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.resources.ITaggedVirtualResource;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
-public class VirtualFolder extends VirtualContainer implements IVirtualFolder {
-
+public class VirtualFolder extends VirtualContainer implements IVirtualFolder, ITaggedVirtualResource {
/**
* p> Creates an unassigned mapping contained by the component identified by aComponentHandle
@@ -147,4 +147,60 @@
}
}
+
+ public boolean tagResource(IPath aProjectRelativeLocation, String tag, IProgressMonitor monitor) {
+ StructureEdit moduleCore = null;
+ try {
+ if (aProjectRelativeLocation.isUNC()){
+ aProjectRelativeLocation = aProjectRelativeLocation.makeUNC(false);
+ }
+ moduleCore = StructureEdit.getStructureEditForWrite(getProject());
+ WorkbenchComponent aComponent = moduleCore.getComponent();
+ ComponentResource[] resources = aComponent.findResourcesByRuntimePath(getRuntimePath());
+ for (ComponentResource resource:resources){
+ if (resource.getSourcePath().equals(aProjectRelativeLocation)){
+ resource.setTag(tag);
+ return true;
+ }
+ }
+ return false;
+ }
+ finally {
+ if (moduleCore != null) {
+ moduleCore.saveIfNecessary(monitor);
+ moduleCore.dispose();
+ }
+ }
+
+ }
+
+ public IPath getFirstTaggedResource(String tag) {
+ WorkbenchComponent aComponent = null;
+ IPath path = null;
+
+ aComponent = getReadOnlyComponent();
+ ComponentResource[] resources = aComponent.findResourcesByRuntimePath(getRuntimePath());
+ for (ComponentResource resource:resources){
+ if (tag.equals(resource.getTag())){
+ path = resource.getSourcePath();
+ break;
+ }
+ }
+ return path;
+ }
+
+ public IPath[] getTaggedResources(String tag) {
+ WorkbenchComponent aComponent = null;
+ List<IPath> paths = new ArrayList<IPath>();
+
+ aComponent = getReadOnlyComponent();
+ ComponentResource[] resources = aComponent.findResourcesByRuntimePath(getRuntimePath());
+ for (ComponentResource resource:resources){
+ if (tag.equals(resource.getTag())){
+ paths.add(resource.getSourcePath());
+ }
+ }
+ return paths.toArray(new IPath[0]);
+ }
+
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentcoreAdapterFactory.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentcoreAdapterFactory.java
index 3716298..4549188 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentcoreAdapterFactory.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentcoreAdapterFactory.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: ComponentcoreAdapterFactory.java,v 1.6 2005/10/18 22:27:18 cbridgha Exp $
+ * $Id: ComponentcoreAdapterFactory.java,v 1.6.28.1 2011/08/03 19:41:59 rsanchez Exp $
*/
package org.eclipse.wst.common.componentcore.internal.util;
@@ -66,7 +66,7 @@
}
/**
- * The switch the delegates to the <code>createXXX</code> methods.
+ * The switch that delegates to the <code>createXXX</code> methods.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentcoreSwitch.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentcoreSwitch.java
index e8c0cc4..99215a7 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentcoreSwitch.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentcoreSwitch.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: ComponentcoreSwitch.java,v 1.7 2009/06/09 20:02:03 jsholl Exp $
+ * $Id: ComponentcoreSwitch.java,v 1.7.4.1 2011/08/03 19:41:59 rsanchez Exp $
*/
package org.eclipse.wst.common.componentcore.internal.util;
@@ -74,11 +74,13 @@
if (theEClass.eContainer() == modelPackage) {
return doSwitch(theEClass.getClassifierID(), theEObject);
}
- List eSuperTypes = theEClass.getESuperTypes();
- return
- eSuperTypes.isEmpty() ?
- defaultCase(theEObject) :
- doSwitch((EClass)eSuperTypes.get(0), theEObject);
+ else {
+ List eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch((EClass)eSuperTypes.get(0), theEObject);
+ }
}
/**
@@ -131,13 +133,13 @@
}
/**
- * Returns the result of interpretting the object as an instance of '<em>Workbench Component</em>'.
+ * Returns the result of interpreting the object as an instance of '<em>Workbench Component</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
- * @return the result of interpretting the object as an instance of '<em>Workbench Component</em>'.
+ * @return the result of interpreting the object as an instance of '<em>Workbench Component</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
@@ -146,13 +148,13 @@
}
/**
- * Returns the result of interpretting the object as an instance of '<em>Component Resource</em>'.
+ * Returns the result of interpreting the object as an instance of '<em>Component Resource</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
- * @return the result of interpretting the object as an instance of '<em>Component Resource</em>'.
+ * @return the result of interpreting the object as an instance of '<em>Component Resource</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
@@ -161,13 +163,13 @@
}
/**
- * Returns the result of interpretting the object as an instance of '<em>Component Type</em>'.
+ * Returns the result of interpreting the object as an instance of '<em>Component Type</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
- * @return the result of interpretting the object as an instance of '<em>Component Type</em>'.
+ * @return the result of interpreting the object as an instance of '<em>Component Type</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
@@ -176,13 +178,13 @@
}
/**
- * Returns the result of interpretting the object as an instance of '<em>Property</em>'.
+ * Returns the result of interpreting the object as an instance of '<em>Property</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
- * @return the result of interpretting the object as an instance of '<em>Property</em>'.
+ * @return the result of interpreting the object as an instance of '<em>Property</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
@@ -191,13 +193,13 @@
}
/**
- * Returns the result of interpretting the object as an instance of '<em>Referenced Component</em>'.
+ * Returns the result of interpreting the object as an instance of '<em>Referenced Component</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
- * @return the result of interpretting the object as an instance of '<em>Referenced Component</em>'.
+ * @return the result of interpreting the object as an instance of '<em>Referenced Component</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
@@ -206,13 +208,13 @@
}
/**
- * Returns the result of interpretting the object as an instance of '<em>Project Components</em>'.
+ * Returns the result of interpreting the object as an instance of '<em>Project Components</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
- * @return the result of interpretting the object as an instance of '<em>Project Components</em>'.
+ * @return the result of interpreting the object as an instance of '<em>Project Components</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
@@ -221,13 +223,13 @@
}
/**
- * Returns the result of interpretting the object as an instance of '<em>EObject</em>'.
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch, but this is the last case anyway.
* <!-- end-user-doc -->
* @param object the target of the switch.
- * @return the result of interpretting the object as an instance of '<em>EObject</em>'.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
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 b88af6b..47fa640 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,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2011 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
@@ -107,7 +107,8 @@
new IPathTranslator(SOURCE_PATH, MODULE_CORE_PKG.getComponentResource_SourcePath(), DOM_ATTRIBUTE),
new IPathTranslator(RUNTIME_PATH, MODULE_CORE_PKG.getComponentResource_RuntimePath(), DOM_ATTRIBUTE),
new Translator(RESOURCE_TYPE, MODULE_CORE_PKG.getComponentResource_ResourceType(), DOM_ATTRIBUTE),
- new Translator(EXCLUSIONS, MODULE_CORE_PKG.getComponentResource_Exclusions())
+ new Translator(EXCLUSIONS, MODULE_CORE_PKG.getComponentResource_Exclusions()),
+ new Translator(TAG, MODULE_CORE_PKG.getComponentResource_Tag(),DOM_ATTRIBUTE)
});
return result;
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/WTPModulesXmlMapperI.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/WTPModulesXmlMapperI.java
index 6dd9ab3..8dc57fa 100644
--- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/WTPModulesXmlMapperI.java
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/WTPModulesXmlMapperI.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2011 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
@@ -33,5 +33,5 @@
String RESOURCE_TYPE = "resource-type";//$NON-NLS-1$
String ARCHIVE_NAME="archiveName";//$NON-NLS-1$
String PROJECT_VERSION="project-version"; //$NON-NLS-1$
-
+ String TAG="tag";//$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/ITaggedVirtualResource.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/ITaggedVirtualResource.java
new file mode 100644
index 0000000..542cf46
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/resources/ITaggedVirtualResource.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.common.componentcore.resources;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface ITaggedVirtualResource {
+
+ /**
+ * Sets the given tag to the path linked to this resource
+ * @param aProjectRelativeLocation - path linked to the resource
+ * @param tag - The tag to be set
+ * @param monitor - can be null
+ * @return true if the path was tagged correctly, false otherwise (e.g. the path is not linked to the resource)
+ */
+
+ boolean tagResource(IPath aProjectRelativeLocation, String tag, IProgressMonitor monitor);
+
+ /**
+ * Returns the path of the first link to this resource tagged with the given tag
+ * @param tag
+ * @return the path linked to this resource tagged with the given tag, or null if no path can be found.
+ */
+ IPath getFirstTaggedResource(String tag);
+
+ /**
+ * Returns the paths of the links to this resource tagged with the given tag
+ * @param tag
+ * @return the paths linked to this resource tagged with the given tag, or empty array if no paths can be found.
+ */
+ IPath[] getTaggedResources(String tag);
+
+}