Minor tweak for auditor perf, and some code clean up
diff --git a/core/org.eclipse.tigerstripe.api/src/main/java/org/eclipse/tigerstripe/workbench/profile/IWorkbenchProfile.java b/core/org.eclipse.tigerstripe.api/src/main/java/org/eclipse/tigerstripe/workbench/profile/IWorkbenchProfile.java
index 72130c5..8564d89 100644
--- a/core/org.eclipse.tigerstripe.api/src/main/java/org/eclipse/tigerstripe/workbench/profile/IWorkbenchProfile.java
+++ b/core/org.eclipse.tigerstripe.api/src/main/java/org/eclipse/tigerstripe/workbench/profile/IWorkbenchProfile.java
@@ -63,50 +63,19 @@
 	public final static String XML_VERSION = "version";
 	public final static String XML_DESCRIPTION = "description";
 
-	//public void setName(String name);
-
 	public String getName();
 
-	//public void setVersion(String version);
-
 	public String getVersion();
 
-	//public void setDescription(String description);
-
 	public String getDescription();
 
 	public Collection<IStereotype> getStereotypes();
 	
 	public Collection<String> getStereotypeCategories();
 
-	/*public void setStereotypes(Collection<IStereotype> stereotypes)
-			throws TigerstripeException;
-
-	public void addStereotype(IStereotype stereotype)
-			throws TigerstripeException;
-
-	public void removeStereotype(IStereotype stereotype)
-			throws TigerstripeException;
-
-	public void removeStereotypes(Collection<IStereotype> stereotype)
-			throws TigerstripeException;*/
-
 	public Collection<IPrimitiveTypeDef> getPrimitiveTypeDefs(boolean includeReservedTypes);
 
-	/*public void setPrimitiveTypeDefs(Collection<IPrimitiveTypeDef> primitiveTypeDefs)
-			throws TigerstripeException;
-
-	public void addPrimitiveTypeDef(IPrimitiveTypeDef stereotype)
-			throws TigerstripeException;
-
-	public void removePrimitiveTypeDef(IPrimitiveTypeDef stereotype)
-			throws TigerstripeException;
-
-	public void removePrimitiveTypeDefs(Collection<IPrimitiveTypeDef> stereotype)
-			throws TigerstripeException;
-
-	public void setDefaultPrimitiveType(IPrimitiveTypeDef stereotype)
-			throws TigerstripeException;*/
+	public IPrimitiveTypeDef getPrimitiveTypeDef(String name);
 
 	public IPrimitiveTypeDef getDefaultPrimitiveType();
 
@@ -168,5 +137,7 @@
 			IWorkbenchProfileProperty property);*/
 	
 	public boolean equals(IWorkbenchProfile profile);
+	
+	public Collection<Class<?>> getSupportedArtifactClasses();
 
 }
diff --git a/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/core/profile/WorkbenchProfile.java b/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/core/profile/WorkbenchProfile.java
index c04cb7a..4faa151 100644
--- a/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/core/profile/WorkbenchProfile.java
+++ b/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/core/profile/WorkbenchProfile.java
@@ -20,6 +20,7 @@
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.lang.StringUtils;
 import org.dom4j.Document;
@@ -33,20 +34,31 @@
 import org.eclipse.tigerstripe.workbench.internal.api.ITigerstripeRuntime;
 import org.eclipse.tigerstripe.workbench.internal.api.profile.IWorkbenchProfileProperty;
 import org.eclipse.tigerstripe.workbench.internal.api.profile.properties.IWorkbenchPropertyLabels;
-import org.eclipse.tigerstripe.workbench.internal.core.NewTigerstripeRuntime;
 import org.eclipse.tigerstripe.workbench.internal.core.profile.primitiveType.PrimitiveTypeDef;
 import org.eclipse.tigerstripe.workbench.internal.core.profile.properties.CoreArtifactSettingsProperty;
 import org.eclipse.tigerstripe.workbench.internal.core.profile.properties.GlobalSettingsProperty;
 import org.eclipse.tigerstripe.workbench.internal.core.profile.properties.OssjLegacySettingsProperty;
 import org.eclipse.tigerstripe.workbench.internal.core.profile.stereotype.Stereotype;
 import org.eclipse.tigerstripe.workbench.model.deprecated_.IAbstractArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IAssociationArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IAssociationClassArtifact;
 import org.eclipse.tigerstripe.workbench.model.deprecated_.IAssociationEnd;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IDatatypeArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IDependencyArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IEnumArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IEventArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IExceptionArtifact;
 import org.eclipse.tigerstripe.workbench.model.deprecated_.IField;
 import org.eclipse.tigerstripe.workbench.model.deprecated_.ILiteral;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IManagedEntityArtifact;
 import org.eclipse.tigerstripe.workbench.model.deprecated_.IMethod;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IPackageArtifact;
 import org.eclipse.tigerstripe.workbench.model.deprecated_.IMethod.IArgument;
 import org.eclipse.tigerstripe.workbench.model.deprecated_.IMethod.IReturnedType;
 import org.eclipse.tigerstripe.workbench.model.deprecated_.IPrimitiveTypeArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IQueryArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.ISessionArtifact;
