diff options
Diffstat (limited to 'common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java')
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java deleted file mode 100644 index 05c340df35..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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.common.core.internal.libval; - -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.runtime.CoreException; -import org.eclipse.jpt.common.core.internal.XPointUtil; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; - -public class LibraryValidatorConfig { - - public static final String CONFIG_EXPR_VAR = "config"; //$NON-NLS-1$ - public static final String LIBRARY_PROVIDER_EXPR_VAR = "libraryProvider"; //$NON-NLS-1$ - - - private String id; - private String pluginId; - private String className; - private Expression enablementCondition; - - - LibraryValidatorConfig() { - 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 Expression getEnablementCondition() { - return this.enablementCondition; - } - - void setEnablementCondition(Expression enablementCondition) { - this.enablementCondition = enablementCondition; - } - - public LibraryValidator getLibraryValidator() { - return XPointUtil.instantiate( - this.pluginId, LibraryValidatorManager.QUALIFIED_EXTENSION_POINT_ID, - this.className, LibraryValidator.class); - } - - public boolean isEnabledFor(JptLibraryProviderInstallOperationConfig config) { - EvaluationContext evalContext = new EvaluationContext(null, config); - evalContext.setAllowPluginActivation(true); - evalContext.addVariable(CONFIG_EXPR_VAR, config); - evalContext.addVariable(LIBRARY_PROVIDER_EXPR_VAR, config.getLibraryProvider()); - - if (this.enablementCondition != null) { - try { - EvaluationResult evalResult = this.enablementCondition.evaluate(evalContext); - - if (evalResult == EvaluationResult.FALSE) { - return false; - } - } - catch (CoreException e) { - log(e); - } - } - - return true; - } -} |