Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java168
1 files changed, 0 insertions, 168 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java
deleted file mode 100644
index 38ec1469f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/ResourceLocatorConfig.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Oracle. 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:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.resource;
-
-import static org.eclipse.jst.common.project.facet.core.internal.FacetedProjectFrameworkJavaPlugin.log;
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.XPointUtil;
-import org.eclipse.jpt.core.resource.ResourceLocator;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-public class ResourceLocatorConfig
- implements Comparable<ResourceLocatorConfig> {
-
- public static final String PROJECT_ENABLEMENT_VARIABLE = "project"; //$NON-NLS-1$
-
- private String id;
- private String pluginId;
- private String className;
- private Priority priority;
- private Expression enablementCondition;
-
-
- ResourceLocatorConfig() {
- super();
- }
-
-
- public String getId() {
- return this.id;
- }
-
- void setId(String id) {
- this.id = id;
- }
-
- public String getPluginId() {
- return this.pluginId;
- }
-
- void setPluginId(String pluginId) {
- this.pluginId = pluginId;
- }
-
- public String getClassName() {
- return this.className;
- }
-
- void setClassName(String className) {
- this.className = className;
- }
-
- public Priority getPriority() {
- return priority;
- }
-
- void setPriority(Priority priority) {
- this.priority = priority;
- }
-
- public Expression getEnablementCondition() {
- return this.enablementCondition;
- }
-
- void setEnablementCondition(Expression enablementCondition) {
- this.enablementCondition = enablementCondition;
- }
-
- public ResourceLocator getResourceLocator() {
- return XPointUtil.instantiate(
- JptCorePlugin.PLUGIN_ID, ResourceLocatorManager.QUALIFIED_EXTENSION_POINT_ID,
- this.className, ResourceLocator.class);
- }
-
- public boolean isEnabledFor(IProject project) {
- EvaluationContext evalContext = new EvaluationContext(null, project);
- evalContext.setAllowPluginActivation(true);
- evalContext.addVariable(PROJECT_ENABLEMENT_VARIABLE, project);
-
- if (this.enablementCondition != null) {
- try {
- EvaluationResult evalResult = this.enablementCondition.evaluate(evalContext);
-
- if (evalResult == EvaluationResult.FALSE) {
- return false;
- }
- }
- catch (CoreException e) {
- log(e);
- }
- }
-
- return true;
- }
-
- public int compareTo(ResourceLocatorConfig other) {
- return Priority.compare(this.priority, other.priority);
- }
-
-
- public static enum Priority {
-
- /* The lowest priority for a resource locator */
- LOWEST(6, "lowest"),
-
- /* The second lowest priority for a resource locator */
- LOWER(5, "lower"),
-
- /* The third lowest priority for a resource locator */
- LOW(4, "low"),
-
- /* The default priority for a resource locator */
- NORMAL(3, "normal"),
-
- /* The third highest priority for a resource locator */
- HIGH(2, "high"),
-
- /* The second highest priority for a resource locator */
- HIGHER(1, "higher"),
-
- /* The highest priority for a resource locator */
- HIGHEST(0, "highest");
-
-
- public static int compare(Priority priority1, Priority priority2) {
- return priority1.value.compareTo(priority2.value);
- }
-
- public static Priority get(String literal) {
- if (literal == null) {
- return NORMAL;
- }
- for (Priority priority : values()) {
- if (StringTools.stringsAreEqual(literal, priority.literal)) {
- return priority;
- }
- }
- return null;
- }
-
-
- private Integer value;
- private String literal;
-
-
- private Priority(int value, String literal) {
- this.value = Integer.valueOf(value);
- this.literal = literal;
- }
-
-
- @Override
- public String toString() {
- return this.literal;
- }
- }
-}

Back to the top