+import org.eclipse.tigerstripe.workbench.model.deprecated_.IUpdateProcedureArtifact;
 import org.eclipse.tigerstripe.workbench.profile.IWorkbenchProfile;
 import org.eclipse.tigerstripe.workbench.profile.primitiveType.IPrimitiveTypeDef;
 import org.eclipse.tigerstripe.workbench.profile.stereotype.IStereotype;
@@ -67,16 +79,16 @@
 
     private static List<IPrimitiveTypeDef> reservedPrimitiveTypeDefs = null;
 
-    private final List<IPrimitiveTypeDef> primitiveTypeDefs = new ArrayList<IPrimitiveTypeDef>();
+    private final Map<String,IPrimitiveTypeDef> primitiveTypeDefs = new HashMap<>();
 
-    private final HashMap<String, IWorkbenchProfileProperty> properties = new HashMap<String, IWorkbenchProfileProperty>();
+    private final HashMap<String, IWorkbenchProfileProperty> properties = new HashMap<>();
 
     public final static String REQUIRED_COMPATIBILITY_LEVEL = "1.2";
 
     private final static String DEFAULT_TYPE = "String";
 
     private ITigerstripeRuntime runtime;
-    
+
     /**
      * The compatibility level of this IWorkbenchProfile.
      * 
@@ -213,9 +225,9 @@
             for (Iterator stIter = stereotypes.elementIterator("primitiveType"); stIter.hasNext();) {
                 Element stElm = (Element) stIter.next();
                 PrimitiveTypeDef st = new PrimitiveTypeDef();
-                this.primitiveTypeDefs.add(st);
                 try {
                     st.parse(stElm);
+                    this.primitiveTypeDefs.put(st.getName(),st);
                 } catch (TigerstripeException e) {
                     runtime.logInfoMessage("Error while parsing " + IPrimitiveTypeArtifact.class.getName() + "(s): " + e.getMessage());
                 }
@@ -350,24 +362,31 @@
     }
 
     public void addPrimitiveTypeDef(IPrimitiveTypeDef primitiveTypeDef) throws TigerstripeException {
-        if (primitiveTypeDefs.contains(primitiveTypeDef))
+        if (primitiveTypeDefs.containsKey(primitiveTypeDef.getName())) {
             throw new TigerstripeException("Duplicate "
                     + IPrimitiveTypeArtifact.class.getName()
                     + " '" + primitiveTypeDef.getName() + "' in profile '" + getName() + "'.");
-        else {
-            primitiveTypeDefs.add(primitiveTypeDef);
         }
+        primitiveTypeDefs.put(primitiveTypeDef.getName(), primitiveTypeDef);
+
     }
 
+    @Override
     public Collection<IPrimitiveTypeDef> getPrimitiveTypeDefs(boolean includeReservedTypes) {
-        if (!includeReservedTypes)
-            return Collections.unmodifiableCollection(primitiveTypeDefs);
-        else {
-            ArrayList<IPrimitiveTypeDef> result = new ArrayList<IPrimitiveTypeDef>();
-            result.addAll(primitiveTypeDefs);
-            result.addAll(getReservedPrimitiveTypes());
-            return Collections.unmodifiableCollection(result);
+        if (!includeReservedTypes) {
+            return Collections.unmodifiableCollection(primitiveTypeDefs.values());
         }
+        ArrayList<IPrimitiveTypeDef> result = new ArrayList<IPrimitiveTypeDef>();
+        result.addAll(primitiveTypeDefs.values());
+        result.addAll(getReservedPrimitiveTypes());
+        return Collections.unmodifiableCollection(result);
+
+    }
+
+
+    @Override
+    public IPrimitiveTypeDef getPrimitiveTypeDef(String name) {
+        return primitiveTypeDefs.get(name);
     }
 
     public static Collection<IPrimitiveTypeDef> getReservedPrimitiveTypes() {
@@ -389,8 +408,8 @@
     }
 
     public void removePrimitiveTypeDef(IPrimitiveTypeDef primitiveTypeDef) throws TigerstripeException {
-        if (primitiveTypeDefs.contains(primitiveTypeDef)) {
-            primitiveTypeDefs.remove(primitiveTypeDef);
+        if (primitiveTypeDefs.containsKey(primitiveTypeDef.getName())) {
+            primitiveTypeDefs.remove(primitiveTypeDef.getName());
         } else
             throw new TigerstripeException(
                     "Unknown "
@@ -407,13 +426,13 @@
     public void setPrimitiveTypeDefs(Collection<IPrimitiveTypeDef> primitiveTypeDefs) throws TigerstripeException {
         this.primitiveTypeDefs.clear();
         for (IPrimitiveTypeDef primitiveTypeDef : primitiveTypeDefs) {
-            if (this.primitiveTypeDefs.contains(primitiveTypeDef))
+            if (this.primitiveTypeDefs.containsKey(primitiveTypeDef.getName())) {
                 throw new TigerstripeException("Duplicate "
                         + IPrimitiveTypeArtifact.class.getName()
                         + "'" + primitiveTypeDef.getName() + "' in profile '" + getName() + "'.");
-            else {
-                this.primitiveTypeDefs.add(primitiveTypeDef);
             }
+            this.primitiveTypeDefs.put(primitiveTypeDef.getName(),primitiveTypeDef);
+
         }
     }
 
@@ -576,4 +595,27 @@
         return false;
     }
 
+    @Override
+    public Collection<Class<?>> getSupportedArtifactClasses() {
+        Class<?>[] potentials = { IManagedEntityArtifact.class,
+                IDatatypeArtifact.class, IEventArtifact.class,
+                IQueryArtifact.class, IExceptionArtifact.class,
+                ISessionArtifact.class, IEnumArtifact.class,
+                IUpdateProcedureArtifact.class, IAssociationArtifact.class,
+                IAssociationClassArtifact.class, IPrimitiveTypeArtifact.class,
+                IDependencyArtifact.class, IPackageArtifact.class };
+
+        ArrayList<Class<?>> result = new ArrayList<Class<?>>();
+
+        CoreArtifactSettingsProperty prop = (CoreArtifactSettingsProperty) getProperty(IWorkbenchPropertyLabels.CORE_ARTIFACTS_SETTINGS);
+
+        for (Class<?> pot : potentials) {
+            if (prop.getDetailsForType(pot.getName()).isEnabled()) {
+                result.add(pot);
+            }
+        }
+
+        return Collections.unmodifiableCollection(result);
+    }
+    
 }
diff --git a/plugins/org.eclipse.tigerstripe.workbench.base/lib/tigerstripe-api-0.10.0-SNAPSHOT.jar b/plugins/org.eclipse.tigerstripe.workbench.base/lib/tigerstripe-api-0.10.0-SNAPSHOT.jar
index 8f0b8ea..c814822 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.base/lib/tigerstripe-api-0.10.0-SNAPSHOT.jar
+++ b/plugins/org.eclipse.tigerstripe.workbench.base/lib/tigerstripe-api-0.10.0-SNAPSHOT.jar
Binary files differ
diff --git a/plugins/org.eclipse.tigerstripe.workbench.base/lib/tigerstripe-core-0.10.0-SNAPSHOT.jar b/plugins/org.eclipse.tigerstripe.workbench.base/lib/tigerstripe-core-0.10.0-SNAPSHOT.jar
index e5f739f..346dcb2 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.base/lib/tigerstripe-core-0.10.0-SNAPSHOT.jar
+++ b/plugins/org.eclipse.tigerstripe.workbench.base/lib/tigerstripe-core-0.10.0-SNAPSHOT.jar
Binary files differ
diff --git a/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/builder/CommonArtifactAuditor.java b/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/builder/CommonArtifactAuditor.java
index 477100d..e0579bf 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/builder/CommonArtifactAuditor.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/builder/CommonArtifactAuditor.java
@@ -41,7 +41,7 @@
 import org.eclipse.tigerstripe.workbench.profile.stereotype.IStereotypeInstance;
 
 public class CommonArtifactAuditor extends AbstractArtifactAuditor implements
-        IArtifactAuditor {
+IArtifactAuditor {
 
     /**
      * Checks in the current active profile whether References are allowed or
@@ -67,8 +67,8 @@
 
         for (IField attribute : getArtifact().getFields()) {
             checkStereotypes(attribute, "attribute '" + attribute.getName()
-                    + "' of artifact '" + getArtifact().getName() + "'",
-                    attribute);
+            + "' of artifact '" + getArtifact().getName() + "'",
+            attribute);
             checkAttributeDefaultValue(artifact, attribute);
             checkEnumField(attribute, artifactName);
         }
@@ -81,10 +81,10 @@
         if (!vStatus.isOK()) {
             TigerstripeProjectAuditor.reportProblem(
                     "Default value of '" + artifact.getFullyQualifiedName()
-                            + "." + attribute.getName()
-                            + "' attribute is incorrect. "
-                            + vStatus.getMessage(), ((IAbstractArtifactInternal) getArtifact())
-                            .getAdapter(IResource.class), 222,
+                    + "." + attribute.getName()
+                    + "' attribute is incorrect. "
+                    + vStatus.getMessage(), ((IAbstractArtifactInternal) getArtifact())
+                    .getAdapter(IResource.class), 222,
                     IMarker.SEVERITY_ERROR, attribute);
         }
     }
@@ -108,19 +108,14 @@
             if (defaultValue != null && defaultValue.trim().length() > 0) {
                 IWorkbenchProfile profile = TigerstripeCore
                         .getWorkbenchProfileSession().getActiveProfile();
-                for (IPrimitiveTypeDef primitiveTypeDef : profile
-                        .getPrimitiveTypeDefs(true)) {
-                    if (primitiveTypeDef.getName().equals(type.getName())) {
-                        if (primitiveTypeDef.getValidationExpression() != null
-                                && !defaultValue.matches(primitiveTypeDef
-                                        .getValidationExpression())) {
-                            return new Status(SWT.ERROR, "pluginId",
-                                    "Default value should match following reqular expression: "
-                                            + primitiveTypeDef
-                                                    .getValidationExpression());
-                        }
-                        break;
-                    }
+                IPrimitiveTypeDef primitiveTypeDef = profile.getPrimitiveTypeDef(type.getName());
+                if (primitiveTypeDef != null && primitiveTypeDef.getValidationExpression() != null
+                        && !defaultValue.matches(primitiveTypeDef
+                                .getValidationExpression())) {
+                    return new Status(SWT.ERROR, "pluginId",
+                            "Default value should match following reqular expression: "
+                                    + primitiveTypeDef
+                                    .getValidationExpression());
                 }
             }
         }
@@ -134,17 +129,17 @@
                 IEnumArtifact enumArtifact = (IEnumArtifact) typeArtifact;
                 if (!isEnumFieldDefaultValueCorrect(field, enumArtifact)) {
                     TigerstripeProjectAuditor
-                            .reportProblem(
-                                    "Default value of '"
-                                            + artifactName
-                                            + field.getName()
-                                            + "' attribute is incorrect. Referenced enumeration '"
-                                            + enumArtifact
-                                                    .getFullyQualifiedName()
-                                            + "' doesn't contain '"
-                                            + field.getDefaultValue()
-                                            + "' literal.",
-                                            ((IAbstractArtifactInternal) getArtifact()).getAdapter(
+                    .reportProblem(
+                            "Default value of '"
+                                    + artifactName
+                                    + field.getName()
+                                    + "' attribute is incorrect. Referenced enumeration '"
+                                    + enumArtifact
+                                    .getFullyQualifiedName()
+                                    + "' doesn't contain '"
+                                    + field.getDefaultValue()
+                                    + "' literal.",
+                                    ((IAbstractArtifactInternal) getArtifact()).getAdapter(
                                             IResource.class), 222,
                                     IMarker.SEVERITY_ERROR, field);
                 }
@@ -205,7 +200,7 @@
                 .getReturnStereotypeInstances()) {
             if (instance instanceof UnresolvedStereotypeInstance) {
                 String location = " return of method '" + method.getName()
-                        + "' of artifact '" + getArtifact().getName() + "'";
+                + "' of artifact '" + getArtifact().getName() + "'";
                 TigerstripeProjectAuditor.reportProblem("Stereotype "
                         + instance.getName() + " on " + location
                         + " not defined in the current profile",
@@ -219,8 +214,8 @@
                     .getStereotypeInstances()) {
                 if (instance instanceof UnresolvedStereotypeInstance) {
                     String location = " argument '" + argument.getName()
-                            + "' of method '" + method.getName()
-                            + "' of artifact '" + getArtifact().getName() + "'";
+                    + "' of method '" + method.getName()
+                    + "' of artifact '" + getArtifact().getName() + "'";
                     TigerstripeProjectAuditor.reportProblem("Stereotype '"
                             + instance.getName() + "' on '" + location
                             + "' not defined in the current profile",
@@ -245,7 +240,7 @@
                                 "Implemented artifact '"
                                         + art.getFullyQualifiedName()
                                         + "' is not a valid ISessionArtifact.",
-                                TigerstripeProjectAuditor
+                                        TigerstripeProjectAuditor
                                         .getIResourceForArtifact(getIProject(),
                                                 getArtifact()), 222);
                     }
@@ -259,7 +254,7 @@
     private void checkLabels(IProgressMonitor monitor) {
         for (ILiteral literal : getArtifact().getLiterals()) {
             checkStereotypes(literal, "literal '" + literal.getName()
-                    + "' of artifact '" + getArtifact().getName() + "'", null);
+            + "' of artifact '" + getArtifact().getName() + "'", null);
         }
     }
 
@@ -269,15 +264,15 @@
             if (method.isAbstract() && !getArtifact().isAbstract()) {
                 TigerstripeProjectAuditor.reportProblem(
                         "Method " + method.getName()
-                                + " is marked Abstract although "
-                                + getArtifact().getFullyQualifiedName()
-                                + " is not marked as Abstract.",
+                        + " is marked Abstract although "
+                        + getArtifact().getFullyQualifiedName()
+                        + " is not marked as Abstract.",
                         TigerstripeProjectAuditor.getIResourceForArtifact(
                                 getIProject(), getArtifact()), 222,
                         IMarker.SEVERITY_ERROR, method);
             }
             checkStereotypes(method, "method '" + method.getName()
-                    + "' of artifact '" + getArtifact().getName() + "'", method);
+            + "' of artifact '" + getArtifact().getName() + "'", method);
             // Need separate method to check the Return and Argument steros.
             // Possible change with new metamodel
             checkMethodDefaultValue(getArtifact(), method);
@@ -299,11 +294,11 @@
         if (!vStatus.isOK()) {
             TigerstripeProjectAuditor.reportProblem(
                     "Default value of argument '" + argument.getName()
-                            + "' in method '"
-                            + artifact.getFullyQualifiedName() + "."
-                            + method.getName() + "' is incorrect. "
-                            + vStatus.getMessage(), ((IAbstractArtifactInternal) getArtifact())
-                            .getAdapter(IResource.class), 222,
+                    + "' in method '"
+                    + artifact.getFullyQualifiedName() + "."
+                    + method.getName() + "' is incorrect. "
+                    + vStatus.getMessage(), ((IAbstractArtifactInternal) getArtifact())
+                    .getAdapter(IResource.class), 222,
                     IMarker.SEVERITY_ERROR, method);
         }
     }
@@ -341,21 +336,21 @@
                         "Invalid Type Hierarchy in '"
                                 + artifact.getFullyQualifiedName()
                                 + "'. Super-artifact should be of same type.",
-                        TigerstripeProjectAuditor.getIResourceForArtifact(
-                                getIProject(), artifact), 222);
+                                TigerstripeProjectAuditor.getIResourceForArtifact(
+                                        getIProject(), artifact), 222);
             }
         }
     }
 
     private boolean compareClasses(String childType,
             String parentType) {
-                if (childType.equals(parentType)
-                        || (childType.endsWith("IManagedEntityArtifact") && 
-                                parentType.endsWith("IAssociationClassArtifact"))
-                        || (childType.endsWith("IAssociationClassArtifact") && 
-                                parentType.endsWith("IManagedEntityArtifact"))) {
-                    return true;
-                }
-    return false;
+        if (childType.equals(parentType)
+                || (childType.endsWith("IManagedEntityArtifact") && 
+                        parentType.endsWith("IAssociationClassArtifact"))
+                || (childType.endsWith("IAssociationClassArtifact") && 
+                        parentType.endsWith("IManagedEntityArtifact"))) {
+            return true;
+        }
+        return false;
     }
 }
\ No newline at end of file
diff --git a/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/core/model/ArtifactManagerImpl.java b/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/core/model/ArtifactManagerImpl.java
index a23eb97..e35abf7 100644
--- a/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/core/model/ArtifactManagerImpl.java
+++ b/plugins/org.eclipse.tigerstripe.workbench.base/src/java/org/eclipse/tigerstripe/workbench/internal/core/model/ArtifactManagerImpl.java
@@ -261,76 +261,6 @@
     }
 
 
-    // ======================================================================
-    // ======================================================================
-    // ======================================================================
-
-
-//    // =======================================================================
-//    // Upon generation the Artifact mgr needs to change state. In particular,
-//    // the following should happen:
-//    // - locking: nothing can be added/removed.
-//    // - Active facet cannot be ignored: the default behavior when non
-//    // generate is to ignore facets for lookups/queries.
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #generationStart()
-//     */
-//    public void generationStart() {
-//        if (wasDisposed) {
-//            return;
-//        }
-//        lock(true);
-//        setDefaultFacetBehavior(DONT_IGNORE_ACTIVEFACET);
-//
-//        // Bug: 928: also, we need to propagate that state change to all
-//        // referenced projects/dependencies
-//        try {
-//            for (ITigerstripeModelProject project : getTSProject().getEnabledReferencedProjects()) {
-//                project.getArtifactManagerSession().generationStart();
-//            }
-//        } catch (TigerstripeException e) {
-//            runtime.logErrorMessage("TigerstripeException detected", e);
-//        }
-//
-//        if (phantomArtifactMgrSession != null)
-//            phantomArtifactMgrSession.generationStart();
-//
-//    }
-//
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #generationComplete()
-//     */
-//    public void generationComplete() {
-//        if (wasDisposed) {
-//            return;
-//        }
-//        setDefaultFacetBehavior(IGNORE_ACTIVEFACET);
-//        lock(false);
-//
-//        // Bug: 928: also, we need to propagate that state change to all
-//        // referenced projects/dependencies
-//
-//        try {
-//            for (ITigerstripeModelProject project : getTSProject().getEnabledReferencedProjects()) {
-//                project.getArtifactManagerSession().generationComplete();
-//            }
-//        } catch (TigerstripeException e) {
-//            runtime.logErrorMessage("TigerstripeException detected", e);
-//        }
-//
-//
-//        if (phantomArtifactMgrSession != null)
-//            phantomArtifactMgrSession.generationComplete();
-//    }
-
 
     /*
      * (non-Javadoc)
@@ -703,73 +633,8 @@
         }
     }
 
-//    // ==================================================
-//    // Logic for Chained ArtifactMgrs
-//    protected Collection<IAbstractArtifact> getArtifactsByModelInChained(IAbstractArtifact model,
-//            ExecutionContext context) {
-//        try {
-//            readLock.lock();
-//            ArrayList<IAbstractArtifact> result = new ArrayList<IAbstractArtifact>();
-//            result.addAll(depContentCache.getArtifactsByModelInChained(model, context));
-//
-//            Set<ITigerstripeModelProject> projects = new HashSet<ITigerstripeModelProject>();
-//            fillProjectsFromReferences(projects, context, Cycles.REFERENCES_BY_MODEL);
-//            fillProjectsFromInstalledModules(projects, context, Cycles.INSTALLED_MODULES_BY_MODEL);
-//            fillProjectsFromDependencies(projects, context, Cycles.DEPENDENCIES_BY_MODEL);
-//
-//            result.addAll(toContextProjectAwareArtifacts(getAllArtifacts(projects, context, model)));
-//            return result;
-//        } finally {
-//            readLock.unlock();
-//        }
-//    }
-//
-//    protected Collection<IAbstractArtifact> getAllChainedArtifacts(ExecutionContext context,
-//            boolean isOverridePredicate) {
-//        try {
-//            readLock.lock();
-//            ArrayList<IAbstractArtifact> result = new ArrayList<IAbstractArtifact>();
-//            result.addAll(depContentCache.getAllChainedArtifacts(context, isOverridePredicate));
-//
-//            Set<ITigerstripeModelProject> projects = new HashSet<ITigerstripeModelProject>();
-//            fillProjectsFromReferences(projects, context, Cycles.REFERENCES_ALL);
-//            fillProjectsFromInstalledModules(projects, context, Cycles.INSTALLED_MODULES_ALL);
-//            fillProjectsFromDependencies(projects, context, Cycles.DEPENDENCIES_ALL);
-//
-//            result.addAll(toContextProjectAwareArtifacts(getAllArtifacts(projects, context, isOverridePredicate)));
-//            return result;
-//        } finally {
-//            readLock.unlock();
-//        }
-//    }
 
 
-   
-
-
-
-//    protected IAbstractArtifact getArtifactByFullyQualifiedNameInChained(String name,
-//            ExecutionContext context) {
-//        try {
-//            readLock.lock();
-//            IAbstractArtifact result = depContentCache.getArtifactByFullyQualifiedNameInChained(name, context);
-//            if (result != null)
-//                return result;
-//            result = getArtifactByFullyQualifiedNameInReferences(name, context);
-//            if (result == null) {
-//                result = getArtifactByFullyQualifiedNameInInstalledModules(name, context);
-//            }
-//
-//            ITigerstripeModelProject contextProject = getTSProject().getTSProject();
-//            if (result != null && contextProject != null && !(result instanceof IContextProjectAware)) {
-//                result = ContextProjectAwareProxy.newInstance(result, contextProject);
-//            }
-//            return result;
-//        } finally {
-//            readLock.unlock();
-//        }
-//    }
-
     /*
      * (non-Javadoc)
      * 
@@ -789,154 +654,6 @@
         }
     }    
 
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #getOriginatingRelationshipForFQN(java.lang.String, boolean)
-//     */
-//    public List<IRelationship> getOriginatingRelationshipForFQN(String fqn, boolean includeProjectDependencies)
-//            throws TigerstripeException {
-//        if (wasDisposed) {
-//            return Collections.emptyList();
-//        }
-//
-//        try {
-//            readLock.lock();
-//            return getOriginatingRelationshipForFQN(fqn, includeProjectDependencies, false);
-//        } finally {
-//            readLock.unlock();
-//        }
-//    }
-//
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #getOriginatingRelationshipForFQN(java.lang.String, boolean, boolean)
-//     */
-//    public List<IRelationship> getOriginatingRelationshipForFQN(String fqn, boolean includeProjectDependencies,
-//            boolean ignoreFacets) throws TigerstripeException {
-//        if (wasDisposed) {
-//            return Collections.emptyList();
-//        }
-//
-//        try {
-//            readLock.lock();
-//            List<IRelationship> result = new ArrayList<IRelationship>();
-//            result.addAll(relationshipCache.getRelationshipsOriginatingFromFQN(fqn, ignoreFacets));
-//
-//            if (includeProjectDependencies) {
-//                for (ITigerstripeModelProject project : collectReferencedProjectsAndDependencies()) {
-//                    /*
-//                     * Do not check for cycles. This method can't raise
-//                     * stackoverflow, because it is not recursive
-//                     */
-//                    ArtifactManager mgr = project
-//                            .getArtifactManagerSession().getArtifactManager();
-//                    if (mgr instanceof ArtifactManagerImpl) {
-//                    result.addAll(toContextProjectAwareArtifacts(
-//                            ((ArtifactManagerImpl) mgr).getRelationshipCache().getRelationshipsOriginatingFromFQN(fqn, ignoreFacets)));
-//                    }
-//                }
-//            }
-//            return result;
-//        } catch (Exception e) {
-//            BasePlugin.logErrorMessage("An error was thrown in getOriginatingRelationshipForFQN: fqn=" + fqn
-//                    + ", includeProjectDependencies=" + String.valueOf(includeProjectDependencies) + ", ignoreFacets="
-//                    + String.valueOf(ignoreFacets) + ".", e);
-//            throw new TigerstripeException("An error occurred in getOriginatingRelationshipForFQN", e);
-//        } finally {
-//            readLock.unlock();
-//        }
-//    }
-//
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #getTerminatingRelationshipForFQN(java.lang.String, boolean)
-//     */
-//    public List<IRelationship> getTerminatingRelationshipForFQN(String fqn, boolean includeProjectDependencies)
-//            throws TigerstripeException {
-//        if (wasDisposed) {
-//            return Collections.emptyList();
-//        }
-//
-//        try {
-//            readLock.lock();
-//            return getTerminatingRelationshipForFQN(fqn, includeProjectDependencies, false);
-//        } finally {
-//            readLock.unlock();
-//        }
-//    }
-//
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #getTerminatingRelationshipForFQN(java.lang.String, boolean, boolean)
-//     */
-//    public List<IRelationship> getTerminatingRelationshipForFQN(String fqn, boolean includeProjectDependencies,
-//            boolean ignoreFacet) throws TigerstripeException {
-//        if (wasDisposed) {
-//            return Collections.emptyList();
-//        }
-//
-//        try {
-//            readLock.lock();
-//            List<IRelationship> result = new ArrayList<IRelationship>();
-//            result.addAll(relationshipCache.getRelationshipsTerminatingInFQN(fqn, ignoreFacet));
-//
-//            if (includeProjectDependencies) {
-//
-//                for (ITigerstripeModelProject project : collectReferencedProjectsAndDependencies()) {
-//                    /*
-//                     * Do not check for cycles. This method can't raise
-//                     * stackoverflow, because it is not recursive
-//                     */
-//                    ArtifactManager mgr = project
-//                            .getArtifactManagerSession().getArtifactManager();
-//                    if (mgr instanceof ArtifactManagerImpl) {
-//                    result.addAll(toContextProjectAwareArtifacts(
-//                            ((ArtifactManagerImpl) mgr).getRelationshipCache().getRelationshipsTerminatingInFQN(fqn, ignoreFacet)));
-//                    }
-//                }
-//            }
-//            return result;
-//        } finally {
-//            readLock.unlock();
-//        }
-//    }
-//
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #collectReferencedProjectsAndDependencies()
-//     */
-//    public List<ITigerstripeModelProject> collectReferencedProjectsAndDependencies() throws TigerstripeException {
-//
-//        ArrayList<ITigerstripeModelProject> models = new ArrayList<ITigerstripeModelProject>();
-//
-//        for (ITigerstripeModelProject project : getTSProject().getEnabledReferencedProjects()) {
-//            models.add(project);
-//        }
-//        for (IDependency d : getTSProject().getEnabledDependencies()) {
-//            models.add(d.makeModuleProject(getTSProject().getTSProject()));
-//        }
-//        return models;
-//    }
-//
-//    protected BaseArtifactRelationshipCache getRelationshipCache() {
-//        return relationshipCache;
-//    }
-
     // This is a backdoor used in the TSDeleteAction to let the Art Mgr know
     // that an artifact was deleted after the fact.
     // Really the Art Mgr should be listenning for Workspace Changes here
