Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2010-10-10 03:25:30 +0000
committerRyan D. Brooks2010-10-10 03:25:30 +0000
commit2a31a1ebce91900e86b826b96ffcab6d4089367e (patch)
treee36e19a5c79a5e25c965be25871c457960e8e480 /plugins
parentb89c7404d24f905befe91def246b9c06ef12ca44 (diff)
downloadorg.eclipse.osee-2a31a1ebce91900e86b826b96ffcab6d4089367e.tar.gz
org.eclipse.osee-2a31a1ebce91900e86b826b96ffcab6d4089367e.tar.xz
org.eclipse.osee-2a31a1ebce91900e86b826b96ffcab6d4089367e.zip
refactor: Make TemplateManager use the PresentationType enum instead of a string0.9.6.v201010110002_REL
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java11
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java3
4 files changed, 12 insertions, 9 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
index 2be8bb66992..ff3c5c706cc 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/WordTemplateRenderer.java
@@ -229,7 +229,7 @@ public class WordTemplateRenderer extends WordRenderer implements ITemplateRende
protected String getTemplate(Artifact artifact, PresentationType presentationType) throws OseeCoreException {
Artifact templateArtifact =
- TemplateManager.getTemplate(this, artifact, presentationType.name(), getStringOption(TEMPLATE_OPTION));
+ TemplateManager.getTemplate(this, artifact, presentationType, getStringOption(TEMPLATE_OPTION));
return templateArtifact.getSoleAttributeValue(CoreAttributeTypes.WholeWordContent);
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java
index 73ba3b600c1..b77c8163aec 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ArtifactTemplateProvider.java
@@ -28,6 +28,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
/**
* This provider gets all of its templates from the common branch based on a name created from concatenating the
@@ -71,7 +72,7 @@ public class ArtifactTemplateProvider implements ITemplateProvider {
}
@Override
- public Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException {
+ public Artifact getTemplate(IRenderer renderer, Artifact artifact, PresentationType presentationType, String option) throws OseeCoreException {
ensureTemplateCachePopulated();
Artifact template = getArtifactFromOptionName(option);
@@ -108,10 +109,10 @@ public class ArtifactTemplateProvider implements ITemplateProvider {
return toReturn;
}
- private List<String> getPossibleTemplateNamesOrderedBySpecialization(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeArgumentException {
+ private List<String> getPossibleTemplateNamesOrderedBySpecialization(IRenderer renderer, Artifact artifact, PresentationType presentationType, String option) throws OseeArgumentException {
if (renderer == null || presentationType == null) {
- throw new OseeArgumentException("Invalid renderer[%s] or presentationType[%s]",
- renderer.toString(), presentationType.toString());
+ throw new OseeArgumentException("Invalid renderer[%s] or presentationType[%s]", renderer.toString(),
+ presentationType.toString());
}
List<String> list = new ArrayList<String>();
@@ -131,7 +132,7 @@ public class ArtifactTemplateProvider implements ITemplateProvider {
}
@Override
- public int getApplicabilityRating(IRenderer rendererId, Artifact artifact, String presentationType, String option) {
+ public int getApplicabilityRating(IRenderer rendererId, Artifact artifact, PresentationType presentationType, String option) {
return ITemplateProvider.DEFAULT_MATCH;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java
index c7c00a84588..925bec9e52d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/ITemplateProvider.java
@@ -14,6 +14,7 @@ import java.util.List;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
/**
* @author Roberto E. Escobar
@@ -25,9 +26,9 @@ public interface ITemplateProvider {
public static final int DEFAULT_MATCH = 10;
public static final int NO_MATCH = -1;
- public Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException;
+ public Artifact getTemplate(IRenderer renderer, Artifact artifact, PresentationType presentationType, String option) throws OseeCoreException;
- public abstract int getApplicabilityRating(IRenderer renderer, Artifact artifact, String presentationType, String option);
+ public abstract int getApplicabilityRating(IRenderer renderer, Artifact artifact, PresentationType presentationType, String option);
public List<Artifact> getAllTemplates() throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java
index dc8a1dae144..f4068107f7f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/templates/TemplateManager.java
@@ -21,6 +21,7 @@ import org.eclipse.osee.framework.plugin.core.util.ExtensionDefinedObjects;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.render.IRenderer;
+import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
/**
* @author Andrew M. Finkbeiner
@@ -38,7 +39,7 @@ public class TemplateManager {
templateProviders = extensionDefinedObjects.getObjects();
}
- public static Artifact getTemplate(IRenderer renderer, Artifact artifact, String presentationType, String option) throws OseeCoreException {
+ public static Artifact getTemplate(IRenderer renderer, Artifact artifact, PresentationType presentationType, String option) throws OseeCoreException {
ITemplateProvider bestTemplateProvider = null;
int highestRating = 0;
for (ITemplateProvider templateProvider : instance.templateProviders) {

Back to the top