Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation')
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/AbstractXMLViewValidationStrategy.java57
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ELValidationPreferences.java767
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSFViewValidator.java88
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSPSemanticValidatorTest.java41
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFTypeComparatorPreferences.java339
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidationContext.java159
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidatorFactory.java28
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/LocalizedMessage.java88
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/Severity.java67
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ValidationPreferences.java90
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/XMLViewDefnValidator.java203
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidationUtil.java471
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidator.java398
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ApplicationValidationVisitor.java299
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AttributeValidationVisitor.java83
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ClassNameEObjectValidationVisitor.java64
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ComponentValidatorVisitor.java151
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ConverterValidationVisitor.java116
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/DiagnosticFactory.java412
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/EObjectValidationVisitor.java165
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FacesConfigValidator.java102
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FactoryValidationVisitor.java170
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ILocalizedMessage.java23
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedBeanValidationVisitor.java131
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedPropertyValidationVisitor.java98
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/Messages.java115
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationCaseValidationVisitor.java79
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationRuleValidator.java91
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NodeValidationVisitor.java134
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyNameValidationVisitor.java169
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyValidationVisitor.java67
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RenderKitValidationVisitor.java79
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RendererValidationVisitor.java79
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ValidatorTypeValidationVisitor.java79
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ViewIdValidator.java29
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/messages.properties28
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsFactory.java64
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsPackage.java353
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ContainsTagConstraint.java83
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagId.java81
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagSet.java46
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsFactoryImpl.java127
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsPackageImpl.java329
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ContainsTagConstraintImpl.java220
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagIdImpl.java215
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagSetImpl.java132
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsAdapterFactory.java154
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceFactoryImpl.java55
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceImpl.java32
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsSwitch.java175
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsXMLProcessor.java50
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ASTSemanticValidator.java612
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ELExpressionValidator.java158
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/EvaluationTracker.java70
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/IExpressionSemanticValidator.java35
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/QuickFixAssistant.java149
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ValueExpressionTracker.java46
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/DiagnosticFactory.java561
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/Messages.java159
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/messages.properties44
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AddArithmeticBinaryOperator.java52
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AndBinaryOperator.java46
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ArithmeticBinaryOperator.java63
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BinaryOperator.java163
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BracketOperator.java184
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java266
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DotOperator.java72
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EmptyUnaryOperator.java122
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java544
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualsBinaryRelationalOperator.java65
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanEqRelationalBinaryOperator.java45
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanRelationalBinaryOperator.java44
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanEqRelationalBinaryOperator.java45
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanRelationalBinaryOperator.java45
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java183
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java230
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java269
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/Messages.java37
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java215
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java388
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MultiplyArithmeticBinaryOperator.java55
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java305
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotEqualsBinaryRelationalOperator.java46
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java105
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/OrBinaryOperator.java46
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/RelationalBinaryOperator.java239
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/SubtractArithmeticBinaryOperator.java56
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java143
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/UnaryOperator.java106
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/messages.properties21
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java710
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/ContainmentValidatingStrategy.java228
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/Messages.java37
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/messages.properties2
94 files changed, 0 insertions, 14686 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/AbstractXMLViewValidationStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/AbstractXMLViewValidationStrategy.java
deleted file mode 100644
index 5be7a8ad9..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/AbstractXMLViewValidationStrategy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-import org.eclipse.jst.jsf.common.dom.DOMAdapter;
-import org.eclipse.jst.jsf.common.internal.policy.IIdentifiable;
-
-/**
- * A strategy that validates JSF views that are defined in XML format.
- *
- * @author cbateman
- *
- */
-public abstract class AbstractXMLViewValidationStrategy implements IIdentifiable<String>
-{
- private final String _id;
- private final String _displayName;
-
- /**
- * @param id
- * @param displayName
- */
- public AbstractXMLViewValidationStrategy(final String id, final String displayName)
- {
- _id = id;
- _displayName = displayName;
- }
-
- /**
- * @param domAdapter
- */
- public abstract void validate(final DOMAdapter domAdapter);
-
- /**
- * @param domAdapter
- * @return true if this validator is interested in validating this node
- */
- public abstract boolean isInteresting(final DOMAdapter domAdapter);
-
- public final String getId()
- {
- return _id;
- }
-
- public String getDisplayName()
- {
- return _displayName;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ELValidationPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ELValidationPreferences.java
deleted file mode 100644
index d66733274..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ELValidationPreferences.java
+++ /dev/null
@@ -1,767 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal;
-
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Model object for EL validation preferences
- *
- * @author cbateman
- */
-public class ELValidationPreferences implements IJSFPreferenceModel
-{
- private final static String KEY_ENABLE_BUILD_VALIDATION =
- "org.eclipse.jst.jsf.ui.ValidateJSFELBuild"; //$NON-NLS-1$
- private final static boolean DEFAULT_ENABLE_BUILD_VALIDATION = true;
-
- private final static String KEY_ENABLE_INCREMENTAL_VALIDATION =
- "org.eclipse.jst.jsf.ui.ValidateJSFELIncremental"; //$NON-NLS-1$
- private final static boolean DEFAULT_ENABLE_INCREMENTAL_VALIDATION = false;
-
-
- private boolean _enableBuildValidation;
- private boolean _enableIncrementalValidation;
- private int[] _severities;
-
- /**
- * Loads the object from the preference store provided
- *
- * @param prefStore
- */
- public void load(IPreferenceStore prefStore)
- {
- if (!prefStore.contains(KEY_ENABLE_BUILD_VALIDATION))
- {
- prefStore.setDefault(KEY_ENABLE_BUILD_VALIDATION, DEFAULT_ENABLE_BUILD_VALIDATION);
- }
- _enableBuildValidation =
- prefStore.getBoolean(KEY_ENABLE_BUILD_VALIDATION);
-
- if (!prefStore.contains(KEY_ENABLE_INCREMENTAL_VALIDATION))
- {
- prefStore.setDefault(KEY_ENABLE_INCREMENTAL_VALIDATION, DEFAULT_ENABLE_INCREMENTAL_VALIDATION);
- }
- _enableIncrementalValidation =
- prefStore.getBoolean(KEY_ENABLE_INCREMENTAL_VALIDATION);
-
- loadSeverities(prefStore);
- }
-
- private void loadSeverities(final IPreferenceStore prefStore)
- {
- final int severities[] = getSeverities();
-
- for (int i = 0; i < DiagnosticFactory.NUM_IDS; i++)
- {
- final String key = getKeyById(i);
-
- if (!prefStore.contains(key))
- {
- final int diagSeverity = getDefaultSeverity(i);
- final Severity severity = mapDiagToSeverity(diagSeverity);
-
- prefStore.setDefault(key, severity.toString());
- }
- final String storedSeverity = prefStore.getString(key);
- severities[i] = mapSeverityToDiag(storedSeverity);
- }
- }
- /**
- * Copies the object into the preference store but DOES NOT SAVE IT
- *
- * @param prefStore
- */
- public void commit(IPreferenceStore prefStore)
- {
- prefStore.setValue(KEY_ENABLE_BUILD_VALIDATION, _enableBuildValidation);
- prefStore.setValue(KEY_ENABLE_INCREMENTAL_VALIDATION,
- _enableIncrementalValidation);
- commitSeverities(prefStore);
- }
-
- private void commitSeverities(final IPreferenceStore prefStore)
- {
- final int severities[] = getSeverities();
-
- for (int i = 0; i < severities.length; i++)
- {
- final String key = getKeyById(i);
- prefStore.setValue(key
- , mapDiagToSeverity(severities[i]).toString());
- }
- }
-
- /**
- * Reverts the model to it's defaults. Does not commit to pref store.
- */
- public void setDefaults()
- {
- setEnableBuildValidation(DEFAULT_ENABLE_BUILD_VALIDATION);
- setEnableIncrementalValidation(DEFAULT_ENABLE_INCREMENTAL_VALIDATION);
- setProblemSeverityDefaults();
- }
-
- private void setProblemSeverityDefaults()
- {
- final int[] severities = getSeverities();
-
- for (int i = 0; i < DiagnosticFactory.NUM_IDS; i++)
- {
- severities[i] = getDefaultSeverity(i);
- }
- }
-
- public Object getValueByKey(IScopeContext context, String key) {
- // ignore context for now; will be used when we have project overrides
- if (KEY_ENABLE_BUILD_VALIDATION.equals(key))
- {
- return Boolean.valueOf(isEnableBuildValidation());
- }
- else if (KEY_ENABLE_INCREMENTAL_VALIDATION.equals(key))
- {
- return Boolean.valueOf(isEnableIncrementalValidation());
- }
- else
- {
- try
- {
- final Severity severity = getSeverity(key);
- return severity.toString();
- }
- catch (IllegalArgumentException e)
- {
- // getIdByKey will throw this exception if key is not a valid
- // severity key. Ignore the exception here and fall-through
- }
- }
-
- return null; // not found
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel#getStoredValueByKey(org.eclipse.core.runtime.preferences.IScopeContext, java.lang.String)
- */
- public Object getStoredValueByKey(IScopeContext context, String key) {
- // ignore context for now; will be used when we have project overrides
- if (KEY_ENABLE_BUILD_VALIDATION.equals(key))
- {
- return Boolean.valueOf(context.getNode("org.eclipse.jst.jsf.ui").getBoolean(key, true)); //$NON-NLS-1$
- }
- else if (KEY_ENABLE_INCREMENTAL_VALIDATION.equals(key))
- {
- return Boolean.valueOf(context.getNode("org.eclipse.jst.jsf.ui").getBoolean(key, false)); //$NON-NLS-1$
- }
- else
- {
- try
- {
- return context.getNode("org.eclipse.jst.jsf.core").get(key, mapDiagToSeverity(getDefaultSeverity(getIdByKey(key))).toString()); //$NON-NLS-1$
- }
- catch (IllegalArgumentException e)
- {
- // getIdByKey will throw this exception if key is not a valid
- // severity key. Ignore the exception here and fall-through
- }
- }
-
- return null; // not found
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel#setValueByKey(org.eclipse.core.runtime.preferences.IScopeContext, java.lang.String, java.lang.Object)
- */
- public Object setValueByKey(IScopeContext context, String key, Object value)
- {
- // ignore context for now; will be used when we have project overrides
- if (KEY_ENABLE_BUILD_VALIDATION.equals(key))
- {
- boolean oldValue = isEnableBuildValidation();
- boolean newValue = ((Boolean)value).booleanValue();
- setEnableBuildValidation(newValue);
- return Boolean.valueOf(oldValue);
- }
- else if (KEY_ENABLE_INCREMENTAL_VALIDATION.equals(key))
- {
- boolean oldValue = isEnableIncrementalValidation();
- boolean newValue = ((Boolean)value).booleanValue();
- setEnableIncrementalValidation(newValue);
- return Boolean.valueOf(oldValue);
- }
- else
- {
- final Severity oldValue = getSeverity(key);
- setSeverity(key, (Severity)value);
- return oldValue;
- }
- }
-
- /**
- * @return the build validation enablement
- */
- public boolean isEnableBuildValidation()
- {
- return _enableBuildValidation;
- }
-
- /**
- * @return the incremental validation enablement
- */
- public boolean isEnableIncrementalValidation()
- {
- return _enableIncrementalValidation;
- }
-
- /**
- * @param enableBuildValidation
- */
- public void setEnableBuildValidation(boolean enableBuildValidation) {
- _enableBuildValidation = enableBuildValidation;
- }
-
- /**
- * @param enableIncrementalValidation
- */
- public void setEnableIncrementalValidation(boolean enableIncrementalValidation) {
- _enableIncrementalValidation = enableIncrementalValidation;
- }
-
- /**
- * @param key
- * @return the severity
- */
- public Severity getSeverity(final String key)
- {
- final int severityDiag = _severities[getIdByKey(key)];
- final Severity severity = mapDiagToSeverity(severityDiag);
- return severity;
- }
-
- /**
- * @param key
- * @param severity
- */
- public void setSeverity(final String key, final Severity severity)
- {
- final int newSeverityDiag = mapSeverityToDiag(severity.toString());
- final int diagId = getIdByKey(key);
- _severities[diagId] = newSeverityDiag;
- }
-
- /**
- * @param diagnosticId
- * @return the severity as configured for diagnosticId. The value
- * is relative to the Diagnostic class severity scheme
- */
- public final int getDiagnosticSeverity(final int diagnosticId)
- {
- return getSeverities()[diagnosticId];
- }
-
- private int[] getSeverities()
- {
- if (_severities == null)
- {
- _severities = new int[DiagnosticFactory.NUM_IDS];
- }
-
- return _severities;
- }
-
- /**
- * @param diagSeverity
- * @return a Severity preference value for a diagnostic severity
- */
- public static Severity mapDiagToSeverity(int diagSeverity)
- {
- switch(diagSeverity)
- {
- case Diagnostic.ERROR:
- return Severity.ERROR;
- case Diagnostic.WARNING:
- return Severity.WARNING;
- default:
- return Severity.IGNORE;
- }
- }
-
- /**
- * @param severity
- * @return a Diagnostic severity level for a severity pref string
- */
- public static int mapSeverityToDiag(String severity)
- {
- if ("error".equals(severity)) //$NON-NLS-1$
- {
- return Diagnostic.ERROR;
- }
- else if ("warning".equals(severity)) //$NON-NLS-1$
- {
- return Diagnostic.WARNING;
- }
- else if ("ignore".equals(severity)) //$NON-NLS-1$
- {
- return Diagnostic.OK;
- }
- else
- {
- throw new IllegalArgumentException("Invalid enum name: "+severity); //$NON-NLS-1$
- }
- }
-
- /**
- * @param diagnosticId
- * @return the default severity of a diagnostic
- */
- public static int getDefaultSeverity(final int diagnosticId)
- {
- switch(diagnosticId)
- {
- case DiagnosticFactory.BINARY_OP_BOTH_OPERANDS_NULL_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.MEMBER_NOT_FOUND_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.VARIABLE_NOT_FOUND_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.MISSING_CLOSING_EXPR_BRACKET_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.EMPTY_EL_EXPRESSION_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_OP_DOT_WITH_VALUEB_NULL_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID:
- return Diagnostic.WARNING;
- case DiagnosticFactory.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID:
- return Diagnostic.ERROR;
- case DiagnosticFactory.MEMBER_IS_INTERMEDIATE_ID:
- return Diagnostic.WARNING;
- default:
- throw new IllegalArgumentException("Diagnostic Id: "+ diagnosticId +" is out of range"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * @param diagnosticId
- * @return the preference key for the corresponding diagnosticId in the el DiagnosticFactory
- */
- public static String getKeyById(final int diagnosticId)
- {
- switch(diagnosticId)
- {
- case DiagnosticFactory.BINARY_OP_BOTH_OPERANDS_NULL_ID:
- return BINARY_OP_BOTH_OPERANDS_NULL;
- case DiagnosticFactory.BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID:
- return BINARY_OP_POSSIBLE_DIVISION_BY_ZERO;
- case DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID:
- return BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION;
- case DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID:
- return BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME;
- case DiagnosticFactory.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID:
- return BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME;
- case DiagnosticFactory.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID:
- return BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN;
- case DiagnosticFactory.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID:
- return BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS;
- case DiagnosticFactory.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID:
- return BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME;
- case DiagnosticFactory.BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID:
- return BINARY_OP_NO_AVAILABLE_TYPE_COERCION;
- case DiagnosticFactory.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID:
- return BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS;
- case DiagnosticFactory.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID:
- return UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME;
- case DiagnosticFactory.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID:
- return UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE;
- case DiagnosticFactory.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID:
- return UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO;
- case DiagnosticFactory.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID:
- return UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION;
- case DiagnosticFactory.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID:
- return UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN;
- case DiagnosticFactory.TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID:
- return TERNARY_OP_CHOICE_IS_ALWAYS_SAME;
- case DiagnosticFactory.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID:
- return TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN;
- case DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID:
- return UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED;
- case DiagnosticFactory.CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID:
- return CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING;
- case DiagnosticFactory.MEMBER_NOT_FOUND_ID:
- return MEMBER_NOT_FOUND;
- case DiagnosticFactory.VARIABLE_NOT_FOUND_ID:
- return VARIABLE_NOT_FOUND;
- case DiagnosticFactory.MISSING_CLOSING_EXPR_BRACKET_ID:
- return MISSING_CLOSING_EXPR_BRACKET;
- case DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID:
- return GENERAL_SYNTAX_ERROR;
- case DiagnosticFactory.EMPTY_EL_EXPRESSION_ID:
- return EMPTY_EL_EXPRESSION;
- case DiagnosticFactory.BINARY_OP_DOT_WITH_VALUEB_NULL_ID:
- return BINARY_OP_DOT_WITH_VALUEB_NULL;
- case DiagnosticFactory.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID:
- return BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY;
- case DiagnosticFactory.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID:
- return POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS;
- case DiagnosticFactory.BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID:
- return BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME;
- case DiagnosticFactory.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID:
- return BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE;
- case DiagnosticFactory.MEMBER_IS_INTERMEDIATE_ID:
- return MEMBER_IS_INTERMEDIATE;
- default:
- throw new IllegalArgumentException("Diagnostic Id: "+ diagnosticId +" is out of range"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * @param key
- * @return the preference key for the corresponding diagnosticId in the el DiagnosticFactory
- */
- public static int getIdByKey(final String key)
- {
- if (BINARY_OP_BOTH_OPERANDS_NULL.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_BOTH_OPERANDS_NULL_ID;
- }
- else if (BINARY_OP_POSSIBLE_DIVISION_BY_ZERO.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID;
- }
- else if (BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID;
- }
- else if (BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID;
- }
- else if (BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID;
- }
- else if (BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID;
- }
- else if (BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID;
- }
- else if (BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID;
- }
- else if (BINARY_OP_NO_AVAILABLE_TYPE_COERCION.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID;
- }
- else if (BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID;
- }
- else if (UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME.equals(key))
- {
- return DiagnosticFactory.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID;
- }
- else if (UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE.equals(key))
- {
- return DiagnosticFactory.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID;
- }
- else if (UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO.equals(key))
- {
- return DiagnosticFactory.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID;
- }
- else if (UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION.equals(key))
- {
- return DiagnosticFactory.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID;
- }
- else if (UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN.equals(key))
- {
- return DiagnosticFactory.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID;
- }
- else if (TERNARY_OP_CHOICE_IS_ALWAYS_SAME.equals(key))
- {
- return DiagnosticFactory.TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID;
- }
- else if (TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN.equals(key))
- {
- return DiagnosticFactory.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID;
- }
- else if (UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED.equals(key))
- {
- return DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID;
- }
- else if (CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING.equals(key))
- {
- return DiagnosticFactory.CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID;
- }
- else if (MEMBER_NOT_FOUND.equals(key))
- {
- return DiagnosticFactory.MEMBER_NOT_FOUND_ID;
- }
- else if (VARIABLE_NOT_FOUND.equals(key))
- {
- return DiagnosticFactory.VARIABLE_NOT_FOUND_ID;
- }
- else if (MISSING_CLOSING_EXPR_BRACKET.equals(key))
- {
- return DiagnosticFactory.MISSING_CLOSING_EXPR_BRACKET_ID;
- }
- else if (GENERAL_SYNTAX_ERROR.equals(key))
- {
- return DiagnosticFactory.GENERAL_SYNTAX_ERROR_ID;
- }
- else if (EMPTY_EL_EXPRESSION.equals(key))
- {
- return DiagnosticFactory.EMPTY_EL_EXPRESSION_ID;
- }
- else if (BINARY_OP_DOT_WITH_VALUEB_NULL.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_DOT_WITH_VALUEB_NULL_ID;
- }
- else if (BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID;
- }
- else if (POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS.equals(key))
- {
- return DiagnosticFactory.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID;
- }
- else if (BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME.equals(key))
- {
- return DiagnosticFactory.BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID;
- }
- else if (BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE.equals(key))
- {
- return DiagnosticFactory.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID;
- }
- else if (MEMBER_IS_INTERMEDIATE.equals(key))
- {
- return DiagnosticFactory.MEMBER_IS_INTERMEDIATE_ID;
- }
- else
- {
- throw new IllegalArgumentException("Severity Key: "+ key); //$NON-NLS-1$
- }
- }
-
- /**
- * e.g. createQualifiedKeyName("foo") -> org.eclipse.jst.jsf.core.foo
- * @param baseName
- * @return a plugin qualified key given the baseName
- *
- */
- private static String createQualifiedKeyName(final String baseName)
- {
- return JSFCorePlugin.PLUGIN_ID + "." + baseName; //$NON-NLS-1$
- }
-
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_BOTH_OPERANDS_NULL =
- createQualifiedKeyName("BINARY_OP_BOTH_OPERANDS_NULL"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_POSSIBLE_DIVISION_BY_ZERO =
- createQualifiedKeyName("BINARY_OP_POSSIBLE_DIVISION_BY_ZERO"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION =
- createQualifiedKeyName("BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME =
- createQualifiedKeyName("BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME =
- createQualifiedKeyName("BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN =
- createQualifiedKeyName("BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS =
- createQualifiedKeyName("BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME =
- createQualifiedKeyName("BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_NO_AVAILABLE_TYPE_COERCION =
- createQualifiedKeyName("BINARY_OP_NO_AVAILABLE_TYPE_COERCION"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS =
- createQualifiedKeyName("BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME =
- createQualifiedKeyName("UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE =
- createQualifiedKeyName("UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO =
- createQualifiedKeyName("UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION =
- createQualifiedKeyName("UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN =
- createQualifiedKeyName("UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String TERNARY_OP_CHOICE_IS_ALWAYS_SAME =
- createQualifiedKeyName("TERNARY_OP_CHOICE_IS_ALWAYS_SAME"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN =
- createQualifiedKeyName("TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED =
- createQualifiedKeyName("UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING =
- createQualifiedKeyName("CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String MEMBER_NOT_FOUND =
- createQualifiedKeyName("MEMBER_NOT_FOUND"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String VARIABLE_NOT_FOUND =
- createQualifiedKeyName("VARIABLE_NOT_FOUND"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String MISSING_CLOSING_EXPR_BRACKET =
- createQualifiedKeyName("MISSING_CLOSING_EXPR_BRACKET"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String GENERAL_SYNTAX_ERROR =
- createQualifiedKeyName("GENERAL_SYNTAX_ERROR"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String EMPTY_EL_EXPRESSION =
- createQualifiedKeyName("EMPTY_EL_EXPRESSION"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_DOT_WITH_VALUEB_NULL =
- createQualifiedKeyName("BINARY_OP_DOT_WITH_VALUEB_NULL"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY =
- createQualifiedKeyName("BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS =
- createQualifiedKeyName("POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME =
- createQualifiedKeyName("BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE =
- createQualifiedKeyName("BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE"); //$NON-NLS-1$
-
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String MEMBER_IS_INTERMEDIATE =
- createQualifiedKeyName("MEMBER_IS_INTERMEDIATE"); //$NON-NLS-1$
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSFViewValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSFViewValidator.java
deleted file mode 100644
index a51c91433..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSFViewValidator.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * A validator for JSF views
- *
- * @author cbateman
- *
- */
-public interface IJSFViewValidator
-{
- /**
- * Validate the entire view file and report an problems using reporter.
- *
- * @param viewFile
- * @param reporter
- */
- void validateView(final IFile viewFile, final IValidationReporter reporter);
-
- /**
- * Validate only those regions specified in the viewFile and report problems
- * using reporter.
- *
- * @param viewFile
- * @param regions
- * @param reporter
- */
- void validateView(final IFile viewFile,
- final IStructuredDocumentRegion[] regions,
- final IValidationReporter reporter);
-
- /**
- * Implemented by callers of the view validator to receive notification
- * of problems discovered during validation.
- *
- */
- public interface IValidationReporter
- {
- /**
- * @param problem
- * @param start
- * @param length
- */
- void report(final Diagnostic problem, final int start, final int length);
-
- /**
- * @param message
- * @deprecated internally by design
- */
- void report(final IMessage message);
- }
-
- /**
- * An empty adapter implementation of IValidationReporter. All methods
- * are noops.
- *
- * @author cbateman
- *
- */
- public class ReporterAdapter implements IValidationReporter
- {
-
- public void report(Diagnostic problem, int start, int length)
- {
- // do nothing
- }
-
- public void report(IMessage message)
- {
- // do nothing
- }
-
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSPSemanticValidatorTest.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSPSemanticValidatorTest.java
deleted file mode 100644
index 454d31d9f..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/IJSPSemanticValidatorTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
-import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter;
-import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter;
-
-/**
- * Exposes certain private members for use by testing.
- *
- * NOT intended for use by production code.
- *
- * @author cbateman
- *
- */
-public interface IJSPSemanticValidatorTest
-{
- /**
- * Proxies the internal call to validate the containment of a particular
- * tag.
- *
- * @param adapter
- * @param node
- * @param uri
- * @param tagName
- * @param reporter
- * @param file
- * @param context
- */
- void validateContainment(Region2ElementAdapter adapter, IValidationReporter reporter, IFile file, IStructuredDocumentContext context);
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFTypeComparatorPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFTypeComparatorPreferences.java
deleted file mode 100644
index f00c7f11d..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFTypeComparatorPreferences.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jst.jsf.common.internal.types.TypeComparatorDiagnosticFactory;
-import org.eclipse.jst.jsf.common.internal.types.TypeComparatorPreferences;
-import org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-
-/**
- * Type comparator preferences for JSF.
- *
- * @author cbateman
- *
- */
-public class JSFTypeComparatorPreferences extends TypeComparatorPreferences
- implements IJSFPreferenceModel
-{
-
- private int[] _severities;
-
- /**
- * Loads the object from the preference store provided
- *
- * @param prefStore
- */
- public void load(IPreferenceStore prefStore)
- {
- loadSeverities(prefStore);
- }
-
- private void loadSeverities(final IPreferenceStore prefStore)
- {
- final int severities[] = getSeverities();
-
- for (int i = 0; i < TypeComparatorDiagnosticFactory.NUM_IDS; i++)
- {
- final String key = getKeyById(i);
-
- if (!prefStore.contains(key))
- {
- final int diagSeverity = getDefaultSeverity(i);
- final Severity severity = mapDiagToSeverity(diagSeverity);
-
- prefStore.setDefault(key, severity.toString());
- }
- final String storedSeverity = prefStore.getString(key);
- severities[i] = mapSeverityToDiag(storedSeverity);
- }
- }
-
- /**
- * Copies the object into the preference store but DOES NOT SAVE IT
- *
- * @param prefStore
- */
- public void commit(IPreferenceStore prefStore)
- {
- commitSeverities(prefStore);
- }
-
- private void commitSeverities(final IPreferenceStore prefStore)
- {
- final int severities[] = getSeverities();
-
- for (int i = 0; i < severities.length; i++)
- {
- final String key = getKeyById(i);
- prefStore
- .setValue(key, mapDiagToSeverity(severities[i]).toString());
- }
- }
-
- /**
- * Reverts the model to it's defaults. Does not commit to pref store.
- */
- public void setDefaults()
- {
- setProblemSeverityDefaults();
- }
-
- private void setProblemSeverityDefaults()
- {
- final int[] severities = getSeverities();
-
- for (int i = 0; i < TypeComparatorDiagnosticFactory.NUM_IDS; i++)
- {
- severities[i] = getDefaultSeverity(i);
- }
- }
-
- public Object getValueByKey(IScopeContext context, String key)
- {
- try
- {
- final Severity severity = getSeverity(key);
- return severity.toString();
- }
- catch (IllegalArgumentException e)
- {
- // getIdByKey will throw this exception if key is not a valid
- // severity key. Ignore the exception here and fall-through
- }
-
- return null; // not found
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel#getStoredValueByKey(org.eclipse.core.runtime.preferences.IScopeContext,
- * java.lang.String)
- */
- public Object getStoredValueByKey(IScopeContext context, String key)
- {
- try
- {
- return context.getNode("org.eclipse.jst.jsf.core").get( //$NON-NLS-1$
- key,
- mapDiagToSeverity(getDefaultSeverity(getIdByKey(key)))
- .toString());
- }
- catch (IllegalArgumentException e)
- {
- // getIdByKey will throw this exception if key is not a valid
- // severity key. Ignore the exception here and fall-through
- }
-
- return null; // not found
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.jsf.core.internal.IJSFPreferenceModel#setValueByKey(org.eclipse.core.runtime.preferences.IScopeContext,
- * java.lang.String, java.lang.Object)
- */
- public Object setValueByKey(IScopeContext context, String key, Object value)
- {
- final Severity oldValue = getSeverity(key);
- setSeverity(key, (Severity) value);
- return oldValue;
- }
-
- /**
- * @param key
- * @return the severity
- */
- public Severity getSeverity(final String key)
- {
- final int severityDiag = _severities[getIdByKey(key)];
- final Severity severity = mapDiagToSeverity(severityDiag);
- return severity;
- }
-
- /**
- * @param key
- * @param severity
- */
- public void setSeverity(final String key, final Severity severity)
- {
- final int newSeverityDiag = mapSeverityToDiag(severity.toString());
- final int diagId = getIdByKey(key);
- _severities[diagId] = newSeverityDiag;
- }
-
- /**
- * @param diagnosticId
- * @return the severity as configured for diagnosticId. The value is
- * relative to the Diagnostic class severity scheme
- */
- public final int getDiagnosticSeverity(final int diagnosticId)
- {
- return getSeverities()[diagnosticId];
- }
-
- private int[] getSeverities()
- {
- if (_severities == null)
- {
- _severities = new int[TypeComparatorDiagnosticFactory.NUM_IDS];
- }
-
- return _severities;
- }
-
- /**
- * @param diagSeverity
- * @return a Severity preference value for a diagnostic severity
- */
- public static Severity mapDiagToSeverity(int diagSeverity)
- {
- switch (diagSeverity)
- {
- case Diagnostic.ERROR:
- return Severity.ERROR;
- case Diagnostic.WARNING:
- return Severity.WARNING;
- default:
- return Severity.IGNORE;
- }
- }
-
- /**
- * @param severity
- * @return a Diagnostic severity level for a severity pref string
- */
- public static int mapSeverityToDiag(String severity)
- {
- if ("error".equals(severity)) //$NON-NLS-1$
- {
- return Diagnostic.ERROR;
- }
- else if ("warning".equals(severity)) //$NON-NLS-1$
- {
- return Diagnostic.WARNING;
- }
- else if ("ignore".equals(severity)) //$NON-NLS-1$
- {
- return Diagnostic.OK;
- }
- else
- {
- throw new IllegalArgumentException("Invalid enum name: " + severity); //$NON-NLS-1$
- }
- }
-
- /**
- * @param diagnosticId
- * @return the preference key for the corresponding diagnosticId in the el
- * DiagnosticFactory
- */
- public static String getKeyById(final int diagnosticId)
- {
- switch (diagnosticId)
- {
- case TypeComparatorDiagnosticFactory.INCOMPATIBLE_METHOD_TYPES_ID:
- return INCOMPATIBLE_METHOD_TYPES;
- case TypeComparatorDiagnosticFactory.INCOMPATIBLE_TYPES_ID:
- return INCOMPATIBLE_TYPES;
- case TypeComparatorDiagnosticFactory.METHOD_EXPRESSION_EXPECTED_ID:
- return METHOD_EXPRESSION_EXPECTED;
- case TypeComparatorDiagnosticFactory.PROPERTY_NOT_READABLE_ID:
- return PROPERTY_NOT_READABLE;
- case TypeComparatorDiagnosticFactory.PROPERTY_NOT_WRITABLE_ID:
- return PROPERTY_NOT_WRITABLE;
- case TypeComparatorDiagnosticFactory.VALUE_EXPRESSION_EXPECTED_ID:
- return VALUE_EXPRESSION_EXPECTED;
- default:
- throw new IllegalArgumentException("Diagnostic Id: " //$NON-NLS-1$
- + diagnosticId + " is out of range"); //$NON-NLS-1$
- }
- }
-
- /**
- * @param key
- * @return the preference key for the corresponding diagnosticId in the el
- * DiagnosticFactory
- */
- public static int getIdByKey(final String key)
- {
- if (INCOMPATIBLE_METHOD_TYPES.equals(key))
- {
- return TypeComparatorDiagnosticFactory.INCOMPATIBLE_METHOD_TYPES_ID;
- }
- else if (INCOMPATIBLE_TYPES.equals(key))
- {
- return TypeComparatorDiagnosticFactory.INCOMPATIBLE_TYPES_ID;
- }
- else if (METHOD_EXPRESSION_EXPECTED.equals(key))
- {
- return TypeComparatorDiagnosticFactory.METHOD_EXPRESSION_EXPECTED_ID;
- }
- else if (PROPERTY_NOT_READABLE.equals(key))
- {
- return TypeComparatorDiagnosticFactory.PROPERTY_NOT_READABLE_ID;
- }
- else if (PROPERTY_NOT_WRITABLE.equals(key))
- {
- return TypeComparatorDiagnosticFactory.PROPERTY_NOT_WRITABLE_ID;
- }
- else if (VALUE_EXPRESSION_EXPECTED.equals(key))
- {
- return TypeComparatorDiagnosticFactory.VALUE_EXPRESSION_EXPECTED_ID;
- }
- else
- {
- throw new IllegalArgumentException("Severity Key: " + key); //$NON-NLS-1$
- }
- }
-
- /**
- * e.g. createQualifiedKeyName("foo") -> org.eclipse.jst.jsf.core.foo
- *
- * @param baseName
- * @return a plugin qualified key given the baseName
- *
- */
- private static String createQualifiedKeyName(final String baseName)
- {
- return JSFCorePlugin.PLUGIN_ID + "." + baseName; //$NON-NLS-1$
- }
-
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String INCOMPATIBLE_METHOD_TYPES = createQualifiedKeyName("INCOMPATIBLE_METHOD_TYPES"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String INCOMPATIBLE_TYPES = createQualifiedKeyName("INCOMPATIBLE_TYPES"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String METHOD_EXPRESSION_EXPECTED = createQualifiedKeyName("METHOD_EXPRESSION_EXPECTED"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String PROPERTY_NOT_READABLE = createQualifiedKeyName("PROPERTY_NOT_READABLE"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String PROPERTY_NOT_WRITABLE = createQualifiedKeyName("PROPERTY_NOT_WRITABLE"); //$NON-NLS-1$
- /**
- * preference key. Match to DiagnosticFactory constants
- */
- public final static String VALUE_EXPRESSION_EXPECTED = createQualifiedKeyName("VALUE_EXPRESSION_EXPECTED"); //$NON-NLS-1$
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidationContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidationContext.java
deleted file mode 100644
index baae123b1..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidationContext.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jst.jsf.designtime.DTAppManagerUtil;
-import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler;
-import org.eclipse.jst.jsf.designtime.internal.view.IViewRootHandle;
-import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory;
-import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * A context object used pass JSF validation information around. Not related to
- * the model context framework.
- *
- * @author cbateman
- *
- */
-public final class JSFValidationContext
-{
- private final ValidationPreferences _prefs;
- private final boolean _isIncremental;
- private final IDTViewHandler _adapter;
- private final DiagnosticFactory _diagnosticFactory;
- private final IFile _file;
- private final IValidationReporter _reporter;
- private final IStructuredDocumentSymbolResolverFactory _symbolResolverFactory;
- // defer initializing this until is asked for because it is expensive
- private IViewRootHandle _viewRootHandle;
-
- /**
- * @param isIncremental --
- * true if this is "as-you-type" validation, false if this is
- * "Build" or "Run Validation" validation *
- * @param prefs
- * @param adapter
- * @param diagnosticFactory
- * @param file
- * @param reporter
- * @param symbolResolveFactory
- */
- public JSFValidationContext(final boolean isIncremental,
- final ValidationPreferences prefs,
- final IDTViewHandler adapter,
- final DiagnosticFactory diagnosticFactory, final IFile file,
- final IValidationReporter reporter, final IStructuredDocumentSymbolResolverFactory symbolResolveFactory)
- {
- super();
- _isIncremental = isIncremental;
- _prefs = prefs;
- _adapter = adapter;
- _diagnosticFactory = diagnosticFactory;
- _file = file;
- _reporter = reporter;
- _symbolResolverFactory = symbolResolveFactory;
- }
-
- /**
- *
- * @return true if user preferences say we should do EL validation, false
- * otherwise
- */
- public final boolean shouldValidateEL()
- {
- _prefs.load();
- if (_isIncremental)
- {
- return _prefs.getElPrefs().isEnableIncrementalValidation();
- }
-
- return _prefs.getElPrefs().isEnableBuildValidation();
- }
-
-
- /**
- * @return the view handler
- */
- public IDTViewHandler getAdapter()
- {
- return _adapter;
- }
-
- /**
- * @return the validator
- */
-// public IValidator getValidator()
-// {
-// return _validator;
-// }
-
- /**
- * @return validation preferences
- */
- public ValidationPreferences getPrefs()
- {
- return _prefs;
- }
-
- /**
- * @return diagnostic factory
- */
- public DiagnosticFactory getDiagnosticFactory()
- {
- return _diagnosticFactory;
- }
-
- /**
- * @return the file
- */
- public IFile getFile()
- {
- return _file;
- }
-
- /**
- * @return the reporter.
- */
- public IValidationReporter getReporter()
- {
- return _reporter;
- }
-
- /**
- * @return the symbol resolver factory for this context
- */
- public IStructuredDocumentSymbolResolverFactory getSymbolResolverFactory()
- {
- return _symbolResolverFactory;
- }
-
- /**
- * This method will be long running on first call, since it has to update
- * the view root if not initialized.
- *
- * @return the view root handle
- */
- public IViewRootHandle getViewRootHandle()
- {
- if (_viewRootHandle == null)
- {
- _viewRootHandle = DTAppManagerUtil.getViewRootHandle(_file);
- if (_viewRootHandle.getCachedViewRoot() == null)
- {
- _viewRootHandle.updateViewRoot();
- }
- }
- return _viewRootHandle;
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidatorFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidatorFactory.java
deleted file mode 100644
index 06ee772e2..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/JSFValidatorFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-/**
- * A factory that is to construct JSF validators
- *
- * @author cbateman
- *
- */
-public class JSFValidatorFactory
-{
- /**
- * @return a default validator for XML-defined views.
- */
- public static IJSFViewValidator createDefaultXMLValidator()
- {
- return new XMLViewDefnValidator();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/LocalizedMessage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/LocalizedMessage.java
deleted file mode 100644
index 11151c210..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/LocalizedMessage.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-/**
- *
- */
-package org.eclipse.jst.jsf.validation.internal;
-
-import java.util.Locale;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.wst.validation.internal.core.Message;
-
-/**
- * Localized version of the message.
- *
- * @author cbateman
- *
- */
-public class LocalizedMessage extends Message {
-
- private String _message = null;
-
- /**
- * @param severity
- * @param messageText
- */
- public LocalizedMessage(int severity, String messageText) {
- this(severity, messageText, null);
- }
-
- /**
- * @param severity
- * @param messageText
- * @param targetObject
- */
- public LocalizedMessage(int severity, String messageText, IResource targetObject) {
- this(severity, messageText, (Object) targetObject);
- }
-
- /**
- * @param severity
- * @param messageText
- * @param targetObject
- */
- public LocalizedMessage(int severity, String messageText, Object targetObject) {
- super(null, severity, null);
- setLocalizedMessage(messageText);
- setTargetObject(targetObject);
- }
-
- /**
- * @param message
- */
- public void setLocalizedMessage(String message) {
- _message = message;
- }
-
- /**
- * @return the message
- */
- public String getLocalizedMessage() {
- return _message;
- }
-
- public String getText() {
- return getLocalizedMessage();
- }
-
- public String getText(ClassLoader cl) {
- return getLocalizedMessage();
- }
-
- public String getText(Locale l) {
- return getLocalizedMessage();
- }
-
- public String getText(Locale l, ClassLoader cl) {
- return getLocalizedMessage();
- }
-} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/Severity.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/Severity.java
deleted file mode 100644
index c97b8527e..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/Severity.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-/**
- * Severity levels of problems
- */
-public enum Severity
-{
- /**
- * Indicates a problem severity of Error
- */
- ERROR
- {
- public java.lang.String toString() {
- return "error"; //$NON-NLS-1$
- }
- }
- ,
- /**
- * Indicates a problem severity of Warning
- */
- WARNING
- {
- public java.lang.String toString() {
- return "warning"; //$NON-NLS-1$
- }
- }
- ,
- /**
- * Indicates no problem should be shown
- */
- IGNORE
- {
- public java.lang.String toString() {
- return "ignore"; //$NON-NLS-1$
- }
- };
-
- /**
- * @param value
- * @return the enum based on the toString mappings
- */
- public static Severity valueOfString(String value)
- {
- if ("error".equals(value)) //$NON-NLS-1$
- {
- return ERROR;
- }
- else if ("warning".equals(value)) //$NON-NLS-1$
- {
- return WARNING;
- }
- else
- {
- return IGNORE;
- }
- }
- } \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ValidationPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ValidationPreferences.java
deleted file mode 100644
index d61f4c027..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/ValidationPreferences.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
-/**
- * @author cbateman
- *
- */
-public class ValidationPreferences
-{
- private final IPreferenceStore _prefStore;
- private final ELValidationPreferences _elPrefs;
- private final JSFTypeComparatorPreferences _typeComparatorPrefs;
- /**
- * Constructor
- * @param prefStore
- */
- public ValidationPreferences(IPreferenceStore prefStore)
- {
- _prefStore = prefStore;
- _elPrefs = new ELValidationPreferences();
- _typeComparatorPrefs = new JSFTypeComparatorPreferences();
- }
-
- /**
- * @return the el preferences
- */
- public ELValidationPreferences getElPrefs()
- {
- return _elPrefs;
- }
-
- /**
- * @return the type comparator preferences.
- */
- public JSFTypeComparatorPreferences getTypeComparatorPrefs()
- {
- return _typeComparatorPrefs;
- }
-
- /**IPreferenceStore
- * The default preference loader
- */
- public void load()
- {
- load(_prefStore);
- }
-
- /**
- * Loads preferences from prefStore
- *
- * @param prefStore
- */
- private void load(IPreferenceStore prefStore)
- {
- _elPrefs.load(prefStore);
- _typeComparatorPrefs.load(prefStore);
- }
-
- /**
- * Commits but does not store the preferences
- *
- * @param prefStore
- */
- public void commit(IPreferenceStore prefStore)
- {
- _elPrefs.commit(prefStore);
- _typeComparatorPrefs.commit(prefStore);
- }
-
- /**
- * Reverts the model to it's defaults. Does not commit to pref store.
- */
- public void setDefaults()
- {
- _elPrefs.setDefaults();
- _typeComparatorPrefs.setDefaults();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/XMLViewDefnValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/XMLViewDefnValidator.java
deleted file mode 100644
index 9de83d19e..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/XMLViewDefnValidator.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.internal.region.Region2AttrAdapter;
-import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter;
-import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter.NoElementException;
-import org.eclipse.jst.jsf.designtime.DTAppManagerUtil;
-import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler;
-import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory;
-import org.eclipse.jst.jsf.designtime.resolver.StructuredDocumentSymbolResolverFactory;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.jst.jsf.validation.internal.strategy.AttributeValidatingStrategy;
-import org.eclipse.jst.jsf.validation.internal.strategy.ContainmentValidatingStrategy;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-
-/**
- * Validator for JSF view definitions that are structured in XML format
- *
- * @author cbateman
- *
- */
-public class XMLViewDefnValidator implements IJSFViewValidator
-{
- // TODO: should the source validator be a separate class in jsp.ui?
- // problem with simple split off is that preference must also be split off
- static final boolean DEBUG;
- static
- {
- final String value = Platform
- .getDebugOption("org.eclipse.jst.jsf.core/validation"); //$NON-NLS-1$
- DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- // default. Overridable by calling setSymbolResolverFactory
- private IStructuredDocumentSymbolResolverFactory _symbolResolverFactory =
- StructuredDocumentSymbolResolverFactory.getInstance();
-
- /**
- * Validates a JSP tag.
- *
- * Currently only attribute values with supplied annotation meta-data is
- * being validated. Also, only JSF EL is being validated and not JSP EL.
- *
- * This method may be extended in the future to validate tag semantics an
- * other cross attribute validations.
- *
- * @param container
- * @param jsfValidationContext
- *
- */
- private void validateTag(final IStructuredDocumentRegion container,
- final JSFValidationContext jsfValidationContext,
- final ContainmentValidatingStrategy containmentStrategy)
- {
- // TODO: later when we move to composite strategy, run in SafeRunner
- // to protect against exceptions generated in external code.
- try
- {
- final Region2ElementAdapter regionAdapter = new Region2ElementAdapter(
- container);
-
-// final IStructuredDocumentContext elementContext =
-// IStructuredDocumentContextFactory.INSTANCE
-// .getContext(container.getParentDocument(), container
-// .getStartOffset());
-
- if (containmentStrategy.isInteresting(regionAdapter))
- {
- containmentStrategy.validate(regionAdapter);
- }
-
- final AttributeValidatingStrategy strategy =
- new AttributeValidatingStrategy(jsfValidationContext);
-
- for (final Region2AttrAdapter attrAdapter : regionAdapter
- .getAttributes().values())
- {
- if (strategy.isInteresting(attrAdapter))
- {
- strategy.validate(attrAdapter);
- }
- }
- }
- catch (NoElementException ne)
- {
- // XXX:
- }
- }
-
- public void validateView(final IFile viewFile, final IValidationReporter reporter)
- {
- IStructuredModel model = null;
- if (DEBUG)
- {
- System.out.println("executing JSPSemanticsValidator.validateFile"); //$NON-NLS-1$
- }
-
- try
- {
- final JSFValidationContext jsfValidationContext =
- createValidationContext(false, viewFile, reporter);
-
- if (jsfValidationContext == null)
- {
- return;
- }
-
- model = StructuredModelManager.getModelManager().getModelForRead(
- viewFile);
-
- final IStructuredDocument structuredDoc =
- model.getStructuredDocument();
- final IStructuredDocumentRegion[] regions =
- structuredDoc.getStructuredDocumentRegions();
- validateRegions(regions, jsfValidationContext,
- new ContainmentValidatingStrategy(jsfValidationContext));
- }
- catch (final CoreException e)
- {
- JSFCorePlugin.log("Error validating JSF", e); //$NON-NLS-1$
- }
- catch (final IOException e)
- {
- JSFCorePlugin.log("Error validating JSF", e); //$NON-NLS-1$
- }
- finally
- {
- if (null != model)
- {
- model.releaseFromRead();
- }
- }
- }
-
- public void validateView(IFile viewFile,
- IStructuredDocumentRegion[] regions, IValidationReporter reporter)
- {
- final JSFValidationContext jsfValidationContext =
- createValidationContext(true, viewFile, reporter);
-
- if (jsfValidationContext == null)
- {
- return;
- }
-
- validateRegions(regions, jsfValidationContext,
- new ContainmentValidatingStrategy(jsfValidationContext));
- }
-
- private void validateRegions(final IStructuredDocumentRegion[] regions,
- final JSFValidationContext context,
- final ContainmentValidatingStrategy containmentValidator)
- {
- for (final IStructuredDocumentRegion curNode : regions)
- {
- if (curNode.getFirstRegion().getType() == DOMRegionContext.XML_TAG_OPEN)
- {
- validateTag(curNode, context, containmentValidator);
- }
- }
- }
-
- private JSFValidationContext createValidationContext(
- final boolean isIncremental, final IFile file,
- final IValidationReporter reporter)
- {
- final ValidationPreferences prefs = new ValidationPreferences(
- JSFCorePlugin.getDefault().getPreferenceStore());
- prefs.load();
- final DiagnosticFactory diagnosticFactory = new DiagnosticFactory();
-
- final IDTViewHandler viewHandler = DTAppManagerUtil.getViewHandler(file
- .getProject());
-
- // only validate files that our designtime supports
- if (viewHandler == null || !viewHandler.supportsViewDefinition(file))
- {
- return null;
- }
-
- return new JSFValidationContext(isIncremental, prefs, viewHandler,
- diagnosticFactory, file, reporter, _symbolResolverFactory);
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidationUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidationUtil.java
deleted file mode 100644
index 76da0f026..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidationUtil.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.util.TypeUtil;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType;
-import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType;
-import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParser;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ParseException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.xml.core.internal.emf2xml.EMF2DOMSSEAdapter;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.w3c.dom.Node;
-
-/**
- * Common functions for app config validation
- *
- * @author cbateman
- *
- */
-public final class AppConfigValidationUtil
-{
- /**
- * Per the fully-qualified-classType in the Faces 1.2 schema and
- * the ClassName entity in the 1.1 DTD
- *
- * @param fullyQualifiedName
- * @param instanceOf
- * @param mustBeAClass
- * @param project
- * @return null if no problems or a Message if problem found
- */
- public static IMessage validateClassName(final String fullyQualifiedName,
- final String instanceOf,
- final boolean mustBeAClass,
- final IProject project)
- {
- try
- {
- IType type = getType(project, fullyQualifiedName);
- if (type == null || !type.exists())
- {
- return DiagnosticFactory
- .create_CANNOT_FIND_CLASS_NAME(fullyQualifiedName);
- }
-
- // must be a class, not an interface or enum
- if (mustBeAClass && !type.isClass())
- {
- return DiagnosticFactory
- .create_FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS
- (fullyQualifiedName);
- }
-
- // must not be abstract since it must instantiable
- if (Flags.isAbstract(type.getFlags()))
- {
- return DiagnosticFactory
- .create_CLASS_MUST_BE_CONCRETE(fullyQualifiedName);
- }
-
- if (instanceOf != null)
- {
- if (!isInstanceOf(type, instanceOf))
- {
- // if we get to here, we haven't found the expected
- // the super type so error
- return DiagnosticFactory.create_CLASS_MUST_BE_INSTANCE_OF
- (fullyQualifiedName, Messages.AppConfigValidationUtil_0, instanceOf);
- }
- }
- }
- catch(JavaModelException jme)
- {
- // fall-through, not found
- JSFCorePlugin.log(jme,
- "Error resolving fully qualified class name: "+fullyQualifiedName); //$NON-NLS-1$
- }
-
- // either found the class or had an exception so don't report error
- return null;
- }
-
- private static IType getType(final IProject project,
- final String fullyQualifiedName) throws JavaModelException
- {
- final IJavaProject javaProject = JavaCore.create(project);
- return javaProject.findType(fullyQualifiedName);
- }
-
- /**
- * Per the faces-config-el-expressionType in the Faces 1.2 schema and
- * the Action entity in the 1.1 DTD
- *
- * @param textContent
- * @return an validation diagnostic or null if the textContent
- * represent an expected EL expression
- */
- public static IMessage validateELExpression(final String textContent)
- {
- final ELResultWrapper result = extractELExpression(textContent);
-
- if (result.elText != null)
- {
- JSPELParser parser = new JSPELParser(new StringReader(result.elText));
-
- try {
- parser.Expression();
- } catch (ParseException e) {
- // syntax error
- return DiagnosticFactory.create_SYNTAX_ERROR_IN_EL();
- }
-
- return null;
- }
-
- return result.message;
- }
-
- /**
- * @param textContent
- * @return the result of trying to extract an EL expression from the
- * textContent string. The content is expected to be of the form
- * #{elText}. elText in the return value will be set to this value
- * from within the braces. If a syntax error occurs in this extraction
- * message property of the result object will contain a validation message
- * and elText will be set to null.
- * TODO: move this somewhere more generic and shared.
- */
- public static ELResultWrapper extractELExpression(final String textContent)
- {
- final String elRegex = "#\\{(.*)\\}"; //$NON-NLS-1$
- Pattern pattern = Pattern.compile(elRegex);
- Matcher matcher = pattern.matcher(textContent.trim());
- if (matcher.matches())
- {
- final String elText = matcher.group(1).trim();
-
- if ("".equals(elText) || elText == null) //$NON-NLS-1$
- {
- return new ELResultWrapper(DiagnosticFactory.create_SYNTAX_ERROR_IN_EL(), null);
- }
- return new ELResultWrapper(null, elText);
- }
- return new ELResultWrapper(DiagnosticFactory.create_EL_EXPR_MUST_BE_IN_HASH_BRACES(), null);
- }
-
- /**
- * Value object that wraps the result of trying
- * to extract an EL expression from an arbitrary String
- */
- public static class ELResultWrapper
- {
- private final IMessage message;
- private final String elText;
-
- ELResultWrapper(IMessage message, String elText) {
- super();
- this.message = message;
- this.elText = elText;
- }
-
- /**
- * @return a message indicating a problem encountered
- * trying to extract, or null if no problem was encountered
- */
- public IMessage getMessage() {
- return message;
- }
-
- /**
- * @return the el expression string raw, stripped of any
- * sorrounding #{} syntax or null if could not be extracted
- */
- public String getElText() {
- return elText;
- }
- }
-
- /**
- * @param eObj
- * @return the offset character offset in to the XML document of the
- * XML node that eObj was constructed from or -1 if not
- * computable
- */
- public static int getStartOffset(EObject eObj)
- {
- IDOMNode node = getDomNode(eObj);
-
- if (node != null)
- {
- return node.getStartStructuredDocumentRegion().getStartOffset();
- }
-
- return -1;
- }
-
- /**
- * @param eObj
- * @return the length in characters of the XML node that
- * eObj was constructed from or -1 if no computable
- */
- public static int getLength(EObject eObj)
- {
- IDOMNode node = getDomNode(eObj);
-
- if (node != null)
- {
- return node.getEndStructuredDocumentRegion().getEndOffset()
- - node.getStartStructuredDocumentRegion().getStartOffset();
- }
-
- return -1;
- }
-
- /**
- * @param eObj
- * @return the DOM node that eObj was constructed from or
- * null if not computable
- */
- public static IDOMNode getDomNode(EObject eObj)
- {
- for (Iterator it = eObj.eAdapters().iterator(); it.hasNext();)
- {
- Adapter adapter = (Adapter) it.next();
-
- if (adapter instanceof EMF2DOMSSEAdapter)
- {
- final EMF2DOMSSEAdapter sseAdapter = (EMF2DOMSSEAdapter) adapter;
- final Node node = sseAdapter.getNode();
- if (node instanceof IDOMNode)
- {
- return (IDOMNode) node;
- }
- }
- }
-
- return null;
- }
-
- /**
- * @param scope
- * @return an error message if scope does not match a valid
- * scope enum.
- */
- public static IMessage validateManagedBeanScope(ManagedBeanScopeType scope)
- {
- // scope must be one of a few enums
- if (!"request".equals(scope.getTextContent()) //$NON-NLS-1$
- && !"session".equals(scope.getTextContent()) //$NON-NLS-1$
- && !"application".equals(scope.getTextContent()) //$NON-NLS-1$
- && !"none".equals(scope.getTextContent())) //$NON-NLS-1$
- {
- return DiagnosticFactory.create_BEAN_SCOPE_NOT_VALID();
- }
-
- return null;
- }
-
- /**
- * @param targetName
- * @param targetType the type of the object that mapEntries will be assigned to
- * @param mapEntries
- * @param project
- * @return null if okay or an error message if the mapEntries type is
- * invalid in some way
- * Note: when Java 1.5 support is added we can validate against the template types
- */
- public static IMessage validateMapEntries(String targetName, String targetType, MapEntriesType mapEntries, IProject project)
- {
- if (mapEntries == null || targetType == null || project == null)
- {
- throw new AssertionError("Arguments to validateMapEntries can't be null"); //$NON-NLS-1$
- }
-
- try
- {
- // TODO: do a bean look-up for targetName to verify that it a) matches the type
- // and b) exists on the bean
- IType type = getType(project, targetType);
-
- if (type != null &&
- !(isInstanceOf(type, Signature.toString(TypeConstants.TYPE_MAP))))
- {
- return DiagnosticFactory
- .create_MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE(targetName);
- }
- // TODO: validate the the map entries
- // TODO: validate the types of the map entries against the values present
- // TODO: validate the map key and value types against the template
- }
- catch (JavaModelException jme)
- {
- JSFCorePlugin.log(new Exception(jme), "Exception while validating mapEntries"); //$NON-NLS-1$
- }
- // if we get to here, we have not found anything meaningful to report
- return null;
- }
-
- /**
- * @param targetName
- * @param targetType the type of the object that mapEntries will be assigned to
- * @param listEntries
- * @param project
- * @return null if okay or an error message if the listEntries type is
- * invalid in some way
- * Note: when Java 1.5 support is added we can validate against the template types
- */
- public static IMessage validateListEntries(String targetName, String targetType, ListEntriesType listEntries, IProject project)
- {
- if (listEntries == null || targetType == null || project == null)
- {
- throw new AssertionError("Arguments to validateMapEntries can't be null"); //$NON-NLS-1$
- }
-
- try
- {
- IType type = getType(project, targetType);
- // TODO: do a bean look-up for targetName to verify that it a) matches the type
- // and b) exists on the bean
- if (type != null &&
- !(isInstanceOf(type, Signature.toString(TypeConstants.TYPE_LIST))))
- {
- return DiagnosticFactory
- .create_LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE(targetName);
- }
- // TODO: validate the the list entries
- // TODO: validate the types of the list entries against the values present
- // TODO: validate the value types against the template
- }
- catch (JavaModelException jme)
- {
- JSFCorePlugin.log(new Exception(jme), "Exception while validating mapEntries"); //$NON-NLS-1$
- }
- // if we get to here, we have not found anything meaningful to report
- return null;
- }
-
- /**
- * @param localeType
- * @return a diagnostic if 'localeType' does not match the
- * expected format or null if all is clear
- */
- public static IMessage validateLocaleType(final String localeType)
- {
- // based on the localeType in the Faces 1.2 schema. This is safe
- // to apply to 1.1 since it expects the same pattern even though
- // the DTD cannot validate it
- final String localeTypePattern = "[a-z]{2}(_|-)?([\\p{L}\\-\\p{Nd}]{2})?"; //$NON-NLS-1$
- final Matcher matcher = Pattern.compile(localeTypePattern).matcher(localeType);
-
- if (!matcher.matches())
- {
- return DiagnosticFactory.create_LOCALE_FORMAT_NOT_VALID();
- }
-
- return null;
- }
-
- /**
- * @param type
- * @param instanceOf
- * @return true if type instanceof instanceOf is true
- *
- * @throws JavaModelException
- */
- public static boolean isInstanceOf(final IType type, final String instanceOf) throws JavaModelException
- {
- if (instanceOf != null)
- {
- // must have either a no-arg constructor or an adapter constructor
- // that is of the type of instanceOf
-// IType constructorParam = getType(project, instanceOf);
-// if (constructorParam != null)
-// {
-// final String constructorMethodName =
-// type.getElementName();
-// final IMethod defaultConstructor =
-// type.getMethod(constructorMethodName, new String[0]);
-// final IMethod adapterConstructor =
-// type.getMethod(constructorMethodName, new String[]{instanceOf});
-// final boolean isDefaultConstructor =
-// defaultConstructor != null && defaultConstructor.isConstructor();
-// final boolean isAdapterConstructor =
-// adapterConstructor != null && adapterConstructor.isConstructor();
-// if (!isDefaultConstructor && !isAdapterConstructor)
-// {
- // TODO: no constructor == default constructor...
-// }
-// }
-
- // if the type is an exact match
- if (instanceOf.equals(type.getFullyQualifiedName()))
- {
- return true;
- }
-
- final ITypeHierarchy typeHierarchy =
- type.newSupertypeHierarchy(new NullProgressMonitor());
-
- final IType[] supers = typeHierarchy.getAllSupertypes(type);
- for (int i = 0; i < supers.length; i++)
- {
- if (instanceOf.equals(supers[i].getFullyQualifiedName()))
- {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Takes the form expected by faces-config files for fully qualified class names
- * @param inputStr java.lang.String format.
- * @return the fully qualified type signature for the inputStr
- */
- public static String getBaseType(final String inputStr)
- {
- String checkValue = inputStr.trim();
- try
- {
- // arrays are a special case where the
- // [Ljava.lang.String; syntax is valid.
- if (Signature.getArrayCount(checkValue)>0)
- {
- checkValue = Signature.getElementType(checkValue);
- checkValue = TypeUtil.getFullyQualifiedName(checkValue);
- }
- }
- catch (final IllegalArgumentException e)
- {
- // ignore
- }
-
- return checkValue;
- }
-
- private AppConfigValidationUtil()
- {
- // no external construction
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidator.java
deleted file mode 100644
index 29bbe1280..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AppConfigValidator.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jst.jsf.core.IJSFCoreConstants;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-import org.eclipse.jst.jsp.core.internal.Logger;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.validation.AbstractValidator;
-import org.eclipse.wst.validation.ValidationResult;
-import org.eclipse.wst.validation.ValidationState;
-import org.eclipse.wst.validation.internal.core.Message;
-import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * General build-time validator for the JSF application configuration file (faces-config.xml)b
- *
- * @author cbateman
- *
- */
-public class AppConfigValidator extends AbstractValidator implements IValidator {
-
- @Override
- public ValidationResult validate(final IResource resource, final int kind,
- final ValidationState state, final IProgressMonitor monitor) {
- final ValidationResult vr = new ValidationResult();
- if (resource == null || !(resource instanceof IFile)) {
- return vr;
- }
- final IReporter reporter = vr.getReporter(monitor);
- validateFile((IFile) resource, reporter);
- return vr;
- }
-
- /**
- * @param helper
- * @return the scheduling rull for this validator
- */
- public ISchedulingRule getSchedulingRule(final IValidationContext helper) {
- // no scheduling rule
- return null;
- }
-
- /**
- * @param helper
- * @param reporter
- * @return the result of running validation
- * @throws ValidationException
- */
- public IStatus validateInJob(final IValidationContext helper, final IReporter reporter)
- throws ValidationException {
- IStatus status = Status.OK_STATUS;
- try {
- validate(helper, reporter);
- }
- catch (final ValidationException e) {
- Logger.logException(e);
- status = new Status(IStatus.ERROR, JSFCorePlugin.getDefault().getPluginID(), IStatus.ERROR, e.getLocalizedMessage(), e);
- }
- return status;
- }
-
- public void cleanup(final IReporter reporter) {
- // no cleanup
-
- }
-
- public void validate(final IValidationContext helper, final IReporter reporter)
- throws ValidationException
- {
- final String[] uris = helper.getURIs();
- final IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
- if (uris.length > 0) {
- IFile currentFile = null;
-
- for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
- currentFile = wsRoot.getFile(new Path(uris[i]));
- if (currentFile != null && currentFile.exists()) {
-// if (shouldValidate(currentFile) && fragmentCheck(currentFile)) {
-
-// int percent = (i * 100) / uris.length + 1;
-//Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, percent + "% " + uris[i]);
- // reporter.displaySubtask(this, message);
-
- validateFile(currentFile, reporter);
- }
- }
- }
-
- // copied from JSPValidator TODO: perhaps just use app config locator?
-// else {
-//
-// // if uris[] length 0 -> validate() gets called for each project
-// if (helper instanceof IWorkbenchContext) {
-//
-// IProject project = ((IWorkbenchContext) helper).getProject();
-// JSPFileVisitor visitor = new JSPFileVisitor(reporter);
-// try {
-// // collect all jsp files for the project
-// project.accept(visitor, IResource.DEPTH_INFINITE);
-// }
-// catch (CoreException e) {
-// if (DEBUG)
-// e.printStackTrace();
-// }
-// IFile[] files = visitor.getFiles();
-// for (int i = 0; i < files.length && !reporter.isCancelled(); i++) {
-// if (shouldValidate(files[i]) && fragmentCheck(files[i])) {
-// int percent = (i * 100) / files.length + 1;
-// Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, percent + "% " + files[i].getFullPath().toString());
-// reporter.displaySubtask(this, message);
-//
-// validateFile(files[i], reporter);
-// }
-// if (DEBUG)
-// System.out.println("validating: [" + files[i] + "]"); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-// }
-// }
- }
-
- private void validateFile(final IFile file, final IReporter reporter)
- {
- FacesConfigArtifactEdit facesConfigEdit = null;
- //Bug 290962 - NPE if faces-config.xml is in wrong folder
- final IPath path = JSFAppConfigUtils.getWebContentFolderRelativePath(file);
- if (path == null)
- {
- reporter.addMessage(this, new Message(JSFCorePlugin.getDefault().getBundle().getSymbolicName(), IMessage.NORMAL_SEVERITY, Messages.CONFIG_FILE_NOT_UNDER_WEBCONTENT_FOLDER));
- }
- else
- {
- try
- {
- facesConfigEdit = FacesConfigArtifactEdit.
- getFacesConfigArtifactEditForRead(file.getProject(), path.toString());
-
- if (facesConfigEdit != null
- && facesConfigEdit.getFacesConfig()!=null)
- {
- final String version = validateVersioning(file, facesConfigEdit, reporter);
- validateModel(file, facesConfigEdit,reporter, version);
- }
- }
- finally
- {
- if (facesConfigEdit != null)
- {
- facesConfigEdit.dispose();
- }
- }
- }
- }
-
- /**
- * Ensure that the expected project version (facet) jives with what is in
- * the faces-config. Generally this means:
- *
- * if (version == 1.1) then no 1.2 artifacts (error)
- * if (version == 1.2) then warn if using old artifacts (warning)
- */
- private String validateVersioning(final IFile file, final FacesConfigArtifactEdit facesConfigEdit, final IReporter reporter)
- {
- final String appConfigFileVersion = getAppConfigFileVersion(facesConfigEdit);
-
- if (appConfigFileVersion != null)
- {
- final String projectVersion = getJSFVersion(file.getProject());
-
- if (IJSFCoreConstants.FACET_VERSION_1_1.equals(projectVersion)
- || IJSFCoreConstants.FACET_VERSION_1_0.equals(projectVersion))
- {
- if (IJSFCoreConstants.FACET_VERSION_1_2.equals(appConfigFileVersion))
- {
- reporter.addMessage(this,
- DiagnosticFactory
- .create_APP_CONFIG_IS_NEWER_THAN_JSF_VERSION(file));
- }
- }
- else if (IJSFCoreConstants.FACET_VERSION_1_2.equals(projectVersion))
- {
- if (IJSFCoreConstants.FACET_VERSION_1_1.equals(appConfigFileVersion)
- || IJSFCoreConstants.FACET_VERSION_1_0.equals(appConfigFileVersion))
- {
- reporter.addMessage(this,
- DiagnosticFactory
- .create_APP_CONFIG_IS_OLDER_THAN_JSF_VERSION(file
- , appConfigFileVersion, projectVersion));
- }
- }
- // if no exact match, don't make any assumptions
- }
- return appConfigFileVersion;
- }
-
- /**
- * @param facesConfigEdit
- * @return the version of the app config file or null if not determinant
- */
- private String getAppConfigFileVersion(final FacesConfigArtifactEdit facesConfigEdit)
- {
- String appConfigVersion = null;
-
- final IDOMModel domModel = facesConfigEdit.getIDOMModel();
- final IDOMDocument document = domModel.getDocument();
- if (document == null) {return null;}
-
- final DocumentType docType = domModel.getDocument().getDoctype();
-
- // if we have DTD doctype then we're looking at 1.1 or before
- if (docType != null)
- {
- appConfigVersion = extractVersionFromPublicId(docType);
- // if not found in the public id, try the system id
- if (appConfigVersion == null)
- {
- appConfigVersion = extractVersionFromSystemId(docType);
- }
- }
- else
- {
- final NodeList rootNodes = domModel.getDocument().getChildNodes();
-
- for (int i = 0; i < rootNodes.getLength(); i++)
- {
- final Node node = rootNodes.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE
- && "faces-config".equals(node.getLocalName())) //$NON-NLS-1$
- {
- final NamedNodeMap map = node.getAttributes();
- // the most accurate thing is the version
- final Node versionAttrib = map.getNamedItem("version"); //$NON-NLS-1$
-
- if (versionAttrib != null)
- {
- appConfigVersion = versionAttrib.getNodeValue();
- break;
- }
-
- // TODO: add additional heuristic to parse out
- // the schema
- }
- }
- }
-
- return appConfigVersion;
- }
-
-
-
- private void validateModel(final IFile file,
- final FacesConfigArtifactEdit facesConfigEdit,
- final IReporter reporter,
- final String version)
- {
- final FacesConfigType facesConfigType = facesConfigEdit.getFacesConfig();
- final FacesConfigValidator validator = new FacesConfigValidator(version);
- final List messages = new ArrayList();
- validator.validate(facesConfigType, messages, file);
-
- for (final Iterator it = messages.iterator(); it.hasNext();)
- {
- final IMessage message = (IMessage) it.next();
- reporter.addMessage(this, message);
- }
- }
-
- /**
- * @param project
- * @return the version string for the JSF facet on project
- * or null if not found
- */
- private String getJSFVersion(final IProject project)
- {
- try
- {
- final IFacetedProject facetedProject = ProjectFacetsManager.create(project);
- final Set facets = facetedProject.getProjectFacets();
-
- for (final Iterator it = facets.iterator(); it.hasNext();)
- {
- final IProjectFacetVersion facetVersion =
- (IProjectFacetVersion) it.next();
-
- if (IJSFCoreConstants.JSF_CORE_FACET_ID.equals(facetVersion.getProjectFacet().getId()))
- {
- return facetVersion.getVersionString();
- }
- }
- }
- catch (final CoreException ce)
- {
- JSFCorePlugin.log(ce, "Problem loading faceted project"); //$NON-NLS-1$
- // fall-through and return null
- }
- return null;
- }
-
- private String extractVersionFromPublicId(final DocumentType docType)
- {
- final String publicId = docType.getPublicId();
- final String publicIdRegex = "-\\/\\/(.*)\\/\\/(.*)\\/\\/.*"; //$NON-NLS-1$
-
- if (publicId != null)
- {
- final Pattern pattern = Pattern.compile(publicIdRegex);
- final Matcher matcher = pattern.matcher(publicId);
-
- if (matcher.matches())
- {
- final String classTypeString = matcher.group(2);
- final String[] classTypes = classTypeString.split("\\s+"); //$NON-NLS-1$
-
- // verify that the class type is a DTD
- if (classTypes.length > 0
- && "DTD".equals(classTypes[0])) //$NON-NLS-1$
- {
- // either 1.0 or 1.1; be most conservative
- String appConfigVersion = IJSFCoreConstants.JSF_VERSION_1_0;
-
- // see if the version is in the public id
- if (IJSFCoreConstants.JSF_VERSION_1_1.equals(classTypes[classTypes.length-1]))
- {
- appConfigVersion = IJSFCoreConstants.FACET_VERSION_1_1;
- }
-
- return appConfigVersion;
- }
- }
- }
-
- return null;
- }
-
- private String extractVersionFromSystemId(final DocumentType docType)
- {
- final String systemId = docType.getSystemId();
- final String systemIdRegEx = "http:\\/\\/java.sun.com\\/dtd\\/web-facesconfig_(.*)\\.dtd"; //$NON-NLS-1$
- if (systemId != null)
- {
- final Pattern pattern = Pattern.compile(systemIdRegEx);
- final Matcher matcher = pattern.matcher(systemId);
-
- if (matcher.matches())
- {
- final String version = matcher.group(1);
- if ("1_1".equals(version)||"1_0".equals(version)) //$NON-NLS-1$ //$NON-NLS-2$
- {
- return version.replaceAll("_", "."); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
- return null;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ApplicationValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ApplicationValidationVisitor.java
deleted file mode 100644
index 98b3611e7..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ApplicationValidationVisitor.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jst.jsf.core.IJSFCoreConstants;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultLocaleType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
-import org.eclipse.jst.jsf.facesconfig.emf.LocaleConfigType;
-import org.eclipse.jst.jsf.facesconfig.emf.SupportedLocaleType;
-
-/**
- * Validator the <application> node of the app config model
- * @author cbateman
- *
- */
-public class ApplicationValidationVisitor extends EObjectValidationVisitor
-{
-
- /**
- * Default constructure
- * @param version
- */
- public ApplicationValidationVisitor(String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Application(), version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // nothing to validate
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- // TODO: validate message and resource bundles
- // TODO: validate default render kit id
- new ActionListenerValidationVisitor(getVersion()),
- new NavigationHandlerValidationVisitor(getVersion()),
- new ViewHandlerValidationVisitor(getVersion()),
- new StateManagerValidationVisitior(getVersion()),
- new PropertyResolverValidationVisitor(getVersion()),
- new VariableResolverValidationVisitor(getVersion()),
- new ELResolverValidationVisitor(getVersion()),
- new LocaleConfigValidationVisitor(getVersion())
- };
- }
-
- /**
- * @param facesConfig
- * @param messages
- * @param file
- */
- protected void validateManagedBeanNames(FacesConfigType facesConfig, List messages, IFile file)
- {
-// final Map foundBeans = new HashMap();
-// final List firstCollisionInstance = new ArrayList();
-//
-// for (final Iterator it = facesConfig.getManagedBean().iterator(); it.hasNext();)
-// {
-// final ManagedBeanType managedBean = (ManagedBeanType) it.next();
-//
-// if (managedBean.getManagedBeanName() == null
-// || managedBean.getManagedBeanName().getTextContent() == null
-// || "".equals(managedBean.getManagedBeanName().getTextContent()))
-// {
-//
-// }
-
-// if (!foundBeans.containsKey(managedBean.getManagedBeanName()))
-// }
- }
-
- private static class LocaleConfigValidationVisitor extends EObjectValidationVisitor
- {
- /**
- * @param version
- */
- public LocaleConfigValidationVisitor(String version)
- {
- super(FacesConfigPackage.eINSTANCE.getApplicationType_LocaleConfig()
- , version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file)
- {
- final LocaleConfigType localeConfig = (LocaleConfigType) object;
-
- DefaultLocaleType defaultLocale = localeConfig.getDefaultLocale();
-
- if (defaultLocale != null)
- {
- addMessageInfo(
- messages,
- AppConfigValidationUtil
- .validateLocaleType(defaultLocale.getTextContent())
- , defaultLocale, file);
- }
-
- for (final Iterator it = localeConfig.getSupportedLocale().iterator(); it.hasNext();)
- {
- final SupportedLocaleType supportedLocale =
- (SupportedLocaleType) it.next();
- addMessageInfo(
- messages,
- AppConfigValidationUtil
- .validateLocaleType(supportedLocale.getTextContent())
- , supportedLocale, file);
- }
-
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- // there are children, but we're going to validate in doValidate
- return NO_CHILDREN;
- }
-
- }
-
- private static class ActionListenerValidationVisitor extends ApplicationClassNameBasedValidationVisitor
- {
- /**
- * @param version
- */
- public ActionListenerValidationVisitor(final String version) {
- super(FacesConfigPackage.eINSTANCE.getApplicationType_ActionListener(),
- version,"javax.faces.event.ActionListener", true); //$NON-NLS-1$
- }
- }
-
- private static class NavigationHandlerValidationVisitor extends ApplicationClassNameBasedValidationVisitor
- {
- /**
- * @param version
- */
- public NavigationHandlerValidationVisitor(final String version) {
- super(FacesConfigPackage.eINSTANCE.getApplicationType_NavigationHandler(),
- version,"javax.faces.application.NavigationHandler", true); //$NON-NLS-1$
- }
- }
-
- private static class ViewHandlerValidationVisitor extends ApplicationClassNameBasedValidationVisitor
- {
- ViewHandlerValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getApplicationType_ViewHandler(),
- version,"javax.faces.application.ViewHandler", true); //$NON-NLS-1$
- }
- }
-
- private static class StateManagerValidationVisitior extends ApplicationClassNameBasedValidationVisitor
- {
- StateManagerValidationVisitior(final String version)
- {
- // must a concrete class with a zero arg constructor:
- // JSF1.1_3.2.3.2 and JSF1.2_3.2.4.2
- super(FacesConfigPackage.eINSTANCE.getApplicationType_StateManager(),
- version,"javax.faces.application.StateManager", true); //$NON-NLS-1$
- }
- }
-
- private static class PropertyResolverValidationVisitor extends ApplicationClassNameBasedValidationVisitor
- {
- PropertyResolverValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getApplicationType_PropertyResolver(),
- version,"javax.faces.el.PropertyResolver", true); //$NON-NLS-1$
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- super.doValidate(object, messages, file);
-
- // if this version greater than 1.1 then property resolvers are
- // deprecated in favour of el-resolvers
- final String version = getVersion();
- if (!IJSFCoreConstants.FACET_VERSION_1_0.equals(version) && !IJSFCoreConstants.FACET_VERSION_1_1.equals(version))
- {
- addMessageInfo(messages,
- DiagnosticFactory.create_API_DEPRECATED_AFTER_VERSION_ID
- ("property-resolver", IJSFCoreConstants.FACET_VERSION_1_1, "el-resolver") //$NON-NLS-1$ //$NON-NLS-2$
- , object, file);
- }
- }
- }
-
- private static class VariableResolverValidationVisitor extends ApplicationClassNameBasedValidationVisitor
- {
- VariableResolverValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getApplicationType_VariableResolver(),
- version, "javax.faces.el.VariableResolver", true); //$NON-NLS-1$
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- super.doValidate(object, messages, file);
- // if this version greater than 1.1 then property resolvers are
- // deprecated in favour of el-resolvers
- final String version = getVersion();
- if (!IJSFCoreConstants.JSF_VERSION_1_0.equals(version) && !IJSFCoreConstants.JSF_VERSION_1_1.equals(version))
- {
- addMessageInfo(messages,
- DiagnosticFactory.create_API_DEPRECATED_AFTER_VERSION_ID
- ("variable-resolver", IJSFCoreConstants.JSF_VERSION_1_1, "el-resolver") //$NON-NLS-1$ //$NON-NLS-2$
- , object, file);
- }
-
- }
- }
-
- private static class ELResolverValidationVisitor extends ApplicationClassNameBasedValidationVisitor
- {
- ELResolverValidationVisitor(final String version)
- {
- // must be a class and have zero-arg constructor
- // JSF1.2_5.6.1.4
- super(FacesConfigPackage.eINSTANCE.getApplicationType_ELResolver(),
- version, "javax.el.ELResolver", true); //$NON-NLS-1$
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // if this version less than 1.2 then property resolvers are
- // deprecated in favour of el-resolvers
- final String version = getVersion();
- if (IJSFCoreConstants.JSF_VERSION_1_0.equals(version) || IJSFCoreConstants.JSF_VERSION_1_1.equals(version))
- {
- addMessageInfo(messages,
- DiagnosticFactory.create_API_NOT_AVAILABLE_BEFORE_VERSION
- ("el-resolver", IJSFCoreConstants.JSF_VERSION_1_2, "variable-resolver or property-resolver") //$NON-NLS-1$ //$NON-NLS-2$
- , object, file);
- }
- else
- {
- super.doValidate(object, messages, file);
- }
- }
- }
-
- private abstract static class ApplicationClassNameBasedValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- private final String _instanceOf;
- private final boolean _mustBeClass;
-
- /**
- * @param feature
- * @param version
- * @param instanceOf
- * @param mustBeClass
- */
- protected ApplicationClassNameBasedValidationVisitor(EStructuralFeature feature,
- final String version, final String instanceOf, final boolean mustBeClass)
- {
- super(feature, version);
- _instanceOf = instanceOf;
- _mustBeClass = mustBeClass;
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- EStructuralFeature feature = eobj.eClass().getEStructuralFeature("textContent"); //$NON-NLS-1$
-
- if (feature != null)
- {
- return (String)eobj.eGet(feature);
- }
-
- return null;
- }
-
- @Override
- protected boolean mustBeClass() {
- return _mustBeClass;
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- // no children
- return NO_CHILDREN;
- }
-
- protected String getInstanceOf() {
- return _instanceOf;
- }
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AttributeValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AttributeValidationVisitor.java
deleted file mode 100644
index 2ddd7e824..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/AttributeValidationVisitor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-
-/**
- * Validates the <attribute> element of components, converters etc.
- *
- * @author cbateman
- *
- */
-public class AttributeValidationVisitor extends EObjectValidationVisitor {
-
- /**
- * @param feature
- * @param version
- */
- public AttributeValidationVisitor(EStructuralFeature feature, String version) {
- // this validator can be attached to numerous parents so it
- // cannot hard-code its feature
- super(feature,version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // nothing to do
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new AttributeClassValidationVisitor(getVersion())
- };
- }
-
- private static class AttributeClassValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- /**
- * @param version
- */
- public AttributeClassValidationVisitor(
- String version) {
- super(FacesConfigPackage.eINSTANCE.getAttributeType_AttributeClass()
- , version);
- }
-
- protected String getFullyQualifiedName(EObject eobj) {
- return ((AttributeClassType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- // null since there is no instance of enforcement here
- return null;
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass()
- {
- // attribute could be a class or an enum
- return false;
- }
-
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ClassNameEObjectValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ClassNameEObjectValidationVisitor.java
deleted file mode 100644
index badc11e38..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ClassNameEObjectValidationVisitor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * Abstract validation visitor for classname based eobjects
- *
- * @author cbateman
- *
- */
-public abstract class ClassNameEObjectValidationVisitor extends
- EObjectValidationVisitor
-{
- /**
- * @param structuralFeature
- * @param version
- */
- public ClassNameEObjectValidationVisitor(
- EStructuralFeature structuralFeature, String version) {
- super(structuralFeature, version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file)
- {
- String fullyQualifiedName = getFullyQualifiedName(object);
- // protect against null
- fullyQualifiedName = fullyQualifiedName == null ? "" : fullyQualifiedName; //$NON-NLS-1$
- addMessageInfo(messages,
- AppConfigValidationUtil
- .validateClassName(fullyQualifiedName, getInstanceOf()
- , false, file.getProject()),object, file);
- }
-
- /**
- * @param eobj
- * @return the fully qualified name from the eobject
- */
- protected abstract String getFullyQualifiedName(EObject eobj);
-
- /**
- * @return a fully-qualified
- */
- protected abstract String getInstanceOf();
-
- /**
- * @return true if the class being named must be a class
- * and may not be an enum or interface
- */
- protected abstract boolean mustBeClass();
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ComponentValidatorVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ComponentValidatorVisitor.java
deleted file mode 100644
index 26f8d5b98..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ComponentValidatorVisitor.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FacetNameType;
-
-/**
- * Validator for a <component>
- *
- * @author cbateman
- *
- */
-public class ComponentValidatorVisitor extends EObjectValidationVisitor
-{
- /**
- * @param version
- */
- public ComponentValidatorVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Component(),
- version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // nothing in the tag to validate
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new ComponentClassValidationVisitor(getVersion()),
- new AttributeValidationVisitor(FacesConfigPackage.eINSTANCE.getComponentType_Attribute(), getVersion()),
- new PropertyValidationVisitor
- (FacesConfigPackage.eINSTANCE.getComponentType_Property()
- ,FacesConfigPackage.eINSTANCE.getComponentType_ComponentClass()
- ,getVersion()),
- new ComponentFacetValidationVisitor(getVersion())
- };
- }
-
- private static class ComponentClassValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- ComponentClassValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getComponentType_ComponentClass(),
- version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((ComponentClassType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.component.UIComponent"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass() {
- // must a class
- return true;
- }
- }
-
- private static class ComponentFacetValidationVisitor extends EObjectValidationVisitor
- {
- /**
- * @param version
- */
- public ComponentFacetValidationVisitor(String version)
- {
- super(FacesConfigPackage.eINSTANCE.getComponentType_Facet(), version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // do nothing
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new FacetNameValidationVisitor(getVersion())
- };
- }
-
- private static class FacetNameValidationVisitor extends EObjectValidationVisitor
- {
- /**
- * @param version
- */
- public FacetNameValidationVisitor(String version) {
- super(FacesConfigPackage.eINSTANCE.getFacetType_FacetName(),
- version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- FacetNameType name = (FacetNameType) object;
- boolean isValid = false;
-
- if (name.getTextContent() != null
- || "".equals(name.getTextContent().trim())) //$NON-NLS-1$
- {
- String nameValue = name.getTextContent().trim();
-
- // TODO: isJavaIdentifierStart seems broken...
- if (Character.isJavaIdentifierStart(nameValue.charAt(0)))
- {
- isValid = true;
- for (int i = 1; i < nameValue.length(); i++)
- {
- if (!Character.isJavaIdentifierPart(nameValue.charAt(i)))
- {
- isValid = false;
- }
- }
- }
- }
-
- if (!isValid)
- {
- addMessageInfo(messages,
- DiagnosticFactory.create_MUST_BE_A_VALID_JAVA_IDENT("Facet name") //$NON-NLS-1$
- , object, file);
- }
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return NO_CHILDREN;
- }
-
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ConverterValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ConverterValidationVisitor.java
deleted file mode 100644
index 2db6114ef..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ConverterValidationVisitor.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-
-/**
- * Validates the converter
- */
-public class ConverterValidationVisitor extends EObjectValidationVisitor
-{
-
- /**
- * @param version
- */
- public ConverterValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Converter(),
- version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // nothing in the tag to validate
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new ConverterClassValidationVisitor(getVersion())
- , new AttributeValidationVisitor(FacesConfigPackage.eINSTANCE.getConverterType_Attribute(), getVersion())
- , new PropertyValidationVisitor
- (FacesConfigPackage.eINSTANCE.getConverterType_Property()
- ,FacesConfigPackage.eINSTANCE.getConverterType_ConverterClass()
- ,getVersion())
- , new ConverterForClassValidationVisitor(getVersion())
- };
- }
-
- private static class ConverterClassValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- ConverterClassValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getConverterType_ConverterClass(),
- version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((ConverterClassType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.convert.Converter"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass() {
- // can't be an enum
- return true;
- }
- }
-
- private static class ConverterForClassValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- ConverterForClassValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getConverterType_ConverterForClass(),
- version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- String className = ((ConverterForClassType)eobj).getTextContent();
- String typeName = AppConfigValidationUtil.getBaseType(className);
- if (typeName == null)
- {
- return className;
- }
- return typeName;
- }
-
- protected String getInstanceOf() {
- // no instanceof enforcement
- return null;
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass() {
- // could be a converter for all instances of an enum type
- return false;
- }
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/DiagnosticFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/DiagnosticFactory.java
deleted file mode 100644
index 219bd5976..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/DiagnosticFactory.java
+++ /dev/null
@@ -1,412 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.wst.validation.internal.core.Message;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * Factory for constructing diagnostic objects for AppConfig file validation
- *
- * @author cbateman
- *
- */
-public final class DiagnosticFactory
-{
- /**
- * Problem id
- */
- public final static int EL_EXPR_MUST_BE_IN_HASH_BRACES_ID = 0;
-
- /**
- * Problem id
- */
- public final static int SYNTAX_ERROR_IN_EL_ID = 1;
-
- /**
- * Problem id
- */
- public final static int CANNOT_FIND_CLASS_NAME_ID = 2;
-
- /**
- * Problem id
- */
- public final static int FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID = 3;
-
- /**
- * Problem id
- */
- public final static int CLASS_MUST_BE_INSTANCE_OF_ID = 4;
-
- /**
- * Problem id
- */
- public final static int CLASS_MUST_BE_CONCRETE_ID = 5;
-
- /**
- * TODO:
- */
- public final static int CLASS_MUST_HAVE_DEFAULT_OR_ADAPTER_CONSTRUCTOR_ID = 6;
-
- /**
- * Problem id
- */
- public final static int API_DEPRECATED_AFTER_VERSION_ID = 7;
-
- /**
- * Problem id
- */
- public final static int BEAN_PROPERTY_NOT_FOUND_ID = 8;
-
- /**
- * Problem id
- */
- public final static int MUST_BE_A_VALID_JAVA_IDENT_ID = 9;
-
- /**
- * Problem id
- */
- public final static int BEAN_SCOPE_NOT_VALID_ID = 10;
-
- /**
- * Problem id
- */
- public final static int MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID = 11;
-
- /**
- * Problem id
- */
- public final static int LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID = 12;
-
- /**
- * Problem id
- */
- public final static int API_NOT_AVAILABLE_BEFORE_VERSION_ID = 13;
-
- /**
- * Problem id
- */
- public final static int APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID = 14;
- /**
- * Problem id
- */
- public final static int APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID = 15;
-
- /**
- * Problem id
- */
- public final static int LOCALE_FORMAT_NOT_VALID_ID = 16;
-
- /**
- * @return message indicating text that should be EL was
- * not found sorrounded in #{} values
- */
- public static IMessage create_EL_EXPR_MUST_BE_IN_HASH_BRACES()
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- Messages.EL_EXPR_MUST_BE_IN_HASH_BRACES_ID,
- null, EL_EXPR_MUST_BE_IN_HASH_BRACES_ID);
- }
-
- /**
- * @return message indicating that EL was found that
- * was empty or did not parse
- */
- public static IMessage create_SYNTAX_ERROR_IN_EL()
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- Messages.SYNTAX_ERROR_IN_EL_ID,
- null, SYNTAX_ERROR_IN_EL_ID);
- }
-
- /**
- * @param className
- * @return message indicating that className can't be found as
- * a valid fully qualified class name
- */
- public static IMessage create_CANNOT_FIND_CLASS_NAME(final String className)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.CANNOT_FIND_CLASS_NAME_ID,new Object[]{className}),
- null, CANNOT_FIND_CLASS_NAME_ID);
- }
-
- /**
- * @param fullyQualifiedName
- * @return the error message for a fullyQualifiedName that resolves to a type
- * that is not a class (i.e. an interface or enum) but is expected to be
- */
- public static IMessage create_FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS(final String fullyQualifiedName)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID
- ,new Object[]{fullyQualifiedName})
- ,null, FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID);
- }
-
- /**
- * @param className
- * @param extensionType
- * @param expectedSuper
- * @return an error when a class name must be of type expectedSuper
- */
- public static IMessage create_CLASS_MUST_BE_INSTANCE_OF(final String className,
- final String extensionType,
- final String expectedSuper)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.CLASS_MUST_BE_INSTANCE_OF_ID
- ,new Object[]{className, extensionType, expectedSuper})
- ,null, CLASS_MUST_BE_INSTANCE_OF_ID);
- }
-
-
- /**
- * @param className
- * @return error indicating that className must specify a class
- * that is concrete
- */
- public static IMessage create_CLASS_MUST_BE_CONCRETE(final String className)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.CLASS_MUST_BE_CONCRETE_ID
- ,new Object[]{className})
- ,null, CLASS_MUST_BE_CONCRETE_ID);
- }
-
- /**
- * @param apiName -- name of deprecated API
- * @param afterVersion -- version after which deprecation is effective
- * @param useInstead -- name of API to use instead
- * @return an error indicating the use of a deprecated API
- */
- public static IMessage create_API_DEPRECATED_AFTER_VERSION_ID(final String apiName, final String afterVersion, final String useInstead)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.API_DEPRECATED_AFTER_VERSION_ID
- ,new Object[]{apiName, afterVersion, useInstead})
- ,null, API_DEPRECATED_AFTER_VERSION_ID);
- }
-
- /**
- * @param propertyName
- * @param beanClassName
- * @return an error indicating that the propertyName was not
- * found on beanClassName
- */
- public static IMessage create_BEAN_PROPERTY_NOT_FOUND(final String propertyName, final String beanClassName)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.BEAN_PROPERTY_NOT_FOUND_ID
- ,new Object[]{propertyName, beanClassName})
- ,null, BEAN_PROPERTY_NOT_FOUND_ID);
-
- }
-
-
- /**
- * @param nameOfId
- * @return an error indicating that some id must be a valid
- * Java identifier
- */
- public static IMessage create_MUST_BE_A_VALID_JAVA_IDENT(final String nameOfId)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.MUST_BE_A_VALID_JAVA_IDENT_ID
- ,new Object[]{nameOfId})
- ,null, MUST_BE_A_VALID_JAVA_IDENT_ID);
- }
-
- /**
- * @return an error indicating an invalid bean scope enum value
- */
- public static IMessage create_BEAN_SCOPE_NOT_VALID()
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- Messages.BEAN_SCOPE_NOT_VALID_ID
- , null, BEAN_SCOPE_NOT_VALID_ID);
- }
-
- /**
- * @param targetName
- * @return an error indicating that a map entry is being set on a target
- * object that is not a java.util.Map
- */
- public static IMessage create_MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE(String targetName)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID,
- new Object[]{targetName}),
- null, MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID);
- }
-
- /**
- * @param targetName
- * @return an error indicating that a list entry is being set on a target
- * object that is not a java.util.List
- */
- public static IMessage create_LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE(String targetName)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID,
- new Object[]{targetName}),
- null, LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID);
- }
-
- /**
- * @param apiName
- * @param beforeVersion
- * @param useInstead
- * @return a diagnostic indicating that an API is being used that is not yet
- * available in the current JSF version.
- */
- public static IMessage create_API_NOT_AVAILABLE_BEFORE_VERSION(final String apiName, final String beforeVersion, final String useInstead)
- {
- return new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(Messages.API_NOT_AVAILABLE_BEFORE_VERSION_ID
- ,new Object[]{apiName, beforeVersion, useInstead})
- ,null, API_NOT_AVAILABLE_BEFORE_VERSION_ID);
- }
-
- /**
- * @param file
- * @return a diagnostic indicating that the app config model in use is too
- * new for the selected JSF runtime version.
- */
- public static IMessage create_APP_CONFIG_IS_NEWER_THAN_JSF_VERSION(IFile file)
- {
- final IMessage message = new MyLocalizedMessage(IMessage.HIGH_SEVERITY,
- Messages.APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID
- ,null, APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID);
- message.setTargetObject(file);
- return message;
- }
-
- /**
- * @param file
- * @param appConfigVersion
- * @param projectVersion
- * @return a diagnostic indicating that the app config model in use is older
- * than the selected JSF runtime version.
- */
- public static IMessage create_APP_CONFIG_IS_OLDER_THAN_JSF_VERSION(IFile file, String appConfigVersion, String projectVersion)
- {
- final IMessage message = new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- MessageFormat.format(
- Messages.APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID,
- new Object[] {appConfigVersion, projectVersion})
- ,null, APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID);
- message.setTargetObject(file);
- return message;
- }
-
- /**
- * @return a diagnostic indicating that the locale format does
- * not match what is expected
- */
- public static IMessage create_LOCALE_FORMAT_NOT_VALID()
- {
- IMessage message = new MyLocalizedMessage(IMessage.NORMAL_SEVERITY,
- Messages.LOCALE_FORMAT_NOT_VALID_ID
- ,null, LOCALE_FORMAT_NOT_VALID_ID);
- return message;
- }
-
- /**
- * Customized localizable message for app config validation
- * @author cbateman
- *
- */
- static class MyLocalizedMessage extends Message implements ILocalizedMessage
- {
- private final String _message;
- private final int _errorCode;
-
- /**
- * @param severity
- * @param messageText
- * @param targetObject
- * @param errorCode
- */
- public MyLocalizedMessage(int severity, String messageText, IResource targetObject, int errorCode) {
- this(severity, messageText, (Object) targetObject, errorCode);
- }
-
- /**
- * @param severity
- * @param messageText
- * @param targetObject
- * @param errorCode
- */
- private MyLocalizedMessage(int severity, String messageText, Object targetObject, int errorCode) {
- super(JSFCorePlugin.getDefault().getBundle().getSymbolicName(), severity,
- messageText);
- _message = messageText;
- setTargetObject(targetObject);
- _errorCode = errorCode;
- }
-
- /**
- * @return the localized message
- */
- public String getLocalizedMessage() {
- return _message;
- }
-
- /**
- * @see org.eclipse.wst.validation.internal.core.Message#getText()
- */
- public String getText() {
- return getLocalizedMessage();
- }
-
- /**
- * @see org.eclipse.wst.validation.internal.core.Message#getText(java.lang.ClassLoader)
- */
- public String getText(ClassLoader cl) {
- return getLocalizedMessage();
- }
-
- /**
- * @see org.eclipse.wst.validation.internal.core.Message#getText(java.util.Locale)
- */
- public String getText(Locale l) {
- return getLocalizedMessage();
- }
-
- public String getText(Locale l, ClassLoader cl) {
- return getLocalizedMessage();
- }
-
- /**
- * @return the error code related to this message
- */
- public int getErrorCode() {
- return _errorCode;
- }
-
-
- /**
- * @param offset
- * @return true if this message applies to document offset
- */
- public boolean appliesTo(int offset)
- {
- return (offset >= getOffset() && offset < getOffset()+getLength());
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/EObjectValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/EObjectValidationVisitor.java
deleted file mode 100644
index a3b7909d5..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/EObjectValidationVisitor.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- *
- * @author cbateman
- */
-public abstract class EObjectValidationVisitor
-{
- private EStructuralFeature _structuralFeature;
- private Map _childFeatures; // == null; lazy initialized in validate
- private final String _version;
-
- /**
- * Used to indicate no child nodes
- */
- protected final static EObjectValidationVisitor[] NO_CHILDREN =
- new EObjectValidationVisitor[0];
-
- /**
- * @param version
- *
- */
- public EObjectValidationVisitor(String version)
- {
- _version = version;
- }
-
- private EObjectValidationVisitor getVisitorForFeature(EStructuralFeature feature)
- {
- if (_childFeatures == null)
- {
- _childFeatures = new HashMap();
-
- EObjectValidationVisitor[] children = getChildNodeValidators();
-
- for (int i = 0; i < children.length; i++)
- {
- final EObjectValidationVisitor child = children[i];
- _childFeatures.put(child.getStructuralFeature(), child);
- }
- }
-
- return (EObjectValidationVisitor) _childFeatures.get(feature);
- }
-
- /**
- * @param structuralFeature
- * @param version
- */
- public EObjectValidationVisitor(EStructuralFeature structuralFeature, String version)
- {
- this(version);
- _structuralFeature = structuralFeature;
- }
-
- /**
- * @param eObject
- * @param messages
- * @param file
- */
- public final void validate(EObject eObject, List messages, IFile file)
- {
- doValidate(eObject, messages, file);
-
- List features = eObject.eClass().getEAllStructuralFeatures();
-
- for (final Iterator it = features.iterator(); it.hasNext();)
- {
- final EStructuralFeature feature = (EStructuralFeature) it.next();
- final EObjectValidationVisitor visitor =
- getVisitorForFeature(feature);
-
- if (visitor != null)
- {
- final Object obj = eObject.eGet(feature);
-
- if (obj instanceof List
- && feature.isMany())
- {
- for (final Iterator childIt = ((List)obj).iterator();
- childIt.hasNext();)
- {
- Object child = childIt.next();
- if (child instanceof EObject)
- {
- visitor.validate((EObject)child, messages, file);
- }
- }
- }
- else if (obj instanceof EObject)
- {
- visitor.validate((EObject)obj , messages, file);
- }
- }
- }
- }
-
- /**
- * Do the validation for this visitor on this node. Add any Message's to
- * the messages list
- *
- * @param eObject
- * @param messages
- * @param file
- */
- protected abstract void doValidate(EObject eObject, List messages, IFile file);
-
- /**
- * @return an array of visitors that validate children of the current node
- */
- protected abstract EObjectValidationVisitor[] getChildNodeValidators();
-
- /**
- * @return the structural feature
- */
- protected final EStructuralFeature getStructuralFeature()
- {
- return _structuralFeature;
- }
-
- /**
- * @return the version of the runtime
- */
- protected final String getVersion()
- {
- return _version;
- }
-
- /**
- * @param messages
- * @param message
- * @param eObj
- * @param file
- */
- protected static void addMessageInfo(List messages, IMessage message, EObject eObj, IFile file)
- {
- if (message != null)
- {
- message.setOffset(AppConfigValidationUtil.getStartOffset(eObj));
- message.setLength(AppConfigValidationUtil.getLength(eObj));
- message.setTargetObject(file);
- messages.add(message);
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FacesConfigValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FacesConfigValidator.java
deleted file mode 100644
index 8916e72bb..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FacesConfigValidator.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.PhaseListenerType;
-
-/**
- * Top-level validator for the faces-config model
- *
- * @author cbateman
- *
- */
-public class FacesConfigValidator extends EObjectValidationVisitor
-{
- /**
- * constructor
- * @param version
- */
- public FacesConfigValidator(String version)
- {
- super(version);
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators()
- {
- return new EObjectValidationVisitor[]
- {
- new NavigationRuleValidator(getVersion())
- , new ApplicationValidationVisitor(getVersion())
- , new LifecycleValidationVisitor(getVersion())
- , new FactoryValidationVisitor(getVersion())
- , new ComponentValidatorVisitor(getVersion())
- , new ValidatorTypeValidationVisitor(getVersion())
- , new ConverterValidationVisitor(getVersion())
- , new ManagedBeanValidationVisitor(getVersion())
- , new RenderKitValidationVisitor(getVersion())
- };
- }
-
- protected void doValidate(EObject object, List messages, IFile file)
- {
- // nothing to do
- }
-
- private static class LifecycleValidationVisitor extends EObjectValidationVisitor
- {
- LifecycleValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Lifecycle(),
- version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // nothing to validate except in children
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[] {
- new PhaseListenerValidation(getVersion())
- };
- }
-
- private static class PhaseListenerValidation extends ClassNameEObjectValidationVisitor
- {
- PhaseListenerValidation(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getLifecycleType_PhaseListener(),
- version);
- }
- protected String getFullyQualifiedName(EObject eobj) {
- return ((PhaseListenerType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.event.PhaseListener"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- // no children
- return NO_CHILDREN;
- }
- @Override
- protected boolean mustBeClass() {
- // must be a class
- return true;
- }
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FactoryValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FactoryValidationVisitor.java
deleted file mode 100644
index 1be47377e..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/FactoryValidationVisitor.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesContextFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.LifecycleFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitFactoryType;
-
-/**
- * @author cbateman
- *
- */
-public class FactoryValidationVisitor extends EObjectValidationVisitor
-{
- /**
- * @param version
- */
- public FactoryValidationVisitor(String version) {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Factory()
- ,version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // nothing to do except vaildate children
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators()
- {
- return new EObjectValidationVisitor[]
- {
- new ApplicationFactoryValidationVisitor(getVersion())
- , new FacesContextFactoryValidationVisitor(getVersion())
- , new LifecycleFactoryValidationVisitor(getVersion())
- , new RenderkitFactoryValidationVisitor(getVersion())
- };
- }
-
- private static class ApplicationFactoryValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- ApplicationFactoryValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFactoryType_ApplicationFactory(),
- version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((ApplicationFactoryType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.application.ApplicationFactory"; //$NON-NLS-1$
- }
-
- @Override
- protected boolean mustBeClass() {
- return true;
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- // none
- return NO_CHILDREN;
- }
-
- }
-
- private static class FacesContextFactoryValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- FacesContextFactoryValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFactoryType_FacesContextFactory(),
- version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((FacesContextFactoryType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.context.FacesContextFactory"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- // none
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass()
- {
- // must be a class
- return true;
- }
-
- }
-
- private static class LifecycleFactoryValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- LifecycleFactoryValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFactoryType_LifecycleFactory(),
- version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((LifecycleFactoryType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.lifecycle.LifecycleFactory"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- // none
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass() {
- // must be a class
- return true;
- }
-
- }
-
- private static class RenderkitFactoryValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- RenderkitFactoryValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFactoryType_RenderKitFactory(),
- version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((RenderKitFactoryType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.render.RenderKitFactory"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- // none
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass() {
- // must be a class
- return true;
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ILocalizedMessage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ILocalizedMessage.java
deleted file mode 100644
index 33240d7aa..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ILocalizedMessage.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-/**
- * Used to expose internal message data to unit tests. Should not be used by clients
- * @author cbateman
- *
- */
-public interface ILocalizedMessage {
- /**
- * @return the error code
- */
- public int getErrorCode();
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedBeanValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedBeanValidationVisitor.java
deleted file mode 100644
index b121f1d26..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedBeanValidationVisitor.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
-import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * Managed bean validator
- *
- * @author cbateman
- *
- */
-public class ManagedBeanValidationVisitor extends EObjectValidationVisitor
-{
- /**
- * @param version
- */
- public ManagedBeanValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_ManagedBean()
- ,version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file)
- {
- final ManagedBeanType managedBean = (ManagedBeanType) object;
-
- // TODO: validate managedBeanName is a valid Java id
-// final String managedBeanName =
-// managedBean.getManagedBeanName().getTextContent();
- validateScope(managedBean.getManagedBeanScope(), messages, file);
- validateClass(managedBean.getManagedBeanClass(), messages, file);
- validateEntryTypes(managedBean, messages, file);
- }
-
- private void validateScope(ManagedBeanScopeType scope, List messages, IFile file)
- {
- if (scope != null && scope.getTextContent() != null)
- {
- addMessageInfo(messages
- , AppConfigValidationUtil.validateManagedBeanScope(scope)
- , scope, file);
- }
- }
-
- private void validateClass(ManagedBeanClassType classType, List messages, IFile file)
- {
- if (classType != null)
- {
- String classTypeValue = classType.getTextContent();
- addMessageInfo(messages
- , AppConfigValidationUtil.validateClassName
- (classTypeValue == null ? "" : classTypeValue //$NON-NLS-1$
- , null, true, // a managed bean must be a class
- file.getProject())
- , classType, file);
- }
- }
-
- private void validateEntryTypes(ManagedBeanType managedBeanType, List messages, IFile file)
- {
- // TODO: do a bean look-up for targetName to verify that it a) matches the type
- // and b) exists on the bean
- if (managedBeanType.getManagedBeanName()!= null
- && managedBeanType.getManagedBeanClass() != null)
- {
- final String propertyName =
- managedBeanType.getManagedBeanName().getTextContent();
- final String propertyClass =
- managedBeanType.getManagedBeanClass().getTextContent();
-
- if (propertyName == null || propertyClass == null
- || "".equals(propertyName.trim()) //$NON-NLS-1$
- || "".equals(propertyClass.trim())) //$NON-NLS-1$
- {
- return;
- }
-
- IMessage message = null;
- EObject eObj = null;
- if (managedBeanType.getMapEntries() != null)
- {
- eObj = managedBeanType.getMapEntries();
- message =
- AppConfigValidationUtil
- .validateMapEntries
- (propertyName
- , propertyClass
- , (MapEntriesType) eObj
- , file.getProject());
- }
- else if (managedBeanType.getListEntries() != null)
- {
- eObj = managedBeanType.getListEntries();
- message =
- AppConfigValidationUtil
- .validateListEntries(
- propertyName
- , propertyClass
- , (ListEntriesType) eObj
- , file.getProject());
- }
- addMessageInfo(messages, message, eObj, file);
- }
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new ManagedPropertyValidationVisitor(getVersion())
- };
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedPropertyValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedPropertyValidationVisitor.java
deleted file mode 100644
index 154ae2450..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ManagedPropertyValidationVisitor.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType;
-import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * Validates managed bean properties
- *
- */
-public class ManagedPropertyValidationVisitor extends EObjectValidationVisitor
-{
- /**
- * @param version
- */
- public ManagedPropertyValidationVisitor(String version) {
- super(FacesConfigPackage.eINSTANCE.getManagedBeanType_ManagedProperty()
- ,version);
- }
-
- protected void doValidate(final EObject object, final List messages, final IFile file)
- {
- // TODO: do a bean look-up for propertyName to verify that it a) matches the type
- // and b) exists on the bean
- final ManagedPropertyType managedPropertyType =
- (ManagedPropertyType) object;
-
- if (managedPropertyType.getPropertyName() == null
- || managedPropertyType.getPropertyClass() == null)
- {
- // don't bother if the basics aren't correct
- return;
- }
-
- final String propertyName =
- managedPropertyType.getPropertyName().getTextContent();
- final String propertyClass =
- managedPropertyType.getPropertyClass().getTextContent();
-
- if (propertyName == null || propertyClass == null
- || "".equals(propertyName.trim()) //$NON-NLS-1$
- || "".equals(propertyClass.trim())) //$NON-NLS-1$
- {
- return;
- }
-
- IMessage message = null;
- EObject eObj = null;
- if (managedPropertyType.getMapEntries() != null)
- {
- eObj = managedPropertyType.getMapEntries();
- message =
- AppConfigValidationUtil
- .validateMapEntries
- (propertyName
- , propertyClass
- , (MapEntriesType) eObj
- , file.getProject());
- }
- else if (managedPropertyType.getListEntries() != null)
- {
- eObj = managedPropertyType.getListEntries();
- message =
- AppConfigValidationUtil
- .validateListEntries(
- propertyName
- , propertyClass
- , (ListEntriesType) eObj
- , file.getProject());
- }
-
- addMessageInfo(messages, message, eObj, file);
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new PropertyNameValidationVisitor(FacesConfigPackage.eINSTANCE.getManagedPropertyType_PropertyName(),
- FacesConfigPackage.eINSTANCE.getManagedBeanType_ManagedBeanClass(), getVersion())
- };
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/Messages.java
deleted file mode 100644
index b0535a9a5..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/Messages.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import org.eclipse.osgi.util.NLS;
-
-class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.validation.internal.appconfig.messages"; //$NON-NLS-1$
-
-
-
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- /**
- * see messages.properties
- */
- public static String AppConfigValidationUtil_0;
-
- /**
- * see messages.properties
- */
- public static String EL_EXPR_MUST_BE_IN_HASH_BRACES_ID;
-
- /**
- * see messages.properties
- */
- public static String SYNTAX_ERROR_IN_EL_ID;
-
- /**
- * see messages.properties
- */
- public static String CANNOT_FIND_CLASS_NAME_ID;
-
- /**
- * see messages.properties
- */
- public static String FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID;
-
- /**
- * see messages.properties
- */
- public static String CLASS_MUST_BE_INSTANCE_OF_ID;
-
- /**
- * see messages.properties
- */
- public static String CLASS_MUST_BE_CONCRETE_ID;
-
- /**
- * see messages.properties
- */
- public static String API_DEPRECATED_AFTER_VERSION_ID;
-
- /**
- * see messages.properties
- */
- public static String BEAN_PROPERTY_NOT_FOUND_ID;
-
- /**
- * see messages.properties
- */
- public static String MUST_BE_A_VALID_JAVA_IDENT_ID;
-
- /**
- * see messages.properties
- */
- public static String BEAN_SCOPE_NOT_VALID_ID;
-
- /**
- * see messages.properties
- */
- public static String MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID;
-
- /**
- * see messages.properties
- */
- public static String LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID;
-
- /**
- * see messages.properties
- */
- public static String API_NOT_AVAILABLE_BEFORE_VERSION_ID;
-
- /**
- * see messages.properties
- */
- public static String APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID;
-
- /**
- * see messages.properties
- */
- public static String APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID;
-
- /**
- * see messages.properties
- */
- public static String LOCALE_FORMAT_NOT_VALID_ID;
-
- /**
- * see messages.properties
- */
- public static String CONFIG_FILE_NOT_UNDER_WEBCONTENT_FOLDER;
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationCaseValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationCaseValidationVisitor.java
deleted file mode 100644
index 9c2c51656..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationCaseValidationVisitor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FromActionType;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * NavigationCase validation visitor.
- *
- * @author cbateman
- *
- */
-public class NavigationCaseValidationVisitor extends EObjectValidationVisitor
-{
- /**
- * @param version
- *
- */
- public NavigationCaseValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getNavigationRuleType_NavigationCase()
- , version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file)
- {
- // nothing to do
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators()
- {
- return new EObjectValidationVisitor[]
- {
- new FromActionValidationVisitor(getVersion())
- };
- }
-
- private static class FromActionValidationVisitor extends EObjectValidationVisitor
- {
- /**
- * @param version
- *
- */
- public FromActionValidationVisitor(String version) {
- super(FacesConfigPackage.eINSTANCE.getNavigationCaseType_FromAction(),
- version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file)
- {
- if (object instanceof FromActionType)
- {
- final FromActionType actionType = (FromActionType) object;
- IMessage message = AppConfigValidationUtil.validateELExpression
- (actionType.getTextContent());
- addMessageInfo(messages, message, actionType, file);
- }
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators()
- {
- return NO_CHILDREN;
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationRuleValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationRuleValidator.java
deleted file mode 100644
index 97b9df029..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NavigationRuleValidator.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-
-/**
- * Recursive validator for navigation-rule
- *
- * @author cbateman
- *
- */
-public class NavigationRuleValidator extends EObjectValidationVisitor
-{
- /**
- * Constructor
- * @param version
- */
- public NavigationRuleValidator(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_NavigationRule()
- , version);
- }
-
- protected void doValidate(EObject eobj, List messages, IFile file)
- {
- // nothing to do
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators()
- {
- return new EObjectValidationVisitor[]
- {
- new NavigationCaseValidationVisitor(getVersion())
- };
- }
-// private static class FromViewIdValidator extends ViewIdValidator
-// {
-// FromViewIdValidator()
-// {
-// super(Node.ELEMENT_NODE, "from-view-id");
-// }
-//
-// protected void doValidate(Node node, List messages, IFile file)
-// {
-// // only validate if a custom navigation handler is not set
-// // since we can only validate against what the default navigation
-// // handler will expect
-// if (!hasCustomNavigationHandler(file))
-// {
-// final String textContent = node.getTextContent();
-// final IProject project = file.getProject();
-//
-//
-// }
-// }
-//
-// private boolean hasCustomNavigationHandler(IFile file)
-// {
-// JSFAppConfigManager configManager =
-// JSFAppConfigManager.getInstance(file.getProject());
-//
-// for (final Iterator appIt = configManager.getApplications().iterator(); appIt.hasNext();)
-// {
-// ApplicationType appType = (ApplicationType) appIt.next();
-// if (appType.getNavigationHandler().size() > 0)
-// {
-// return true;
-// }
-// }
-//
-// return false;
-// }
-//
-// protected NodeValidationVisitor[] getChildNodeValidators() {
-// return EMPTY_CHILDREN;
-// }
-// }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NodeValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NodeValidationVisitor.java
deleted file mode 100644
index aa2f78117..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/NodeValidationVisitor.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Visits an app config DOM tree and calls validators based on the
- * configured validator tree
- *
- * @author cbateman
- *
- */
-public abstract class NodeValidationVisitor
-{
- private final short _nodeType;
- private final String _nodeName;
- private final Map _attributeVisitors;
- private final Map _elementVisitors;
-
- /**
- * Used to indicate no child nodes
- */
- protected final static NodeValidationVisitor[] EMPTY_CHILDREN = new NodeValidationVisitor[0];
-
- /**
- * @param nodeType
- * @param nodeName
- */
- public NodeValidationVisitor(short nodeType, String nodeName)
- {
- _nodeType = nodeType;
- _nodeName = nodeName;
- _attributeVisitors = new HashMap();
- _elementVisitors = new HashMap();
-
- NodeValidationVisitor[] childVisitors = getChildNodeValidators();
-
- for (int i = 0; i < childVisitors.length; i++)
- {
- final NodeValidationVisitor visitor = childVisitors[i];
-
- switch(visitor.getNodeType())
- {
- case Node.ATTRIBUTE_NODE:
- _attributeVisitors.put(visitor.getNodeName(), visitor);
- break;
-
- case Node.ELEMENT_NODE:
- _elementVisitors.put(visitor.getNodeName(), visitor);
- break;
- }
- }
- }
-
- /**
- * @param node
- * @param messages
- * @param file
- */
- public final void validate(Node node, List messages, IFile file)
- {
- doValidate(node, messages, file);
-
- final NamedNodeMap attributes = node.getAttributes();
-
- for (int i = 0; attributes != null && i < attributes.getLength(); i++)
- {
- final Node attr = attributes.item(i);
- final NodeValidationVisitor visitor =
- (NodeValidationVisitor) _attributeVisitors.get(attr.getNodeName());
- if (visitor != null)
- {
- visitor.validate(attr, messages, file);
- }
- }
-
- for (int i = 0; i < node.getChildNodes().getLength(); i++)
- {
- final Node child = node.getChildNodes().item(i);
- final NodeValidationVisitor visitor =
- (NodeValidationVisitor) _elementVisitors.get(child.getNodeName());
- if (visitor != null)
- {
- visitor.validate(child, messages, file);
- }
- }
- }
-
- /**
- * Do the validation for this visitor on this node. Add any Message's to
- * the messages list
- *
- * @param node
- * @param messages
- * @param file
- */
- protected abstract void doValidate(Node node, List messages, IFile file);
-
- /**
- * @return an array of visitors that validate children of the current node
- */
- protected abstract NodeValidationVisitor[] getChildNodeValidators();
-
- /**
- * @return the node type for this validator
- */
- protected short getNodeType()
- {
- return _nodeType;
- }
-
- /**
- * @return the node name for this validator
- */
- protected String getNodeName()
- {
- return _nodeName;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyNameValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyNameValidationVisitor.java
deleted file mode 100644
index c076c1b9e..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyNameValidationVisitor.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jst.jsf.common.util.JDTBeanIntrospector;
-import org.eclipse.jst.jsf.common.util.JDTBeanProperty;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
-
-/**
- * Validate the validation property name
- *
- * @author cbateman
- */
-class PropertyNameValidationVisitor extends EObjectValidationVisitor
-{
- private final EStructuralFeature _parentClassNameFeature;
- private final Map<IType, Map<String, JDTBeanProperty>> _propertyCache;
- private final Map<String, IType> _typeCache;
-
- /**
- * @param feature
- * @param parentClassNameFeature
- * @param version
- */
- public PropertyNameValidationVisitor(EStructuralFeature feature,
- EStructuralFeature parentClassNameFeature, String version)
- {
- super(feature, version);
- _parentClassNameFeature = parentClassNameFeature;
- _propertyCache = new HashMap<IType, Map<String, JDTBeanProperty>>();
- _typeCache = new HashMap<String, IType>();
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators()
- {
- return PropertyValidationVisitor.NO_CHILDREN;
- }
-
- protected void doValidate(EObject object, List messages, IFile file)
- {
- final String parentClassType = getParentClassType(object);
-
- if (parentClassType != null)
- {
- final boolean isBeanProperty =
- validateProperty((PropertyNameType)object
- , file.getProject(), parentClassType);
- final String propertyName =
- ((PropertyNameType)object).getTextContent();
-
- if (!isBeanProperty)
- {
- PropertyValidationVisitor.addMessageInfo(messages,
- DiagnosticFactory
- .create_BEAN_PROPERTY_NOT_FOUND
- (propertyName, parentClassType)
- , object, file);
- }
- }
- }
-
- private String getParentClassType(EObject object)
- {
- String parentClassType = null;
-
- // need to derive the parent's type
- final EObject property = object.eContainer();
- if (property != null)
- {
- EObject owningObject = property.eContainer();
-
- if (owningObject != null)
- {
- final EObject parentClassTypeObject =
- (EObject) owningObject.eGet(_parentClassNameFeature);
-
- if (parentClassTypeObject != null)
- {
- final EStructuralFeature feature =
- parentClassTypeObject.eClass()
- .getEStructuralFeature("textContent"); //$NON-NLS-1$
-
- if (feature != null)
- {
- parentClassType = (String)
- parentClassTypeObject.eGet(feature);
- }
- }
- }
- }
-
- return parentClassType;
- }
-
- private boolean validateProperty(PropertyNameType object, IProject project, String parentClassType)
- {
- boolean isBeanProperty = false;
-
- final IType type = getType(parentClassType, project);
-
- if (type != null)
- {
- final String propertyName = object.getTextContent();
-
- Map<String, JDTBeanProperty> cachedType = _propertyCache.get(type);
- if (cachedType == null)
- {
- cachedType = getProperties(type, project);
- _propertyCache.put(type, cachedType);
- }
-
- final JDTBeanProperty beanProperty = cachedType.get(propertyName);
-
- if (beanProperty != null)
- {
- isBeanProperty = true;
- }
- }
- return isBeanProperty;
- }
-
- private Map<String, JDTBeanProperty> getProperties(final IType type, final IProject project)
- {
- final JDTBeanIntrospector introspector = new JDTBeanIntrospector(type);
- return introspector.getProperties();
- }
-
- private IType getType(final String typeName, final IProject project)
- {
- IType type = _typeCache.get(typeName);
- if (type == null)
- {
- IJavaProject javaProject = JavaCore.create(project);
- try
- {
- type = javaProject.findType(typeName);
- _typeCache.put(typeName, type);
- }
- catch (JavaModelException e)
- {
- JSFCorePlugin
- .log(new Exception(e),
- "Problem validating on parent: "+typeName); //$NON-NLS-1$
- }
- }
- return type;
- }
-} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyValidationVisitor.java
deleted file mode 100644
index 5ff1e81d8..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/PropertyValidationVisitor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-
-/**
- * Validates property's
- *
- */
-public class PropertyValidationVisitor extends EObjectValidationVisitor
-{
- private final EStructuralFeature _parentClassName;
-
- /**
- * @param feature
- * @param parentClassName
- * @param version
- */
- public PropertyValidationVisitor(EStructuralFeature feature, EStructuralFeature parentClassName, String version) {
- // this validator can be attached to numerous parents so it
- // cannot hard-code its feature
- super(feature,version);
- _parentClassName = parentClassName;
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // validate the class type here because we need knowledge
- // of the property name to do it
- //TODO:
-// final PropertyType property = (PropertyType) object;
-// final String propertyClass =
-// property.getPropertyClass().getTextContent();
-// final String propertySignature =
-// validateProperty(property.getPropertyName()
-// , file.getProject(), _parentClassType);
-//
-// if (propertySignature != null
-// && Signature.)
-// {
-// Signature.create
-// }
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new PropertyNameValidationVisitor(FacesConfigPackage.eINSTANCE.getPropertyType_PropertyName(),
- _parentClassName, getVersion())
- };
- }
-
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RenderKitValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RenderKitValidationVisitor.java
deleted file mode 100644
index caf7d6c08..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RenderKitValidationVisitor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitClassType;
-
-/**
- * Validates the renderkit
- */
-public class RenderKitValidationVisitor extends EObjectValidationVisitor
-{
-
- /**
- * @param version
- */
- public RenderKitValidationVisitor(String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_RenderKit()
- ,version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file)
- {
- // nothing to do
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators()
- {
- return new EObjectValidationVisitor[]
- {
- new RenderKitClassValidationVisitor(getVersion()),
- new RendererValidationVisitor(getVersion())
- };
- }
-
- private static class RenderKitClassValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- /**
- * @param version
- */
- public RenderKitClassValidationVisitor(String version)
- {
- super(FacesConfigPackage.eINSTANCE.getRenderKitType_RenderKitClass()
- , version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((RenderKitClassType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.render.RenderKit"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass() {
- // must be a class
- return true;
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RendererValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RendererValidationVisitor.java
deleted file mode 100644
index aa6a8244c..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/RendererValidationVisitor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.RendererClassType;
-
-/**
- * Renderer validation
- *
- */
-public class RendererValidationVisitor extends EObjectValidationVisitor {
-
- /**
- * @param version
- */
- public RendererValidationVisitor(String version)
- {
- super(FacesConfigPackage.eINSTANCE.getRenderKitType_Renderer(),
- version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // nothing to do
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new RendererClassValidationVisitor(getVersion())
- , new AttributeValidationVisitor
- (FacesConfigPackage.eINSTANCE.getRendererType_Attribute()
- , getVersion())
- };
- }
-
- private static class RendererClassValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- /**
- * @param version
- */
- public RendererClassValidationVisitor(String version)
- {
- super(FacesConfigPackage.eINSTANCE.getRendererType_RendererClass()
- , version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((RendererClassType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.render.Renderer"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass() {
- // must be a class
- return true;
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ValidatorTypeValidationVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ValidatorTypeValidationVisitor.java
deleted file mode 100644
index ff60fee54..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ValidatorTypeValidationVisitor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorClassType;
-
-/**
- * Validation visitor for the Validator faces config model sub-type
- * @author cbateman
- *
- */
-public class ValidatorTypeValidationVisitor extends EObjectValidationVisitor {
-
- /**
- * @param version
- */
- public ValidatorTypeValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getFacesConfigType_Validator(),
- version);
- }
-
- protected void doValidate(EObject object, List messages, IFile file) {
- // nothing in the tag to validate
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return new EObjectValidationVisitor[]
- {
- new ValidatorClassValidationVisitor(getVersion()),
- new AttributeValidationVisitor(FacesConfigPackage.eINSTANCE.getValidatorType_Attribute(), getVersion()),
- new PropertyValidationVisitor
- (FacesConfigPackage.eINSTANCE.getValidatorType_Property()
- ,FacesConfigPackage.eINSTANCE.getValidatorType_ValidatorClass()
- ,getVersion()),
- };
- }
-
- private static class ValidatorClassValidationVisitor extends ClassNameEObjectValidationVisitor
- {
- ValidatorClassValidationVisitor(final String version)
- {
- super(FacesConfigPackage.eINSTANCE.getValidatorType_ValidatorClass(),
- version);
- }
-
- protected String getFullyQualifiedName(EObject eobj)
- {
- return ((ValidatorClassType)eobj).getTextContent();
- }
-
- protected String getInstanceOf() {
- return "javax.faces.validator.Validator"; //$NON-NLS-1$
- }
-
- protected EObjectValidationVisitor[] getChildNodeValidators() {
- return NO_CHILDREN;
- }
-
- @Override
- protected boolean mustBeClass() {
- // must be a class
- return true;
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ViewIdValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ViewIdValidator.java
deleted file mode 100644
index 6c2a06734..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/ViewIdValidator.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.appconfig;
-
-
-/**
- * @author cbateman
- *
- */
-public abstract class ViewIdValidator extends NodeValidationVisitor
-{
- /**
- * @param nodeType
- * @param nodeName
- */
- protected ViewIdValidator(final short nodeType, final String nodeName)
- {
- super(nodeType, nodeName);
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/messages.properties
deleted file mode 100644
index b910ba6e6..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/appconfig/messages.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2007 Oracle 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:
-# Oracle Corporation - initial API and implementation
-###############################################################################
-EL_EXPR_MUST_BE_IN_HASH_BRACES_ID=EL expression must be of the form #{expression}
-SYNTAX_ERROR_IN_EL_ID=Syntax error in EL
-CANNOT_FIND_CLASS_NAME_ID=Cannot find fully qualified class: {0}
-FULLY_QUALIFIED_NAME_MUST_BE_A_CLASS_ID=Fully qualified name must be a class: {0}
-CLASS_MUST_BE_INSTANCE_OF_ID=Class {0} must {1} the type {2}
-CLASS_MUST_BE_CONCRETE_ID=Class {0} must be concrete (not abstract)
-API_DEPRECATED_AFTER_VERSION_ID=API {0} is deprecated after JSF {1}. Use {2} instead.
-BEAN_PROPERTY_NOT_FOUND_ID=Bean property {0} not found on parent class {1}
-MUST_BE_A_VALID_JAVA_IDENT_ID={0} must be a valid Java identifier
-BEAN_SCOPE_NOT_VALID_ID=Managed bean scope must be one of: request, session, application, none
-MAP_ENTRIES_CAN_ONLY_BE_SET_ON_MAP_TYPE_ID=Map entries can only be set on objects of type Map. {0} is not an instance of type java.util.Map
-LIST_ENTRIES_CAN_ONLY_BE_SET_ON_LIST_TYPE_ID=List entries can only be set on objects of type List. {0} is not an instance of type java.util.List
-API_NOT_AVAILABLE_BEFORE_VERSION_ID=API {0} is not avaiable before JSF {1}. Use {2} instead.
-APP_CONFIG_IS_NEWER_THAN_JSF_VERSION_ID=Faces 1.2 application configuration cannot be used in projects for Faces 1.1 or before
-APP_CONFIG_IS_OLDER_THAN_JSF_VERSION_ID=Faces {0} application configuration being used in Faces {1} project. Not all Faces {1} features will be available"
-LOCALE_FORMAT_NOT_VALID_ID=Locale format must be of the form lang_[_country[_variant]] like en or en_US or ja_JP_SJIS
-AppConfigValidationUtil_0=extend
-CONFIG_FILE_NOT_UNDER_WEBCONTENT_FOLDER=JSF configuration file is not under this project's web content folder. Please check project setup. \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsFactory.java
deleted file mode 100644
index 0df2966b4..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsFactory.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints;
-
-import org.eclipse.emf.ecore.EFactory;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage
- * @generated
- */
-public interface ConstraintsFactory extends EFactory {
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- ConstraintsFactory eINSTANCE = org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsFactoryImpl.init();
-
- /**
- * Returns a new object of class '<em>Tag Id</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Tag Id</em>'.
- * @generated
- */
- TagId createTagId();
-
- /**
- * Returns a new object of class '<em>Tag Set</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Tag Set</em>'.
- * @generated
- */
- TagSet createTagSet();
-
- /**
- * Returns a new object of class '<em>Contains Tag Constraint</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Contains Tag Constraint</em>'.
- * @generated
- */
- ContainsTagConstraint createContainsTagConstraint();
-
- /**
- * Returns the package supported by this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the package supported by this factory.
- * @generated
- */
- ConstraintsPackage getConstraintsPackage();
-
-} //ConstraintsFactory
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsPackage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsPackage.java
deleted file mode 100644
index 2347907b0..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ConstraintsPackage.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsPackage.java,v 1.5 2008/11/18 22:24:09 gkessler Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsFactory
- * @model kind="package"
- * @generated
- */
-@SuppressWarnings("hiding")
-public interface ConstraintsPackage extends EPackage {
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNAME = "constraints"; //$NON-NLS-1$
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_URI = "http://org.eclipse.jst.jsf.core/constraints.ecore"; //$NON-NLS-1$
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_PREFIX = "cnst"; //$NON-NLS-1$
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- ConstraintsPackage eINSTANCE = org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl <em>Tag Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getTagId()
- * @generated
- */
- int TAG_ID = 0;
-
- /**
- * The feature id for the '<em><b>Uri</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int TAG_ID__URI = 0;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int TAG_ID__NAME = 1;
-
- /**
- * The number of structural features of the '<em>Tag Id</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int TAG_ID_FEATURE_COUNT = 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl <em>Tag Set</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getTagSet()
- * @generated
- */
- int TAG_SET = 1;
-
- /**
- * The feature id for the '<em><b>Tags</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int TAG_SET__TAGS = 0;
-
- /**
- * The number of structural features of the '<em>Tag Set</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int TAG_SET_FEATURE_COUNT = 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl <em>Contains Tag Constraint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getContainsTagConstraint()
- * @generated
- */
- int CONTAINS_TAG_CONSTRAINT = 2;
-
- /**
- * The feature id for the '<em><b>Set Generator</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int CONTAINS_TAG_CONSTRAINT__SET_GENERATOR = 0;
-
- /**
- * The feature id for the '<em><b>Satisfies Set</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int CONTAINS_TAG_CONSTRAINT__SATISFIES_SET = 1;
-
- /**
- * The number of structural features of the '<em>Contains Tag Constraint</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int CONTAINS_TAG_CONSTRAINT_FEATURE_COUNT = 2;
-
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId <em>Tag Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Tag Id</em>'.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.TagId
- * @generated
- */
- EClass getTagId();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getUri <em>Uri</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Uri</em>'.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.TagId#getUri()
- * @see #getTagId()
- * @generated
- */
- EAttribute getTagId_Uri();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.TagId#getName()
- * @see #getTagId()
- * @generated
- */
- EAttribute getTagId_Name();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagSet <em>Tag Set</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Tag Set</em>'.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.TagSet
- * @generated
- */
- EClass getTagSet();
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagSet#getTags <em>Tags</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Tags</em>'.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.TagSet#getTags()
- * @see #getTagSet()
- * @generated
- */
- EReference getTagSet_Tags();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint <em>Contains Tag Constraint</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Contains Tag Constraint</em>'.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint
- * @generated
- */
- EClass getContainsTagConstraint();
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSetGenerator <em>Set Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Set Generator</em>'.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSetGenerator()
- * @see #getContainsTagConstraint()
- * @generated
- */
- EReference getContainsTagConstraint_SetGenerator();
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSatisfiesSet <em>Satisfies Set</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Satisfies Set</em>'.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSatisfiesSet()
- * @see #getContainsTagConstraint()
- * @generated
- */
- EReference getContainsTagConstraint_SatisfiesSet();
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- ConstraintsFactory getConstraintsFactory();
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- interface Literals {
- /**
- * The meta object literal for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl <em>Tag Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getTagId()
- * @generated
- */
- // @SuppressWarnings("hiding")
- EClass TAG_ID = eINSTANCE.getTagId();
-
- /**
- * The meta object literal for the '<em><b>Uri</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- // @SuppressWarnings("hiding")
- EAttribute TAG_ID__URI = eINSTANCE.getTagId_Uri();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- // @SuppressWarnings("hiding")
- EAttribute TAG_ID__NAME = eINSTANCE.getTagId_Name();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl <em>Tag Set</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getTagSet()
- * @generated
- */
- // @SuppressWarnings("hiding")
- EClass TAG_SET = eINSTANCE.getTagSet();
-
- /**
- * The meta object literal for the '<em><b>Tags</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- // @SuppressWarnings("hiding")
- EReference TAG_SET__TAGS = eINSTANCE.getTagSet_Tags();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl <em>Contains Tag Constraint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl
- * @see org.eclipse.jst.jsf.validation.internal.constraints.impl.ConstraintsPackageImpl#getContainsTagConstraint()
- * @generated
- */
- // @SuppressWarnings("hiding")
- EClass CONTAINS_TAG_CONSTRAINT = eINSTANCE.getContainsTagConstraint();
-
- /**
- * The meta object literal for the '<em><b>Set Generator</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- // @SuppressWarnings("hiding")
- EReference CONTAINS_TAG_CONSTRAINT__SET_GENERATOR = eINSTANCE.getContainsTagConstraint_SetGenerator();
-
- /**
- * The meta object literal for the '<em><b>Satisfies Set</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- // @SuppressWarnings("hiding")
- EReference CONTAINS_TAG_CONSTRAINT__SATISFIES_SET = eINSTANCE.getContainsTagConstraint_SatisfiesSet();
-
- }
-
-} //ConstraintsPackage
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ContainsTagConstraint.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ContainsTagConstraint.java
deleted file mode 100644
index d91e5c064..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/ContainsTagConstraint.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ContainsTagConstraint.java,v 1.2 2007/04/16 19:53:29 itrimble Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Contains Tag Constraint</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSetGenerator <em>Set Generator</em>}</li>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSatisfiesSet <em>Satisfies Set</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getContainsTagConstraint()
- * @model
- * @generated
- */
-public interface ContainsTagConstraint extends EObject {
- /**
- * Returns the value of the '<em><b>Set Generator</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Set Generator</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Set Generator</em>' reference.
- * @see #setSetGenerator(SetGenerator)
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getContainsTagConstraint_SetGenerator()
- * @model extendedMetaData="kind='element' name='set-generator'"
- * @generated
- */
- SetGenerator getSetGenerator();
-
- /**
- * Sets the value of the '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSetGenerator <em>Set Generator</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Set Generator</em>' reference.
- * @see #getSetGenerator()
- * @generated
- */
- void setSetGenerator(SetGenerator value);
-
- /**
- * Returns the value of the '<em><b>Satisfies Set</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Satisfies Set</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Satisfies Set</em>' reference.
- * @see #setSatisfiesSet(TagSet)
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getContainsTagConstraint_SatisfiesSet()
- * @model extendedMetaData="kind='element' name='satisfies-set'"
- * @generated
- */
- TagSet getSatisfiesSet();
-
- /**
- * Sets the value of the '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint#getSatisfiesSet <em>Satisfies Set</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Satisfies Set</em>' reference.
- * @see #getSatisfiesSet()
- * @generated
- */
- void setSatisfiesSet(TagSet value);
-
-} // ContainsTagConstraint
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagId.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagId.java
deleted file mode 100644
index 5c5ebb12b..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagId.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: TagId.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Tag Id</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getUri <em>Uri</em>}</li>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getName <em>Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagId()
- * @model
- * @generated
- */
-public interface TagId extends EObject {
- /**
- * Returns the value of the '<em><b>Uri</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Uri</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Uri</em>' attribute.
- * @see #setUri(String)
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagId_Uri()
- * @model extendedMetaData="kind='element'"
- * @generated
- */
- String getUri();
-
- /**
- * Sets the value of the '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getUri <em>Uri</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Uri</em>' attribute.
- * @see #getUri()
- * @generated
- */
- void setUri(String value);
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagId_Name()
- * @model extendedMetaData="kind='element'"
- * @generated
- */
- String getName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- void setName(String value);
-
-} // TagId
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagSet.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagSet.java
deleted file mode 100644
index 5c60d5ddb..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/TagSet.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: TagSet.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Tag Set</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.TagSet#getTags <em>Tags</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagSet()
- * @model
- * @generated
- */
-public interface TagSet extends EObject {
- /**
- * Returns the value of the '<em><b>Tags</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.jst.jsf.validation.internal.constraints.TagId}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Tags</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Tags</em>' reference list.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#getTagSet_Tags()
- * @model type="org.eclipse.jst.jsf.validation.internal.constraints.TagId"
- * @generated
- */
- EList getTags();
-
-} // TagSet
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsFactoryImpl.java
deleted file mode 100644
index e2b10e5d2..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsFactoryImpl.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsFactoryImpl.java,v 1.3 2008/11/18 22:23:52 gkessler Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.impl;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-
-import org.eclipse.jst.jsf.validation.internal.constraints.*;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Factory</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class ConstraintsFactoryImpl extends EFactoryImpl implements ConstraintsFactory {
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the constraints factory
- * @generated
- */
- public static ConstraintsFactory init() {
- try {
- ConstraintsFactory theConstraintsFactory = (ConstraintsFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.core/constraints.ecore"); //$NON-NLS-1$
- if (theConstraintsFactory != null) {
- return theConstraintsFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new ConstraintsFactoryImpl();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ConstraintsFactoryImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param eClass
- * @return the eobject for the class
- * @generated
- */
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case ConstraintsPackage.TAG_ID: return createTagId();
- case ConstraintsPackage.TAG_SET: return createTagSet();
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT: return createContainsTagConstraint();
- default:
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new tag id
- * @generated
- */
- public TagId createTagId() {
- TagIdImpl tagId = new TagIdImpl();
- return tagId;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new tag set
- * @generated
- */
- public TagSet createTagSet() {
- TagSetImpl tagSet = new TagSetImpl();
- return tagSet;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new Contains Tag Constraint
- * @generated
- */
- public ContainsTagConstraint createContainsTagConstraint() {
- ContainsTagConstraintImpl containsTagConstraint = new ContainsTagConstraintImpl();
- return containsTagConstraint;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the constraints package
- * @generated
- */
- public ConstraintsPackage getConstraintsPackage() {
- return (ConstraintsPackage)getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the package
- * @deprecated
- * @generated
- */
- public static ConstraintsPackage getPackage() {
- return ConstraintsPackage.eINSTANCE;
- }
-
-} //ConstraintsFactoryImpl
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsPackageImpl.java
deleted file mode 100644
index 7e1547e8f..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ConstraintsPackageImpl.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsPackageImpl.java,v 1.4 2008/11/18 22:23:52 gkessler Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.impl;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-
-import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage;
-
-import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsFactory;
-import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage;
-import org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint;
-import org.eclipse.jst.jsf.validation.internal.constraints.TagId;
-import org.eclipse.jst.jsf.validation.internal.constraints.TagSet;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Package</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class ConstraintsPackageImpl extends EPackageImpl implements ConstraintsPackage {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass tagIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass tagSetEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass containsTagConstraintEClass = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private ConstraintsPackageImpl() {
- super(eNS_URI, ConstraintsFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this
- * model, and for any others upon which it depends. Simple
- * dependencies are satisfied by calling this method on all
- * dependent packages before doing anything else. This method drives
- * initialization for interdependent packages directly, in parallel
- * with this package, itself.
- * <p>Of this package and its interdependencies, all packages which
- * have not yet been registered by their URI values are first created
- * and registered. The packages are then initialized in two steps:
- * meta-model objects for all of the packages are created before any
- * are initialized, since one package's meta-model objects may refer to
- * those of another.
- * <p>Invocation of this method will not affect any packages that have
- * already been initialized.
- * <!-- begin-user-doc -->
- * @return the initialized package
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static ConstraintsPackage init() {
- if (isInited) return (ConstraintsPackage)EPackage.Registry.INSTANCE.getEPackage(ConstraintsPackage.eNS_URI);
-
- // Obtain or create and register package
- ConstraintsPackageImpl theConstraintsPackage = (ConstraintsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ConstraintsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ConstraintsPackageImpl());
-
- isInited = true;
-
- // Initialize simple dependencies
- TraitTypesPackage.eINSTANCE.eClass();
-
- // Create package meta-data objects
- theConstraintsPackage.createPackageContents();
-
- // Initialize created meta-data
- theConstraintsPackage.initializePackageContents();
-
- // Mark meta-data to indicate it can't be changed
- theConstraintsPackage.freeze();
-
- return theConstraintsPackage;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getTagId() {
- return tagIdEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getTagId_Uri() {
- return (EAttribute)tagIdEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getTagId_Name() {
- return (EAttribute)tagIdEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getTagSet() {
- return tagSetEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getTagSet_Tags() {
- return (EReference)tagSetEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getContainsTagConstraint() {
- return containsTagConstraintEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getContainsTagConstraint_SetGenerator() {
- return (EReference)containsTagConstraintEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getContainsTagConstraint_SatisfiesSet() {
- return (EReference)containsTagConstraintEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ConstraintsFactory getConstraintsFactory() {
- return (ConstraintsFactory)getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated) return;
- isCreated = true;
-
- // Create classes and their features
- tagIdEClass = createEClass(TAG_ID);
- createEAttribute(tagIdEClass, TAG_ID__URI);
- createEAttribute(tagIdEClass, TAG_ID__NAME);
-
- tagSetEClass = createEClass(TAG_SET);
- createEReference(tagSetEClass, TAG_SET__TAGS);
-
- containsTagConstraintEClass = createEClass(CONTAINS_TAG_CONSTRAINT);
- createEReference(containsTagConstraintEClass, CONTAINS_TAG_CONSTRAINT__SET_GENERATOR);
- createEReference(containsTagConstraintEClass, CONTAINS_TAG_CONSTRAINT__SATISFIES_SET);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized) return;
- isInitialized = true;
-
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
-
- // Obtain other dependent packages
- TraitTypesPackage theTraitTypesPackage = (TraitTypesPackage)EPackage.Registry.INSTANCE.getEPackage(TraitTypesPackage.eNS_URI);
-
- // Add supertypes to classes
-
- // Initialize classes and features; add operations and parameters
- initEClass(tagIdEClass, TagId.class, "TagId", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEAttribute(getTagId_Uri(), ecorePackage.getEString(), "uri", null, 0, 1, TagId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
- initEAttribute(getTagId_Name(), ecorePackage.getEString(), "name", null, 0, 1, TagId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(tagSetEClass, TagSet.class, "TagSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getTagSet_Tags(), this.getTagId(), null, "tags", null, 0, -1, TagSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- initEClass(containsTagConstraintEClass, ContainsTagConstraint.class, "ContainsTagConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEReference(getContainsTagConstraint_SetGenerator(), theTraitTypesPackage.getSetGenerator(), null, "setGenerator", null, 0, 1, ContainsTagConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
- initEReference(getContainsTagConstraint_SatisfiesSet(), this.getTagSet(), null, "satisfiesSet", null, 0, 1, ContainsTagConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
-
- // Create resource
- createResource(eNS_URI);
-
- // Create annotations
- // http:///org/eclipse/emf/ecore/util/ExtendedMetaData
- createExtendedMetaDataAnnotations();
- }
-
- /**
- * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void createExtendedMetaDataAnnotations() {
- String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$
- addAnnotation
- (getTagId_Uri(),
- source,
- new String[] {
- "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$
- "name", "uri" //$NON-NLS-1$ //$NON-NLS-2$
- });
- addAnnotation
- (getTagId_Name(),
- source,
- new String[] {
- "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$
- "name", "name" //$NON-NLS-1$ //$NON-NLS-2$
- });
- addAnnotation
- (getTagSet_Tags(),
- source,
- new String[] {
- "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$
- "name", "tagId" //$NON-NLS-1$ //$NON-NLS-2$
- });
- addAnnotation
- (getContainsTagConstraint_SetGenerator(),
- source,
- new String[] {
- "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$
- "name", "set-generator" //$NON-NLS-1$ //$NON-NLS-2$
- });
- addAnnotation
- (getContainsTagConstraint_SatisfiesSet(),
- source,
- new String[] {
- "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$
- "name", "satisfies-set" //$NON-NLS-1$ //$NON-NLS-2$
- });
- }
-
-} //ConstraintsPackageImpl
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ContainsTagConstraintImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ContainsTagConstraintImpl.java
deleted file mode 100644
index d3fad7129..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/ContainsTagConstraintImpl.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ContainsTagConstraintImpl.java,v 1.3 2007/04/16 19:53:19 itrimble Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-
-import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator;
-
-import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage;
-import org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint;
-import org.eclipse.jst.jsf.validation.internal.constraints.TagSet;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Contains Tag Constraint</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl#getSetGenerator <em>Set Generator</em>}</li>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.ContainsTagConstraintImpl#getSatisfiesSet <em>Satisfies Set</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class ContainsTagConstraintImpl extends EObjectImpl implements ContainsTagConstraint {
- /**
- * The cached value of the '{@link #getSetGenerator() <em>Set Generator</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSetGenerator()
- * @generated
- * @ordered
- */
- protected SetGenerator setGenerator = null;
-
- /**
- * The cached value of the '{@link #getSatisfiesSet() <em>Satisfies Set</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSatisfiesSet()
- * @generated
- * @ordered
- */
- protected TagSet satisfiesSet = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected ContainsTagConstraintImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected EClass eStaticClass() {
- return ConstraintsPackage.Literals.CONTAINS_TAG_CONSTRAINT;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public SetGenerator getSetGenerator() {
- if (setGenerator != null && setGenerator.eIsProxy()) {
- InternalEObject oldSetGenerator = (InternalEObject)setGenerator;
- setGenerator = (SetGenerator)eResolveProxy(oldSetGenerator);
- if (setGenerator != oldSetGenerator) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR, oldSetGenerator, setGenerator));
- }
- }
- return setGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * @return the set generator
- * <!-- end-user-doc -->
- * @generated
- */
- public SetGenerator basicGetSetGenerator() {
- return setGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setSetGenerator(SetGenerator newSetGenerator) {
- SetGenerator oldSetGenerator = setGenerator;
- setGenerator = newSetGenerator;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR, oldSetGenerator, setGenerator));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public TagSet getSatisfiesSet() {
- if (satisfiesSet != null && satisfiesSet.eIsProxy()) {
- InternalEObject oldSatisfiesSet = (InternalEObject)satisfiesSet;
- satisfiesSet = (TagSet)eResolveProxy(oldSatisfiesSet);
- if (satisfiesSet != oldSatisfiesSet) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET, oldSatisfiesSet, satisfiesSet));
- }
- }
- return satisfiesSet;
- }
-
- /**
- * <!-- begin-user-doc -->
- * @return the tag set that must be satisfied
- * <!-- end-user-doc -->
- * @generated
- */
- public TagSet basicGetSatisfiesSet() {
- return satisfiesSet;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setSatisfiesSet(TagSet newSatisfiesSet) {
- TagSet oldSatisfiesSet = satisfiesSet;
- satisfiesSet = newSatisfiesSet;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET, oldSatisfiesSet, satisfiesSet));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR:
- if (resolve) return getSetGenerator();
- return basicGetSetGenerator();
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET:
- if (resolve) return getSatisfiesSet();
- return basicGetSatisfiesSet();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR:
- setSetGenerator((SetGenerator)newValue);
- return;
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET:
- setSatisfiesSet((TagSet)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void eUnset(int featureID) {
- switch (featureID) {
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR:
- setSetGenerator((SetGenerator)null);
- return;
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET:
- setSatisfiesSet((TagSet)null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SET_GENERATOR:
- return setGenerator != null;
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT__SATISFIES_SET:
- return satisfiesSet != null;
- }
- return super.eIsSet(featureID);
- }
-
-} //ContainsTagConstraintImpl
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagIdImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagIdImpl.java
deleted file mode 100644
index be7dbce24..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagIdImpl.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: TagIdImpl.java,v 1.2 2008/11/18 22:23:52 gkessler Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-
-import org.eclipse.emf.ecore.EClass;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-
-import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage;
-import org.eclipse.jst.jsf.validation.internal.constraints.TagId;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Tag Id</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl#getUri <em>Uri</em>}</li>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagIdImpl#getName <em>Name</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class TagIdImpl extends EObjectImpl implements TagId {
- /**
- * The default value of the '{@link #getUri() <em>Uri</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUri()
- * @generated
- * @ordered
- */
- protected static final String URI_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getUri() <em>Uri</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUri()
- * @generated
- * @ordered
- */
- protected String uri = URI_EDEFAULT;
-
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected TagIdImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected EClass eStaticClass() {
- return ConstraintsPackage.Literals.TAG_ID;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getUri() {
- return uri;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setUri(String newUri) {
- String oldUri = uri;
- uri = newUri;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.TAG_ID__URI, oldUri, uri));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.TAG_ID__NAME, oldName, name));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case ConstraintsPackage.TAG_ID__URI:
- return getUri();
- case ConstraintsPackage.TAG_ID__NAME:
- return getName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case ConstraintsPackage.TAG_ID__URI:
- setUri((String)newValue);
- return;
- case ConstraintsPackage.TAG_ID__NAME:
- setName((String)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void eUnset(int featureID) {
- switch (featureID) {
- case ConstraintsPackage.TAG_ID__URI:
- setUri(URI_EDEFAULT);
- return;
- case ConstraintsPackage.TAG_ID__NAME:
- setName(NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case ConstraintsPackage.TAG_ID__URI:
- return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri);
- case ConstraintsPackage.TAG_ID__NAME:
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (uri: "); //$NON-NLS-1$
- result.append(uri);
- result.append(", name: "); //$NON-NLS-1$
- result.append(name);
- result.append(')');
- return result.toString();
- }
-
-} //TagIdImpl
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagSetImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagSetImpl.java
deleted file mode 100644
index f3899144a..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/impl/TagSetImpl.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: TagSetImpl.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.impl;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.ecore.EClass;
-
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-
-import org.eclipse.emf.ecore.util.EObjectResolvingEList;
-
-import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage;
-import org.eclipse.jst.jsf.validation.internal.constraints.TagId;
-import org.eclipse.jst.jsf.validation.internal.constraints.TagSet;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Tag Set</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.jst.jsf.validation.internal.constraints.impl.TagSetImpl#getTags <em>Tags</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class TagSetImpl extends EObjectImpl implements TagSet {
- /**
- * The cached value of the '{@link #getTags() <em>Tags</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTags()
- * @generated
- * @ordered
- */
- protected EList tags = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected TagSetImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected EClass eStaticClass() {
- return ConstraintsPackage.Literals.TAG_SET;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList getTags() {
- if (tags == null) {
- tags = new EObjectResolvingEList(TagId.class, this, ConstraintsPackage.TAG_SET__TAGS);
- }
- return tags;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case ConstraintsPackage.TAG_SET__TAGS:
- return getTags();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case ConstraintsPackage.TAG_SET__TAGS:
- getTags().clear();
- getTags().addAll((Collection)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void eUnset(int featureID) {
- switch (featureID) {
- case ConstraintsPackage.TAG_SET__TAGS:
- getTags().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case ConstraintsPackage.TAG_SET__TAGS:
- return tags != null && !tags.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
-} //TagSetImpl
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsAdapterFactory.java
deleted file mode 100644
index ff1de0e99..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsAdapterFactory.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsAdapterFactory.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.jst.jsf.validation.internal.constraints.*;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage
- * @generated
- */
-public class ConstraintsAdapterFactory extends AdapterFactoryImpl {
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static ConstraintsPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ConstraintsAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = ConstraintsPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject)object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected ConstraintsSwitch modelSwitch =
- new ConstraintsSwitch() {
- public Object caseTagId(TagId object) {
- return createTagIdAdapter();
- }
- public Object caseTagSet(TagSet object) {
- return createTagSetAdapter();
- }
- public Object caseContainsTagConstraint(ContainsTagConstraint object) {
- return createContainsTagConstraintAdapter();
- }
- public Object defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- public Adapter createAdapter(Notifier target) {
- return (Adapter)modelSwitch.doSwitch((EObject)target);
- }
-
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagId <em>Tag Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.TagId
- * @generated
- */
- public Adapter createTagIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.validation.internal.constraints.TagSet <em>Tag Set</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.TagSet
- * @generated
- */
- public Adapter createTagSetAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint <em>Contains Tag Constraint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint
- * @generated
- */
- public Adapter createContainsTagConstraintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-
-} //ConstraintsAdapterFactory
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceFactoryImpl.java
deleted file mode 100644
index e0da2ca89..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceFactoryImpl.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsResourceFactoryImpl.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.util;
-
-import org.eclipse.emf.common.util.URI;
-
-import org.eclipse.emf.ecore.resource.Resource;
-
-import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
-
-import org.eclipse.emf.ecore.xmi.XMLResource;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Resource Factory</b> associated with the package.
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.util.ConstraintsResourceImpl
- * @generated
- */
-public class ConstraintsResourceFactoryImpl extends ResourceFactoryImpl {
- /**
- * Creates an instance of the resource factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ConstraintsResourceFactoryImpl() {
- super();
- }
-
- /**
- * Creates an instance of the resource.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Resource createResource(URI uri) {
- XMLResource result = new ConstraintsResourceImpl(uri);
- result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
- result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
-
- result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
-
- result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
- result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
-
- result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
- return result;
- }
-
-} //ConstraintsResourceFactoryImpl
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceImpl.java
deleted file mode 100644
index c397df097..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsResourceImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsResourceImpl.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.util;
-
-import org.eclipse.emf.common.util.URI;
-
-import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Resource </b> associated with the package.
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.util.ConstraintsResourceFactoryImpl
- * @generated
- */
-public class ConstraintsResourceImpl extends XMLResourceImpl {
- /**
- * Creates an instance of the resource.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param uri the URI of the new resource.
- * @generated
- */
- public ConstraintsResourceImpl(URI uri) {
- super(uri);
- }
-
-} //ConstraintsResourceImpl
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsSwitch.java
deleted file mode 100644
index 9628616c4..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsSwitch.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsSwitch.java,v 1.2 2007/04/09 02:40:07 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.util;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.jst.jsf.validation.internal.constraints.*;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage
- * @generated
- */
-public class ConstraintsSwitch {
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static ConstraintsPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ConstraintsSwitch() {
- if (modelPackage == null) {
- modelPackage = ConstraintsPackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * @param theEObject
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public Object doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * @param theEClass
- * @param theEObject
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected Object doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- List eSuperTypes = theEClass.getESuperTypes();
- return
- eSuperTypes.isEmpty() ?
- defaultCase(theEObject) :
- doSwitch((EClass)eSuperTypes.get(0), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * @param classifierID
- * @param theEObject
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected Object doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case ConstraintsPackage.TAG_ID: {
- TagId tagId = (TagId)theEObject;
- Object result = caseTagId(tagId);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case ConstraintsPackage.TAG_SET: {
- TagSet tagSet = (TagSet)theEObject;
- Object result = caseTagSet(tagSet);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case ConstraintsPackage.CONTAINS_TAG_CONSTRAINT: {
- ContainsTagConstraint containsTagConstraint = (ContainsTagConstraint)theEObject;
- Object result = caseContainsTagConstraint(containsTagConstraint);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- default: return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpretting the object as an instance of '<em>Tag Id</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>Tag Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public Object caseTagId(TagId object) {
- return null;
- }
-
- /**
- * Returns the result of interpretting the object as an instance of '<em>Tag Set</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>Tag Set</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public Object caseTagSet(TagSet object) {
- return null;
- }
-
- /**
- * Returns the result of interpretting the object as an instance of '<em>Contains Tag Constraint</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>Contains Tag Constraint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public Object caseContainsTagConstraint(ContainsTagConstraint object) {
- return null;
- }
-
- /**
- * Returns the result of interpretting 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>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public Object defaultCase(EObject object) {
- return null;
- }
-
-} //ConstraintsSwitch
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsXMLProcessor.java
deleted file mode 100644
index 3d80420bb..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/constraints/util/ConstraintsXMLProcessor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: ConstraintsXMLProcessor.java,v 1.1 2007/02/28 21:16:02 cbateman Exp $
- */
-package org.eclipse.jst.jsf.validation.internal.constraints.util;
-
-import java.util.Map;
-
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.emf.ecore.xmi.util.XMLProcessor;
-
-import org.eclipse.jst.jsf.validation.internal.constraints.ConstraintsPackage;
-
-/**
- * This class contains helper methods to serialize and deserialize XML documents
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-public class ConstraintsXMLProcessor extends XMLProcessor {
- /**
- * Public constructor to instantiate the helper.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ConstraintsXMLProcessor() {
- super((EPackage.Registry.INSTANCE));
- ConstraintsPackage.eINSTANCE.eClass();
- }
-
- /**
- * Register for "*" and "xml" file extensions the ConstraintsResourceFactoryImpl factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected Map getRegistrations() {
- if (registrations == null) {
- super.getRegistrations();
- registrations.put(XML_EXTENSION, new ConstraintsResourceFactoryImpl());
- registrations.put(STAR_EXTENSION, new ConstraintsResourceFactoryImpl());
- }
- return registrations;
- }
-
-} //ConstraintsXMLProcessor
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ASTSemanticValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ASTSemanticValidator.java
deleted file mode 100644
index 1ee65f51c..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ASTSemanticValidator.java
+++ /dev/null
@@ -1,612 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.MethodType;
-import org.eclipse.jst.jsf.common.internal.types.NullLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType;
-import org.eclipse.jst.jsf.common.internal.types.StringLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
-import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver;
-import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
-import org.eclipse.jst.jsf.context.symbol.IInstanceSymbol;
-import org.eclipse.jst.jsf.context.symbol.IPropertySymbol;
-import org.eclipse.jst.jsf.context.symbol.ISymbol;
-import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory;
-import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver;
-import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.jst.jsf.validation.internal.el.operators.BinaryOperator;
-import org.eclipse.jst.jsf.validation.internal.el.operators.BracketOperator;
-import org.eclipse.jst.jsf.validation.internal.el.operators.DotOperator;
-import org.eclipse.jst.jsf.validation.internal.el.operators.TernaryChoiceOperator;
-import org.eclipse.jst.jsf.validation.internal.el.operators.UnaryOperator;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTAddExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTAndExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTChoiceExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTEqualityExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTFunctionInvocation;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTLiteral;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTMultiplyExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTOperatorExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTOrExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTRelationalExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTUnaryExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValue;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValuePrefix;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTValueSuffix;
-import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParser;
-import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserConstants;
-import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserVisitor;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ParseException;
-import org.eclipse.jst.jsp.core.internal.java.jspel.SimpleNode;
-import org.eclipse.jst.jsp.core.internal.java.jspel.Token;
-
-
-class ASTSemanticValidator implements JSPELParserVisitor, IExpressionSemanticValidator
-{
- private final IFile _targetFile;
- private final ASTExpression _expr;
- private final IStructuredDocumentContext _context;
- private final ISymbolContextResolver _symbolResolver;
-// private final List<IMessage> _messages;
- private final EvaluationTracker _tracker;
- private final DiagnosticFactory _diagnosticFactory;
- private final IValidationReporter _reporter;
-
- ASTSemanticValidator(final ASTExpression expr,
- final IStructuredDocumentContext context,
- final IStructuredDocumentSymbolResolverFactory symbolResolverFactory,
- final IValidationReporter reporter)
- {
- final IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE
- .getWorkspaceContextResolver(context);
-
- if (resolver != null)
- {
- _targetFile = (IFile) resolver.getResource();
- }
- else
- {
- _targetFile = null;
- }
-
- _expr = expr;
- _context = context;
- _symbolResolver = symbolResolverFactory.getSymbolContextResolver(context);
- _tracker = new EvaluationTracker();
- _diagnosticFactory = new DiagnosticFactory();
- _reporter = reporter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.validation.internal.el.IExpressionSemanticValidator#validate()
- */
- public void validate()
- {
- _expr.jjtAccept(this, _tracker);
- }
-
- public Object visit(final ASTAddExpression node, final Object data)
- {
- performBinaryEvaluation(node, (EvaluationTracker)data);
- return data;
- }
-
- public Object visit(final ASTAndExpression node, final Object data)
- {
- performBinaryEvaluation(node, (EvaluationTracker)data);
- return data;
- }
-
- public Object visit(final ASTChoiceExpression node, final Object data)
- {
- if (node.jjtGetNumChildren() != 3)
- {
- throw new AssertionError("Binary operators should always have two sub-expressions"); //$NON-NLS-1$
- }
-
- // evaluate choice argument
- node.jjtGetChild(0).jjtAccept(this, data);
- final ValueType choiceArg = ((EvaluationTracker)data).getValueType();
- // evaluate when true argument
- node.jjtGetChild(1).jjtAccept(this, data);
- final ValueType whenTrueArg = ((EvaluationTracker)data).getValueType();
- //evaluate when false argument
- node.jjtGetChild(2).jjtAccept(this, data);
- final ValueType whenFalseArg = ((EvaluationTracker)data).getValueType();
-
-
- if (choiceArg != null && whenTrueArg != null && whenFalseArg != null)
- {
- final TernaryChoiceOperator operator =
- new TernaryChoiceOperator(_diagnosticFactory);
-
- final Diagnostic diagnostic =
- operator.validate(choiceArg/* whenTrueArg, whenFalseArg*/);
-
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- final Token firstToken = node.getFirstToken();
- final int offset = _context.getDocumentPosition() + firstToken.beginColumn - 1;
- final int length = node.getLastToken().endColumn - firstToken.beginColumn+1;
- _reporter.report(diagnostic, offset, length);
- }
-
- ((EvaluationTracker)data).setType(operator.perform(choiceArg, whenTrueArg, whenFalseArg));
- }
- else
- {
- ((EvaluationTracker)data).setType(null);
- }
-
- return data;
- }
-
- public Object visit(final ASTEqualityExpression node, final Object data)
- {
- performBinaryEvaluation(node, (EvaluationTracker)data);
- return data;
- }
-
- public Object visit(final ASTExpression node, final Object data) {
- return node.childrenAccept(this, data);
- }
-
- public Object visit(final ASTFunctionInvocation node, final Object data)
- {
- // when we see a function invocation, null the type
- // we do not validate function invocations currently
- final Object retVal = node.childrenAccept(this, data);
- ((EvaluationTracker)data).setType(null);
- return retVal;
- }
-
- public Object visit(final ASTLiteral node, final Object data)
- {
- // note, there is an implicit assumption here that literals
- // are all terminals (leafs in the tree)
- if (node.jjtGetNumChildren() > 0)
- {
- throw new AssertionError("Literals should be terminal"); //$NON-NLS-1$
- }
-
- LiteralType type = null;
-
- final Token literalToken = node.getFirstToken();
-
- switch (literalToken.kind)
- {
- case JSPELParserConstants.STRING_LITERAL:
- type = new StringLiteralType(stripQuotes(literalToken.image));
- break;
-
- case JSPELParserConstants.INTEGER_LITERAL:
- type = new IntegerLiteralType(Long.parseLong(literalToken.image));
- break;
-
- case JSPELParserConstants.FLOATING_POINT_LITERAL:
- type = new FloatLiteralType(Double.parseDouble(literalToken.image));
- break;
-
- case JSPELParserConstants.FALSE:
- type = BooleanLiteralType.FALSE;
- break;
-
- case JSPELParserConstants.TRUE:
- type = BooleanLiteralType.TRUE;
- break;
-
- case JSPELParserConstants.NULL:
- type = NullLiteralType.SINGLETON;
- break;
-
- default:
- JSFCorePlugin.log("Unknown EL literal: " +literalToken.toString(), new Throwable("This throwable simply used to mark a stack trace")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- ((EvaluationTracker)data).setType(type);
- return data;
- }
-
- private String stripQuotes(final String stringLiteral)
- {
- if (stringLiteral.startsWith("'") //$NON-NLS-1$
- || stringLiteral.startsWith("\"")) //$NON-NLS-1$
-
- {
- if (stringLiteral.length() > 2)
- {
- // take 'literal' -> literal
- return stringLiteral.substring(1, stringLiteral.length()-1);
- }
- // if only two characters, then the empty string
- return ""; //$NON-NLS-1$
- }
-
- return stringLiteral;
- }
-
- public Object visit(final ASTMultiplyExpression node, final Object data)
- {
- performBinaryEvaluation(node, (EvaluationTracker)data);
- return data;
- }
-
- public Object visit(final ASTOrExpression node, final Object data)
- {
- performBinaryEvaluation(node, (EvaluationTracker)data);
- return data;
- }
-
- public Object visit(final ASTRelationalExpression node, final Object data)
- {
- performBinaryEvaluation(node, (EvaluationTracker)data);
- return data;
- }
-
- public Object visit(final ASTUnaryExpression node, final Object data)
- {
- // assertion here is that this expression decomposes:
- // UnaryExpr -> Value
- // UnaryExpr -> UnaryOp UnaryExpression
- // since UnaryOp is a terminal (-,!,not,empty) node will
- // always have exactly one child
- node.childrenAccept(this, data);
- final SignatureBasedType type = ((EvaluationTracker)data).getType();
-
- if (type != null)
- {
- final Token firstToken = node.getFirstToken();
- if (UnaryOperator.isUnaryOperator(firstToken))
- {
- if (type instanceof ValueType)
- {
- final UnaryOperator unaryOp = UnaryOperator.createUnaryOperator(firstToken, _diagnosticFactory);
- final Diagnostic diagnostic = unaryOp.validate((ValueType)type);
-
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- final int offset = _context.getDocumentPosition() + firstToken.beginColumn - 1;
- final int length = node.getLastToken().endColumn - firstToken.beginColumn+1;
- _reporter.report(diagnostic, offset, length);
- }
-
- ((EvaluationTracker)data).
- setType(unaryOp.performOperation ((ValueType)type));
- }
- // cannot apply operations to method bindings
- else
- {
- final int offset = _context.getDocumentPosition() +
- firstToken.beginColumn - 1;
- final int length = node.getLastToken().endColumn -
- firstToken.beginColumn+1;
-
- Diagnostic diagnostic =
- _diagnosticFactory.create_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING();
-
- _reporter.report(diagnostic, offset, length);
- }
- }
- }
-
- return data;
- }
-
- public Object visit(final ASTValue node, final Object data) {
- final ValueExpressionTracker tracker = new ValueExpressionTracker();
-
- ((EvaluationTracker)data).setValueTracker(tracker);
-
- node.childrenAccept(this, data);
-
- final SignatureBasedType type = ((EvaluationTracker)data).getType();
-
- // now check the tracker. If the last property in the expression
- // is non-null (i.e. the value has one or more suffices) then we
- // to very the leaf node (i.e. 'z' in #{x.y.z}) is more than just
- // an intermediate value used to get to other properties
- if (type instanceof IObjectSymbolBasedValueType
- && ((IObjectSymbolBasedValueType)type).getSymbol() instanceof IPropertySymbol
- && ((IPropertySymbol)((IObjectSymbolBasedValueType)type).getSymbol()).isIntermediate())
- {
- final int offset = tracker.getCurPropertySymbolOffset();
- final int length = tracker.getCurPropertySymbolLength();
- final Diagnostic diagnostic =
- _diagnosticFactory.create_MEMBER_IS_INTERMEDIATE(
- ((IPropertySymbol)((IObjectSymbolBasedValueType)type).getSymbol()).getName());
- _reporter.report(diagnostic, offset, length);
- }
-
- return data;
- }
-
- public Object visit(final ASTValuePrefix node, final Object data)
- {
- if (node.jjtGetNumChildren() == 0)
- {
- final Token token = node.getFirstToken();
- final String image = token.image;
-
- final ISymbol symbol = _symbolResolver.getVariable(image);
-
- if (symbol == null)
- {
- final int offset =
- _context.getDocumentPosition() + token.beginColumn - 1;
- final int length = token.endColumn - token.beginColumn + 1;
-
- final Diagnostic diagnostic =
- _diagnosticFactory.create_VARIABLE_NOT_FOUND(image);
-
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- _reporter.report(diagnostic, offset, length);
- }
- }
- else if (symbol instanceof IInstanceSymbol)
- {
- final IObjectSymbolBasedValueType symbolType =
- IObjectSymbolBasedValueType.getInstance(symbol);
- ((EvaluationTracker) data).setType(symbolType);
- }
- }
-
- return node.childrenAccept(this, data);
- }
-
- public Object visit(final ASTValueSuffix node, final Object data)
- {
- final ValueExpressionTracker tracker = ((EvaluationTracker) data).getValueTracker();
- final SignatureBasedType type = ((EvaluationTracker) data).getType();
-
- if (type instanceof IObjectSymbolBasedValueType)
- {
- final IObjectSymbolBasedValueType symbolType =
- (IObjectSymbolBasedValueType) type;
- final Token firstToken = node.getFirstToken();
-
- if (node.jjtGetNumChildren() == 0
- && firstToken.kind == JSPELParserConstants.DOT)
- {
- final Token dotId = node.getLastToken();
-
- final int offset =
- _context.getDocumentPosition() + dotId.beginColumn - 1;
- final int length = dotId.endColumn - dotId.beginColumn + 1;
-
- final DotOperator dotOp = new DotOperator(_diagnosticFactory, _targetFile, _symbolResolver);
-
- final StringLiteralType suffixLiteral = new StringLiteralType(dotId.image);
- final Diagnostic diagnostic =
- dotOp.validate(symbolType,
- suffixLiteral);
-
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- _reporter.report(diagnostic, offset, length);
- ((EvaluationTracker) data).setType(null);
- }
- else
- {
- // // if the base (value-a) is a map, then using the bracket value-a['y'] type
- // // syntax is recommended. Note that we do this here instead of
- // // DotOperator so that we don't tie the default property resolver
- // // behaviour to that operator class. If someone changes the rules
- // // of how the prop resolver interprets the base, then they may want to
- // // write their own validator that doesn't do this
- // if (symbolType.getSymbol().supportsCoercion(TypeConstants.TYPE_MAP))
- // {
- // _messages.add(ValidationMessageFactory.createFromDiagnostic(
- // DiagnosticFactory.create_BINARY_OP_DOT_WITH_VALUEA_MAP_SHOULD_USE_ARRAY
- // (symbolType.getSymbol().getName(), dotId.image),
- // startOffset, length, _targetFile));
- // }
-
- ((EvaluationTracker) data).setType(dotOp.performOperation(symbolType,
- suffixLiteral));
- tracker.setCurMemberSymbol(offset, length);
- }
-
- // we finished with the single dot suffix here
- return data;
- }
- else if (firstToken.kind == JSPELParserConstants.LBRACKET)
- {
- final EvaluationTracker subExprTracker = new EvaluationTracker();
- node.childrenAccept(this, subExprTracker);
-
- final SignatureBasedType subExprType = subExprTracker.getType();
-
- if (subExprType instanceof ValueType)
- {
- final Token lastToken = node.getLastToken();
- final int offset =
- _context.getDocumentPosition() + firstToken.beginColumn - 1;
- final int length = lastToken.endColumn - firstToken.beginColumn + 1;
-
- final BracketOperator bracketOperator = new BracketOperator(_diagnosticFactory, _targetFile, _symbolResolver);
-
- final Diagnostic diagnostic =
- bracketOperator.validate(symbolType,
- (ValueType)subExprType);
-
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- _reporter.report(diagnostic, offset, length);
- ((EvaluationTracker) data).setType(null);
- }
- else
- {
- ((EvaluationTracker) data).setType(bracketOperator.performOperation(symbolType,
- (ValueType)subExprType));
- tracker.setCurMemberSymbol(offset, length);
- }
- }
- // we are finished with the bracketed suffix at this point.
- return data;
- }
- }
-
- // don't bother to accept children, since if we haven't done
- // something above, there's not much sensible we can do with it
- // clear the type first though
- ((EvaluationTracker) data).setType(null);
- return data; //node.childrenAccept(this, data);
- }
-
- public Object visit(final SimpleNode node, final Object data) {
- return node.childrenAccept(this, data);
- }
-
- /**
- * Copies stored messages into the validation reporter
- * @param validator
- * @param reporter
- */
-// public void reportFindings(final IValidator validator, final IReporter reporter)
-// {
-// for (final IMessage message : _messages)
-// {
-// // don't report messages that have no severity.
-// if ((message.getSeverity() & IMessage.ALL_MESSAGES) != 0)
-// {
-// reporter.addMessage(validator, message);
-// }
-// }
-// }
-
- private void performBinaryEvaluation(final ASTOperatorExpression node, final EvaluationTracker tracker)
- {
- if (node.jjtGetNumChildren() < 2)
- {
- throw new AssertionError("Binary operators should always have at least two sub-expressions"); //$NON-NLS-1$
- }
- else if (node.getOperatorTokens().size() != node.jjtGetNumChildren()-1)
- {
- throw new AssertionError("Binary operators should always have one operator token less than number of sub-expressions"); //$NON-NLS-1$
- }
-
- // evaluate left-most argument
- node.jjtGetChild(0).jjtAccept(this, tracker);
-
- ValueType curType = getValueTypeForBinaryOperation(tracker.getType(), (SimpleNode) node.jjtGetChild(0));
-
- for (int child = 1; child < node.jjtGetNumChildren(); child++)
- {
- // evaluate next argument running left-to-right
- node.jjtGetChild(child).jjtAccept(this, tracker);
- final ValueType secondType =
- getValueTypeForBinaryOperation(tracker.getType(), (SimpleNode) node.jjtGetChild(child));
-
- if (curType != null && secondType != null)
- {
- final BinaryOperator operator =
- BinaryOperator.getBinaryOperator((Token)node.getOperatorTokens().get(child-1), _diagnosticFactory, _context);
-
- final Diagnostic diagnostic = operator.validate(curType, secondType);
-
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- final Token firstToken = node.getFirstToken();
- final int offset = _context.getDocumentPosition() + firstToken.beginColumn - 1;
- final int length = node.getLastToken().endColumn - firstToken.beginColumn+1;
- _reporter.report(diagnostic, offset, length);
- }
-
- curType = operator.performOperation(curType, secondType);
- }
- }
-
- tracker.setType(curType);
- }
-
- private ValueType getValueTypeForBinaryOperation(final SignatureBasedType type, final SimpleNode node)
- {
- if (type instanceof ValueType)
- {
- return (ValueType) type;
- }
- else if (type instanceof MethodType)
- {
- final int offset = _context.getDocumentPosition() + node.getFirstToken().beginColumn - 1;
- final int length = node.getLastToken().endColumn - node.getFirstToken().beginColumn+1;
- final Diagnostic diagnostic = _diagnosticFactory.create_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING();
- _reporter.report(diagnostic, offset, length);
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.validation.internal.el.IExpressionSemanticValidator#getMessages()
- */
-// public List getMessages()
-// {
-// if (!_validatorHasBeenCalled)
-// {
-// throw new AssertionError("Should not call getMessages before validate has been called");
-// }
-// return _messages;
-// }
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.validation.internal.el.IExpressionSemanticValidator#getExpressionType()
- */
- public SignatureBasedType getExpressionType()
- {
- return _tracker.getType();
- }
-
- /**
- * @param args
- * @throws IOException
- * @throws ParseException
- */
- public static void main(final String[] args) throws IOException, ParseException
- {
- String elText = ""; //$NON-NLS-1$
- int nextCharacter;
-
- while(((nextCharacter = System.in.read()) != -1))
- {
- final char nextChar = (char) nextCharacter;
-
- if (nextChar == '\n')
- {
- final JSPELParser parser = JSPELParser.createParser(elText);
- final ASTExpression expr = parser.Expression();
- expr.dump(""); //$NON-NLS-1$
-
- elText = ""; //$NON-NLS-1$
- }
- else
- {
- elText += nextChar;
- }
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ELExpressionValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ELExpressionValidator.java
deleted file mode 100644
index 71ccead6b..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ELExpressionValidator.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.CompositeType;
-import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType;
-import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
-import org.eclipse.jst.jsf.designtime.resolver.IStructuredDocumentSymbolResolverFactory;
-import org.eclipse.jst.jsf.validation.internal.IJSFViewValidator.IValidationReporter;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ASTExpression;
-import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParser;
-import org.eclipse.jst.jsp.core.internal.java.jspel.ParseException;
-import org.eclipse.jst.jsp.core.internal.java.jspel.Token;
-import org.eclipse.jst.jsp.core.internal.java.jspel.TokenMgrError;
-
-/**
- * Validates a single expression string
- *
- * @author cbateman
- *
- */
-public class ELExpressionValidator
-{
- private final IStructuredDocumentContext _context;
- private final String _elText;
- private final DiagnosticFactory _diagnosticFactory;
-
- private ASTSemanticValidator _semanticValidator;
- private final IStructuredDocumentSymbolResolverFactory _symbolResolverFactory;
- private final IValidationReporter _reporter;
-
- /**
- * @param context
- * @param elText
- * @param symbolResolverFactory
- * @param reporter
- */
- public ELExpressionValidator(final IStructuredDocumentContext context,
- final String elText,
- final IStructuredDocumentSymbolResolverFactory symbolResolverFactory,
- final IValidationReporter reporter)
- {
- _context = context;
- _elText = elText;
- _diagnosticFactory = new DiagnosticFactory();
- _symbolResolverFactory = symbolResolverFactory;
- _reporter = reporter;
- }
-
- /**
- * Validates a single EL expression in an XML attribute value
- * @return an ASTExpression for the node
- */
- public ASTExpression validateXMLNode()
- {
- JSPELParser elParser = JSPELParser.createParser(_elText);
- // =
- try {
- //final long startParsing = System.currentTimeMillis();
- final ASTExpression expr = elParser.Expression();
- //final long endParsing = System.currentTimeMillis();
- //final long startSemantics = System.currentTimeMillis();
- validateSemantics(expr, _context);
- //final long endSemantics = System.currentTimeMillis();
-
- //System.out.println("Time to parse '"+elText+"' = "+(endParsing-startParsing));
- //System.out.println("Time to semantic checking '"+elText+"' = "+(endSemantics-startSemantics));
-
- // if the parser bailed before parsing the whole
- // expression, raise a warning that there is probably
- // some syntatical issue
- if (expr.getLastToken().endColumn < _elText.trim().length()-1)
- {
- final int offset = _context.getDocumentPosition() + expr.getLastToken().endColumn;
- final int length = _elText.trim().length() - expr.getLastToken().endColumn;
- final Diagnostic diagnostic =
- _diagnosticFactory.create_GENERAL_SYNTAX_ERROR();
-
- _reporter.report(diagnostic, offset, length);
- }
-
- return expr;
- }
- catch (ParseException e) {
- Token curTok = e.currentToken;
- int offset = _context.getDocumentPosition() + curTok.beginColumn;
- int length = curTok.endColumn - curTok.beginColumn + 1;
- final Diagnostic diagnostic = _diagnosticFactory.create_GENERAL_SYNTAX_ERROR();
- _reporter.report(diagnostic, offset, length);
- return null;
- }
- catch (TokenMgrError te) {
- final int offset = _context.getDocumentPosition();
- final int length = _elText.length();
- final Diagnostic diagnostic =
- _diagnosticFactory.create_GENERAL_SYNTAX_ERROR();
- _reporter.report(diagnostic, offset, length);
- return null;
- }
- }
-
- /**
- * @return the type of the expression or null if
- * the type could not be evaluated
- */
- public CompositeType getExpressionType()
- {
- if (_semanticValidator != null)
- {
- final SignatureBasedType type =
- _semanticValidator.getExpressionType();
-
- if (type != null)
- {
- return type.toCompositeType();
- }
- }
-
- return null;
- }
-
-
- /**
- * @return the EL semantic validator for this expression validitor or
- * null if one has not yet been constructor. One will only be construct
- * if validate is called and the expression does not have any syntax errors.
- */
- public IExpressionSemanticValidator getSemanticValidator()
- {
- return _semanticValidator;
- }
-
- /**
- * Validates the context-specific data for one EL expressino
- *
- * @param expr
- * @param file
- * @param reporter
- * @param context
- */
- private void validateSemantics(ASTExpression expr,IStructuredDocumentContext context)
- {
- _semanticValidator = new ASTSemanticValidator(expr, context, _symbolResolverFactory, _reporter);
- _semanticValidator.validate();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/EvaluationTracker.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/EvaluationTracker.java
deleted file mode 100644
index aec1b214d..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/EvaluationTracker.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el;
-
-import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-
-/**
- * Used to track the evaulation of an EL expression AST
- *
- * @author cbateman
- *
- */
-class EvaluationTracker
-{
- private ValueExpressionTracker _valueTracker;
- private SignatureBasedType _type;
-
- /**
- * @return the current value expression tracker or null if not set
- */
- public ValueExpressionTracker getValueTracker() {
- return _valueTracker;
- }
-
- /**
- * @param valueTracker
- */
- public void setValueTracker(ValueExpressionTracker valueTracker) {
- _valueTracker = valueTracker;
- }
-
- /**
- * @return the currently resolved type or null if not yet resolved
- * or not able to resolve
- */
- public SignatureBasedType getType() {
- return _type;
- }
-
- /**
- * @param type
- */
- public void setType(SignatureBasedType type) {
- _type = type;
- }
-
- /**
- * @return if getType() is a ValueType, returns it otherwise null
- */
- public ValueType getValueType()
- {
- if (_type instanceof ValueType)
- {
- return (ValueType) _type;
- }
-
- return null;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/IExpressionSemanticValidator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/IExpressionSemanticValidator.java
deleted file mode 100644
index 636fffe33..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/IExpressionSemanticValidator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.el;
-
-import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType;
-
-/**
- * Exposes certain parts of the ASTSemanticValidator without exposing the whole class
- * Primarily this was done for JUnit testing
- *
- * @author cbateman
- *
- */
-public interface IExpressionSemanticValidator {
-
- /**
- * Performs the semantic validatino
- */
- public abstract void validate();
-
- /**
- * @return the value type of fully resolved expression
- * or null if not resolved (or could not be resolved)
- */
- public abstract SignatureBasedType getExpressionType();
-
-} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/QuickFixAssistant.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/QuickFixAssistant.java
deleted file mode 100644
index 89ff50f04..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/QuickFixAssistant.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el;
-
-
-/**
- * @author cbateman
- *
- */
-public class QuickFixAssistant //extends CorrectionAssistantProvider
-{
-/* public IContentAssistant getCorrectionAssistant(ISourceViewer sourceViewer) {
- IContentAssistant ca = null;
-
- if (sourceViewer != null) {
- ContentAssistant assistant = new ContentAssistant();
-
- if (sourceViewer != null) {
- IContentAssistProcessor correctionProcessor = new CorrectionProcessorXML(sourceViewer);
- assistant.setContentAssistProcessor(correctionProcessor, IJSPPartitions.JSP_DEFAULT_EL2);
- }
- ca = assistant;
- }
-
- return ca;
-
- }
-
- private class CorrectionProcessorXML extends StructuredCorrectionProcessor {
- /**
- * quick assist processor
- */
-/* protected IQuickAssistProcessor fQuickAssistProcessor;
- /**
- * quick fix processor
- */
-/* protected IQuickFixProcessor fQuickFixProcessor;
-
- /**
- * @param sourceViewer
- */
-/* public CorrectionProcessorXML(ISourceViewer sourceViewer) {
- super(sourceViewer);
- }
-
- protected IQuickAssistProcessor getQuickAssistProcessor() {
- if (fQuickAssistProcessor == null)
- fQuickAssistProcessor = new IQuickAssistProcessor()
- {
- public boolean canAssist(StructuredTextViewer viewer, int offset)
- {
- return true;
- }
-
- /**
- * Collects proposals for assistant at the given offset.
- */
-/* public ICompletionProposal[] getProposals(StructuredTextViewer viewer, int offset) throws CoreException
- {
- final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE.getContext(viewer, offset);
- final ITextRegionContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE.getTextRegionResolver(context);
-
- if (resolver == null)
- {
- return new ICompletionProposal[0];
- }
-
- final String regionType = resolver.getRegionType();
- final List proposals = new ArrayList();
-
- if (DOMJSPRegionContexts.JSP_VBL_CONTENT.equals(regionType))
- {
- final String elText = resolver.getRegionText();
- final StringReader reader = new StringReader(elText);
- final JSPELParser parser = new JSPELParser(reader);
-
- try
- {
- final ASTExpression expr = parser.Expression();
- final IExpressionSemanticValidator validator = new ASTSemanticValidator(expr, context);
- validator.validate();
-
-// for (final Iterator it = validator.getMessages().iterator(); it.hasNext();)
-// {
-// // TODO:MyLocalizedMessage message = (MyLocalizedMessage) it.next();
-//
-// if (message.appliesTo(offset))
-// {
- throw new UnsupportedOperationException("TODO:");
-// switch(message.getErrorCode())
-// {
- //TODO:
-// case Messages.ERROR_CODE_BEANNAME_NOT_FOUND:
-// {
-// final String beanName =
-// (String) message.getAttribute("name");
-// proposals.add(new ELContentAssistProposal(beanName, ((IFile)message.getTargetObject()).getProject()));
-// }
-// break;
-// }
-// }
-// }
- }
- catch (ParseException pe)
- {
- // left empty on purpose
- }
- }
-
- return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[0]);
- }
- };
-
- return fQuickAssistProcessor;
- }
-
- protected IQuickFixProcessor getQuickFixProcessor() {
- if (fQuickFixProcessor == null)
- {
- // TODO: should use the approach where possible, but the Annotation doesn't pass
- // enough info
- fQuickFixProcessor = new QuickFixProcessorXML()
- {
- public boolean canFix(Annotation annnotation)
- {
- return true;
- }
-
- public ICompletionProposal[] getProposals(Annotation annnotation) throws CoreException
- {
- return new ICompletionProposal[0];
- }
- };
- }
-
- return fQuickFixProcessor;
- }
- }*/
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ValueExpressionTracker.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ValueExpressionTracker.java
deleted file mode 100644
index 702f997a6..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/ValueExpressionTracker.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el;
-
-
-class ValueExpressionTracker
-{
- private int _curPropertySymbolOffset;
- private int _curPropertySymbolLength;
-
- /**
- * @param offset
- * @param length
- */
- public void setCurMemberSymbol(int offset, int length)
- {
- _curPropertySymbolOffset = offset;
- _curPropertySymbolLength = length;
- }
-
- /**
- * @return the offset of the current property symbol or 0 if no current property symbol
- */
- public int getCurPropertySymbolOffset()
- {
- return _curPropertySymbolOffset;
- }
-
- /**
- * @return the length of the current property symbol or 0 if no current property symbol
- */
- public int getCurPropertySymbolLength()
- {
- return _curPropertySymbolLength;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/DiagnosticFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/DiagnosticFactory.java
deleted file mode 100644
index 64e8381d4..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/DiagnosticFactory.java
+++ /dev/null
@@ -1,561 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation7
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.diagnostics;
-
-import java.text.MessageFormat;
-
-import org.eclipse.emf.common.util.BasicDiagnostic;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.validation.internal.ELValidationPreferences;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Factory for all operator diagnostics. Class should
- * not be implemented, instantiated or sub-classed.
- *
- * @author cbateman
- *
- */
-public final class DiagnosticFactory
-{
- /**
- * The id used in the source field of all Diagnostic's created by this factory
- * to uniquely identify EL validation as their source type.
- */
- public final static String SOURCE_ID = "org.eclipse.jst.jsf.validation.el.Diagnostics";//$NON-NLS-1$
-
- /**
- * Problem id
- */
- public final static int BINARY_OP_BOTH_OPERANDS_NULL_ID = 0;
- /**
- * Problem id
- */
- public final static int BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID = 1;
- /**
- * Problem id
- */
- public final static int BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID = 2;
- /**
- * Problem id
- */
- public final static int BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID = 3;
- /**
- * Problem id
- */
- public final static int BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID = 4;
- /**
- * Problem id
- */
- public final static int BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID = 5;
- /**
- * Problem id
- */
- public final static int BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID = 6;
- /**
- * Problem id
- */
- public final static int BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID = 7;
- /**
- * Problem id
- */
- public final static int BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID = 8;
- /**
- * Problem id
- */
- public final static int BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID = 9;
- /**
- * Problem id
- */
- public final static int UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID = 10;
- /**
- * Problem id
- */
- public final static int UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID = 11;
- /**
- * Problem id
- */
- public final static int UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID = 12;
- /**
- * Problem id
- */
- public final static int UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID = 13;
- /**
- * Problem id
- */
- public final static int UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID = 14;
- /**
- * Problem id
- */
- public final static int TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID = 15;
- /**
- * Problem id
- */
- public final static int TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID = 16;
- /**
- * Problem id
- */
- public final static int UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID = 17;
- /**
- * Problem id
- */
- public final static int CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID = 18;
- /**
- * Problem id
- */
- public final static int MEMBER_NOT_FOUND_ID = 19;
- /**
- * Problem id
- */
- public final static int VARIABLE_NOT_FOUND_ID = 20;
- /**
- * Problem id
- */
- public final static int MISSING_CLOSING_EXPR_BRACKET_ID = 21;
- /**
- * Problem id
- */
- public final static int GENERAL_SYNTAX_ERROR_ID = 22;
- /**
- * Problem id
- */
- public final static int EMPTY_EL_EXPRESSION_ID = 23;
-
- /**
- *
- */
- public final static int BINARY_OP_DOT_WITH_VALUEB_NULL_ID = 24;
-
- /**
- * Identifies a problem where we have x.y and x is a map. In this case
- * the recommend syntax is x['y']
- */
- public final static int BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID = 25;
-
- /**
- * Indicates that a numeric array accessor is being used with a value
- * which is either < 0 or may be greater than the assumed size of the array
- */
- public final static int POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID = 26;
-
- /**
- * Identifies the problem where an expr like bean.enumProp == 'blah'
- * but 'blah' does not match any of the possible enum constants, meaning
- * that the operation will always resolve to a constant value (in this case false)
- */
- public final static int BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID = 27;
-
- /**
- * Identifies a problem where two enum variables are compared but the enums are
- * not compatible. i.e. bean.enum1 < bean.enum2. Enum.compareTo() may throw
- * an exception in this case (CCE).
- */
- public final static int BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID = 28;
-
- /**
- * Indicates a situation such as x.y where x is a bundle and
- * 'x.y.z' exists, but x.y while partially valid, does not have a value
- * associated.
- */
- public final static int MEMBER_IS_INTERMEDIATE_ID = 29;
-
- /**
- * Count of ids
- */
- public final static int NUM_IDS = 30;
-
- /**
- * @param operatorName
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_BOTH_OPERANDS_NULL(final String operatorName)
- {
- final String message = NLS.bind(
- Messages.BINARY_OP_BOTH_OPERANDS_NULL, operatorName);
- return create(BINARY_OP_BOTH_OPERANDS_NULL_ID, message);
- }
-
- private static Diagnostic DIAGNOSTIC_POSSIBLE_DIV_BY_ZERO;
-
- /**
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO()
- {
- if (DIAGNOSTIC_POSSIBLE_DIV_BY_ZERO == null)
- {
- final String message = Messages.POSSIBLE_DIV_BY_ZERO;
- DIAGNOSTIC_POSSIBLE_DIV_BY_ZERO =
- create(BINARY_OP_POSSIBLE_DIVISION_BY_ZERO_ID, message);
- }
- return DIAGNOSTIC_POSSIBLE_DIV_BY_ZERO;
- }
-
- /**
- * @param operatorName
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(final String operatorName)
- {
- final String message =
- NLS.bind(Messages.BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION, operatorName);
- return create(BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID, message);
- }
-
- /**
- * @param operatorName
- * @param value
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME(final String operatorName, final String value)
- {
- final String message =
- NLS.bind(Messages.BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME,operatorName, value);
- return create(BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME_ID, message);
- }
-
- /**
- * @param value
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME(final String value)
- {
- final String message =
- NLS.bind(Messages.BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME, value);
- return create(BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME_ID, message);
- }
-
- /**
- * @param whichArgument
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN(final String whichArgument)
- {
- final String message =
- NLS.bind(Messages.BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN, whichArgument);
- return create(BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID, message);
- }
-
- /**
- * @param shortCircuitValue
- * @param operatorName
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS(boolean shortCircuitValue, String operatorName)
- {
- final String message =
- NLS.bind(Messages.BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS,
- Boolean.valueOf(shortCircuitValue), operatorName);
- return create(BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS_ID, message);
- }
-
- /**
- * @param shortCircuitValue
- * @param operatorName
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME(final boolean shortCircuitValue, final String operatorName)
- {
- final String message =
- NLS.bind(Messages.BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME,
- Boolean.valueOf(shortCircuitValue), operatorName);
-
- return create(BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME_ID, message);
- }
-
- private static Diagnostic DIAGNOSTIC_NO_AVAILABLE_TYPE_COERCION;
-
- /**
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_NO_AVAILABLE_TYPE_COERCION()
- {
- if (DIAGNOSTIC_NO_AVAILABLE_TYPE_COERCION == null)
- {
- DIAGNOSTIC_NO_AVAILABLE_TYPE_COERCION =
- create(BINARY_OP_NO_AVAILABLE_TYPE_COERCION_ID,
- Messages.BINARY_OP_NO_AVAILABLE_TYPE_COERCION);
- }
-
- return DIAGNOSTIC_NO_AVAILABLE_TYPE_COERCION;
- }
-
- private static Diagnostic DIAGNOSTIC_COULD_NOT_COERCE_LITERALS;
-
- /**
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS()
- {
- if (DIAGNOSTIC_COULD_NOT_COERCE_LITERALS == null)
- {
- DIAGNOSTIC_COULD_NOT_COERCE_LITERALS =
- create(BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS_ID,
- Messages.BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS);
- }
-
- return DIAGNOSTIC_COULD_NOT_COERCE_LITERALS;
- }
-
- /**
- * @param operatorName
- * @param value
- * @return a configured diagnostic
- */
- public Diagnostic create_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID(final String operatorName, final String value)
- {
- final String message =
- NLS.bind(Messages.UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME,
- operatorName, value);
- return create(UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID, message);
- }
-
- /**
- * @return a configured diagnostic
- */
- public Diagnostic create_UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE()
- {
- return create(UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE_ID,
- Messages.UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE);
- }
-
- /**
- * @return a configured diagnostic
- */
- public Diagnostic create_UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO()
- {
- return create(UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO_ID,
- Messages.UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO);
- }
-
- /**
- * @param operatorName
- * @return a configured diagnostic
- */
- public Diagnostic create_UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(final String operatorName)
- {
- final String message =
- NLS.bind(Messages.UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION,
- operatorName);
- return create(UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION_ID, message);
- }
-
- /**
- * @param operatorName
- * @return a configured diagnostic
- */
- public Diagnostic create_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED(final String operatorName)
- {
- final String message =
- NLS.bind(Messages.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED,
- operatorName);
- return create(UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID, message);
- }
-
- /**
- * @return a configured diagnostic
- */
- public Diagnostic create_UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN()
- {
- return create(UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN_ID,
- Messages.UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN);
- }
-
- /**
- * @param result
- * @param whichSelected
- * @return a configured diagnostic
- */
- public Diagnostic create_TERNARY_OP_CHOICE_IS_ALWAYS_SAME(boolean result, String whichSelected)
- {
- final String message =
- NLS.bind(Messages.TERNARY_OP_CHOICE_IS_ALWAYS_SAME,
- Boolean.valueOf(result), whichSelected);
- return create(TERNARY_OP_CHOICE_IS_ALWAYS_SAME_ID, message);
- }
-
- /**
- * @return a configured diagnostic
- */
- public Diagnostic create_TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN()
- {
- return create(TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID,
- Messages.TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID);
- }
-
- /**
- * Method bindings cannot participate in expressions involving operators
- * Per JSP 1.1 spec section 5.2.1
- *
- * @return a configured message
- */
- public Diagnostic create_CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING()
- {
- return create(CANNOT_APPLY_OPERATOR_TO_METHOD_BINDING_ID,
- Messages.CANNOT_APPLY_OPERATORS_TO_MB);
- }
-
- /**
- * @param curMemberSymbol
- * @param owningMember
- * @return a configured message
- */
- public Diagnostic create_MEMBER_NOT_FOUND(String curMemberSymbol, String owningMember)
- {
- return create(MEMBER_NOT_FOUND_ID,
- NLS.bind(Messages.VM_PROP_NAME_NOT_FOUND, curMemberSymbol, owningMember));
- }
-
- /**
- * @param variableName
- * @return a configured message
- */
- public Diagnostic create_VARIABLE_NOT_FOUND(String variableName)
- {
- return create(VARIABLE_NOT_FOUND_ID
- , NLS.bind(Messages.VM_ROOT_NAME_NOT_FOUND, variableName));
- }
-
- /**
- * @return a configured message
- */
- public Diagnostic create_MISSING_CLOSING_EXPR_BRACKET()
- {
- return create(MISSING_CLOSING_EXPR_BRACKET_ID
- , Messages.MISSING_CLOSING_EXPR_BRACKET);
- }
-
- /**
- * @return a configured message
- */
- public Diagnostic create_GENERAL_SYNTAX_ERROR()
- {
- return create(GENERAL_SYNTAX_ERROR_ID, Messages.GENERAL_SYNTAX_ERROR);
- }
-
- /**
- * @return a configured message
- */
- public Diagnostic create_EMPTY_EL_EXPRESSION()
- {
- return create(EMPTY_EL_EXPRESSION_ID, Messages.EMPTY_EL_EXPRESSION);
- }
-
- /**
- * @param operatorName
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_DOT_WITH_VALUEB_NULL(final String operatorName)
- {
- return create(BINARY_OP_DOT_WITH_VALUEB_NULL_ID
- , Messages.bind(Messages.BINARY_OP_DOT_WITH_VALUEB_NULL, operatorName));
- }
-
- /**
- * @param valAName
- * @param valueBName
- * @return a configured diagnostic
- */
- public Diagnostic create_BINARY_OP_DOT_WITH_VALUEA_MAP_SHOULD_USE_ARRAY(final String valAName, final String valueBName)
- {
- final Object[] formatArgs = new Object[] {valAName, valueBName};
- return create(BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY_ID,
- MessageFormat.format(Messages.BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY,formatArgs));
- }
-
- /**
- * @param value
- * @return an array index out of bounds diagnostic
- */
- public Diagnostic create_POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS(final Integer value)
- {
- final Object[] formatArgs = new Object[] {value};
-
- return create(POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS_ID
- , MessageFormat.format(Messages.POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS,formatArgs));
- }
-
- /**
- * @param operatorName
- * @param invariantResult
- * @param enumName
- * @param fieldName
- * @return a diagnostic
- */
- public Diagnostic create_BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME(final String operatorName, final boolean invariantResult, final String enumName, final String fieldName)
- {
- return create(BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID
- , MessageFormat.format(Messages.BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME
- , new Object[] {operatorName
- , Boolean.valueOf(invariantResult), enumName, fieldName}));
- }
-
- /**
- * @param operatorName
- * @param invariantResult
- * @param enumName1
- * @param enumName2
- * @return a diagnostic
- */
- public Diagnostic create_BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME(final String operatorName, final boolean invariantResult, final String enumName1, final String enumName2)
- {
- return create(BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID
- , MessageFormat.format(Messages.BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME
- , new Object[] {operatorName
- , Boolean.valueOf(invariantResult), enumName1, enumName2}));
- }
-
- /**
- * @param operatorName
- * @param invariantResult
- * @param enumName
- * @param nonEnum
- * @return a diagnostic
- */
- public Diagnostic create_BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME(final String operatorName, final boolean invariantResult, final String enumName, final String nonEnum)
- {
- return create(BINARY_COMPARISON_WITH_ENUM_ALWAYS_SAME_ID
- , MessageFormat.format(Messages.BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME
- , new Object[] {operatorName
- , Boolean.valueOf(invariantResult), enumName, nonEnum}));
- }
-
- /**
- * @return a diagnostic
- */
- public Diagnostic create_BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE()
- {
- return create(BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE_ID
- , Messages.BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE);
- }
-
- /**
- * @param intermediateMemberName
- * @return a diagnostic
- */
- public Diagnostic create_MEMBER_IS_INTERMEDIATE(final String intermediateMemberName)
- {
- return create(MEMBER_IS_INTERMEDIATE_ID
- , NLS.bind(Messages.MEMBER_IS_INTERMEDIATE
- , intermediateMemberName));
- }
-
- private BasicDiagnostic create(int diagnosticId, String message)
- {
- final int severity = ELValidationPreferences.getDefaultSeverity(diagnosticId);
- return new BasicDiagnostic(severity, SOURCE_ID
- , diagnosticId
- , message
- , null);
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/Messages.java
deleted file mode 100644
index c14a8513d..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/Messages.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.diagnostics;
-
-import org.eclipse.osgi.util.NLS;
-
-class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.validation.internal.el.diagnostics.messages"; //$NON-NLS-1$
-
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- /**
- * see messages.properties
- */
- public static String POSSIBLE_DIV_BY_ZERO;
- /**
- * see messages.properties
- */
- public static String UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE;
- /**
- * see messages.properties
- */
- public static String UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN;
- /**
- * see messages.properties
- */
- public static String TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_BOTH_OPERANDS_NULL;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_NO_AVAILABLE_TYPE_COERCION;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS;
- /**
- * see messages.properties
- */
- public static String UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME;
- /**
- * see messages.properties
- */
- public static String UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO;
- /**
- * see messages.properties
- */
- public static String UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION;
- /**
- * see messages.properties
- */
- public static String UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED;
- /**
- * see messages.properties
- */
- public static String TERNARY_OP_CHOICE_IS_ALWAYS_SAME;
- /**
- * see messages.properties
- */
- public static String VM_PROP_NAME_NOT_FOUND;
- /**
- * see messages.properties
- */
- public static String VM_ROOT_NAME_NOT_FOUND;
- /**
- * see messages.properties
- */
- public static String CANNOT_APPLY_OPERATORS_TO_MB;
- /**
- * see messages.properties
- */
- public static String MISSING_CLOSING_EXPR_BRACKET;
- /**
- * see messages.properties
- */
- public static String GENERAL_SYNTAX_ERROR;
- /**
- * see messages.properties
- */
- public static String EMPTY_EL_EXPRESSION;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_DOT_WITH_VALUEB_NULL;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY;
-
- /**
- * see messages.properties
- */
- public static String POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS;
- /**
- * see messages.properties
- */
- public static String BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME;
- /**
- * see messages.properties
- */
- public static String BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME;
- /**
- * see messages.properties
- */
- public static String BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE;
-
- /**
- * see messages.properties
- */
- public static String BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME;
- /**
- * see messages.properties
- */
- public static String MEMBER_IS_INTERMEDIATE;
-
- private Messages() {
- // do nothing; no external instantiation
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/messages.properties
deleted file mode 100644
index 8f78e7c78..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/diagnostics/messages.properties
+++ /dev/null
@@ -1,44 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2008 Oracle 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:
-# Oracle Corporation - initial API and implementation
-###############################################################################
-GENERAL_SYNTAX_ERROR=Syntax error in EL
-EMPTY_EL_EXPRESSION=Empty EL expression
-
-VM_ROOT_NAME_NOT_FOUND = {0} cannot be resolved
-VM_PROP_NAME_NOT_FOUND = {0} cannot be resolved as a member of {1}
-CANNOT_APPLY_OPERATORS_TO_MB=Cannot apply expression operators to method bindings
-MISSING_CLOSING_EXPR_BRACKET=Missing closing bracket on expression
-
-POSSIBLE_DIV_BY_ZERO=Possible division by zero
-UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE=This empty expression always evaluates to false. Only string, maps, arrays and collection have meaningful values for the empty operator
-UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN=Not operator does not support type coercion.
-TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN_ID=Could not coerce choice argument to boolean
-BINARY_OP_BOTH_OPERANDS_NULL={0} with operand ''null'' is always zero
-BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION=Could not make numeric conversion for {0} operation
-BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME=This {0} will always result a value of {1}
-BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME=Comparisons with null always evaluates to {0}
-BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN=Cannot coerce {0} argument to boolean
-BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS=The first boolean argument is always {0}. The second argument will never be evaluated and the {1} will always evaluate to {0}.
-BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME=The second boolean argument is always {0}. The {1} will always evaluate to {0}
-BINARY_OP_NO_AVAILABLE_TYPE_COERCION=Cannot coerce arguments for this operator
-BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS=Could not coerce literals to numbers
-UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME=This {0} will always result a value of {1}
-UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO=Unary minus applied to null is always zero
-UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION=Could not make numeric conversion for {0} operation
-UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED=Type coercion for {0} operator not guaranteed for possible runtime types: {1}
-TERNARY_OP_CHOICE_IS_ALWAYS_SAME=Choice argument is always {0}. {1} argument is always returned
-BINARY_OP_DOT_WITH_VALUEB_NULL=Applying the {0} operator with null second argument always results in null
-BINARY_OP_DOT_WITH_DOTTED_KEY_SHOULD_USE_ARRAY=Array syntax is preferred when accessing Map properties with keys containing dots (i.e. {0}[''{1}''])
-POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS=Possible array index out of bound on list/array access with value: {0}
-BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME=Comparison using {0} will always evaluate to {1}. Enumeration type {2} does not have a constant named {3}
-BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE=Comparison of incompatible enumeration vales may cause a ClassCastException.
-BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME=Comparison using {0} will always evaulate to {1}. Enumeration type {2} is not equality comparable with {3}
-BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME=Comparison using {0} will always evaulate to {1}. Enumeration type {2} is not equality comparable with non-enumeration type {3}
-MEMBER_IS_INTERMEDIATE={0} is an intermediate property which does not have its own value associated with it. \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AddArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AddArithmeticBinaryOperator.java
deleted file mode 100644
index 755a447c9..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AddArithmeticBinaryOperator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the arithmetic + operator in EL
- *
- * @author cbateman
- *
- */
-/*package*/ class AddArithmeticBinaryOperator extends NoDivArithmeticBinaryOperator {
-
- private static final String ADDITION = "addition"; //$NON-NLS-1$
-
- AddArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) {
- super(diagnosticFactory);
- }
-
- protected Long doRealOperation(Long firstArg, Long secondArg)
- {
- return Long.valueOf(firstArg.longValue() + secondArg.longValue());
- }
-
- protected Double doRealOperation(Double firstArg, Double secondArg) {
- return Double.valueOf(firstArg.doubleValue() + secondArg.doubleValue());
- }
-
- protected BigDecimal doRealOperation(BigDecimal firstArg,
- BigDecimal secondArg)
- {
- return firstArg.add(secondArg);
- }
-
- protected String getOperatorName() {
- return ADDITION;
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AndBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AndBinaryOperator.java
deleted file mode 100644
index 2ef4a2523..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/AndBinaryOperator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-
-/**
- * Encapsulates the 'and'/'&&' boolean-AND operator
- * Based on JSP.2.3.6.1
- *
- * @author cbateman
- *
- */
-/*package*/class AndBinaryOperator extends LogicalBinaryOperator
-{
-
- AndBinaryOperator(DiagnosticFactory diagnosticFactory) {
- super(diagnosticFactory);
- }
-
- protected boolean doRealOperation(Boolean firstArg, Boolean secondArg)
- {
- return (firstArg.booleanValue() && secondArg.booleanValue());
- }
-
- protected String readableOperatorName()
- {
- return "logical-AND"; //$NON-NLS-1$
- }
-
- protected boolean shortCircuitValue() {
- // AND short-circuits on false
- return false;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ArithmeticBinaryOperator.java
deleted file mode 100644
index 3f7000046..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ArithmeticBinaryOperator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Super for all arithmetic binary operators -- +, -, *,/,%
- *
- * @author cbateman
- *
- */
-/*package*/ abstract class ArithmeticBinaryOperator extends BinaryOperator
-{
- ArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory)
- {
- super(diagnosticFactory);
- }
-
- public abstract ValueType performOperation(ValueType firstArg, ValueType secondArg);
- public abstract Diagnostic validate(ValueType firstArg, ValueType secondArg);
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of firstArg op secondArg
- */
- protected abstract Long doRealOperation(Long firstArg, Long secondArg);
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of firstArg op secondArg
- */
- protected abstract Double doRealOperation(Double firstArg, Double secondArg);
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of firstArg op secondArg
- */
- protected abstract BigDecimal doRealOperation(BigDecimal firstArg, BigDecimal secondArg);
-
- /**
- * @return human-readable name of the operator
- */
- protected abstract String getOperatorName();
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BinaryOperator.java
deleted file mode 100644
index 58661da4e..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BinaryOperator.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
-import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver;
-import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserConstants;
-import org.eclipse.jst.jsp.core.internal.java.jspel.Token;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * Represents an abstract EL binary operator that always
- * takes arguments and produces a single results
- *
- * @author cbateman
- *
- */
-public abstract class BinaryOperator
-{
- /**
- * the factory used to construct diagnostics
- */
- protected final DiagnosticFactory _diagnosticFactory;
-
- /**
- * @param operatorToken
- * @param diagnosticFactory
- * @param context -- the current EL document context; must not be null
- * @return a binary operator based on the provided token
- * @throws IllegalArgumentException if the token is not a recognized
- * EL binary operator token or if context is null
- */
- public static BinaryOperator getBinaryOperator(Token operatorToken, DiagnosticFactory diagnosticFactory, IStructuredDocumentContext context)
- {
- if (context == null)
- {
- throw new IllegalArgumentException("Context must not be null"); //$NON-NLS-1$
- }
- final String facetVersion = determineJSFVersion(context);
-
- switch (operatorToken.kind)
- {
- case JSPELParserConstants.AND1:
- case JSPELParserConstants.AND2:
- return new AndBinaryOperator(diagnosticFactory);
-
- case JSPELParserConstants.OR1:
- case JSPELParserConstants.OR2:
- return new OrBinaryOperator(diagnosticFactory);
-
- case JSPELParserConstants.EQ1:
- case JSPELParserConstants.EQ2:
- return new EqualsBinaryRelationalOperator(diagnosticFactory,facetVersion);
-
- case JSPELParserConstants.NEQ1:
- case JSPELParserConstants.NEQ2:
- return new NotEqualsBinaryRelationalOperator(diagnosticFactory,facetVersion);
-
- case JSPELParserConstants.GT1:
- case JSPELParserConstants.GT2:
- return new GreaterThanRelationalBinaryOperator(diagnosticFactory,facetVersion);
-
- case JSPELParserConstants.GE1:
- case JSPELParserConstants.GE2:
- return new GreaterThanEqRelationalBinaryOperator(diagnosticFactory,facetVersion);
-
- case JSPELParserConstants.LT1:
- case JSPELParserConstants.LT2:
- return new LessThanRelationalBinaryOperator(diagnosticFactory,facetVersion);
-
- case JSPELParserConstants.LE1:
- case JSPELParserConstants.LE2:
- return new LessThanEqRelationalBinaryOperator(diagnosticFactory,facetVersion);
-
- case JSPELParserConstants.PLUS:
- return new AddArithmeticBinaryOperator(diagnosticFactory);
-
- case JSPELParserConstants.MINUS:
- return new SubtractArithmeticBinaryOperator(diagnosticFactory);
-
- case JSPELParserConstants.MULTIPLY:
- return new MultiplyArithmeticBinaryOperator(diagnosticFactory);
-
- case JSPELParserConstants.DIVIDE1:
- case JSPELParserConstants.DIVIDE2:
- return new DivArithmeticBinaryOperator(diagnosticFactory);
-
- case JSPELParserConstants.MODULUS1:
- case JSPELParserConstants.MODULUS2:
- return new ModArithmeticBinaryOperator(diagnosticFactory);
- }
-
- throw new IllegalArgumentException("Unknown binary operator: "+operatorToken.image); //$NON-NLS-1$
- }
-
- /**
- *
- * Constructor
- */
- BinaryOperator(DiagnosticFactory diagnosticFactory)
- {
- /* no construction or sub-classing outside package*/
- _diagnosticFactory = diagnosticFactory;
- }
-
- /**
- * If both arguments are literals and the operation can be performed, then
- * the return must be a new LiteralType transformed using this operator.
- *
- * If one or both of the arg is not a literal and the operaton can be performed, then
- * the return is a new ValueType transformed per the rules of the operator
- *
- * If the operation cannot be performed on ValueType, return null
- *
- * @param firstArg
- * @param secondArg
- * @return a new value type after the operation is performed
- */
- public abstract ValueType performOperation(ValueType firstArg, ValueType secondArg);
-
-
- /**
- * @param firstArg
- * @param secondArg
- * @return a Diagnostic interpreting whether it is valid to perform the
- * operation on the two arguments
- */
- public abstract Diagnostic validate(ValueType firstArg, ValueType secondArg);
-
- private static String determineJSFVersion(IStructuredDocumentContext context)
- {
- final IWorkspaceContextResolver wkResolver =
- IStructuredDocumentContextResolverFactory.
- INSTANCE.getWorkspaceContextResolver(context);
-
- IProject project = wkResolver.getProject();
-
- IProjectFacetVersion projectVersion = JSFAppConfigUtils.getProjectFacet(project);
-
- if (projectVersion != null)
- {
- return projectVersion.getVersionString();
- }
-
- return null;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BracketOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BracketOperator.java
deleted file mode 100644
index ac9308fb9..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/BracketOperator.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.context.symbol.IObjectSymbol;
-import org.eclipse.jst.jsf.context.symbol.ISymbol;
-import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType;
-import org.eclipse.jst.jsf.designtime.DesignTimeApplicationManager;
-import org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver;
-import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Handles the operator 'bracket' where bracket(expr-a, id-b) == 'expr-a[id-b]' in EL syntax
- *
- * @author cbateman
- *
- */
-public class BracketOperator extends MemberAccessorOperator
-{
- private static final String OPERATOR_NAME_ARRAY_ACCESSOR = "array ('[]') accessor"; //$NON-NLS-1$
-
- /**
- * @param diagnosticFactory
- * @param file
- * @param resolver
- */
- public BracketOperator(final DiagnosticFactory diagnosticFactory, final IFile file, final ISymbolContextResolver resolver)
- {
- super(file, diagnosticFactory, resolver);
- }
-
- protected SignatureBasedType handlePerformObjectSymbolValue(
- IObjectSymbolBasedValueType firstArg, ValueType secondArg)
- {
- // per JSP.2.3.4 step 5.2, if value-a is a list or array access
- if (firstArg.isInstanceOf(TypeConstants.TYPE_LIST)
- || Signature.getArrayCount(firstArg.getSignature()) > 0)
- {
- return handlePerformNumericPropertyAccessorBase(firstArg, secondArg);
- }
-
- // per JSP.2.3.4 step 5, if value-a is a map or if it is not
- // a list or array (and therefore a bean), treat it as named property accessed object
- // if firstArg is a map then we must treat the access like a map.get(secondArg)
-
- // if we don't have a literal value with which to derive value-b, then
- // we can't get a property
- if (secondArg instanceof LiteralType)
- {
- return handlePerformNamedPropertyAccessorBase(firstArg, (LiteralType)secondArg);
- }
-
- return null;
- }
-
- protected Diagnostic validateObjectSymbolValue(IObjectSymbolBasedValueType firstArg,
- ValueType secondArg)
- {
- // per JSP.2.3.4 step 5.2, if value-a is a list or array access
- if (firstArg.isInstanceOf(TypeConstants.TYPE_LIST)
- || firstArg.getSymbol().getTypeDescriptor().isArray())
- {
- return validateNumericPropertyAccessorBase(firstArg, secondArg);
- }
-
- // per JSP.2.3.4 step 5, if value-a is a map or if it is not
- // a list or array (and therefore a bean), treat it as named property accessed object
- // if firstArg is a map then we must treat the access like a map.get(secondArg)
- if (secondArg instanceof LiteralType)
- {
- return validateNamedPropertyAccessorBase(firstArg, (LiteralType) secondArg);
- }
- // otherwise, there's nothing we can guarantee
- return Diagnostic.OK_INSTANCE;
- }
-
- private Diagnostic validateNumericPropertyAccessorBase(IObjectSymbolBasedValueType firstArg,
- ValueType secondArg)
- {
- try
- {
- // secondArg must successfully coerce to integer
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- if (secondArg instanceof LiteralType)
- {
- // this will throw a TypeCoercionExceptino if it won't
- // coerce
- Integer integerValue =
- (Integer) ((LiteralType)secondArg).coerceToNumber(Integer.class);
-
- if (integerValue.intValue() < 0)
- {
- return _diagnosticFactory.create_POSSIBLE_ARRAY_INDEX_OUT_OF_BOUNDS(integerValue);
- }
- }
- else
- {
- // if the argument is a non-literal string, we can't verify
- // that the coercion to integer won't throw an exception
- // at runtime
- if (TypeCoercer.typeIsString(secondArg.getSignature()))
- {
- return _diagnosticFactory.create_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED(OPERATOR_NAME_ARRAY_ACCESSOR);
- }
- }
-
- // TODO: attempt to detect ArrayIndexOutOfBoundsException
- return Diagnostic.OK_INSTANCE;
- }
- catch (TypeCoercionException e)
- {
- return _diagnosticFactory.create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(OPERATOR_NAME_ARRAY_ACCESSOR);
- }
- }
-
- private SignatureBasedType handlePerformNumericPropertyAccessorBase(IObjectSymbolBasedValueType firstArg,
- ValueType secondArg)
- {
- AbstractDTPropertyResolver propResolver = getPropertyResolver();
- int index = 0;
- if (secondArg instanceof LiteralType)
- {
- try {
- index = ((LiteralType)secondArg).coerceToNumber(Integer.class).intValue();
- } catch (TypeCoercionException e) {
- // suppress, just use index = 0
- // this maybe should be an assertion...
- }
- }
-
- final ISymbol symbol =
- propResolver.getProperty(firstArg.getSymbol(), index);
-
- if (symbol instanceof IObjectSymbol)
- {
- return IObjectSymbolBasedValueType.getInstance(symbol);
- }
-
- // if can't be resolved, return null
- return null;
- }
-
- @Override
- protected String getOperatorName()
- {
- return Messages.getString("BracketOperator.Name"); //$NON-NLS-1$
- }
-
- /**
- * @return the property resolver for the current source file
- */
- private AbstractDTPropertyResolver getPropertyResolver()
- {
- final DesignTimeApplicationManager manager =
- DesignTimeApplicationManager.getInstance(_file.getProject());
-
- if (manager != null)
- {
- return manager.getPropertyResolver();
- }
-
- return null;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java
deleted file mode 100644
index 67242ec60..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DivArithmeticBinaryOperator.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents dividing EL binary operators: div and / (same operator)
- * Based on JSP.2.3.5.2
- *
- * @author cbateman
- *
- */
-/*package*/ class DivArithmeticBinaryOperator extends ArithmeticBinaryOperator
-{
-
- private static final String DIVISION = "division"; //$NON-NLS-1$
-
- DivArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) {
- super(diagnosticFactory);
- // TODO Auto-generated constructor stub
- }
-
- public ValueType performOperation(ValueType firstArg, ValueType secondArg)
- {
- // JSP.2.3.5.2, step one: if both null then always 0
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- && TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return new IntegerLiteralType(0);
- }
-
- final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.2, step 2: if one arg is BigInteger or BigDecimal
- // then coerce to BigDecimal and do div
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg))
- {
- return performBigDecimal(firstArg, secondArg);
- }
-
- return performDouble(firstArg, secondArg);
- }
-
- public Diagnostic validate(ValueType firstArg, ValueType secondArg) {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
- TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
-
- // JSP.2.3.5.2, step one: if both null then always 0
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- && TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return _diagnosticFactory.create_BINARY_OP_BOTH_OPERANDS_NULL(DIVISION);
- }
-
- final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.2, step 2: if one arg is BigInteger or BigDecimal
- // then coerce to BigDecimal and do div
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg))
- {
- return validateBigDecimal(firstArg, secondArg);
- }
-
- return validateDouble(firstArg, secondArg);
- }
-
- private ValueType performBigDecimal(ValueType firstArg, ValueType secondArg)
- {
- // since one or the other args must be either big decimal or big int,
- // we don't have two literals, so it is sufficient to ensure that we can
- // coerce both to numbers and check for div by zero and div of zero
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- // if we get to here, the result is always BigDecimal unless we have
- // a div by zero
- if (secondArg instanceof LiteralType)
- {
- final Number coercedValue = ((LiteralType)secondArg).coerceToNumber(BigDecimal.class);
- if (((BigDecimal)coercedValue).equals(new BigDecimal(0)))
- {
- return null;
- }
- }
-
- return new ValueType(TypeConstants.TYPE_BIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- catch (TypeCoercionException ce)
- {
- return null;
- }
- }
-
- private ValueType performDouble(ValueType firstArg, ValueType secondArg)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- Number secondValue = null;
- if (secondArg instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondArg).coerceToNumber(Double.class);
- // if the second value is definitely 0, then return null since
- // we have a div by zero
- if (secondValue.doubleValue() == 0.0)
- {
- return null;
- }
- }
-
- Number firstValue = null;
-
- if (firstArg instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstArg).coerceToNumber(Double.class);
- }
-
- if (firstValue != null && secondValue != null)
- {
- return new FloatLiteralType(
- doRealOperation(new Double(firstValue.doubleValue())
- , new Double(secondValue.doubleValue())).doubleValue());
- }
-
- // if not both literals and could coerce, then the type is double
- return new ValueType(Signature.SIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- catch (TypeCoercionException ce)
- {
- // could not coerce for the operation
- return null;
- }
- }
-
- private Diagnostic validateBigDecimal(ValueType firstArg, ValueType secondArg)
- {
- // since one or the other args must be either big decimal or big int,
- // we don't have two literals, so it is sufficient to ensure that we can
- // coerce both to numbers and check for div by zero and div of zero
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- // if we get to here, the result is always BigDecimal unless we have
- // a div by zero
- if (secondArg instanceof LiteralType)
- {
- final Number coercedValue = ((LiteralType)secondArg).coerceToNumber(BigDecimal.class);
- if (((BigDecimal)coercedValue).equals(new BigDecimal(0)))
- {
- return _diagnosticFactory.create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO();
- }
- }
-
- // everything's okay if we get here
- return Diagnostic.OK_INSTANCE;
- }
- catch (TypeCoercionException ce)
- {
- return _diagnosticFactory.create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(DIVISION);
- }
- }
-
- private Diagnostic validateDouble(ValueType firstArg, ValueType secondArg)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- Number secondValue = null;
- if (secondArg instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondArg).coerceToNumber(Double.class);
- // if the second value is definitely 0, then return null since
- // we have a div by zero
- if (secondValue.doubleValue() == 0.0)
- {
- return _diagnosticFactory.create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO();
- }
- }
-
- Number firstValue = null;
-
- if (firstArg instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstArg).coerceToNumber(Double.class);
- }
-
- if (firstValue != null && secondValue != null)
- {
- String result
- = Double.toString(
- doRealOperation(new Double(firstValue.doubleValue()),
- new Double(secondValue.doubleValue())).doubleValue());
-
- return _diagnosticFactory.create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME(DIVISION, result);
- }
-
- // if not both literals and could coerce, then the type is double
- return Diagnostic.OK_INSTANCE;
- }
- catch (TypeCoercionException ce)
- {
- // could not coerce for the operation
- return _diagnosticFactory.create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(DIVISION);
- }
- }
-
- protected BigDecimal doRealOperation(BigDecimal firstArg, BigDecimal secondArg) {
- // per JSP.2.3.5.2, step 2
- return firstArg.divide(secondArg, BigDecimal.ROUND_HALF_UP);
- }
-
- protected Double doRealOperation(Double firstArg, Double secondArg)
- {
- return new Double(firstArg.doubleValue() / secondArg.doubleValue());
- }
-
- protected Long doRealOperation(Long firstArg, Long secondArg) {
- return Long.valueOf(firstArg.longValue() / secondArg.longValue());
- }
-
- protected String getOperatorName() {
- return DIVISION;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DotOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DotOperator.java
deleted file mode 100644
index f31950cc7..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/DotOperator.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType;
-import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Handles the operator 'dot' where dot(expr-a, id-b) == 'expr-a.id-b' in EL syntax
- *
- * @author cbateman
- *
- */
-public class DotOperator extends MemberAccessorOperator
-{
- /**
- * @param diagnosticFactory
- * @param file
- * @param resolver
- */
- public DotOperator(final DiagnosticFactory diagnosticFactory, final IFile file, final ISymbolContextResolver resolver)
- {
- super(file, diagnosticFactory, resolver);
- }
-
- protected SignatureBasedType handlePerformObjectSymbolValue(
- IObjectSymbolBasedValueType firstArg, ValueType secondArg)
- {
- // the dot operator (unlike the bracket) can only treat firstArg as
- // a named property accessor object
- // if we don't have a literal value with which to derive value-b, then
- // we can't get a property
- if (secondArg instanceof LiteralType)
- {
- return handlePerformNamedPropertyAccessorBase(firstArg, (LiteralType)secondArg);
- }
- return null;
- }
-
- public Diagnostic validateObjectSymbolValue(IObjectSymbolBasedValueType firstArg,
- ValueType secondArg)
- {
- Diagnostic diag = Diagnostic.OK_INSTANCE;
-
- if (secondArg instanceof LiteralType)
- {
- diag = validateNamedPropertyAccessorBase(firstArg, (LiteralType) secondArg);
- }
-
- return diag;
- }
-
- @Override
- protected String getOperatorName()
- {
- return Messages.getString("DotOperator.Name"); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EmptyUnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EmptyUnaryOperator.java
deleted file mode 100644
index 8da62be01..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EmptyUnaryOperator.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.NullLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.StringLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the EL unary operator '-' on a ValueType
- * as described by JSP.2.3.7
- *
- * @author cbateman
- *
- */
-/*package*/ class EmptyUnaryOperator extends UnaryOperator
-{
- private static final String EMPTY = "empty"; //$NON-NLS-1$
-
- EmptyUnaryOperator(DiagnosticFactory diagnosticFactory)
- {
- super(diagnosticFactory);
- }
-
- public ValueType performOperation(ValueType type)
- {
- if (type instanceof StringLiteralType)
- {
- if ("".equals(((StringLiteralType)type).getLiteralValue())) //$NON-NLS-1$
- {
- // if the string is empty, operator always returns true
- return BooleanLiteralType.TRUE;
- }
-
- // if the string is empty, operator always returns true
- return BooleanLiteralType.FALSE;
- }
-
- // empty(null) is always true
- if (type instanceof NullLiteralType)
- {
- return BooleanLiteralType.TRUE;
- }
-
- // if the type is not string, array, Map, or Collection
- // then empty is always false
- String testSig = type.getSignature();
-
- if (!TypeConstants.TYPE_STRING.equals(testSig)
- && !type.isInstanceOf(TypeConstants.TYPE_COLLECTION)
- && !type.isInstanceOf(TypeConstants.TYPE_MAP)
- && Signature.getTypeSignatureKind(testSig) != Signature.ARRAY_TYPE_SIGNATURE)
- {
- return BooleanLiteralType.FALSE;
- }
-
- // otherwise, return a generic boolean type
- return new ValueType(TypeConstants.TYPE_BOOLEAN, type.getAssignability());
- }
-
- public Diagnostic validate(ValueType type)
- {
- // empty always validates to false unless:
- // the value is an empty string, array, map or collection
- // one thing we do is see if the thing is a literal. If it is
- // we can warn that the value could be folded
- if (type instanceof StringLiteralType)
- {
- String condition;
-
- if ("".equals(((StringLiteralType)type).getLiteralValue())) //$NON-NLS-1$
- {
- condition = "true"; //$NON-NLS-1$
- }
- else
- {
- condition = "false"; //$NON-NLS-1$
- }
-
- return _diagnosticFactory.
- create_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID
- (EMPTY,condition);
- }
-
- // empty(null) is always true
- if (type instanceof NullLiteralType)
- {
- return _diagnosticFactory.
- create_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID
- (EMPTY,"true"); //$NON-NLS-1$
- }
-
- // if the type is not string, array, Map, or Collection warn that
- // this may be always false
- String testSig = type.getSignature();
-
- if (!TypeConstants.TYPE_STRING.equals(testSig)
- && !type.isInstanceOf(TypeConstants.TYPE_COLLECTION)
- && !type.isInstanceOf(TypeConstants.TYPE_MAP)
- && Signature.getTypeSignatureKind(testSig) != Signature.ARRAY_TYPE_SIGNATURE)
- {
- return _diagnosticFactory.create_UNARY_OP_EMPTY_ALWAYS_FALSE_ON_TYPE();
- }
-
- return Diagnostic.OK_INSTANCE;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java
deleted file mode 100644
index 963f9ad00..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java
+++ /dev/null
@@ -1,544 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.StringLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.common.util.TypeUtil;
-import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * A relational binary operator for equality: "==" or "!="
- *
- * @author cbateman
- *
- */
-/*package*/ abstract class EqualityRelationalBinaryOperator extends RelationalBinaryOperator
-{
- EqualityRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion)
- {
- super(diagnosticFactory, jsfVersion);
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of the operation
- */
- protected abstract boolean doRealOperation(Boolean firstArg, Boolean secondArg);
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.validation.internal.el.operators.BinaryOperator#performOperation(org.eclipse.jst.jsf.core.internal.types.ValueType, org.eclipse.jst.jsf.core.internal.types.ValueType)
- */
- public ValueType performOperation(ValueType firstArg, ValueType secondArg)
- {
- // JSP.2.3.5.7 step 1 if operands are equal, then true for ==, false for !=
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- && TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- // perform the operation on two arguments that are equal.
- return BooleanLiteralType.valueOf(doRealOperation(Integer.valueOf(4), Integer.valueOf(4)));
- }
-
- String boxedFirstType = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- String boxedSecondType = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.7 step 3, if either is BigDecimal, promote both and compare
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstType)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondType))
- {
- return handleNumericComparison(firstArg, secondArg, BigDecimal.class);
- }
-
- // JSP.2.3.5.7, step 4 if either is a float or double, promote both to
- // double and compare
- if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondType))
- {
- return handleNumericComparison(firstArg, secondArg, Double.class);
- }
-
- // JSP.2.3.5.7, step 5 if either is a big integer, promote and compare
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstType)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondType))
- {
- return handleNumericComparison(firstArg, secondArg, BigInteger.class);
- }
-
- // JSP.2.3.5.7, step 6 if either is Long or smaller, coerce both to Long
- if (TypeConstants.TYPE_BOXED_LONG.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_LONG.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_SHORT.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_SHORT.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_BYTE.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_BYTE.equals(boxedSecondType)
- || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedFirstType)
- || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedSecondType))
- {
- return handleNumericComparison(firstArg, secondArg, Long.class);
- }
-
- // JSP.2.3.5.7, step 7 if either is a boolean, coerce to boolean
- if (TypeConstants.TYPE_BOXED_BOOLEAN.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_BOOLEAN.equals(boxedSecondType))
- {
- return handleBooleanComparison(firstArg, secondArg);
- }
-
- // Unified EL 1.8.2, step 8 if either is a enum, then coerce both to enum
- // NOTE: we handle the JSF 1.1 case also where enums are treated as non-coercable
- // Object's
- if (firstArg.isEnumType() || secondArg.isEnumType())
- {
- return handleEnumComparison(firstArg, secondArg);
- }
-
- // JSP.2.3.5.7, step 8 if either is a string, coerce to string and
- // compare lexically
- if (TypeConstants.TYPE_STRING.equals(boxedFirstType)
- || TypeConstants.TYPE_STRING.equals(boxedSecondType))
- {
- return handleStringComparison(firstArg, secondArg);
- }
-
- // otherwise, an equal compare will be done A.equals(B). Since
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- private ValueType handleEnumComparison(ValueType firstArg,
- ValueType secondArg)
- {
- assert firstArg.isEnumType() || secondArg.isEnumType();
-
- // if the first is not an enum, then we have non-Enum == Enum case
- if (!firstArg.isEnumType())
- {
- return handleComparsionOfEnumAndNonEnum(secondArg, firstArg);
- }
-
- // if the second is not an enum, then we have Enum == non-Enum case
- if (!secondArg.isEnumType())
- {
- return handleComparsionOfEnumAndNonEnum(firstArg, secondArg);
- }
-
- // only other case is they are both enums. Check if they are directly
- // comparable.
- if (TypeUtil.canNeverBeEqual(firstArg.getSignature(), secondArg.getSignature()))
- {
- boolean result = doRealOperation("foo", "notFoo"); // just simulate the operation where the operands are not equal //$NON-NLS-1$ //$NON-NLS-2$
-
- return BooleanLiteralType.valueOf(result);
- }
-
- // otherwise, all we know is that it's a boolean
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- private ValueType handleComparsionOfEnumAndNonEnum(ValueType enumType,
- ValueType nonEnumType)
- {
- // the only literal value that could have got us here is a
- // StringLiteralValue since the others a filtered out before this is
- // called
- if (nonEnumType instanceof LiteralType)
- {
- assert nonEnumType instanceof StringLiteralType;
-
- Diagnostic result = validateIfEnumToStringComparison(((StringLiteralType)nonEnumType).getLiteralValue(), enumType);
-
- if (result != null)
- {
- // compare two things that aren't equal
- return BooleanLiteralType.valueOf(doRealOperation("foo", "foo_")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- // if the arg is a String, then we can't prove anything before runtime
- if (nonEnumType.isInstanceOf(TypeConstants.TYPE_STRING))
- {
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- // otherwise, we know it will result in a problem since one is an enum
- // and the other isn't so simply do a comparison on two things that aren't equals
- return BooleanLiteralType.valueOf(doRealOperation("foo", "foo_")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public Diagnostic validate(ValueType firstArg, ValueType secondArg) {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
- TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
-
- // JSP.2.3.5.7 step 2 if either operand is null, then not equal
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- && TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- // perform the operation on two arguments that are equal.
- final boolean result = doRealOperation(Integer.valueOf(4), Integer.valueOf(4));
- return _diagnosticFactory.create_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME(Boolean.toString(result));
- }
-
- final String boxedFirstType =
- TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- final String boxedSecondType =
- TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.7 step 3, if either is BigDecimal, promote both and compare
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstType)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondType))
- {
- return validateNumericComparison(firstArg, secondArg, BigDecimal.class);
- }
-
- // JSP.2.3.5.7, step 4 if either is a float or double, promote both to
- // double and compare
- if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondType))
- {
- return validateNumericComparison(firstArg, secondArg, Double.class);
- }
-
- // JSP.2.3.5.7, step 5 if either is a big integer, promote and compare
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstType)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondType))
- {
- return validateNumericComparison(firstArg, secondArg, BigInteger.class);
- }
-
- // JSP.2.3.5.7, step 6 if either is Long or smaller, coerce both to Long
- if (TypeConstants.TYPE_BOXED_LONG.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_LONG.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_SHORT.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_SHORT.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_BYTE.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_BYTE.equals(boxedSecondType)
- || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedFirstType)
- || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedSecondType))
- {
- return validateNumericComparison(firstArg, secondArg, Long.class);
- }
-
- // JSP.2.3.5.7, step 7 if either is a boolean, coerce to boolean
- if (TypeConstants.TYPE_BOXED_BOOLEAN.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_BOOLEAN.equals(boxedSecondType))
- {
- return validateBooleanComparison(firstArg, secondArg);
- }
-
- // Unified EL 1.8.2, step 8 if either is a enum, then coerce both to enum
- // NOTE: we handle the JSF 1.1 case also where enums are treated as non-coercable
- // Object's
- if (firstArg.isEnumType() || secondArg.isEnumType())
- {
- return validateEnumComparison(firstArg, secondArg);
- }
-
- // JSP.2.3.5.7, step 8 if either is a string, coerce to string and
- // compare lexically
- if (TypeConstants.TYPE_STRING.equals(boxedFirstType)
- || TypeConstants.TYPE_STRING.equals(boxedSecondType))
- {
- return validateStringComparison(firstArg, secondArg);
- }
-
- // otherwise, an equal compare will be done A.equals(B). Since
- return Diagnostic.OK_INSTANCE;
- }
-
-
- /**
- * Both types are coerced to boolean before comparison
- *
- * @param firstArg
- * @param secondArg
- * @return the result of the comparison
- */
- private ValueType handleBooleanComparison(ValueType firstArg, ValueType secondArg)
- {
- boolean canCoerceFirstArg =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- boolean canCoerceSecondArg = TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- if (! (canCoerceFirstArg && canCoerceSecondArg))
- {
- return null;
- }
-
- if (firstArg instanceof LiteralType && secondArg instanceof LiteralType)
- {
- try
- {
- Boolean firstValue = ((LiteralType)firstArg).coerceToBoolean();
- Boolean secondValue = ((LiteralType)secondArg).coerceToBoolean();
-
- if (firstValue != null && secondValue != null)
- {
- boolean result = doRealOperation(firstValue, secondValue);
- return result ?
- BooleanLiteralType.TRUE :
- BooleanLiteralType.FALSE;
- }
- }
- catch (TypeCoercionException tce)
- {
- throw new AssertionError("should never get here; have already checked coercability above"); //$NON-NLS-1$
- }
- }
-
- // otherwise, we have a valid comparison that results in boolean
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- private Diagnostic validateBooleanComparison(ValueType firstType, ValueType secondType)
- {
- boolean canCoerceFirstArg =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstType.getSignature()));
- boolean canCoerceSecondArg = TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(secondType.getSignature()));
-
- if (!canCoerceFirstArg)
- {
- return _diagnosticFactory.create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN(Messages.getString("EqualityRelationalBinaryOperator.FirstArgument")); //$NON-NLS-1$
- }
-
- if (!canCoerceSecondArg)
- {
- return _diagnosticFactory.create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN(Messages.getString("EqualityRelationalBinaryOperator.SecondArgument")); //$NON-NLS-1$
- }
-
- if (firstType instanceof LiteralType && secondType instanceof LiteralType)
- {
- try
- {
- Boolean firstValue = ((LiteralType)firstType).coerceToBoolean();
- Boolean secondValue = ((LiteralType)secondType).coerceToBoolean();
-
- if (firstValue != null && secondValue != null)
- {
- final boolean result =
- doRealOperation(firstValue, secondValue);
- return _diagnosticFactory.
- create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME(getOperationName(), Boolean.toString(result));
- }
- }
- catch (TypeCoercionException tce)
- {
- throw new AssertionError("should never get here; have already checked coercability above"); //$NON-NLS-1$
- }
- }
-
- // otherwise, we have a valid comparison
- return Diagnostic.OK_INSTANCE;
- }
-
- @Override
- protected Diagnostic validateStringComparison(ValueType firstType,
- ValueType secondType)
- {
- String firstValue = null;
-
- if (firstType instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstType).getLiteralValue();
- }
-
- String secondValue = null;
- if (secondType instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondType).getLiteralValue();
- }
-
- if (firstValue != null)
- {
- Diagnostic result = validateIfEnumToStringComparison(firstValue, secondType);
-
- if (result != null)
- {
- return result;
- }
- }
-
- if (secondValue != null)
- {
- Diagnostic result = validateIfEnumToStringComparison(secondValue, firstType);
-
- if (result != null)
- {
- return result;
- }
- }
-
- // if it's a string to enum compare, do the default parent thing
- return super.validateStringComparison(firstType, secondType);
- }
-
-
- @Override
- protected ValueType handleStringComparison(ValueType firstType,
- ValueType secondType)
- {
- String firstValue = null;
-
- if (firstType instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstType).getLiteralValue();
- }
-
- String secondValue = null;
- if (secondType instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondType).getLiteralValue();
- }
-
- if (firstValue != null)
- {
- Diagnostic result = validateIfEnumToStringComparison(firstValue, secondType);
-
- if (result != null)
- {
- return handleIfEnumToNonMemberStringComparison(firstValue, secondType);
- }
- }
-
- if (secondValue != null)
- {
- Diagnostic result = validateIfEnumToStringComparison(secondValue, firstType);
-
- if (result != null)
- {
- return handleIfEnumToNonMemberStringComparison(secondValue, firstType);
- }
- }
-
- // otherwise, do the super thing
- return super.handleStringComparison(firstType, secondType);
- }
-
- private Diagnostic validateEnumComparison(final ValueType firstArg, final ValueType secondArg)
- {
- assert firstArg.isEnumType() || secondArg.isEnumType();
-
- // if the first is not an enum, then we have non-Enum == Enum case
- if (!firstArg.isEnumType())
- {
- return validateComparsionOfEnumAndNonEnum(firstArg, secondArg);
- }
-
- // if the second is not an enum, then we have Enum == non-Enum case
- if (!secondArg.isEnumType())
- {
- return validateComparsionOfEnumAndNonEnum(secondArg, firstArg);
- }
-
- // only other case is they are both enums. Check if they are directly
- // comparable.
- if (TypeUtil.canNeverBeEqual(firstArg.getSignature(), secondArg.getSignature()))
- {
- return _diagnosticFactory.
- create_BINARY_COMPARISON_WITH_TWO_ENUMS_ALWAYS_SAME
- (getOperationName()
- , doRealOperation("foo", "notFoo") // just simulate the operation where the operands are not equal //$NON-NLS-1$ //$NON-NLS-2$
- , TypeUtil.getFullyQualifiedName(firstArg.getSignature())
- , TypeUtil.getFullyQualifiedName(secondArg.getSignature()));
- }
-
- // otherwise, it's all good
- return Diagnostic.OK_INSTANCE;
- }
-
- private Diagnostic validateComparsionOfEnumAndNonEnum(final ValueType nonEnumType, final ValueType enumType)
- {
- // the only literal value that could have got us here is a
- // StringLiteralValue since the others a filtered out before this is
- // called
- if (nonEnumType instanceof LiteralType)
- {
- assert nonEnumType instanceof StringLiteralType;
-
- Diagnostic result = validateIfEnumToStringComparison(((StringLiteralType)nonEnumType).getLiteralValue(), enumType);
-
- if (result != null)
- {
- return result;
- }
- return Diagnostic.OK_INSTANCE;
- }
-
- // if the arg is a String, then we can't prove anything before runtime
- if (nonEnumType.isInstanceOf(TypeConstants.TYPE_STRING))
- {
- return Diagnostic.OK_INSTANCE;
- }
- // otherwise, we know it will result in a problem since one is an enum
- // and the other isn't
- return _diagnosticFactory.
- create_BINARY_COMPARISON_WITH_ENUM_AND_UNCOERCABLE_NONCONST_ALWAYS_SAME
- (getOperationName()
- , doRealOperation("foo", "notFoo") // just simulate the operation where the operands are not equal //$NON-NLS-1$ //$NON-NLS-2$
- , TypeUtil.getFullyQualifiedName(enumType.getSignature())
- , TypeUtil.getFullyQualifiedName(nonEnumType.getSignature()));
- }
-
- private Diagnostic validateIfEnumToStringComparison(final String literalValue, final ValueType validateIfEnum)
- {
- if (validateIfEnum.isEnumType()
- && validateIfEnum instanceof IObjectSymbolBasedValueType)
- {
- final IObjectSymbolBasedValueType symbolValueType =
- (IObjectSymbolBasedValueType) validateIfEnum;
-
- IType type = symbolValueType.getSymbol().getTypeDescriptor().resolveType(symbolValueType.getSymbol().getTypeDescriptor().getTypeSignature());
-
- if (type != null && !TypeUtil.isEnumMember(type, literalValue))
- {
- return _diagnosticFactory.
- create_BINARY_COMPARISON_WITH_ENUM_AND_CONST_ALWAYS_SAME
- (getOperationName()
- , doRealOperation(literalValue, literalValue+"_") // just simulate the operation where the operands are not equal //$NON-NLS-1$
- , TypeUtil.getFullyQualifiedName(validateIfEnum.getSignature())
- , literalValue);
- }
- }
-
- return null;
- }
-
- private ValueType handleIfEnumToNonMemberStringComparison(final String literalValue, final ValueType enumValueType)
- {
- // we need to apply the real operation to literalValue and any string that !equals(literalValue)
- // since it's not a member of the enum
- return BooleanLiteralType.valueOf(doRealOperation(literalValue, literalValue+"_")); //$NON-NLS-1$
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualsBinaryRelationalOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualsBinaryRelationalOperator.java
deleted file mode 100644
index 3fa99f472..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualsBinaryRelationalOperator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the equals -- ==/eq EL binary operator
- *
- * @author cbateman
- *
- */
-/*package*/ class EqualsBinaryRelationalOperator extends
- EqualityRelationalBinaryOperator
-{
-
- EqualsBinaryRelationalOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) {
- super(diagnosticFactory, jsfVersion);
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of the operation
- */
- protected boolean doRealOperation(Number firstArg, Number secondArg)
- {
- return firstArg.equals(secondArg);
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of the operation
- */
- protected boolean doRealOperation(Boolean firstArg, Boolean secondArg)
- {
- return firstArg.equals(secondArg);
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of the operation
- */
- protected boolean doRealOperation(String firstArg, String secondArg)
- {
- return firstArg.equals(secondArg);
- }
-
- protected String getOperationName()
- {
- return Messages.getString("EqualsBinaryRelationalOperator.OperationName"); //$NON-NLS-1$
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanEqRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanEqRelationalBinaryOperator.java
deleted file mode 100644
index edab570f8..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanEqRelationalBinaryOperator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Encapsulates the EL greater-than-eq operator -- ">="/ge
- *
- * @author cbateman
- *
- */
-/*package*/ class GreaterThanEqRelationalBinaryOperator extends
- LtGtRelationalBinaryOperator
-{
- GreaterThanEqRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) {
- super(diagnosticFactory, jsfVersion);
- }
-
- protected boolean doRealOperation(Number firstArg, Number secondArg)
- {
- return ((Comparable)firstArg).compareTo(secondArg) >= 0;
- }
-
- protected boolean doRealOperation(String firstArg, String secondArg)
- {
- return firstArg.compareTo(secondArg) >= 0;
- }
-
- protected String getOperationName()
- {
- return Messages.getString("GreaterThanEqRelationalBinaryOperator.OperationName"); //$NON-NLS-1$
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanRelationalBinaryOperator.java
deleted file mode 100644
index 78a62a7a6..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/GreaterThanRelationalBinaryOperator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the EL greater than operator -- ">"/gt
- * @author cbateman
- *
- */
-/*package*/ class GreaterThanRelationalBinaryOperator extends
- LtGtRelationalBinaryOperator {
-
- GreaterThanRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion)
- {
- super(diagnosticFactory, jsfVersion);
- }
-
- protected boolean doRealOperation(Number firstArg, Number secondArg)
- {
- return ((Comparable)firstArg).compareTo(secondArg) > 0;
- }
-
- protected boolean doRealOperation(String firstArg, String secondArg)
- {
- return firstArg.compareTo(secondArg) > 0;
- }
-
- protected String getOperationName()
- {
- return Messages.getString("GreaterThanRelationalBinaryOperator.OperationName"); //$NON-NLS-1$
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanEqRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanEqRelationalBinaryOperator.java
deleted file mode 100644
index 24dc5e2a5..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanEqRelationalBinaryOperator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-
-/**
- * Encapsulates the EL less-than-equal operator -- "<="/le
- *
- * @author cbateman
- *
- */
-/*package*/ class LessThanEqRelationalBinaryOperator extends
- LtGtRelationalBinaryOperator
-{
- LessThanEqRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion) {
- super(diagnosticFactory, jsfVersion);
- }
-
- protected boolean doRealOperation(Number firstArg, Number secondArg)
- {
- return ((Comparable)firstArg).compareTo(secondArg) <= 0;
- }
-
- protected boolean doRealOperation(String firstArg, String secondArg)
- {
- return firstArg.compareTo(secondArg) <= 0;
- }
-
- protected String getOperationName()
- {
- return Messages.getString("LessThanEqRelationalBinaryOperator.OperationName"); //$NON-NLS-1$
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanRelationalBinaryOperator.java
deleted file mode 100644
index 7b8e7ea7b..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LessThanRelationalBinaryOperator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * The "<"/"lt" less-than EL operator
- *
- * @author cbateman
- *
- */
-/*package*/ class LessThanRelationalBinaryOperator extends
- LtGtRelationalBinaryOperator
-{
- LessThanRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion)
- {
- super(diagnosticFactory, jsfVersion);
- }
-
- protected boolean doRealOperation(Number firstArg, Number secondArg)
- {
- return ((Comparable)firstArg).compareTo(secondArg) < 0;
- }
-
- protected boolean doRealOperation(String firstArg, String secondArg)
- {
- return firstArg.compareTo(secondArg) < 0;
- }
-
- protected String getOperationName()
- {
- return Messages.getString("LessThanRelationalBinaryOperator.OperationName"); //$NON-NLS-1$
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java
deleted file mode 100644
index deb4e9b7f..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LogicalBinaryOperator.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents a logical binary operator per JSP.2.3.6.1 (logical and/or)
- *
- * @author cbateman
- *
- */
-/*package*/abstract class LogicalBinaryOperator extends BinaryOperator
-{
- LogicalBinaryOperator(DiagnosticFactory diagnosticFactory) {
- super(diagnosticFactory);
- }
-
- public ValueType performOperation(ValueType firstArg, ValueType secondArg)
- {
- final boolean canCoerceFirstArg =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- final boolean canCoerceSecondArg =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- // if can't perform, must return null
- if (! (canCoerceFirstArg && canCoerceSecondArg))
- {
- return null;
- }
-
- Boolean firstArgResolvedValue = null;
-
- if (firstArg instanceof LiteralType)
- {
- try
- {
- firstArgResolvedValue = ((LiteralType)firstArg).coerceToBoolean();
- }
- catch (TypeCoercionException tce)
- {
- // should never be throw due to already checking if can coerce
- throw new AssertionError("coercion already checked; this should never be reached"); //$NON-NLS-1$
- }
- }
-
- Boolean secondArgResolvedValue = null;
- if (secondArg instanceof LiteralType)
- {
- try
- {
- secondArgResolvedValue = ((LiteralType)secondArg).coerceToBoolean();
- }
- catch (TypeCoercionException tce)
- {
- // should never be throw due to already checking if can coerce
- throw new AssertionError("coercion already checked; this should never be reached"); //$NON-NLS-1$
- }
- }
-
- if (firstArgResolvedValue != null && secondArgResolvedValue != null)
- {
- boolean result =
- doRealOperation(firstArgResolvedValue, secondArgResolvedValue);
-
- return result ? BooleanLiteralType.TRUE : BooleanLiteralType.FALSE;
-
- }
-
- // otherwise, just return a boolean
- // result can only be an rvalue
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- public Diagnostic validate(ValueType firstArg, ValueType secondArg)
- {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
- TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
-
- final boolean canCoerceFirstArg =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- final boolean canCoerceSecondArg =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- if (!canCoerceFirstArg)
- {
- return _diagnosticFactory.
- create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN("first"); //$NON-NLS-1$
- //return new BasicDiagnostic(Diagnostic.ERROR, "", 0, "Cannot coerce first argument of "+readableOperatorName()+" to boolean", null);
- }
-
- if (!canCoerceSecondArg)
- {
- return _diagnosticFactory.
- create_BINARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN("first"); //$NON-NLS-1$
-
- //return new BasicDiagnostic(Diagnostic.ERROR, "", 0, "Cannot coerce second argument of "+readableOperatorName()+" to boolean", null);
- }
-
- if (firstArg instanceof LiteralType)
- {
- try
- {
- final Boolean boolValue =
- ((LiteralType)firstArg).coerceToBoolean();
-
- if (boolValue.booleanValue() == shortCircuitValue())
- {
- return _diagnosticFactory.
- create_BINARY_OP_FIRST_ARGUMENT_SHORT_CIRCUITS
- (shortCircuitValue(), readableOperatorName());
- }
- }
- catch (TypeCoercionException tce)
- {
- // should never be throw due to already checking if can coerce
- throw new AssertionError("coercion already checked; this should never be reached"); //$NON-NLS-1$
- }
- }
-
- if (secondArg instanceof LiteralType)
- {
- try
- {
- final Boolean boolValue =
- ((LiteralType)secondArg).coerceToBoolean();
-
- if (boolValue.booleanValue() == shortCircuitValue())
- {
- return _diagnosticFactory.
- create_BINARY_OP_SECOND_ARGUMENT_ALWAYS_EVAL_SAME
- (shortCircuitValue(), readableOperatorName());
- }
- }
- catch (TypeCoercionException tce)
- {
- // should never be throw due to already checking if can coerce
- throw new AssertionError("coercion already checked; this should never be reached"); //$NON-NLS-1$
- }
- }
-
- // otherwise, nothing to report
- return Diagnostic.OK_INSTANCE;
- }
-
- /**
- * @return a human readable name for the operator
- */
- protected abstract String readableOperatorName();
-
- /**
- * @return the boolean value on which the operator short-circuits
- */
- protected abstract boolean shortCircuitValue();
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of performing the operator to two actual values
- */
- protected abstract boolean doRealOperation(Boolean firstArg, Boolean secondArg);
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java
deleted file mode 100644
index 8d8445c5b..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/LtGtRelationalBinaryOperator.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.common.util.TypeUtil;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Encapsulates the EL binary operators "<", ">", "<=", ">="
- *
- * @author cbateman
- *
- */
-/*package*/ abstract class LtGtRelationalBinaryOperator extends RelationalBinaryOperator
-{
- LtGtRelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion)
- {
- super(diagnosticFactory, jsfVersion);
- }
-
- protected abstract boolean doRealOperation(Number firstArg, Number secondArg);
-
- protected abstract boolean doRealOperation(String firstArg, String secondArg);
-
- public ValueType performOperation(ValueType firstArg, ValueType secondArg)
- {
- // JSP.2.3.5.6 step 2 if either operand is null, then always false
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- || TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return BooleanLiteralType.FALSE;
- }
-
- String boxedFirstType = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- String boxedSecondType = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.6 step 3, if either is BigDecimal, promote both and compare
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstType)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondType))
- {
- return handleNumericComparison(firstArg, secondArg, BigDecimal.class);
- }
-
- // JSP.2.3.5.6, step 4 if either is a float or double, promote both to
- // double and compare
- if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondType))
- {
- return handleNumericComparison(firstArg, secondArg, Double.class);
- }
-
- // JSP.2.3.5.6, step 5 if either is a big integer, promote and compare
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstType)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondType))
- {
- return handleNumericComparison(firstArg, secondArg, BigInteger.class);
- }
-
- // JSP.2.3.5.6, step 6 if either is Long or smaller, coerce both to Long
- if (TypeConstants.TYPE_BOXED_LONG.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_LONG.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_SHORT.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_SHORT.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_BYTE.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_BYTE.equals(boxedSecondType)
- || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedFirstType)
- || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedSecondType))
- {
- return handleNumericComparison(firstArg, secondArg, Long.class);
- }
-
- // JSP.2.3.5.7, step 7 if either is a string, coerce to string and
- // compare lexically
- if (TypeConstants.TYPE_STRING.equals(boxedFirstType)
- || TypeConstants.TYPE_STRING.equals(boxedSecondType))
- {
- return handleStringComparison(firstArg, secondArg);
- }
-
- // JSP.2.3.5.7, steps 8 and 9 -- if either one implements the
- // Comparable interface, then as far as we can determine statically
- // (compareTo may not work on the other arg, but who knows),
- // we are good
- if (firstArg.isInstanceOf(TypeConstants.TYPE_COMPARABLE)
- || secondArg.isInstanceOf(TypeConstants.TYPE_COMPARABLE))
- {
- if (checkIfIncompatibleEnums(firstArg, secondArg))
- {
- // error: no point in validating further since expr will probably throw an exception
- return null;
- }
-
- return new ValueType(Signature.SIG_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- // JSP.2.3.5.6, step 10 -- otherwise, error
- return null;
-
- }
-
- public Diagnostic validate(ValueType firstArg, ValueType secondArg)
- {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
- TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
-
- // JSP.2.3.5.6 step 2 if either operand is null, then always false
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- || TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return _diagnosticFactory.
- create_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME(Messages.getString("LtGtRelationalBinaryOperator.ConstantName.False")); //$NON-NLS-1$
- }
-
- String boxedFirstType = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- String boxedSecondType = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.6 step 3, if either is BigDecimal, promote both and compare
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstType)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondType))
- {
- return validateNumericComparison(firstArg, secondArg, BigDecimal.class);
- }
-
- // JSP.2.3.5.6, step 4 if either is a float or double, promote both to
- // double and compare
- if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondType))
- {
- return validateNumericComparison(firstArg, secondArg, Double.class);
- }
-
- // JSP.2.3.5.6, step 5 if either is a big integer, promote and compare
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstType)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondType))
- {
- return validateNumericComparison(firstArg, secondArg, BigInteger.class);
- }
-
- // JSP.2.3.5.6, step 6 if either is Long or smaller, coerce both to Long
- if (TypeConstants.TYPE_BOXED_LONG.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_LONG.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_INTEGER.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_SHORT.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_SHORT.equals(boxedSecondType)
- || TypeConstants.TYPE_BOXED_BYTE.equals(boxedFirstType)
- || TypeConstants.TYPE_BOXED_BYTE.equals(boxedSecondType)
- || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedFirstType)
- || TypeConstants.SIGNATURE_BOXED_CHARACTER.equals(boxedSecondType))
- {
- return validateNumericComparison(firstArg, secondArg, Long.class);
- }
-
- // JSP.2.3.5.7, step 7 if either is a string, coerce to string and
- // compare lexically
- if (TypeConstants.TYPE_STRING.equals(boxedFirstType)
- || TypeConstants.TYPE_STRING.equals(boxedSecondType))
- {
- return validateStringComparison(firstArg, secondArg);
- }
-
- // JSP.2.3.5.7, steps 8 and 9 -- if either one implements the
- // Comparable interface, then as far as we can determine statically
- // (compareTo may not work on the other arg, but who knows),
- // we are good
- if (firstArg.isInstanceOf(TypeConstants.TYPE_COMPARABLE)
- || secondArg.isInstanceOf(TypeConstants.TYPE_COMPARABLE))
- {
- Diagnostic diag = Diagnostic.OK_INSTANCE;
- if(checkIfIncompatibleEnums(firstArg, secondArg))
- {
- diag = _diagnosticFactory.create_BINARY_OP_COMPARISON_OF_ENUMS_INCOMPATIBLE();
- }
- return diag;
- }
-
- // JSP.2.3.5.6, step 10 -- otherwise, error
- return _diagnosticFactory.create_BINARY_OP_NO_AVAILABLE_TYPE_COERCION();
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return diagnostic if firstArg and secondArg are incompatible with each other
- * for compareTo purpose or OK if not
- */
- private boolean checkIfIncompatibleEnums(ValueType firstArg,
- ValueType secondArg)
- {
- if (firstArg.isEnumType()
- && secondArg.isEnumType()
- && !TypeUtil.isEnumsCompareCompatible(firstArg.getSignature()
- , secondArg.getSignature()))
- {
- return true;
- }
-
- return false;
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java
deleted file mode 100644
index b346d9fcd..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MemberAccessorOperator.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.NullLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.SignatureBasedType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.context.symbol.IMethodSymbol;
-import org.eclipse.jst.jsf.context.symbol.IObjectSymbol;
-import org.eclipse.jst.jsf.context.symbol.IPropertySymbol;
-import org.eclipse.jst.jsf.context.symbol.ISymbol;
-import org.eclipse.jst.jsf.context.symbol.internal.util.IMethodSymbolBasedType;
-import org.eclipse.jst.jsf.context.symbol.internal.util.IObjectSymbolBasedValueType;
-import org.eclipse.jst.jsf.designtime.resolver.ISymbolContextResolver;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Super-class for all operators whose function is to access members of an EL
- * object. i.e. the "." and "[]" operators
- *
- * @author cbateman
- *
- */
-public abstract class MemberAccessorOperator
-{
- /**
- * The source file for the EL expression in which this operator is being
- * evaluated.
- */
- protected final IFile _file;
-
- /**
- * the common factory used to create diagnostics
- */
- protected final DiagnosticFactory _diagnosticFactory;
-
- /**
- * Used to resolve variables and properties.
- */
- protected final ISymbolContextResolver _contextResolver;
-
- // TODO: need to reconcile with BinaryOperator? performOperation must return
- // SignatureBasedType since it may return a method. This can't happen
- // with other operators (besides eqiv [])
- /**
- * @param file
- * @param diagnosticFactory
- * @param contextResolver
- */
- protected MemberAccessorOperator(final IFile file,
- final DiagnosticFactory diagnosticFactory, final ISymbolContextResolver contextResolver)
- {
- _file = file;
- _diagnosticFactory = diagnosticFactory;
- _contextResolver = contextResolver;
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of validating the dot operation with these arguments.
- */
- public Diagnostic validate(final ValueType firstArg, final ValueType secondArg)
- {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
- if (!(firstArg instanceof IObjectSymbolBasedValueType))
- {
- throw new AssertionError(
- "The first argument of the member operator must always be a symbol resolvable value type"); //$NON-NLS-1$
- }
-
- if (TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return _diagnosticFactory
- .create_BINARY_OP_DOT_WITH_VALUEB_NULL(getOperatorName());
- }
-
- return validateObjectSymbolValue(
- (IObjectSymbolBasedValueType) firstArg, secondArg);
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the diagnostic for member(firstArg, secondArg)
- */
- protected abstract Diagnostic validateObjectSymbolValue(
- IObjectSymbolBasedValueType firstArg, ValueType secondArg);
-
- /**
- * @param firstArg
- * @param secondArg
- * @return a validation of a named property accessible base (map or bean)
- * given an a literal key argument
- */
- protected Diagnostic validateNamedPropertyAccessorBase(
- final IObjectSymbolBasedValueType firstArg, final LiteralType secondArg)
- {
- final IObjectSymbol curBaseSymbol = firstArg.getSymbol();
-
- final ISymbol nextSymbol =
- getMemberSymbol(firstArg.getSymbol(), secondArg
- .getLiteralValueRaw());
-
- // if the x in x.y is an unconstrained map an it returns
- // a java.lang.Object, then return null. We can't really say
- // anything meaningful about such a property anyway.
- // TODO: do we need to refine the type descriptor on such
- // a property object to make this more precise?
- if (curBaseSymbol.supportsCoercion(TypeConstants.TYPE_MAP)
- && nextSymbol instanceof IPropertySymbol
- && TypeConstants.TYPE_JAVAOBJECT
- .equals(((IPropertySymbol) nextSymbol)
- .getTypeDescriptor().getTypeSignature()))
- {
- // if we get a symbol back that's a generic object coming from a map
- // then stop validating; we can't tell anything for sure
- return Diagnostic.OK_INSTANCE;
- }
-
- if (nextSymbol == null)
- {
- return _diagnosticFactory.create_MEMBER_NOT_FOUND(secondArg
- .getLiteralValue(), firstArg.getSymbol().getName());
- }
-
- return Diagnostic.OK_INSTANCE;
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the resolved type for the operation or null if not computable
- */
- public SignatureBasedType performOperation(final ValueType firstArg,
- final ValueType secondArg)
- {
- if (!(firstArg instanceof IObjectSymbolBasedValueType))
- {
- return null;
- }
-
- // per JSP.2.3.4, if value-b is null, then return null (not literal
- // null)
- if (TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return null;
- }
-
- return handlePerformObjectSymbolValue(
- (IObjectSymbolBasedValueType) firstArg, secondArg);
- }
-
- /**
- * @param firstArg --
- * represents value-a (expr-a after step 1) in JSP.2.3.4
- * @param secondArg --
- * represents value-b (expr-b after step 3) in JSP.2.3.4
- * @return the new ValueType for this operation or null
- */
- protected abstract SignatureBasedType handlePerformObjectSymbolValue(
- IObjectSymbolBasedValueType firstArg, ValueType secondArg);
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the resolved type for firstArg[secondArg] treating firstArg as a
- * type that uses a named property accessor (i.e. a map or bean but
- * not a list or array) or null if unresolved
- */
- protected SignatureBasedType handlePerformNamedPropertyAccessorBase(
- final IObjectSymbolBasedValueType firstArg, final LiteralType secondArg)
- {
- final ISymbol symbol =
- getMemberSymbol(firstArg.getSymbol(), secondArg
- .getLiteralValueRaw());
-
- if (symbol instanceof IPropertySymbol)
- {
- return new IObjectSymbolBasedValueType((IPropertySymbol) symbol);
- }
- else if (symbol instanceof IMethodSymbol)
- {
- return new IMethodSymbolBasedType((IMethodSymbol) symbol);
- }
-
- // fall-through and return null
- // per JSP2.3.4 steps 5 and 6, return null literal if map, null (error)
- // otherwise
- if (firstArg.isInstanceOf(TypeConstants.TYPE_MAP))
- {
- return NullLiteralType.SINGLETON;
- }
- return null;
- }
-
- /**
- * @param symbol
- * @param name
- * @return the member symbol of 'symbol' corresponding to 'name' or null if
- * there is no such member
- */
- protected final ISymbol getMemberSymbol(final IObjectSymbol symbol,
- final Object name)
- {
- ISymbol memberSymbol = getPropertySymbol(symbol, name);
-
- if (memberSymbol != null)
- {
- return memberSymbol;
- }
-
- memberSymbol = getMethodSymbol(symbol, name);
-
- // otherwise, see if it's a valid method
- if (memberSymbol != null)
- {
- return memberSymbol;
- }
-
- // if not a property or method, then not a valid member
- return null;
- }
-
- /**
- * @param symbol
- * @param name
- * @return the property symbol called name relative to 'symbol' or null if
- * one doesn't exist
- */
- protected final ISymbol getPropertySymbol(final ISymbol symbol,
- final Object name)
- {
- return _contextResolver.getProperty(symbol, name);
- }
-
- /**
- * @param symbol
- * @param name
- * @return the method symbol on 'symbol' corresponding to 'name' or null if
- * no such member
- */
- protected final IMethodSymbol getMethodSymbol(final IObjectSymbol symbol,
- final Object name)
- {
- return _contextResolver.getMethod(symbol, name);
- }
-
-
- /**
- * @return a user-readable name of the operator (i.e. dot or bracket)
- */
- protected abstract String getOperatorName();
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/Messages.java
deleted file mode 100644
index 22c4c5618..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/Messages.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-class Messages {
- private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.validation.internal.el.operators.messages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
- private Messages() {
- // no external instantiation
- }
-
- /**
- * @param key
- * @return the string or !key! if not found
- */
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java
deleted file mode 100644
index 91705d9db..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MinusUnaryOperator.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.StringLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the EL unary operator '-' on a ValueType
- * as described by JSP.2.3.5.4
- *
- *
- * @author cbateman
- *
- */
-/*package*/class MinusUnaryOperator extends UnaryOperator
-{
- private static final String UNARY_MINUS = "unary minus"; //$NON-NLS-1$
-
- MinusUnaryOperator(DiagnosticFactory diagnosticFactory)
- {
- super(diagnosticFactory);
- }
-
- public Diagnostic validate(ValueType type)
- {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(type.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
- // must coerce to numeric type
- try
- {
- // if coerceTypeNumber doesn't throw an exception, then
- // give the benefit of the doubt
- final String coercedType =
- TypeCoercer.
- coerceToNumber(TypeTransformer.
- transformBoxPrimitives(type.getSignature()));
-
- if (TypeCoercer.typeIsNull(coercedType))
- {
- // null always coerces to 0L on this operator
- return _diagnosticFactory.
- create_UNARY_OP_MINUS_ON_NULL_ALWAYS_ZERO();
- }
-
- // JSP.2.3.5.4, step 2 if BigDecimal or BigInteger, then can't be
- // literal and retains type
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(coercedType)
- || TypeConstants.TYPE_BIG_INTEGER.equals(coercedType))
- {
- return Diagnostic.OK_INSTANCE;
- }
-
- // JSP.2.4.5.4, step 3: if String
- // note, use uncoerced type, since type coercer will return null for strings
- if (TypeCoercer.typeIsString(type.getSignature()))
- {
- // if it's a string and we have the value, we can determine for
- // sure whether or not it's coercable to a number
- // per JSP.2.3.5.4 step 3.1
- if (type instanceof StringLiteralType)
- {
- String literalValue = ((LiteralType)type).getLiteralValue();
- if (literalValue.indexOf('.') > -1
- || literalValue.indexOf('e') > -1
- || literalValue.indexOf('E') > -1)
- {
- // if it coerces to double, then it's a double
- ((LiteralType)type).coerceToNumber(Double.class);
- // this is okay, because an expression like #{-3.3} can't be folded
- return Diagnostic.OK_INSTANCE;
- }
- // per JSP.2.3.5.4, step 3.2 try to coerce to long
- // if it coerces to long, then it's a long
- ((LiteralType)type).coerceToNumber(Long.class);
- // this is okay, because an expression like #{-3} can't be folded
- return Diagnostic.OK_INSTANCE;
- }
- // if non-literal string, warn that coercion to number is not
- // guaranteed since Long.valueOf and Double.valueOf
- // (unlike Boolean.valueOf) throw NumberFormatExceptions
- return _diagnosticFactory.create_UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED(UNARY_MINUS);
- }
-
- // JSP.2.3.5.4, step 4, for all numeric types, retain type,
- // validate constant folding
- // note that this return true for big int and decimal, so those cases
- // must already have been handled.
- if (TypeCoercer.typeIsNumeric(coercedType))
- {
- // otherwise, we are fine
- return Diagnostic.OK_INSTANCE;
- }
-
- }
- catch (TypeCoercionException tce)
- {
- // fallthrough to error below
- }
- // otherwise, error
- return _diagnosticFactory.create_UNARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(UNARY_MINUS);
- }
-
- /**
- * Based on JSP.2.3.5.4
- *
- * @param type
- * @return type of type after a minus is applied or null if unknown
- */
- public ValueType performOperation(ValueType type)
- {
- try
- {
- final String boxedType =
- TypeTransformer.transformBoxPrimitives(type.getSignature());
- // check for valid type coercion
- String coercedType = TypeCoercer.coerceToNumber(boxedType);
-
- if (TypeCoercer.typeIsNull(coercedType))
- {
- // null always coerces to 0L on this operator
- return new IntegerLiteralType(0L);
- }
-
- // JSP.2.3.5.4, step 2 if BigDecimal or BigInteger, then can't be
- // literal and retains type
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(coercedType))
- {
- return new ValueType(TypeConstants.TYPE_BIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- else if (TypeConstants.TYPE_BIG_INTEGER.equals(coercedType))
- {
- return new ValueType(TypeConstants.TYPE_BIG_INTEGER, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- if (TypeCoercer.typeIsString(type.getSignature()))
- {
- // if it's string and we have the value, we can determine for
- // sure whether or not it's coercable to a number
- // per JSP.2.3.5.4 step 3
- if (type instanceof StringLiteralType)
- {
- String literalValue = ((LiteralType)type).getLiteralValue();
- if (literalValue.indexOf('.') > -1
- || literalValue.indexOf('e') > -1
- || literalValue.indexOf('E') > -1)
- {
- // if it coerces to double, then it's a double
- Number value = ((LiteralType)type).coerceToNumber(Double.class);
- return new FloatLiteralType(-1 * value.doubleValue());
- }
-
- // if it coerces to long, then it's a long
- Number value = ((LiteralType)type).coerceToNumber(Long.class);
- return new IntegerLiteralType(-1 * value.longValue());
- }
-
- // otherwise, just return a long typed value
- return new ValueType(Signature.SIG_LONG, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- // JSP.2.3.5.4
- // big integer and big decimal retain type
- // all numeric types retain type
- if (TypeCoercer.typeIsNumeric(boxedType))
- {
- // integer and float literals are special because -1 or -1.0
- // is syntically minusOp(1) and minusOp(1.0)
- if (type instanceof IntegerLiteralType)
- {
- return new IntegerLiteralType(-1 * ((IntegerLiteralType)type).coerceToNumber(Long.class).longValue());
- }
- else if (type instanceof FloatLiteralType)
- {
- return new FloatLiteralType(-1 * ((FloatLiteralType)type).coerceToNumber(Double.class).doubleValue());
- }
- return type;
- }
-
- // all other cases, return null
- // even is type represents a String, without it's value, we have
- // no idea how to coerce it without it's value
- // fall through and return null
- }
- catch (TypeCoercionException tce)
- {
- // do nothing, fall through and return null
- }
-
- return null;
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java
deleted file mode 100644
index 0b6ac7d01..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/ModArithmeticBinaryOperator.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the EL modulo operator: % or mod
- * Based JSP.2.3.5.3
- *
- * @author cbateman
- *
- */
-/*package*/ class ModArithmeticBinaryOperator extends ArithmeticBinaryOperator
-{
- private static final String MODULO = "modulo"; //$NON-NLS-1$
-
- ModArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) {
- super(diagnosticFactory);
- }
-
- public ValueType performOperation(ValueType firstArg, ValueType secondArg)
- {
- // JSP.2.3.5.3, step 1 if both null, then return zero
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- && TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return IntegerLiteralType.ZERO;
- }
-
- final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.3, step 2, if either arg is BigDecimal, Float, Double
- // or String (ignoring whether it is value coercable), then coerce
- // to Double and do op
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg)
- || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstArg)
- || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondArg)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstArg)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondArg))
- {
- // TODO: handle case where one is a literal or resolvable string value
- // that containss ".", "e" or "E"
- return performDouble(firstArg, secondArg);
- }
-
- // JSP.2.3.5.3, step 3, if either arg is a BigInteger, coerce
- // both to BigInteger
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg))
- {
- return performBigInteger(firstArg, secondArg);
- }
-
- // JSP.2.3.5.3, step 4, otherwise try to perform as a Long op
- return performLong(firstArg, secondArg);
- }
-
- public Diagnostic validate(ValueType firstArg, ValueType secondArg) {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
- TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
-
- // JSP.2.3.5.3, step 1 if both null, then return zero
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- && TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return _diagnosticFactory.create_BINARY_OP_BOTH_OPERANDS_NULL(MODULO);
- }
-
- final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.3, step 2, if either arg is BigDecimal, Float, Double
- // or String (ignoring whether it is value coercable), then coerce
- // to Double and do op
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg)
- || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstArg)
- || TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondArg)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstArg)
- || TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondArg))
- {
- // TODO: handle case where one is a literal or resolvable string value
- // that containss ".", "e" or "E"
- return validateDouble(firstArg, secondArg);
- }
-
- // JSP.2.3.5.3, step 3, if either arg is a BigInteger, coerce
- // both to BigInteger
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg))
- {
- return validateBigInteger(firstArg, secondArg);
- }
-
- // JSP.2.3.5.3, step 4, otherwise try to perform as a Long op
- return validateLong(firstArg, secondArg);
- }
-
- private ValueType performDouble(ValueType firstArg, ValueType secondArg)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- Number secondValue = null;
-
- if (secondArg instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondArg).coerceToNumber(Double.class);
-
- if (secondValue.doubleValue() == 0.0)
- {
- // division by zero
- return null;
- }
- }
-
- Number firstValue = null;
-
- if (firstArg instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstArg).coerceToNumber(Double.class);
- }
-
- if (firstValue != null && secondValue != null)
- {
- return new FloatLiteralType(
- doRealOperation(new Double(firstValue.doubleValue()),
- new Double(secondValue.doubleValue())).doubleValue());
- }
-
- // if we get to here, the coercion is valid, so a Double will be
- // returned
- return new ValueType(Signature.SIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- catch (TypeCoercionException tce)
- {
- // could not coerce, so null
- return null;
- }
- }
-
- private ValueType performBigInteger(ValueType firstArg, ValueType secondArg)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- // check second arg for zero
- if (secondArg instanceof LiteralType)
- {
- if (((LiteralType)secondArg).coerceToNumber(BigInteger.class).equals(BigInteger.ZERO))
- {
- // division by zero
- return null;
- }
- }
-
- // since one of the args is BigInteger, they are not both literals,
- // so if we get to here, we have a successful mod of two
- // big integers to one big integer
- return new ValueType(TypeConstants.TYPE_BIG_INTEGER, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- catch (TypeCoercionException tce)
- {
- // no coercion
- return null;
- }
- }
-
- private ValueType performLong(ValueType firstArg, ValueType secondArg)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- Number secondValue = null;
-
- if (secondArg instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondArg).coerceToNumber(Long.class);
-
- if (secondValue.longValue() == 0)
- {
- // division by zero
- return null;
- }
- }
-
- Number firstValue = null;
-
- if (firstArg instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstArg).coerceToNumber(Long.class);
- }
-
- if (firstValue != null && secondValue != null)
- {
- return new IntegerLiteralType(
- doRealOperation(Long.valueOf(firstValue.longValue()),
- Long.valueOf(secondValue.longValue())).longValue());
- }
-
- // if we get to here, the coercion is valid, so a Long will be
- // returned
- return new ValueType(Signature.SIG_LONG, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- catch (TypeCoercionException tce)
- {
- // could not coerce, so null
- return null;
- }
- }
-
- private Diagnostic validateDouble(ValueType firstArg, ValueType secondArg)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- Number secondValue = null;
-
- if (secondArg instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondArg).coerceToNumber(Double.class);
-
- if (secondValue.doubleValue() == 0.0)
- {
- // division by zero
- return _diagnosticFactory.create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO();
- }
- }
-
- Number firstValue = null;
-
- if (firstArg instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstArg).coerceToNumber(Double.class);
- }
-
- if (firstValue != null && secondValue != null)
- {
- return _diagnosticFactory.
- create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME
- (MODULO, Double.toString(
- firstValue.doubleValue()%secondValue.doubleValue()));
- }
-
- // if we get to here, the coercion is valid, so a Double will be
- // returned and everything is good
- return Diagnostic.OK_INSTANCE;
- }
- catch (TypeCoercionException tce)
- {
- // could not coerce, so error
- return _diagnosticFactory.
- create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(MODULO);
- }
- }
-
- private Diagnostic validateBigInteger(ValueType firstArg, ValueType secondArg)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- // check second arg for zero
- if (secondArg instanceof LiteralType)
- {
- if (((LiteralType)secondArg).coerceToNumber(BigInteger.class).equals(BigInteger.ZERO))
- {
- // division by zero
- return _diagnosticFactory.create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO();
- }
- }
-
- // since one of the args is BigInteger, they are not both literals,
- // so if we get to here, we have a successful mod of two
- // big integers to one big integer
- return Diagnostic.OK_INSTANCE;
- }
- catch (TypeCoercionException tce)
- {
- // no coercion
- return _diagnosticFactory.
- create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(MODULO);
- }
- }
-
- private Diagnostic validateLong(ValueType firstArg, ValueType secondArg)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- Number secondValue = null;
-
- if (secondArg instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondArg).coerceToNumber(Long.class);
-
- if (secondValue.longValue() == 0)
- {
- // division by zero
- return _diagnosticFactory.
- create_BINARY_OP_POSSIBLE_DIVISION_BY_ZERO();
- }
- }
-
- Number firstValue = null;
-
- if (firstArg instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstArg).coerceToNumber(Long.class);
- }
-
- if (firstValue != null && secondValue != null)
- {
- return _diagnosticFactory.
- create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME
- (MODULO, Long.toString(firstValue.longValue()%secondValue.longValue()));
- }
-
- // if we get to here, the coercion is valid, so a Long will be
- // returned
- return Diagnostic.OK_INSTANCE;
- }
- catch (TypeCoercionException tce)
- {
- // could not coerce, so error
- return _diagnosticFactory.
- create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(MODULO);
- }
- }
-
- protected Long doRealOperation(Long firstArg, Long secondArg) {
- return Long.valueOf(firstArg.longValue() % secondArg.longValue());
- }
-
- protected Double doRealOperation(Double firstArg, Double secondArg) {
- return new Double(firstArg.doubleValue() % secondArg.doubleValue());
- }
-
- protected BigDecimal doRealOperation(BigDecimal firstArg,
- BigDecimal secondArg) {
- return new BigDecimal(firstArg.doubleValue() % secondArg.doubleValue());
- }
-
- protected String getOperatorName() {
- return MODULO;
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MultiplyArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MultiplyArithmeticBinaryOperator.java
deleted file mode 100644
index 605ce470a..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/MultiplyArithmeticBinaryOperator.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the EL Multiply arithmetic binary operator "*"
- *
- * @author cbateman
- *
- */
-/*package*/ class MultiplyArithmeticBinaryOperator extends
- NoDivArithmeticBinaryOperator
-{
- private static final String MULTIPLICATION = "multiplication"; //$NON-NLS-1$
-
-
- MultiplyArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory)
- {
- super(diagnosticFactory);
- }
-
- protected Long doRealOperation(Long firstArg, Long secondArg)
- {
- return Long.valueOf(firstArg.longValue() * secondArg.longValue());
- }
-
- protected Double doRealOperation(Double firstArg, Double secondArg)
- {
- return new Double(firstArg.doubleValue() * secondArg.doubleValue());
- }
-
- protected BigDecimal doRealOperation(BigDecimal firstArg,
- BigDecimal secondArg)
- {
- return firstArg.multiply(secondArg);
- }
-
- protected String getOperatorName() {
- return MULTIPLICATION;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java
deleted file mode 100644
index 3b057545d..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NoDivArithmeticBinaryOperator.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jst.jsf.common.internal.types.FloatLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.IntegerLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents non-dividing arithmetic EL operators: +,-,*
- * Based on JSP.2.3.5.1
- *
- * @author cbateman
- *
- */
-/*package*/ abstract class NoDivArithmeticBinaryOperator extends ArithmeticBinaryOperator
-{
- NoDivArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) {
- super(diagnosticFactory);
- }
-
- protected abstract Long doRealOperation(Long firstArg, Long secondArg);
-
- protected abstract Double doRealOperation(Double firstArg, Double secondArg);
-
- public ValueType performOperation(ValueType firstArg, ValueType secondArg)
- {
- // JSP.2.3.5.1, step 1, if either arg is null, return (Long) 0
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- && TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return new IntegerLiteralType(0);
- }
-
- final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.1, step 2, if either arg is a BigDecimal, coerce to BigDecimal
- // and apply
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg))
- {
- return handleNumericArithmetic(firstArg, secondArg, BigDecimal.class);
- }
-
- // JSP.2.3.5.1, step 3, if either arg is float or double or
- // a String containing "., e or E", then coerce if the other is
- // a big int, coerce up to BigDecimal, else to Double
- // Note: we are ignoring strings we can't resolve to figure out
- // if the contain "., e or E". Assume they always do
- if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstArg)
- ||TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondArg)
- ||TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstArg)
- ||TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondArg))
- {
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg)
- ||TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg))
- {
- // if the other operand is BigInteger, treat as BigDecimal
- return handleNumericArithmetic(firstArg, secondArg, BigDecimal.class);
- }
-
- // otherwise as double
- return handleNumericArithmetic(firstArg, secondArg, Double.class);
- }
-
- // JSP.2.3.5.1, step 4, if one is a big integer, coerce to big integer
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg))
- {
- return handleNumericArithmetic(firstArg, secondArg, BigInteger.class);
- }
-
- // JSP.2.3.5.1, step 5, otherwise, try to coerce to Long
- return handleNumericArithmetic(firstArg, secondArg, Long.class);
- }
-
- public Diagnostic validate(ValueType firstArg, ValueType secondArg)
- {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(firstArg.getSignature()) ||
- TypeConstants.TYPE_JAVAOBJECT.equals(secondArg.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
-
- // JSP.2.3.5.1, step 1, if either arg is null, return (Long) 0
- if (TypeCoercer.typeIsNull(firstArg.getSignature())
- && TypeCoercer.typeIsNull(secondArg.getSignature()))
- {
- return _diagnosticFactory.create_BINARY_OP_BOTH_OPERANDS_NULL(getOperatorName());
- }
-
- final String boxedFirstArg = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
- final String boxedSecondArg = TypeTransformer.transformBoxPrimitives(secondArg.getSignature());
-
- // JSP.2.3.5.1, step 2, if either arg is a BigDecimal, coerce to BigDecimal
- // and apply
- if (TypeConstants.TYPE_BIG_DOUBLE.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_DOUBLE.equals(boxedSecondArg))
- {
- return validateNumericArithmetic(firstArg, secondArg, BigDecimal.class);
- }
-
- // JSP.2.3.5.1, step 3, if either arg is float or double or
- // a String containing "., e or E", then coerce if the other is
- // a big int, coerce up to BigDecimal, else to Double
- // Note: we are ignoring strings we can't resolve to figure out
- // if the contain "., e or E". Assume they always do
- if (TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedFirstArg)
- ||TypeConstants.TYPE_BOXED_DOUBLE.equals(boxedSecondArg)
- ||TypeConstants.TYPE_BOXED_FLOAT.equals(boxedFirstArg)
- ||TypeConstants.TYPE_BOXED_FLOAT.equals(boxedSecondArg))
- {
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg)
- ||TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg))
- {
- // if the other operand is BigInteger, treat as BigDecimal
- return validateNumericArithmetic(firstArg, secondArg, BigDecimal.class);
- }
-
- // otherwise as double
- return validateNumericArithmetic(firstArg, secondArg, Double.class);
- }
-
- // JSP.2.3.5.1, step 4, if one is a big integer, coerce to big integer
- if (TypeConstants.TYPE_BIG_INTEGER.equals(boxedFirstArg)
- || TypeConstants.TYPE_BIG_INTEGER.equals(boxedSecondArg))
- {
- return validateNumericArithmetic(firstArg, secondArg, BigInteger.class);
- }
-
- // JSP.2.3.5.1, step 5, otherwise, try to coerce to Long
- return validateNumericArithmetic(firstArg, secondArg, Long.class);
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @param numberType
- * @return a value type based on the result of the arithmetic operation
- */
- protected ValueType handleNumericArithmetic(ValueType firstArg, ValueType secondArg, Class numberType)
- {
- try
- {
-// final String coercedFirstArg =
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
-// final String coercedSecondArg =
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- if (firstArg instanceof LiteralType && secondArg instanceof LiteralType)
- {
- try
- {
- Number firstValue =
- ((LiteralType)firstArg).coerceToNumber(numberType);
- Number secondValue =
- ((LiteralType)secondArg).coerceToNumber(numberType);
-
- LiteralType result = null;
-
- if (numberType == Double.class)
- {
- Double resultValue =
- doRealOperation((Double)firstValue,
- (Double) secondValue);
- result = new FloatLiteralType(resultValue.doubleValue());
- }
- else if (numberType == Long.class)
- {
- Long resultValue =
- doRealOperation((Long) firstValue, (Long) secondValue);
- result = new IntegerLiteralType(resultValue.longValue());
- }
- else
- {
- throw new AssertionError("unsupport arithmetic upcast type"); //$NON-NLS-1$
- }
-
- return result;
- }
- catch (TypeCoercionException tce)
- {
- // could happen if two string literals passed
- return null;
- }
- }
-
- // if we get to here, then we have two valid numeric arith
- // types, but at least one is not a literal, so the best we can
- // say is that the return will be the same asthe type of numeric
- // coercion
- if (numberType == BigDecimal.class)
- {
- return new ValueType(TypeConstants.TYPE_BIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- else if (numberType == Double.class)
- {
- return new ValueType(Signature.SIG_DOUBLE, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- else if (numberType == BigInteger.class)
- {
- return new ValueType(TypeConstants.TYPE_BIG_INTEGER, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- else
- {
- return new ValueType(Signature.SIG_LONG, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- }
- catch (TypeCoercionException tce)
- {
- // coercion to number failed, so no go
- return null;
- }
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @param numberType
- * @return a diagnostic validating the arithmetic expr firstArg op secondArg
- */
- protected Diagnostic validateNumericArithmetic(ValueType firstArg, ValueType secondArg, Class numberType)
- {
- try
- {
-// final String coercedFirstArg =
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
-// final String coercedSecondArg =
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- if (firstArg instanceof LiteralType && secondArg instanceof LiteralType)
- {
- try
- {
- Number firstValue =
- ((LiteralType)firstArg).coerceToNumber(numberType);
- Number secondValue =
- ((LiteralType)secondArg).coerceToNumber(numberType);
-
- Number result = null;
-
- if (numberType == Double.class)
- {
- result =
- doRealOperation((Double)firstValue,
- (Double) secondValue);
- }
- else if (numberType == Long.class)
- {
- result =
- doRealOperation((Long) firstValue, (Long) secondValue);
- }
- else
- {
- throw new AssertionError("unsupport arithmetic upcast type"); //$NON-NLS-1$
- }
-
- return _diagnosticFactory.
- create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME
- (getOperatorName(), result.toString());
- }
- catch (TypeCoercionException tce)
- {
- // could happen when two strings are passed
- return _diagnosticFactory.
- create_BINARY_OP_COULD_NOT_COERCE_LITERALS_TO_NUMBERS();
- }
- }
-
- // if we get to here, then we have two valid numeric arith
- // types, but at least one is not a literal
- // everything should be ok
- return Diagnostic.OK_INSTANCE;
- }
- catch (TypeCoercionException tce)
- {
- // coercion to number failed, so no go
- return _diagnosticFactory.
- create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(getOperatorName());
- }
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotEqualsBinaryRelationalOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotEqualsBinaryRelationalOperator.java
deleted file mode 100644
index 1d6245426..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotEqualsBinaryRelationalOperator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the not equals -- "!="/ne EL binary operator
- * @author cbateman
- *
- */
-/*package*/ class NotEqualsBinaryRelationalOperator extends
- EqualityRelationalBinaryOperator {
-
- NotEqualsBinaryRelationalOperator(final DiagnosticFactory diagnosticFactory, String jsfVersion)
- {
- super(diagnosticFactory, jsfVersion);
- }
-
- protected boolean doRealOperation(Number firstArg, Number secondArg) {
- return !firstArg.equals(secondArg);
- }
-
- protected boolean doRealOperation(Boolean firstArg, Boolean secondArg) {
- return !firstArg.equals(secondArg);
- }
-
- protected boolean doRealOperation(String firstArg, String secondArg) {
- return !firstArg.equals(secondArg);
- }
-
- protected String getOperationName()
- {
- return Messages.getString("NotEqualsBinaryRelationalOperator.OperationName"); //$NON-NLS-1$
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java
deleted file mode 100644
index f8f09b22e..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/NotUnaryOperator.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents te EL unary operators "!" and "not" on a ValueType
- * as described by JSP.2.3.6.2
- *
- * @author cbateman
- *
- */
-/*package*/ class NotUnaryOperator extends UnaryOperator
-{
- NotUnaryOperator(DiagnosticFactory diagnosticFactory)
- {
- super(diagnosticFactory);
- }
-
- public Diagnostic validate(ValueType type)
- {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(type.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
- boolean canCoerce =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(type.getSignature()));
-
- if (canCoerce)
- {
- // check for constant evaluation
- if (type instanceof LiteralType)
- {
- try
- {
- Boolean coercedValue = ((LiteralType)type).coerceToBoolean();
-
- // we are logically notting, so coerced is true, then false
- // if false then true
- return _diagnosticFactory.create_UNARY_OP_CONSTANT_EXPRESSION_EVAL_SAME_ID(
- "not" //$NON-NLS-1$
- , Boolean.valueOf(!coercedValue.booleanValue()).toString());
-
- }
- catch (TypeCoercionException tce)
- {
- throw new AssertionError("coerce should not throw exception"); //$NON-NLS-1$
- }
- }
-
- return Diagnostic.OK_INSTANCE;
- }
- return _diagnosticFactory.create_UNARY_OP_CANNOT_COERCE_ARGUMENT_TO_BOOLEAN();
- }
-
- public ValueType performOperation(ValueType type)
- {
- boolean canCoerce =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(type.getSignature()));
-
- if (canCoerce)
- {
- if (type instanceof LiteralType)
- {
- try
- {
- Boolean coercedValue = ((LiteralType)type).coerceToBoolean();
-
- // we are logically notting, so coerced is true, then false
- // if false then true
- return
- coercedValue.booleanValue() ?
- BooleanLiteralType.FALSE :
- BooleanLiteralType.TRUE;
- }
- catch (TypeCoercionException tce)
- {
- throw new AssertionError("coerce should not throw exception"); //$NON-NLS-1$
- }
- }
-
- return new ValueType(TypeConstants.TYPE_BOOLEAN, type.getAssignability());
- }
- return null;
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/OrBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/OrBinaryOperator.java
deleted file mode 100644
index 4914704d8..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/OrBinaryOperator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Encapsulates the 'and'/'&&' boolean-AND operator
- * Based on JSP.2.3.6.1
- *
- * @author cbateman
- *
- */
-/*package*/class OrBinaryOperator extends LogicalBinaryOperator
-{
- OrBinaryOperator(DiagnosticFactory diagnosticFactory)
- {
- super(diagnosticFactory);
- }
-
- protected boolean doRealOperation(Boolean firstArg, Boolean secondArg)
- {
- return (firstArg.booleanValue() || secondArg.booleanValue());
- }
-
- protected String readableOperatorName()
- {
- return "logical-OR"; //$NON-NLS-1$
- }
-
- protected boolean shortCircuitValue()
- {
- // OR short-circuits on true
- return true;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/RelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/RelationalBinaryOperator.java
deleted file mode 100644
index 924ec9854..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/RelationalBinaryOperator.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.BooleanLiteralType;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.core.IJSFCoreConstants;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-
-/**
- * Super-class of all relational binary ops - "==", "!=", "<", ">", "<=", ">="
- * @author cbateman
- *
- */
-/*package*/ abstract class RelationalBinaryOperator extends BinaryOperator
-{
- private final String _jsfVersion;
-
- RelationalBinaryOperator(final DiagnosticFactory diagnosticFactory, final String jsfVersion)
- {
- super(diagnosticFactory);
- _jsfVersion = jsfVersion;
- }
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of the operation
- */
- protected abstract boolean doRealOperation(Number firstArg, Number secondArg);
-
- /**
- * @param firstArg
- * @param secondArg
- * @return the result of the operation
- */
- protected abstract boolean doRealOperation(String firstArg, String secondArg);
-
- /**
- * @return the operation's user readable name
- */
- protected abstract String getOperationName();
-
- /**
- * Performs a the operation, casting both args to BigDecimal first
- *
- * @param firstArg
- * @param secondArg
- * @param numberType
- * @return the result of the comparison or null if indeterminate
- */
- protected ValueType handleNumericComparison(ValueType firstArg, ValueType secondArg, Class numberType)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstArg.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondArg.getSignature()));
-
- Number firstValue = null;
- if (firstArg instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstArg).coerceToNumber(numberType);
- }
-
- Number secondValue = null;
- if (secondArg instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondArg).coerceToNumber(numberType);
- }
-
- if (firstValue != null && secondValue != null)
- {
- boolean result = doRealOperation(firstValue, secondValue);
-
- return result ? BooleanLiteralType.TRUE : BooleanLiteralType.FALSE;
- }
-
- // if we get to here, we only know that both can be up cast to BigDecimal
- // and compared. This will yield a boolean result
- // this value cannot be lhs
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
- catch (TypeCoercionException tce)
- {
- // no valid coercion, so return null
- return null;
- }
- }
-
- /**
- * @param firstType
- * @param secondType
- * @param numberType
- * @return a diagnostic validating the relational comparison of firstType to secondType
- */
- protected Diagnostic validateNumericComparison(ValueType firstType, ValueType secondType, Class numberType)
- {
- try
- {
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(firstType.getSignature()));
- TypeCoercer.coerceToNumber(TypeTransformer.transformBoxPrimitives(secondType.getSignature()));
-
- Number firstValue = null;
- if (firstType instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstType).coerceToNumber(numberType);
- }
-
- Number secondValue = null;
- if (secondType instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondType).coerceToNumber(numberType);
- }
-
- if (firstValue != null && secondValue != null)
- {
- boolean result = doRealOperation(firstValue, secondValue);
-
- return _diagnosticFactory.
- create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME
- (getOperationName(), Boolean.toString(result));
- }
-
- // if we get to here, we only know that both can be up cast to BigDecimal
- // and compared. This condition is okay
- return Diagnostic.OK_INSTANCE;
- }
- catch (TypeCoercionException tce)
- {
- // could not make numeric coercion for valid comparison
- return _diagnosticFactory.create_BINARY_OP_COULD_NOT_MAKE_NUMERIC_COERCION(getOperationName());
- }
- }
-
- /**
- * @param firstType
- * @param secondType
- * @return the result of the operation
- */
- protected ValueType handleStringComparison(ValueType firstType, ValueType secondType)
- {
- String firstValue = null;
-
- if (firstType instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstType).getLiteralValue();
- }
-
- String secondValue = null;
- if (secondType instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondType).getLiteralValue();
- }
-
- if (firstValue != null && secondValue != null)
- {
- boolean newValue = doRealOperation(firstValue, secondValue);
- return newValue ? BooleanLiteralType.TRUE : BooleanLiteralType.FALSE;
- }
-
- // if don't have all literals, just return boolean type
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- /**
- * @param firstType
- * @param secondType
- * @return a diagnostic validating the string comparison of firstType to secondType
- */
- protected Diagnostic validateStringComparison(ValueType firstType, ValueType secondType)
- {
- String firstValue = null;
-
- if (firstType instanceof LiteralType)
- {
- firstValue = ((LiteralType)firstType).getLiteralValue();
- }
-
- String secondValue = null;
- if (secondType instanceof LiteralType)
- {
- secondValue = ((LiteralType)secondType).getLiteralValue();
- }
-
- if (firstValue != null && secondValue != null)
- {
- boolean newValue = doRealOperation(firstValue, secondValue);
- return _diagnosticFactory.
- create_BINARY_OP_CONSTANT_EXPRESSION_ALWAYS_EVAL_SAME
- (getOperationName(), Boolean.toString(newValue));
- }
-
- // if don't have all literals, just return boolean type
- return Diagnostic.OK_INSTANCE;
- }
-
-
- /**
- * @return the current JSF version string
- */
- protected final String getJsfVersion() {
- return _jsfVersion;
- }
-
- /**
- * @return true if the JSF version for this operator is JSF 1.1 or 1.0
- */
- protected final boolean isPreJSF12()
- {
- return IJSFCoreConstants.JSF_VERSION_1_1.equals(_jsfVersion)
- || IJSFCoreConstants.JSF_VERSION_1_0.equals(_jsfVersion);
- }
-
- /**
- * @return true if the JSF version for this operator is JSF 1.2 or later
- */
- protected final boolean isJSF12OrLater()
- {
- return !isPreJSF12();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/SubtractArithmeticBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/SubtractArithmeticBinaryOperator.java
deleted file mode 100644
index acdaeda13..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/SubtractArithmeticBinaryOperator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import java.math.BigDecimal;
-
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the EL arithmetic subtraction binary operator
- *
- * @author cbateman
- *
- */
-/*package*/ class SubtractArithmeticBinaryOperator extends
- NoDivArithmeticBinaryOperator
-{
-
- private static final String SUBTRACTION = "subtraction"; //$NON-NLS-1$
-
- SubtractArithmeticBinaryOperator(DiagnosticFactory diagnosticFactory) {
- super(diagnosticFactory);
- }
-
- protected Long doRealOperation(Long firstArg, Long secondArg)
- {
- return Long.valueOf(firstArg.longValue() - secondArg.longValue());
- }
-
- protected Double doRealOperation(Double firstArg, Double secondArg)
- {
- return new Double(firstArg.doubleValue() - secondArg.doubleValue());
- }
-
- protected BigDecimal doRealOperation(BigDecimal firstArg,
- BigDecimal secondArg)
- {
- return firstArg.subtract(secondArg);
- }
-
- protected String getOperatorName()
- {
- return SUBTRACTION;
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java
deleted file mode 100644
index a6a36838a..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/TernaryChoiceOperator.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.IAssignable;
-import org.eclipse.jst.jsf.common.internal.types.LiteralType;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercer;
-import org.eclipse.jst.jsf.common.internal.types.TypeCoercionException;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-
-/**
- * Represents the ternary choice op in EL: a ? b :c
- * Based on JSP.2.3.8
- *
- * @author cbateman
- *
- */
-public class TernaryChoiceOperator
-{
- private final DiagnosticFactory _diagnosticFactory;
-
-
- /**
- * @param diagnosticFactory
- */
- public TernaryChoiceOperator(DiagnosticFactory diagnosticFactory)
- {
- super();
- _diagnosticFactory = diagnosticFactory;
- }
-
- /**
- * @param choiceArg
- * @param whenTrueArg
- * @param whenFalseArg
- * @return the result of the choice arguments or null if indeterminant
- */
- public ValueType perform(ValueType choiceArg, ValueType whenTrueArg, ValueType whenFalseArg)
- {
- final boolean isChoiceBoolean =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(choiceArg.getSignature()));
-
- if (isChoiceBoolean)
- {
- if (choiceArg instanceof LiteralType)
- {
- try
- {
- Boolean result = ((LiteralType)choiceArg).coerceToBoolean();
-
- if (result != null)
- {
- return result.booleanValue() ? whenTrueArg : whenFalseArg;
- }
- }
- catch (TypeCoercionException tce)
- {
- return null;
- }
- }
-
- final String boxedWhenTrueArg =
- TypeTransformer.transformBoxPrimitives(whenTrueArg.getSignature());
-
- final String boxedWhenFalseArg =
- TypeTransformer.transformBoxPrimitives(whenFalseArg.getSignature());
- // check if the two results are the same type
- // TODO: could increase accuracy by appoximating type:i.e. if both
- // are numeric etc.
- if (boxedWhenTrueArg.equals(boxedWhenFalseArg))
- {
- return new ValueType(whenTrueArg, IAssignable.ASSIGNMENT_TYPE_RHS);
- }
-
- // otherwise, we have no idea what the resulting type is
- return null;
- }
-
- // if choice is not boolean, then can't resolve
- return null;
- }
-
- /**
- * @param choiceArg
- * @return a diagnostic validating the choice expr with these arguments
- */
- public Diagnostic validate(ValueType choiceArg)
- {
- if (TypeConstants.TYPE_JAVAOBJECT.equals(choiceArg.getSignature())) {
- return Diagnostic.OK_INSTANCE;
- }
-
- final boolean isChoiceBoolean =
- TypeCoercer.canCoerceToBoolean(TypeTransformer.transformBoxPrimitives(choiceArg.getSignature()));
-
- if (isChoiceBoolean)
- {
- if (choiceArg instanceof LiteralType)
- {
- try
- {
- Boolean result = ((LiteralType)choiceArg).coerceToBoolean();
-
- if (result != null)
- {
- String whichSelected = result.booleanValue() ? "first" : "second"; //$NON-NLS-1$ //$NON-NLS-2$
- return _diagnosticFactory.
- create_TERNARY_OP_CHOICE_IS_ALWAYS_SAME
- (result.booleanValue(), whichSelected);
- }
- }
- catch (TypeCoercionException tce)
- {
- return _diagnosticFactory.
- create_TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN();
- }
- }
-
- // in both the case where the two arguments are the same and when
- // they are different types, the best we can say is "OK", since
- // we really don't know
- return Diagnostic.OK_INSTANCE;
- }
-
- // if choice is not boolean, then can't resolve
- return _diagnosticFactory.
- create_TERNARY_OP_CANNOT_COERCE_CHOICE_TO_BOOLEAN();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/UnaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/UnaryOperator.java
deleted file mode 100644
index 5161e4650..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/UnaryOperator.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation.
- * 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:
- * Cameron Bateman/Oracle - initial API and implementation
- *
- ********************************************************************************/
-
-package org.eclipse.jst.jsf.validation.internal.el.operators;
-
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.internal.types.ValueType;
-import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
-import org.eclipse.jst.jsp.core.internal.java.jspel.JSPELParserConstants;
-import org.eclipse.jst.jsp.core.internal.java.jspel.Token;
-
-/**
- * Encapsulates an EL unary operator
- * @author cbateman
- *
- */
-public abstract class UnaryOperator
-{
- /**
- * The common factory used to construct diagnostics
- */
- protected final DiagnosticFactory _diagnosticFactory;
-
- /**
- * @param token
- * @return true if the token is a unary operator
- */
- public static boolean isUnaryOperator(Token token)
- {
- return (token.kind == JSPELParserConstants.MINUS)
- || (token.kind == JSPELParserConstants.NOT1)
- || (token.kind == JSPELParserConstants.NOT2)
- || (token.kind == JSPELParserConstants.EMPTY);
- }
-
- /**
- * @param token
- * @param diagnosticFactory
- * @return a new UnaryOperator instance matching token
- */
- public static UnaryOperator createUnaryOperator(Token token, DiagnosticFactory diagnosticFactory)
- {
- if (!isUnaryOperator(token))
- {
- throw new IllegalArgumentException("token must be a unary operator"); //$NON-NLS-1$
- }
-
- switch(token.kind)
- {
- case JSPELParserConstants.MINUS:
- return new MinusUnaryOperator(diagnosticFactory);
-
- case JSPELParserConstants.NOT1:
- case JSPELParserConstants.NOT2:
- return new NotUnaryOperator(diagnosticFactory);
-
- case JSPELParserConstants.EMPTY:
- return new EmptyUnaryOperator(diagnosticFactory);
- }
-
- // should never get here because all four ops are covered
- throw new AssertionError();
- }
-
- /**
- * Constructor
- */
- UnaryOperator(DiagnosticFactory diagnosticFactory)
- {
- /* no construction or sub-classing outside package*/
- _diagnosticFactory = diagnosticFactory;
- }
-
- /**
- * If ValueType is a literal and the operation can be performed, then
- * the return must be a new LiteralType transformed using this operator.
- *
- * If ValueType is not a literal and the operaton can be performed, then
- * the return is a new ValueType transformed per the rules of the operator
- * (i.e. if it is a string type and the operator is "!", then the string
- * must be coerced to a boolean and this is what will be returned)
- *
- * If the operation cannot be performed on ValueType, return null
- *
- * @param type
- * @return a new value type after the operation is performed
- */
- public abstract ValueType performOperation(ValueType type);
-
-
- /**
- * @param type
- * @return a Diagnostic interpreting whether it is valid to perform the
- * operation on this type
- */
- public abstract Diagnostic validate(ValueType type);
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/messages.properties
deleted file mode 100644
index ae40823e8..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/messages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2007 Oracle 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:
-# Oracle Corporation - initial API and implementation
-###############################################################################
-EqualityRelationalBinaryOperator.FirstArgument=first
-EqualsBinaryRelationalOperator.OperationName=equals
-EqualityRelationalBinaryOperator.SecondArgument=second
-GreaterThanEqRelationalBinaryOperator.OperationName=greater than or equal to
-GreaterThanRelationalBinaryOperator.OperationName=greater than
-LessThanEqRelationalBinaryOperator.OperationName=less than or equal to
-LessThanRelationalBinaryOperator.OperationName=less than
-LtGtRelationalBinaryOperator.ConstantName.False=false
-NotEqualsBinaryRelationalOperator.OperationName=not equals
-BracketOperator.Name=bracket
-DotOperator.Name=dot
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java
deleted file mode 100644
index 7be62a0a6..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java
+++ /dev/null
@@ -1,710 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.strategy;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.emf.common.util.BasicDiagnostic;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jst.jsf.common.dom.AttrDOMAdapter;
-import org.eclipse.jst.jsf.common.dom.AttributeIdentifier;
-import org.eclipse.jst.jsf.common.dom.DOMAdapter;
-import org.eclipse.jst.jsf.common.internal.types.CompositeType;
-import org.eclipse.jst.jsf.common.internal.types.TypeComparator;
-import org.eclipse.jst.jsf.common.internal.types.TypeComparatorDiagnosticFactory;
-import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
-import org.eclipse.jst.jsf.common.internal.types.TypeTransformer;
-import org.eclipse.jst.jsf.common.runtime.internal.model.ViewObject;
-import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentFactory;
-import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterDecorator;
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo;
-import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
-import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.internal.region.Region2AttrAdapter;
-import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
-import org.eclipse.jst.jsf.designtime.DTAppManagerUtil;
-import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot;
-import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter;
-import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService;
-import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException;
-import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter.DTELExpression;
-import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService.ElementData;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
-import org.eclipse.jst.jsf.metadataprocessors.MetaDataEnabledProcessingFactory;
-import org.eclipse.jst.jsf.metadataprocessors.features.ELIsNotValidException;
-import org.eclipse.jst.jsf.metadataprocessors.features.IValidELValues;
-import org.eclipse.jst.jsf.metadataprocessors.features.IValidValues;
-import org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage;
-import org.eclipse.jst.jsf.validation.internal.AbstractXMLViewValidationStrategy;
-import org.eclipse.jst.jsf.validation.internal.JSFValidationContext;
-import org.eclipse.jst.jsf.validation.internal.el.ELExpressionValidator;
-import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-
-/**
- * An XML view validation strategy that validates
- *
- * @author cbateman
- *
- */
-public class AttributeValidatingStrategy extends
-AbstractXMLViewValidationStrategy
-{
- private static final String DISABLE_ALTERATIVE_TYPES_KEY = "jsfCoreDisableConverterValidation"; //$NON-NLS-1$
- static final boolean DEBUG;
- static
- {
- final String value = Platform
- .getDebugOption("org.eclipse.jst.jsf.validation.internal.el/debug/jspsemanticsvalidator"); //$NON-NLS-1$
- DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- /**
- * identifier
- */
- public final static String ID = "org.eclipse.jst.jsf.validation.strategy.AttributeValidatingStrategy"; //$NON-NLS-1$
- private final static String DISPLAY_NAME = "Attribute Validator"; //$NON-NLS-1$
-
- private final JSFValidationContext _validationContext;
- private final TypeComparator _typeComparator;
- private Set<String> _conversionTypes;
-
- /**
- * Default constructor
- *
- * @param validationContext
- */
- public AttributeValidatingStrategy(final JSFValidationContext validationContext)
- {
- super(ID, DISPLAY_NAME);
-
- _validationContext = validationContext;
- _typeComparator = new TypeComparator(
- new TypeComparatorDiagnosticFactory(validationContext
- .getPrefs().getTypeComparatorPrefs()));
- }
-
- @Override
- public boolean isInteresting(final DOMAdapter domAdapter)
- {
- return (domAdapter instanceof AttrDOMAdapter);
- }
-
- @Override
- public void validate(final DOMAdapter domAdapter)
- {
- if (domAdapter instanceof AttrDOMAdapter)
- {
- final long curTime = System.nanoTime();
- final Region2AttrAdapter attrAdapter = (Region2AttrAdapter) domAdapter;
- // check that this is attribute value region - 221722
- if (attrAdapter.getAttributeValueRegion() != null)
- {
- final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE
- .getContext(attrAdapter.getDocumentContext()
- .getStructuredDocument(), attrAdapter
- .getOwningElement().getDocumentContext()
- .getDocumentPosition()
- + attrAdapter.getAttributeValueRegion()
- .getStart());
-
- validateAttributeValue(context, attrAdapter);
- }
- if (DEBUG)
- {
- System.out.println(String.format("Validation for attribute: %s took %d" //$NON-NLS-1$
- , domAdapter.toString()
- , Long.valueOf(System.nanoTime()-curTime)));
- }
- }
- }
-
- /**
- * Validates the attribute value. Reports any problems to the reporter in
- * the JSFValidationContext.
- *
- * @param context
- * @param attrAdapter
- */
- private void validateAttributeValue(
- final IStructuredDocumentContext context,
- final Region2AttrAdapter attrAdapter)
- {
- // so of the code in run calls out into extension code or code
- // dependent on external data (meta-data)
- SafeRunner.run(new ISafeRunnable()
- {
- public void handleException(final Throwable exception)
- {
- JSFCorePlugin.log(String.format(
- "Error validating attribute: %s on element %s", //$NON-NLS-1$
- attrAdapter.getNodeName(), attrAdapter
- .getOwningElement().getNodeName()), exception);
- }
-
- public void run() throws Exception
- {
- final Region2ElementAdapter elementAdapter =
- attrAdapter.getOwningElement();
- // if there's elText then validate it
- // TODO: this approach will fail with mixed expressions
- if (!checkIfELAndValidate(elementAdapter, attrAdapter, context))
- {
- validateNonELAttributeValue(context, attrAdapter);
- }
- }
- });
- }
-
- private boolean checkIfELAndValidate(final Region2ElementAdapter elementAdapter,
- final Region2AttrAdapter attrAdapter,
- final IStructuredDocumentContext context)
- {
- int offsetOfFirstEL = -1;
- final String attrValue = attrAdapter.getValue();
-
- // TODO: should find and validate all
- offsetOfFirstEL = attrValue.indexOf('#');
-
- if (offsetOfFirstEL != -1 && offsetOfFirstEL < attrValue.length() - 1
- && attrValue.charAt(offsetOfFirstEL + 1) == '{')
- {
- offsetOfFirstEL += 2;
- }
- else
- {
- offsetOfFirstEL = -1;
- }
-
- final XMLViewDefnAdapter adapter = DTAppManagerUtil
- .getXMLViewDefnAdapter(context);
-
- boolean isEL = false;
- if (adapter != null && offsetOfFirstEL != -1)
- {
- try
- {
- // use the attribute's context plus the offset into the
- // whole attribute value to find where we think the el
- // expression starts. Add one since the attribute value
- // string returned by attrAdapter will have the value quotes
- // removed, but the region offsets include the quotes.
- IStructuredDocumentContext elContext = IStructuredDocumentContextFactory.INSTANCE
- .getContext(context.getStructuredDocument(), context
- .getDocumentPosition()
- + offsetOfFirstEL + 1);
- final DTELExpression elExpression = adapter
- .getELExpression(elContext);
- if (elExpression != null)
- {
- final String elText = elExpression.getText();
-
- if (DEBUG)
- {
- System.out.println(addDebugSpacer(3) + "EL attrVal= " //$NON-NLS-1$
- + elText);
- }
-
- elContext = elExpression.getDocumentContext();
- // EL validation is user configurable because
- // it can be computationally costly.
- if (_validationContext.shouldValidateEL())
- {
- // also, skip the validation if the expression is empty
- // or only whitespace, since the parser doesn't handle
- // it
- // anyway.
- if ("".equals(elText.trim())) //$NON-NLS-1$
- {
- final int offset = elContext.getDocumentPosition() - 1;
- final int length = elText.length() + 2;
- final Diagnostic diagnostic = _validationContext
- .getDiagnosticFactory()
- .create_EMPTY_EL_EXPRESSION();
- // detected empty EL expression
- if (_validationContext.shouldValidateEL())
- {
- _validationContext.getReporter().report(
- diagnostic, offset, length);
- }
- }
- else
- {
- final List elVals = MetaDataEnabledProcessingFactory
- .getInstance()
- .getAttributeValueRuntimeTypeFeatureProcessors(
- IValidELValues.class,
- elContext,
- attrAdapter
- .getAttributeIdentifier());
- final String safeELText = elText.replaceAll(
- "[\n\r\t]", " "); //$NON-NLS-1$ //$NON-NLS-2$
- validateELExpression(context, elContext, elVals,
- elementAdapter, attrAdapter, safeELText);
- isEL = true;
- }
- }
- }
- }
- catch (final ViewHandlerException e)
- {
- // fall through to return false
- }
- }
-
- // is el if we've already detected it or if the step 2 method
- // finds it. Run the method first to avoid short-circuiting
- final boolean isEL2 = checkIfELAndValidate2(attrAdapter, context);
-
- return isEL || isEL2;
- }
-
- /**
- * Checks the region to see if it contains an EL attribute value. If it
- * does, validates it
- *
- * @return true if validated EL, false otherwise
- */
- private boolean checkIfELAndValidate2(final Region2AttrAdapter attrAdapter,
- final IStructuredDocumentContext sDocContext)
- {
- final ITextRegion attrValueRegion = attrAdapter
- .getAttributeValueRegion();
- if (attrValueRegion instanceof ITextRegionCollection)
- {
- final ITextRegionCollection parentRegion = ((ITextRegionCollection) attrValueRegion);
- if (parentRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE)
- {
- final ITextRegionList regionList = parentRegion.getRegions();
-
- if (regionList.size() >= 3)
- {
- final ITextRegion openQuote = regionList.get(0);
- final ITextRegion vblOpen = regionList.get(1);
-
- if ((openQuote.getType() == DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE || openQuote
- .getType() == DOMJSPRegionContexts.JSP_VBL_DQUOTE ||
- openQuote.getType() == DOMJSPRegionContexts.JSP_TAG_ATTRIBUTE_VALUE_DQUOTE)
- && vblOpen.getType() == DOMJSPRegionContexts.JSP_VBL_OPEN)
- {
- boolean foundClosingQuote = false;
- for (int i = 2; !foundClosingQuote
- && i < regionList.size(); i++)
- {
- final ITextRegion searchRegion = regionList.get(i);
- if (searchRegion.getType() == DOMJSPRegionContexts.JSP_VBL_CLOSE)
- {
- foundClosingQuote = true;
- }
- }
-
- if (!foundClosingQuote
- && _validationContext.shouldValidateEL())
- {
- final int offset = sDocContext
- .getDocumentPosition() + 1;
- final int length = parentRegion.getText().length();
- final Diagnostic diagnostic = _validationContext
- .getDiagnosticFactory()
- .create_MISSING_CLOSING_EXPR_BRACKET();
- _validationContext.getReporter().report(diagnostic,
- offset, length);
- }
- return true;
- }
- }
- }
- }
- return false;
- }
-
- private void validateELExpression(final IStructuredDocumentContext context,
- final IStructuredDocumentContext elContext, final List elVals,
- final Region2ElementAdapter elementAdapter,
- final Region2AttrAdapter attrAdapter, final String elText)
- {
- // Call EL validator which will perform at least the syntactical
- // validation
- final ELExpressionValidator elValidator = new ELExpressionValidator(
- elContext, elText, _validationContext
- .getSymbolResolverFactory(), _validationContext
- .getReporter());
- elValidator.validateXMLNode();
-
- final CompositeType exprType = elValidator.getExpressionType();
- if (exprType != null)
- {
- // Ignore the expression whose last two segments are of types Object.
- final CompositeType boxedType = TypeTransformer
- .transformBoxPrimitives(exprType);
- final String[] testSignatures = boxedType.getSignatures();
- if (testSignatures.length > 0 && TypeConstants.TYPE_JAVAOBJECT.equals(testSignatures[0]))
- {
- if (elText.indexOf('.') != -1)
- {
- String elText2 = elText.substring(0, elText.lastIndexOf('.'));
- final ELExpressionValidator elValidator2 = new ELExpressionValidator(
- elContext, elText2, _validationContext
- .getSymbolResolverFactory(), _validationContext
- .getReporter());
- elValidator2.validateXMLNode();
-
- final CompositeType exprType2 = elValidator.getExpressionType();
- final CompositeType boxedType2 = TypeTransformer.transformBoxPrimitives(exprType2);
- final String[] testSignatures2 = boxedType2.getSignatures();
- if (testSignatures2.length > 0 && TypeConstants.TYPE_JAVAOBJECT.equals(testSignatures2[0]))
- {
- return;
- }
- }
- }
-
- for (final Iterator it = elVals.iterator(); it.hasNext();)
- {
- final IValidELValues elval = (IValidELValues) it.next();
- final String attributeVal = attrAdapter.getValue();
- CompositeType expectedType;
- Diagnostic status = null;
- try
- {
- expectedType = elval.getExpectedRuntimeType();
-
- if (expectedType != null)
- {
- expectedType = maybeAddAlternativeTypes(
- expectedType, exprType, elementAdapter,
- attrAdapter);
- status = _typeComparator.calculateTypeCompatibility(
- expectedType, exprType);
- if (status.getSeverity() != Diagnostic.OK)
- {
- reportValidationMessage(status, context,
- attributeVal);
- }
- }
- }
- catch (final ELIsNotValidException e)
- {
- reportValidationMessage(createValidationMessage(context,
- attributeVal, IStatus.WARNING, e.getMessage(),
- _validationContext.getFile()), context,
- attributeVal);
- }
- }
- }
- }
-
- private boolean disableAlternativeTypes()
- {
- String res = System.getProperty(DISABLE_ALTERATIVE_TYPES_KEY);
- if (res == null) {
- //check env var also
- res = System.getenv(DISABLE_ALTERATIVE_TYPES_KEY);
- }
- if (res != null)
- {
- return true;
- }
- final IPreferenceStore prefStore = JSFCorePlugin.getDefault().getPreferenceStore();
- return prefStore.getBoolean("org.eclipse.jst.jsf.core."+DISABLE_ALTERATIVE_TYPES_KEY); //$NON-NLS-1$
- }
- /**
- * @return true if alternative type comparison (i.e. post-conversion) passes
- */
- private CompositeType maybeAddAlternativeTypes(
- final CompositeType expectedType, final CompositeType exprTypes,
- final Region2ElementAdapter elementAdapter,
- final Region2AttrAdapter attrAdapter)
- {
- final long curTime = System.nanoTime();
- if (disableAlternativeTypes())
- {
- return expectedType;
- }
-
- final IStructuredDocumentContext context = elementAdapter
- .getDocumentContext();
- final DTUIViewRoot viewRoot = _validationContext.getViewRootHandle().getCachedViewRoot();
- final IAdaptable serviceAdaptable = viewRoot.getServices();
- final XMLViewObjectMappingService mappingService = (XMLViewObjectMappingService) serviceAdaptable
- .getAdapter(XMLViewObjectMappingService.class);
- if (mappingService != null)
- {
- final ElementData elementData = XMLViewObjectMappingService
- .createElementData(elementAdapter.getNamespace(),
- elementAdapter.getLocalName(), context,
- Collections.EMPTY_MAP);
- final ViewObject viewObject = mappingService
- .findViewObject(elementData);
- // if the corresponding view object is a valueholder, then
- // we need to see if you think there a valid conversion
- // available
- if (viewObject instanceof ComponentInfo
- && ((ComponentInfo) viewObject).getComponentTypeInfo() != null
- && ((ComponentInfo) viewObject).getComponentTypeInfo()
- .isInstanceOf(
- ComponentFactory.INTERFACE_VALUEHOLDER))
- {
- final ComponentInfo component = (ComponentInfo) viewObject;
- // get the original elementData
- final ElementData mappedElementData = mappingService
- .findElementData(component);
- final String propName = mappedElementData
- .getPropertyName(attrAdapter.getLocalName());
- if ("value".equals(propName)) //$NON-NLS-1$
- {
- // final List converters =
- // component.getDecorators(ComponentFactory.CONVERTER);
-
- // (ConverterDecorator) it.next();
- final CompositeType alternativeTypes = createCompositeType(
- expectedType, exprTypes, component
- .getDecorators(ComponentFactory.CONVERTER));
- if (DEBUG)
- {
- System.out.println(String.format(
- "maybeAddAlternative took %d", Long.valueOf(System //$NON-NLS-1$
- .nanoTime()
- - curTime)));
- }
- return alternativeTypes;
- }
- }
- }
- if (DEBUG)
- {
- System.out.println(String.format("maybeAddAlternative took %d", Long //$NON-NLS-1$
- .valueOf(System.nanoTime() - curTime)));
- }
- // don't add anything by default
- return expectedType;
- }
-
- private CompositeType createCompositeType(final CompositeType initialTypes,
- final CompositeType testTypes, final List<ConverterDecorator> decorators)
- {
- // indicates unknown converter
- final Set<String> types = new HashSet(Arrays.asList(initialTypes
- .getSignatures()));
- // look for converters. If there's one where we don't know the type,
- // simply copy over the testTypes to force validation to ignore, since
- // we have no idea.
- for (final ConverterDecorator decorator : decorators)
- {
- if (decorator.getTypeInfo() != null)
- {
- final ConverterTypeInfo converterTypeInfo = decorator.getTypeInfo();
- if (converterTypeInfo.getForClass().length == 0)
- {
- types.addAll(Arrays.asList(testTypes.getSignatures()));
- break;
- }
- types.addAll(createSignatures(converterTypeInfo.getForClass()));
- }
- }
- types.addAll(getRegisteredConversionTypesByClass());
- return new CompositeType(types.toArray(new String[0])
- , initialTypes.getAssignmentTypeMask());
- }
-
- private Set<String> getRegisteredConversionTypesByClass()
- {
- if (_conversionTypes == null)
- {
- _conversionTypes = new HashSet<String>();
- final IProject project = _validationContext.getFile().getProject();
- final JSFAppConfigManager appConfig = JSFAppConfigManager.getInstance(project);
- final List converters = appConfig.getConverters();
- for (final Iterator it = converters.iterator(); it.hasNext();)
- {
- final ConverterType converterType = (ConverterType) it.next();
- final ConverterForClassType forClassType = converterType.getConverterForClass();
- if (forClassType != null)
- {
- final String forClass = forClassType.getTextContent();
- if (forClass != null)
- {
- String signature = forClass.trim();
- try
- {
- // arrays are a special case where the
- // [Ljava.lang.String; syntax is valid.
- if (Signature.getArrayCount(signature)>0)
- {
- _conversionTypes.add(signature);
- }
- }
- catch (final IllegalArgumentException e)
- {
- // ignore
- }
-
- try
- {
- signature = Signature.createTypeSignature(signature, true);
- _conversionTypes.add(signature);
- }
- catch (final Exception e)
- {
- // ignore: JSFCorePlugin.log(IStatus.INFO, "Could not use registered converter for-class: "+forClass); //$NON-NLS-1$
- }
- }
- }
- }
- }
- return _conversionTypes;
- }
-
- private List<String> createSignatures(final String[] classNames)
- {
- final List<String> signatures = new ArrayList<String>();
- for (final String className : classNames)
- {
- try
- {
- String signature = Signature.createTypeSignature(className, true);
- signatures.add(signature);
- }
- catch (final Exception e)
- {
- JSFCorePlugin.log(e, "Trying to create signature"); //$NON-NLS-1$
- }
- }
- return signatures;
- }
-
- /**
- * Validates an attribute value in context using the JSF metadata processing
- * framework
- *
- * @param context
- * @param region
- * @param uri
- * @param tagName
- * @param attrName
- * @param attributeVal
- * @param reporter
- * @param file
- */
- private void validateNonELAttributeValue(
- final IStructuredDocumentContext context,
- final Region2AttrAdapter attrAdapter)
- {
- final String attributeValue = attrAdapter.getValue();
- // else validate as static attribute value
- if (DEBUG)
- {
- System.out.println(addDebugSpacer(3) + "attrVal= " //$NON-NLS-1$
- + (attributeValue != null ? attributeValue : "null")); //$NON-NLS-1$
- }
-
- final AttributeIdentifier attributeId = attrAdapter
- .getAttributeIdentifier();
-
- if (attributeId.getTagIdentifier() == null
- || attributeId.getTagIdentifier().getTagName() == null
- || attributeId.getName() == null)
- {
- return;
- }
-
- final List vv = MetaDataEnabledProcessingFactory.getInstance()
- .getAttributeValueRuntimeTypeFeatureProcessors(
- IValidValues.class, context, attributeId);
- if (!vv.isEmpty())
- {
- for (final Iterator it = vv.iterator(); it.hasNext();)
- {
- final IValidValues v = (IValidValues) it.next();
- if (!v.isValidValue(attributeValue.trim()))
- {
- if (DEBUG)
- {
- System.out.println(addDebugSpacer(4) + "NOT VALID "); //$NON-NLS-1$
- }
-
- for (final Iterator msgs = v.getValidationMessages()
- .iterator(); msgs.hasNext();)
- {
- final IValidationMessage msg = (IValidationMessage) msgs
- .next();
- reportValidationMessage(createValidationMessage(
- context, attributeValue, msg.getSeverity(), msg
- .getMessage(), _validationContext
- .getFile()), context, attributeValue);
- }
- }
- else if (DEBUG)
- {
- System.out.println(addDebugSpacer(5) + "VALID "); //$NON-NLS-1$
- }
- }
- }
- else if (DEBUG)
- {
- System.out.println(addDebugSpacer(4) + "NO META DATA "); //$NON-NLS-1$
- }
- }
-
- private void reportValidationMessage(final Diagnostic problem,
- final IStructuredDocumentContext context,
- final String attributeValue)
- {
- final int start = context.getDocumentPosition() + 1;
- final int length = attributeValue.length();
- _validationContext.getReporter().report(problem, start, length);
- }
-
- private Diagnostic createValidationMessage(
- final IStructuredDocumentContext context,
- final String attributeValue, final int severity, final String msg,
- final IFile file)
- {
- // TODO: need factory
- final Diagnostic diagnostic = new BasicDiagnostic(severity, "", -1, //$NON-NLS-1$
- msg, null);
- return diagnostic;
- }
-
- private String addDebugSpacer(final int count)
- {
- final String TAB = "\t"; //$NON-NLS-1$
- final StringBuffer ret = new StringBuffer(""); //$NON-NLS-1$
- for (int i = 0; i <= count; i++)
- {
- ret.append(TAB);
- }
- return ret.toString();
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/ContainmentValidatingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/ContainmentValidatingStrategy.java
deleted file mode 100644
index aff0083dc..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/ContainmentValidatingStrategy.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.strategy;
-
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.common.util.BasicDiagnostic;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.jst.jsf.common.dom.DOMAdapter;
-import org.eclipse.jst.jsf.common.dom.TagIdentifier;
-import org.eclipse.jst.jsf.common.internal.JSPUtil;
-import org.eclipse.jst.jsf.common.metadata.Entity;
-import org.eclipse.jst.jsf.common.metadata.Trait;
-import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext;
-import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper;
-import org.eclipse.jst.jsf.common.sets.AxiomaticSet;
-import org.eclipse.jst.jsf.common.sets.ConcreteAxiomaticSet;
-import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver;
-import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
-import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter;
-import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory;
-import org.eclipse.jst.jsf.core.set.constraint.MemberConstraint;
-import org.eclipse.jst.jsf.core.set.mapping.ElementToTagIdentifierMapping;
-import org.eclipse.jst.jsf.core.tagmatcher.EvaluationException;
-import org.eclipse.jst.jsf.core.tagmatcher.InvalidExpressionException;
-import org.eclipse.jst.jsf.core.tagmatcher.XPathMatchingAlgorithm;
-import org.eclipse.jst.jsf.validation.internal.AbstractXMLViewValidationStrategy;
-import org.eclipse.jst.jsf.validation.internal.JSFValidationContext;
-import org.eclipse.jst.jsf.validation.internal.constraints.ContainsTagConstraint;
-import org.eclipse.jst.jsf.validation.internal.constraints.TagId;
-import org.eclipse.jst.jsf.validation.internal.constraints.TagSet;
-import org.w3c.dom.Node;
-
-/**
- * @author cbateman
- *
- */
-public class ContainmentValidatingStrategy extends
- AbstractXMLViewValidationStrategy
-{
- /**
- * identifier
- */
- public final static String ID =
- "org.eclipse.jst.jsf.validation.strategy.ElementValidatingStrategy"; //$NON-NLS-1$
- private final static String DISPLAY_NAME =
- Messages.ContainmentValidatingStrategy_DisplayName;
- private final static ElementToTagIdentifierMapping elem2TagIdMapper =
- new ElementToTagIdentifierMapping();
- private int _containmentValidationCount; // = 0;
- private final JSFValidationContext _jsfValidationContext;
-
- /**
- * @param jsfValidationContext
- */
- public ContainmentValidatingStrategy(
- final JSFValidationContext jsfValidationContext)
- {
- super(ID, DISPLAY_NAME);
- _jsfValidationContext = jsfValidationContext;
- }
-
- @Override
- public boolean isInteresting(DOMAdapter domAdapter)
- {
- return domAdapter instanceof Region2ElementAdapter;
- }
-
- @Override
- public void validate(DOMAdapter domAdapter)
- {
- if (domAdapter instanceof Region2ElementAdapter)
- {
- final Region2ElementAdapter elementAdapter =
- (Region2ElementAdapter) domAdapter;
- validateContainment(elementAdapter, _jsfValidationContext);
- }
- }
-
- private void validateContainment(
- final Region2ElementAdapter elementAdapter,
- final JSFValidationContext jsfValidationContext)
- {
- // don't validate JSP fragments since the necessary containment may
- // existing
- // in the JSP files that include them
- // also only validate the first instance of containment violation in a
- // file
- if (JSPUtil.isJSPFragment(jsfValidationContext.getFile())
- || _containmentValidationCount > 0)
- {
- return;
- }
-
- final IStructuredDocumentContext context = elementAdapter
- .getDocumentContext();
- final IDOMContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE
- .getDOMContextResolver(context);
- final Node node = resolver.getNode();
-
- final String uri = elementAdapter.getNamespace();
- final String tagName = elementAdapter.getLocalName();
- // final Element node = elementAdapter.
-
- final ITaglibDomainMetaDataModelContext modelContext = TaglibDomainMetaDataQueryHelper
- .createMetaDataModelContext(jsfValidationContext.getFile()
- .getProject(), uri);
- final Entity entity = TaglibDomainMetaDataQueryHelper.getEntity(
- modelContext, tagName);
- if (entity != null)
- {
- final Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(
- entity, "containment-constraint"); //$NON-NLS-1$
-
- if (trait != null)
- {
- final ContainsTagConstraint tagConstraint = (ContainsTagConstraint) trait
- .getValue();
-
- final String algorithm = tagConstraint.getSetGenerator()
- .getAlgorithm();
-
- // TODO: need generalized factory mechanism for registering and
- // constructing algorithms.
- if (!"xpath".equals(algorithm)) //$NON-NLS-1$
- {
- return;
- }
-
- final String expr = tagConstraint.getSetGenerator()
- .getExpression();
-
- // TODO: optimize on the expression and cache for reuse
- final XPathMatchingAlgorithm xpathAlg = new XPathMatchingAlgorithm(
- expr);
-
- AxiomaticSet set = null;
-
- try
- {
- set = xpathAlg.evaluate(node);
- // map dom nodes to tag identifiers
- set = elem2TagIdMapper.map(set);
- }
- catch (final InvalidExpressionException e)
- {
- JSFCorePlugin.log(e, "Problem with expression: " + expr //$NON-NLS-1$
- + " on node " + node); //$NON-NLS-1$
- return;
- }
- catch (final EvaluationException e)
- {
- JSFCorePlugin.log(e, "Problem evaluating expression: " //$NON-NLS-1$
- + expr + " on node " + node); //$NON-NLS-1$
- return;
- }
-
- final TagSet constraintData = tagConstraint.getSatisfiesSet();
- final AxiomaticSet constraintSet = new ConcreteAxiomaticSet();
- for (final Iterator it = constraintData.getTags().iterator(); it
- .hasNext();)
- {
- final TagId tagId = (TagId) it.next();
- constraintSet.add(TagIdentifierFactory.createJSPTagWrapper(
- tagId.getUri(), tagId.getName()));
- }
- final MemberConstraint memberConstraint = new MemberConstraint(
- constraintSet);
- final Diagnostic diag = memberConstraint.isSatisfied(set);
-
- if (diag.getSeverity() != Diagnostic.OK)
- {
- _containmentValidationCount++; // found a violation
-
- final List data = diag.getData();
-
- for (final Iterator it = data.iterator(); it.hasNext();)
- {
- final TagIdentifier missingParent = (TagIdentifier) it
- .next();
-
- reportContainmentProblem(context, node.getNodeName(),
- Diagnostic.WARNING,
- missingParent.getTagName(), missingParent
- .getUri());
- }
- }
- }
- }
- }
-
- private static final String MESSAGE_PATTERN =
- "Tag {0} is missing required parent tag \"{1}\" ({2})"; //$NON-NLS-1$
-
- // TODO: need a diagnostic factory
- private void reportContainmentProblem(
- final IStructuredDocumentContext context,
- final String nodeName, final int severity,
- final String tagName, final String uri)
- {
-
- final String msg = MessageFormat.format(
- MESSAGE_PATTERN, new Object[]
- {nodeName, tagName, uri});
-
- final Diagnostic problem =
- new BasicDiagnostic(severity, "", -1, msg, null); //$NON-NLS-1$
- // add one so that the start offset is at the node name, rather
- // than the opening brace.
- final int start = context.getDocumentPosition()+1;
- final int length = nodeName.length();
-
- _jsfValidationContext.getReporter().report(problem, start, length);
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/Messages.java
deleted file mode 100644
index 2bf113d9f..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/Messages.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 Oracle 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.validation.internal.strategy;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * String resource handler
- *
- */
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.validation.internal.strategy.messages"; //$NON-NLS-1$
- /**
- * see messages.properties
- */
- public static String AttributeValidatingStrategy_DisplayName;
- /**
- * see messages.properties
- */
- public static String ContainmentValidatingStrategy_DisplayName;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- //
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/messages.properties
deleted file mode 100644
index fbb4eed0c..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/messages.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-AttributeValidatingStrategy_DisplayName=Attribute Validator
-ContainmentValidatingStrategy_DisplayName=Tag Containment Validator

Back to the top