@@ -1116,106 +833,6 @@
         }
     }
 
-//    /**
-//     * Bug 928: When a facet is applied here, it must be propagated to all
-//     * referenced projects and dependencies. The dependencies cache needs to be
-//     * refreshed too.
-//     * 
-//     * @param oldFacet
-//     * @param newFacet
-//     * @param monitor
-//     * @throws TigerstripeException
-//     */
-//    private void propagateFacetChangeToDependencies(IFacetReference oldFacet, IFacetReference newFacet,
-//            ExecutionContext context) throws TigerstripeException {
-//        if (!context.addToCycle(Cycles.FACET_UPDATE, getTSProject())) {
-//            return;
-//        }
-//        if (newFacet == null) {
-//            // reseting all referenced projects
-//            for (ITigerstripeModelProject project : getTSProject().getEnabledReferencedProjects()) {
-//                try {
-//                    project.getArtifactManagerSession().resetActiveFacet(context);
-//                } catch (TigerstripeException e) {
-//                    runtime.logErrorMessage("TigerstripeException detected", e);
-//                }
-//            }
-//            for (IDependency dep : getTSProject().getEnabledDependencies()) {
-//                try {
-//                    Dependency dependency = (Dependency) dep;
-//                    if (dependency.isValid(context.getMonitor())) {
-//                        dependency.getArtifactManager(null).resetActiveFacet(context);
-//                    }
-//                } catch (TigerstripeException e) {
-//                    runtime.logErrorMessage("TigerstripeException detected", e);
-//                }
-//            }
-//
-//            // need to take care of modules too
-//            depContentCache.resetActiveFacet();
-//            relationshipCache.resetActiveFacet();
-//
-//            if (phantomArtifactMgrSession != null)
-//                phantomArtifactMgrSession.resetActiveFacet(context);
-//
-//        } else {
-//            // this is a new facet being set
-//            for (ITigerstripeModelProject project : getTSProject().getEnabledReferencedProjects()) {
-//                try {
-//                    project.getArtifactManagerSession().setActiveFacet(newFacet, context);
-//                } catch (TigerstripeException e) {
-//                    runtime.logErrorMessage("TigerstripeException detected", e);
-//                }
-//            }
-//            for (IDependency dep : getTSProject().getEnabledDependencies()) {
-//                try {
-//                    Dependency dependency = (Dependency) dep;
-//                    if (dependency.isValid(context.getMonitor())) {
-//                        dependency.getArtifactManager(null).setActiveFacet(newFacet, context);
-//                    }
-//                } catch (TigerstripeException e) {
-//                    runtime.logErrorMessage("TigerstripeException detected", e);
-//                }
-//            }
-//            depContentCache.setActiveFacet(newFacet);
-//            relationshipCache.setActiveFacet(newFacet);
-//
-//            if (phantomArtifactMgrSession != null)
-//                phantomArtifactMgrSession.setActiveFacet(newFacet, context);
-//        }
-//    }
-//
-//
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #resetActiveFacet()
-//     */
-//    public void resetActiveFacet() throws TigerstripeException {
-//        resetActiveFacet(newContext());
-//    }
-//
-//    public void resetActiveFacet(ExecutionContext context) throws TigerstripeException {
-//        if (wasDisposed) {
-//            return;
-//        }
-//        IFacetReference oldFacet = activeFacet;
-//        activeFacet = null;
-//        try {
-//            writeLock.lock();
-//            resetScopingPredicate();
-//            if (oldFacet != null) {
-//                removeArtifactManagerListener((FacetReference) oldFacet);
-////                ((FacetReference) oldFacet).stopListeningToManager();
-//            }
-//        } finally {
-//            writeLock.unlock();
-//        }
-//        propagateFacetChangeToDependencies(oldFacet, null, context);
-//        notifyFacetChanged(oldFacet);
-//    }
 
     // although facets are handled with Predicated lists in the artifact manager
     // to handle artifact-level
@@ -1231,49 +848,6 @@
         }
     }
 
-//    /*
-//     * (non-Javadoc)
-//     * 
-//     * @see
-//     * org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager
-//     * #setActiveFacet
-//     * (org.eclipse.tigerstripe.workbench.internal.api.contract.segment
-//     * .IFacetReference, org.eclipse.core.runtime.IProgressMonitor)
-//     */
-//    public void setActiveFacet(IFacetReference facetRef, IProgressMonitor monitor) throws TigerstripeException {
-//        setActiveFacet(facetRef, newContext(monitor));
-//    }
-//
-//    public void setActiveFacet(IFacetReference facetRef, ExecutionContext context) throws TigerstripeException {
-//        if (wasDisposed) {
-//            return;
-//        }
-//        if (facetRef.canResolve()) {
-//            IFacetReference oldFacet = activeFacet;
-//            activeFacet = facetRef;
-//            try {
-//                writeLock.lock();
-//                setScopingPredicate(facetRef.getFacetPredicate());
-//                if (oldFacet != facetRef) {
-//                    if (oldFacet != null) {
-//                        removeArtifactManagerListener((FacetReference) facetRef);
-//                        WorkingCopyManager.removeCommitListener((FacetReference) facetRef);
-////                        ((FacetReference) oldFacet).stopListeningToManager();
-//                    }
-//                    addArtifactManagerListener((FacetReference) facetRef);
-//                    WorkingCopyManager.addCommitListener((FacetReference) facetRef);
-////                    ((FacetReference) facetRef).startListeningToManager(this);
-//                }
-//            } finally {
-//                writeLock.unlock();
-//            }
-//            propagateFacetChangeToDependencies(oldFacet, activeFacet, context);
-//            notifyFacetChanged(oldFacet);
-//            return;
-//        }
-//        throw new TigerstripeException("Can't resolve Facet (" + facetRef.getURI().toASCIIString() + ")");
-//    }
-
 
     /*
      * (non-Javadoc)