JBoss Tools SVN: r27779 - in trunk/jsf/plugins/org.jboss.tools.jsf: META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-28 13:25:47 -0500 (Tue, 28 Dec 2010)
New Revision: 27779
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFELValidationDelegate.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
Log:
https://issues.jboss.org/browse/JBIDE-7955
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-12-28 18:21:58 UTC (rev 27778)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-12-28 18:25:47 UTC (rev 27779)
@@ -29,7 +29,6 @@
org.jboss.tools.jsf.model.impl,
org.jboss.tools.jsf.model.pv,
org.jboss.tools.jsf.model.pv.handler,
- org.jboss.tools.jsf.preferences,
org.jboss.tools.jsf.project,
org.jboss.tools.jsf.project.capabilities,
org.jboss.tools.jsf.project.facet,
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2010-12-28 18:21:58 UTC (rev 27778)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2010-12-28 18:25:47 UTC (rev 27779)
@@ -464,7 +464,15 @@
resolver-class="org.jboss.tools.jsf.model.JSF2CCAttrsELCompletionEngine"/>
</el-resolver>
</extension>
+
<extension
+ point="org.jboss.tools.jst.web.kb.elValidationDelegate">
+ <delegate
+ class="org.jboss.tools.jsf.web.validation.JSFELValidationDelegate">
+ </delegate>
+ </extension>
+
+ <extension
point="org.jboss.tools.common.model.modelnatures">
<modelnature
name="org.jboss.tools.jsf.jsfnature"
@@ -484,25 +492,6 @@
</contribution>
</extension>
- <extension point="org.eclipse.core.runtime.preferences">
- <initializer class="org.jboss.tools.jsf.preferences.JSFPreferenceInitializer"/>
- </extension>
-
- <extension id="elproblem" name="%KBProblemName" point="org.eclipse.core.resources.markers">
- <super type="org.jboss.tools.jst.web.kb.kbproblemmarker">
- </super>
- <persistent value="true">
- </persistent>
- </extension>
-
- <extension
- point="org.jboss.tools.jst.web.kb.validator">
- <validator
- class="org.jboss.tools.jsf.web.validation.ELValidator"
- id="org.jboss.tools.jsf.ELValidator">
- </validator>
- </extension>
-
<extension point="org.eclipse.core.runtime.adapters">
<factory
class="org.jboss.tools.jsf.model.pv.JSFProjectsRootAdapterFactory"
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-12-28 18:21:58 UTC (rev 27778)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-12-28 18:25:47 UTC (rev 27779)
@@ -1,510 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.web.validation;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-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.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.jboss.tools.common.el.core.ELReference;
-import org.jboss.tools.common.el.core.model.ELExpression;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.parser.ELParserFactory;
-import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.common.el.core.parser.LexicalToken;
-import org.jboss.tools.common.el.core.parser.SyntaxError;
-import org.jboss.tools.common.el.core.resolver.ELContext;
-import org.jboss.tools.common.el.core.resolver.ELContextImpl;
-import org.jboss.tools.common.el.core.resolver.ELResolution;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
-import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
-import org.jboss.tools.common.el.core.resolver.ELSegment;
-import org.jboss.tools.common.el.core.resolver.IVariable;
-import org.jboss.tools.common.el.core.resolver.JavaMemberELSegmentImpl;
-import org.jboss.tools.common.el.core.resolver.SimpleELContext;
-import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
-import org.jboss.tools.common.el.core.resolver.Var;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
-import org.jboss.tools.jsf.project.JSFNature;
-import org.jboss.tools.jst.web.kb.IKbProject;
-import org.jboss.tools.jst.web.kb.KbProjectFactory;
-import org.jboss.tools.jst.web.kb.PageContextFactory;
-import org.jboss.tools.jst.web.kb.internal.KbProject;
-import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
-import org.jboss.tools.jst.web.kb.internal.validation.SimpleValidatingProjectTree;
-import org.jboss.tools.jst.web.kb.internal.validation.ValidatingProjectSet;
-import org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager;
-import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
-import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
-import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
-import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
-import org.jboss.tools.jst.web.kb.validation.IValidator;
-
-/**
- * EL Validator
- * @author Alexey Kazakov
- */
-public class ELValidator extends ValidationErrorManager implements IValidator {
-
- public static final String ID = "org.jboss.tools.jsf.ELValidator"; //$NON-NLS-1$
- public static final String PROBLEM_TYPE = "org.jboss.tools.jsf.elproblem"; //$NON-NLS-1$
-
- private ELResolver[] resolvers;
- protected ELParserFactory mainFactory;
-
- private IProject currentProject;
- private IResource[] currentSources;
- private IContainer webRootFolder;
- private boolean revalidateUnresolvedELs = false;
- private boolean validateVars = true;
-
- public ELValidator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMarkerType()
- */
- @Override
- public String getMarkerType() {
- return PROBLEM_TYPE;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#isEnabled(org.eclipse.core.resources.IProject)
- */
- public boolean isEnabled(IProject project) {
- return JSFSeverityPreferences.isValidationEnabled(project) && JSFSeverityPreferences.shouldValidateEL(project);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMaxNumberOfMarkersPerFile(org.eclipse.core.resources.IProject)
- */
- @Override
- public int getMaxNumberOfMarkersPerFile(IProject project) {
- return JSFSeverityPreferences.getMaxNumberOfProblemMarkersPerFile(project);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.eclipse.wst.validation.internal.provisional.core.IValidator, org.eclipse.wst.validation.internal.provisional.core.IReporter)
- */
- @Override
- public void init(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext context, org.eclipse.wst.validation.internal.provisional.core.IValidator manager, IReporter reporter) {
- super.init(project, validationHelper, context, manager, reporter);
- resolvers = ELResolverFactoryManager.getInstance().getResolvers(project);
- mainFactory = ELParserUtil.getDefaultFactory();
- validateVars = JSFSeverityPreferences.ENABLE.equals(JSFSeverityPreferences.getInstance().getProjectPreference(validatingProject, JSFSeverityPreferences.CHECK_VARS));
- currentProject = null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#validate(java.util.Set, org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
- */
- public IStatus validate(Set<IFile> changedFiles, IProject project, ContextValidationHelper validationHelper, IProjectValidationContext context, ValidatorManager manager, IReporter reporter) throws ValidationException {
- init(project, validationHelper, context, manager, reporter);
- webRootFolder = null;
- initRevalidationFlag();
- IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
-
- Set<IFile> filesToValidate = new HashSet<IFile>();
- boolean containsJavaOrComponentsXml = false;
- for (IFile file : changedFiles) {
- filesToValidate.add(file);
- if(!containsJavaOrComponentsXml) {
- String fileName = file.getName().toLowerCase();
- containsJavaOrComponentsXml = fileName.endsWith(".java") || fileName.endsWith(".properties") || fileName.equals("components.xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- if(containsJavaOrComponentsXml) {
- if(revalidateUnresolvedELs) {
- Set<IPath> unnamedResources = validationContext.getUnnamedElResources();
- for (IPath path : unnamedResources) {
- IFile file = wsRoot.getFile(path);
- if(file.exists()) {
- filesToValidate.add(file);
- }
- }
- }
- }
-
- Set<ELReference> elsToValidate = validationContext.getElsForValidation(changedFiles, false);
- validationContext.removeLinkedEls(filesToValidate);
- for (IFile file : filesToValidate) {
- if(!reporter.isCancelled()) {
- validateFile(file);
- }
- }
- if(revalidateUnresolvedELs) {
- int i=0;
- for (ELReference el : elsToValidate) {
- // Don't re-validate more than 1000 ELs.
- if(!filesToValidate.contains(el.getResource())) {
- if(i++>1000) {
- break;
- }
- validateEL(el);
- }
- }
- }
-
- validationContext.clearOldVariableNameForElValidation();
- return OK_STATUS;
- }
-
- private void initRevalidationFlag() {
- String revalidateUnresolvedELsString = JSFSeverityPreferences.getInstance().getProjectPreference(validatingProject, JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL);
- revalidateUnresolvedELs = JSFSeverityPreferences.ENABLE.equals(revalidateUnresolvedELsString);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#validateAll(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
- */
- public IStatus validateAll(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext context, ValidatorManager manager, IReporter reporter) throws ValidationException {
- init(project, validationHelper, context, manager, reporter);
- webRootFolder = null;
- initRevalidationFlag();
- Set<IFile> files = validationHelper.getProjectSetRegisteredFiles();
- for (IFile file : files) {
- if(!reporter.isCancelled()) {
- if(file.exists()) {
- validateFile(file);
- } else {
- validationContext.removeUnnamedElResource(file.getFullPath());
- }
- }
- }
- return OK_STATUS;
- }
-
- private static final String JAVA_EXT = "java"; //$NON-NLS-1$
-
- private boolean enabled = true;
-
- private boolean shouldFileBeValidated(IFile file) {
- if(!file.isAccessible()) {
- return false;
- }
- IProject project = file.getProject();
- if(!file.isSynchronized(IResource.DEPTH_ZERO)) {
- // The resource is out of sync with the file system
- // Just ignore this resource.
- return false;
- }
- if(!project.equals(currentProject)) {
- currentProject = project;
- enabled = isEnabled(project);
- if(!enabled) {
- return false;
- }
- if(webRootFolder!=null && !project.equals(webRootFolder.getProject())) {
- webRootFolder = null;
- }
- if(webRootFolder==null) {
- IFacetedProject facetedProject = null;
- try {
- facetedProject = ProjectFacetsManager.create(project);
- } catch (CoreException e) {
- JSFModelPlugin.getDefault().logError(JSFValidationMessages.EL_VALIDATOR_ERROR_VALIDATING, e);
- }
- if(facetedProject!=null && facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET)!=null) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- if(component!=null) {
- IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
- webRootFolder = webRootVirtFolder.getUnderlyingFolder();
- }
- }
- }
- currentProject = project;
- currentSources = EclipseResourceUtil.getJavaSourceRoots(project);
- }
- if(!enabled) {
- return false;
- }
- // Validate all files from java source folders.
- for (int i = 0; currentSources!=null && i < currentSources.length; i++) {
- if(currentSources[i].getLocation().isPrefixOf(file.getLocation())) {
- return true;
- }
- }
- // If *.java is out of Java Source path then ignore it.
- if(JAVA_EXT.equalsIgnoreCase(file.getFileExtension())) {
- return false;
- }
- // Otherwise validate only files from Web-Content (in case of WTP project)
- if(webRootFolder!=null) {
- return webRootFolder.getLocation().isPrefixOf(file.getLocation());
- }
- return true;
- }
-
- private int markers;
-
- private void validateFile(IFile file) {
- if(!shouldFileBeValidated(file)) {
- return;
- }
- removeAllMessagesFromResource(file);
- markers = 0;
- displaySubtask(JSFValidationMessages.VALIDATING_EL_FILE, new String[]{file.getProject().getName(), file.getName()});
- ELContext context = PageContextFactory.createPageContext(file);
- if(context!=null) {
- ELReference[] references = context.getELReferences();
- for (int i = 0; i < references.length; i++) {
- if(!references[i].getSyntaxErrors().isEmpty()) {
- for (SyntaxError error: references[i].getSyntaxErrors()) {
- markers++;
- addError(JSFValidationMessages.EL_SYNTAX_ERROR, JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()}, references[i].getLineNumber(), 1, references[i].getStartPosition() + error.getPosition(), context.getResource());
-// IMarker marker = addError(JSFValidationMessages.EL_SYNTAX_ERROR, JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()}, 1, references[i].getStartPosition() + error.getPosition(), context.getResource());
-// references[i].addMarker(marker);
- }
- }
- if(markers<getMaxNumberOfMarkersPerFile(file.getProject())) {
- validateEL(references[i]);
- }
- }
- }
- }
-
- private void validateEL(ELReference el) {
- if(!reporter.isCancelled()) {
- displaySubtask(JSFValidationMessages.VALIDATING_EL_FILE, new String[]{el.getResource().getProject().getName(), el.getResource().getName()});
- el.deleteMarkers();
- for (ELExpression expresion : el.getEl()) {
- validateELExpression(el, expresion);
- }
- }
- }
-
- private void validateELExpression(ELReference elReference, ELExpression el) {
- if(el == null) return;
- List<ELInvocationExpression> es = el.getInvocations();
- for (ELInvocationExpression token: es) {
- validateElOperand(elReference, token);
- }
- }
-
- private void validateElOperand(ELReference elReference, ELInvocationExpression operandToken) {
- IFile file = elReference.getResource();
- int documnetOffset = elReference.getStartPosition();
- String operand = operandToken.getText();
- if(operand.trim().length()==0) {
- return;
- }
- String varName = operand;
- int offsetOfVarName = documnetOffset + operandToken.getFirstToken().getStart();
- int lengthOfVarName = varName.length();
- boolean unresolvedTokenIsVariable = false;
- if (!operand.endsWith(".")) { //$NON-NLS-1$
- ELResolution resolution = null;
- ELContext context = PageContextFactory.createPageContext(file);
- if(context==null) {
- context = new SimpleELContext();
- context.setResource(file);
- context.setElResolvers(resolvers);
- }
- int maxNumberOfResolvedSegments = -1;
- List<Var> vars = null;
- ELContextImpl c = null;
- if(!validateVars && context instanceof ELContextImpl) {
- c = (ELContextImpl)context;
- vars = c.getAllVars();
- c.setAllVars(new ArrayList<Var>());
- }
-
- for (int i = 0; i < resolvers.length; i++) {
- ELResolution elResolution = resolvers[i].resolve(context, operandToken, documnetOffset);
- if(elResolution==null) {
- continue;
- }
- if(elResolution.isResolved()) {
- resolution = elResolution;
- break;
- }
- int number = elResolution.getNumberOfResolvedSegments();
- if(number>maxNumberOfResolvedSegments) {
- maxNumberOfResolvedSegments = number;
- resolution = elResolution;
- }
- }
-
- if(c!=null) {
- c.setAllVars(vars);
- }
-
- if(!resolution.isResolved()) {
- Set<String> names = findVariableNames(operandToken);
- for (String name : names) {
- validationContext.addLinkedEl(name, elReference);
- }
- }
-
- List<ELSegment> segments = resolution.getSegments();
- List<IVariable> usedVariables = new ArrayList<IVariable>();
- for (ELSegment segment : segments) {
- if(!segment.getVariables().isEmpty()) {
- usedVariables.addAll(segment.getVariables());
- }
- // Check pair for getter/setter
- if(segment instanceof JavaMemberELSegmentImpl) {
- JavaMemberELSegmentImpl javaSegment = (JavaMemberELSegmentImpl)segment;
- if(!javaSegment.getUnpairedGettersOrSetters().isEmpty()) {
- TypeInfoCollector.MethodInfo unpairedMethod = javaSegment.getUnpairedGettersOrSetters().values().iterator().next();
- String methodName = unpairedMethod.getName();
- String propertyName = javaSegment.getUnpairedGettersOrSetters().keySet().iterator().next();
- String missingMethodName = JSFValidationMessages.EL_VALIDATOR_SETTER;
- String existedMethodName = JSFValidationMessages.EL_VALIDATOR_GETTER;
- if(methodName.startsWith("s")) { //$NON-NLS-1$
- missingMethodName = existedMethodName;
- existedMethodName = JSFValidationMessages.EL_VALIDATOR_SETTER;
- }
- int startPosition = documnetOffset + operandToken.getStartPosition();
- int length = operandToken.getLength();
- int startPr = operand.indexOf(propertyName);
- if(startPr>-1) {
- startPosition = startPosition + startPr;
- length = propertyName.length();
- }
-// addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER, JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, length, startPosition, file);
- markers++;
- IMarker marker = addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER, JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, elReference.getLineNumber(), length, startPosition, file);
- elReference.addMarker(marker);
- }
- }
- }
- // Save links between resource and used variables names
- for(IVariable variable: usedVariables) {
- validationContext.addLinkedEl(variable.getName(), elReference);
- }
-
- if (resolution.isResolved()) {
- // It's valid EL.
- return;
- }
-
- ELSegment segment = resolution.getUnresolvedSegment();
- if(segment==null) {
- return;
- }
- LexicalToken token = segment.getToken();
-
- varName = token.getText();
- if(varName == null) {
- //This is syntax error case. Reported by parser.
- return;
- }
- offsetOfVarName = documnetOffset + token.getStart();
- lengthOfVarName = varName == null ? 0 : varName.length();
- if(usedVariables.isEmpty()) {
- unresolvedTokenIsVariable = true;
- }
- }
- markers++;
- // Mark invalid EL
- if(unresolvedTokenIsVariable) {
-// addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
- IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
- elReference.addMarker(marker);
- } else {
-// addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
- IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
- elReference.addMarker(marker);
- }
- }
-
- private Set<String> findVariableNames(ELInvocationExpression invocationExpression){
- Set<String> names = new HashSet<String>();
- while(invocationExpression != null) {
- if(invocationExpression instanceof ELPropertyInvocation) {
- String name = ((ELPropertyInvocation)invocationExpression).getQualifiedName();
- if(name != null) {
- names.add(name);
- }
- }
- invocationExpression = invocationExpression.getLeft();
- }
- return names;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getPreference(org.eclipse.core.resources.IProject, java.lang.String)
- */
- @Override
- protected String getPreference(IProject project, String preferenceKey) {
- return JSFSeverityPreferences.getInstance().getProjectPreference(project, preferenceKey);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#getId()
- */
- public String getId() {
- return ID;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#getValidatingProjects(org.eclipse.core.resources.IProject)
- */
- public IValidatingProjectTree getValidatingProjects(IProject project) {
- Set<IProject> projects = new HashSet<IProject>();
- projects.add(project);
- IKbProject kbProject = KbProjectFactory.getKbProject(project, false);
- if(kbProject!=null) {
- IProjectValidationContext rootContext = kbProject.getValidationContext();
- IValidatingProjectSet projectSet = new ValidatingProjectSet(project, projects, rootContext);
- return new SimpleValidatingProjectTree(projectSet);
- }
- return new SimpleValidatingProjectTree(project);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse.core.resources.IProject)
- */
- public boolean shouldValidate(IProject project) {
- try {
- return project!=null && project.isAccessible() && project.hasNature(JSFNature.NATURE_ID) && KbProject.checkKBBuilderInstalled(project);
- } catch (CoreException e) {
- JSFModelPlugin.getDefault().logError(e);
- }
- return false;
- }
-}
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFELValidationDelegate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFELValidationDelegate.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFELValidationDelegate.java 2010-12-28 18:25:47 UTC (rev 27779)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.web.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
+import org.jboss.tools.jst.web.kb.internal.validation.SimpleValidatingProjectTree;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.validation.IELValidationDelegate;
+import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class JSFELValidationDelegate implements IELValidationDelegate {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IELValidationDelegate#getValidatingProjects(org.eclipse.core.resources.IProject)
+ */
+ public IValidatingProjectTree getValidatingProjects(IProject project) {
+ Set<IProject> projects = new HashSet<IProject>();
+ projects.add(project);
+ IKbProject kbProject = KbProjectFactory.getKbProject(project, false);
+ if(kbProject!=null) {
+ IProjectValidationContext rootContext = kbProject.getValidationContext();
+ IValidatingProjectSet projectSet = new ValidatingProjectSet(project, projects, rootContext);
+ return new SimpleValidatingProjectTree(projectSet);
+ }
+ return new SimpleValidatingProjectTree(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IELValidationDelegate#shouldValidate(org.eclipse.core.resources.IProject)
+ */
+ public boolean shouldValidate(IProject project) {
+ try {
+ return project!=null && project.isAccessible() && project.hasNature(JSFNature.NATURE_ID) && KbProject.checkKBBuilderInstalled(project);
+ } catch (CoreException e) {
+ JSFModelPlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFELValidationDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java 2010-12-28 18:21:58 UTC (rev 27778)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java 2010-12-28 18:25:47 UTC (rev 27779)
@@ -1,22 +0,0 @@
-package org.jboss.tools.jsf.web.validation;
-
-import org.eclipse.osgi.util.NLS;
-
-public class JSFValidationMessages {
- private static final String BUNDLE_NAME = "org.jboss.tools.jsf.web.validation.messages"; //$NON-NLS-1$
-
- public static String UNKNOWN_EL_VARIABLE_NAME;
- public static String UNKNOWN_EL_VARIABLE_PROPERTY_NAME;
- public static String UNPAIRED_GETTER_OR_SETTER;
- public static String EL_SYNTAX_ERROR;
-
- public static String VALIDATING_EL_FILE;
-
- public static String EL_VALIDATOR_ERROR_VALIDATING;
- public static String EL_VALIDATOR_SETTER;
- public static String EL_VALIDATOR_GETTER;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, JSFValidationMessages.class);
- }
-}
\ No newline at end of file
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties 2010-12-28 18:21:58 UTC (rev 27778)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties 2010-12-28 18:25:47 UTC (rev 27779)
@@ -1,23 +0,0 @@
-#*******************************************************************************
-#* Copyright (c) 2007 Red Hat, Inc.
-#* Distributed under license by Red Hat, Inc. All rights reserved.
-#* This program is 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:
-#* Red Hat, Inc. - initial API and implementation
-#******************************************************************************/
-
-#Expression Language
-UNKNOWN_EL_VARIABLE_NAME="{0}" cannot be resolved
-UNKNOWN_EL_VARIABLE_PROPERTY_NAME="{0}" cannot be resolved
-UNPAIRED_GETTER_OR_SETTER=Property "{0}" has only {1}. {2} is missing.
-EL_SYNTAX_ERROR=EL syntax error: {0}.
-
-#Messages for Progress Monitor
-VALIDATING_EL_FILE=project "{0}"; EL in "{1}" (JSF EL Validator)
-
-EL_VALIDATOR_ERROR_VALIDATING=Error validating EL
-EL_VALIDATOR_SETTER=Setter
-EL_VALIDATOR_GETTER=Getter
\ No newline at end of file
14 years
JBoss Tools SVN: r27778 - in trunk: cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation and 30 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-28 13:21:58 -0500 (Tue, 28 Dec 2010)
New Revision: 27778
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIELValidationDelegate.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/tck/WebContent/elValidation.xhtml
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.validation
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NewNamedBean.validation
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/TestBean.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ELValidationTest.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/ELPreferencesPage.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/Messages.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/preferences.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elValidationDelegate.exsd
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidationMessages.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/KBValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELSeverityPreferences.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IELValidationDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.properties
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationDelegate.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DependentProjectValidationTest.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.properties
trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.properties
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
trunk/vpe/plugins/org.jboss.tools.vpe/.settings/org.eclipse.jdt.core.prefs
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
Log:
https://issues.jboss.org/browse/JBIDE-7955
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2010-12-28 18:21:58 UTC (rev 27778)
@@ -138,6 +138,13 @@
</validator>
</extension>
+ <extension
+ point="org.jboss.tools.jst.web.kb.elValidationDelegate">
+ <delegate
+ class="org.jboss.tools.cdi.internal.core.validation.CDIELValidationDelegate">
+ </delegate>
+ </extension>
+
<!-- Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=315390 -->
<extension
id="excludeEJBValidation"
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -95,13 +95,12 @@
import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
-import org.jboss.tools.jst.web.kb.validation.IValidator;
import org.jboss.tools.jst.web.kb.validation.ValidationUtil;
/**
* @author Alexey Kazakov
*/
-public class CDICoreValidator extends CDIValidationErrorManager implements IValidator {
+public class CDICoreValidator extends CDIValidationErrorManager {
public static final String ID = "org.jboss.tools.cdi.core.CoreValidator"; //$NON-NLS-1$
public static final String PROBLEM_TYPE = "org.jboss.tools.cdi.core.cdiproblem"; //$NON-NLS-1$
@@ -142,10 +141,14 @@
* (org.eclipse.core.resources.IProject)
*/
public IValidatingProjectTree getValidatingProjects(IProject project) {
- projectTree = new CDIProjectTree(project);
+ projectTree = getProjectTree(project);
return projectTree;
}
+ public static IValidatingProjectTree getProjectTree(IProject project) {
+ return new CDIProjectTree(project);
+ }
+
/*
* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.validation.IValidator#isEnabled(org.eclipse.core.resources.IProject)
@@ -339,14 +342,6 @@
return OK_STATUS;
}
- private boolean notValidatedYet(IResource resource) {
- if(resource==null) {
- System.out.println("!!!");
- }
- IProject pr = resource.getProject();
- return !coreHelper.getValidationContextManager().projectHasBeenValidated(this, pr);
- }
-
/**
* Validates a resource.
*
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIELValidationDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIELValidationDelegate.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIELValidationDelegate.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.internal.core.validation;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.jst.web.kb.validation.IELValidationDelegate;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CDIELValidationDelegate implements IELValidationDelegate {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IELValidationDelegate#getValidatingProjects(org.eclipse.core.resources.IProject)
+ */
+ public IValidatingProjectTree getValidatingProjects(IProject project) {
+ return CDICoreValidator.getProjectTree(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IELValidationDelegate#shouldValidate(org.eclipse.core.resources.IProject)
+ */
+ public boolean shouldValidate(IProject project) {
+ try {
+ return project != null && project.isAccessible() && project.hasNature(CDICoreNature.NATURE_ID);
+ } catch (CoreException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIELValidationDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -12,9 +12,9 @@
import org.eclipse.core.resources.IProject;
import org.jboss.tools.cdi.core.preferences.CDIPreferences;
-import org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager;
+import org.jboss.tools.jst.web.kb.internal.validation.KBValidator;
-abstract public class CDIValidationErrorManager extends ValidationErrorManager {
+abstract public class CDIValidationErrorManager extends KBValidator {
public static final String MESSAGE_ID_ATTRIBUTE_NAME = "CDI_message_id"; //$NON-NLS-1$
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/tck/WebContent/elValidation.xhtml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/tck/WebContent/elValidation.xhtml (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/tck/WebContent/elValidation.xhtml 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,11 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html">
+
+ <ui:define name="body">
+ <h:outputText value="#{namedBean.foo}"/>
+ </ui:define>
+</ui:composition>
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/tck/WebContent/elValidation.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.el;
+
+import javax.inject.Named;
+
+@Named
+public class NamedBean {
+
+ public String getFoo() {
+ return "";
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.validation
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.validation (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NamedBean.validation 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.el;
+
+import javax.inject.Named;
+
+@Named
+public class NamedBean {
+
+ public String getFoo() {
+ return "";
+ }
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NewNamedBean.validation
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NewNamedBean.validation (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/NewNamedBean.validation 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.el;
+
+import javax.inject.Named;
+
+@Named
+public class NamedBean {
+
+ public String getNewFoo() {
+ return "";
+ }
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/TestBean.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/TestBean.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/TestBean.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.el;
+
+public class TestBean {
+
+ public String toString() {
+ return "#{namedBean.foo}";
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/el/TestBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -46,6 +46,7 @@
import org.jboss.tools.cdi.core.test.tck.validation.DefenitionErrorsValidationTest;
import org.jboss.tools.cdi.core.test.tck.validation.DependentProjectValidationTest;
import org.jboss.tools.cdi.core.test.tck.validation.DeploymentProblemsValidationTests;
+import org.jboss.tools.cdi.core.test.tck.validation.ELValidationTest;
/**
* @author Alexey Kazakov
@@ -82,13 +83,15 @@
suite.addTestSuite(DecoratorDefinitionTest.class);
suite.addTestSuite(ObserverMethodResolutionTest.class);
suite.addTestSuite(BeansXmlCATest.class);
+ suite.addTestSuite(SelectedAlternativeTest.class);
+ // Validation tests
suite.addTestSuite(DefenitionErrorsValidationTest.class);
suite.addTestSuite(DeploymentProblemsValidationTests.class);
suite.addTestSuite(BeansXmlValidationTest.class);
suite.addTestSuite(AnnotationsValidationTest.class);
suite.addTestSuite(CoreValidationTest.class);
- suite.addTestSuite(SelectedAlternativeTest.class);
+ suite.addTestSuite(ELValidationTest.class);
suiteAll.addTestSuite(BeansXMLTest.class);
suiteAll.addTestSuite(DependentProjectTest.class);
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -212,7 +212,7 @@
static class JavaFileFilter implements FileFilter {
public boolean accept(File pathname) {
String name = pathname.getName();
- return (pathname.isDirectory() && !name.endsWith(".svn")) || ((name.endsWith(".java") || name.endsWith(".qfxresult") || name.equals("beans.xml")) && !name.endsWith("Test.java"));
+ return (pathname.isDirectory() && !name.endsWith(".svn")) || ((name.endsWith(".java") || name.endsWith(".qfxresult") || name.endsWith(".validation") || name.equals("beans.xml")) && !name.endsWith("Test.java"));
}
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DependentProjectValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DependentProjectValidationTest.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DependentProjectValidationTest.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -78,9 +78,9 @@
IFile scope = project2.getFile(new Path("src/test/TestScope.java"));
IFile normalScope = project2.getFile(new Path("src/test/TestNormalScope.validation"));
scope.setContents(normalScope.getContents(), IFile.FORCE, new NullProgressMonitor());
- JobUtils.waitForIdle();
+ JobUtils.waitForIdle(1000);
project2.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
- JobUtils.waitForIdle();
+ JobUtils.waitForIdle(1000);
testBean3 = project3.getFile("src/cdi/test3/TestBean3.java");
assertMarkerIsCreated(testBean3, MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_PRIMITIVE_TYPE, "boolean", "TestBean3.foo()"), 10);
@@ -94,9 +94,9 @@
normalScope = project2.getFile(new Path("src/test/TestScope.java"));
scope = project2.getFile(new Path("src/test/TestScope.validation"));
normalScope.setContents(scope.getContents(), IFile.FORCE, new NullProgressMonitor());
- JobUtils.waitForIdle();
+ JobUtils.waitForIdle(1000);
project2.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
- JobUtils.waitForIdle();
+ JobUtils.waitForIdle(1000);
testBean3 = project3.getFile("src/cdi/test3/TestBean3.java");
assertMarkerIsNotCreated(testBean3, MessageFormat.format(CDIValidationMessages.UNPROXYABLE_BEAN_PRIMITIVE_TYPE, "boolean", "TestBean3.foo()"), 10);
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ELValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ELValidationTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ELValidationTest.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core.test.tck.validation;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.jst.web.kb.internal.validation.ELValidationMessages;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ELValidationTest extends ValidationTest {
+
+ public void testEls() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ JobUtils.waitForIdle();
+
+ try {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/TestBean.java");
+ assertMarkerIsNotCreated(file, MessageFormat.format(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, "foo"), 6);
+ file = tckProject.getFile("WebContent/elValidation.xhtml");
+ assertMarkerIsNotCreated(file, MessageFormat.format(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, "foo"), 9);
+
+ IFile namedBean = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/NamedBean.java");
+ IFile newNamedBean = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/NewNamedBean.validation");
+ namedBean.setContents(newNamedBean.getContents(), IFile.FORCE, new NullProgressMonitor());
+ JobUtils.waitForIdle(1000);
+ tckProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
+ JobUtils.waitForIdle(1000);
+
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/TestBean.java");
+ assertMarkerIsCreated(file, MessageFormat.format(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, "foo"), 6);
+ file = tckProject.getFile("WebContent/elValidation.xhtml");
+ assertMarkerIsCreated(file, MessageFormat.format(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, "foo"), 9);
+
+ newNamedBean = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/NamedBean.java");
+ namedBean = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/NamedBean.validation");
+ newNamedBean.setContents(namedBean.getContents(), IFile.FORCE, new NullProgressMonitor());
+ JobUtils.waitForIdle(1000);
+ tckProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
+ JobUtils.waitForIdle(1000);
+
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/TestBean.java");
+ assertMarkerIsNotCreated(file, MessageFormat.format(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, "foo"), 6);
+ file = tckProject.getFile("WebContent/elValidation.xhtml");
+ assertMarkerIsNotCreated(file, MessageFormat.format(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, "foo"), 9);
+ } finally {
+ IFile newNamedBean = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/NamedBean.java");
+ IFile namedBean = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/el/NamedBean.validation");
+ newNamedBean.setContents(namedBean.getContents(), IFile.FORCE, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ tckProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ JobUtils.waitForIdle();
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ELValidationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -51,8 +51,11 @@
* @return
*/
public ELResolver[] getResolvers(IResource resource) {
+ if(!resource.isAccessible()) {
+ return new ELResolver[0];
+ }
IProject project = resource.getProject();
- if (project == null)
+ if (project == null || !project.isAccessible())
return new ELResolver[0];
// ELResolver[] result = resolvers.get(project.getName());
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.properties 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.properties 2010-12-28 18:21:58 UTC (rev 27778)
@@ -1,3 +1,4 @@
#Properties file for org.jboss.tools.common.el.ui
Bundle-Vendor.0 = JBoss by Red Hat
-Bundle-Name.0 = EL UI Plug-in
\ No newline at end of file
+Bundle-Name.0 = EL UI Plug-in
+PreferencePage_EL = Expression Language
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml 2010-12-28 18:21:58 UTC (rev 27778)
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
-
-</plugin>
+ <extension point="org.eclipse.ui.preferencePages">
+ <page category="org.jboss.tools.common.model.ui"
+ class="org.jboss.tools.common.el.ui.preferences.ELPreferencesPage"
+ id="org.jboss.tools.el.ui"
+ name="%PreferencePage_EL">
+ </page>
+ </extension>
+</plugin>
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/ELPreferencesPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/ELPreferencesPage.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/ELPreferencesPage.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.ui.preferences;
+
+import org.jboss.tools.common.model.ui.preferences.CompanyPreferencesPage;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ELPreferencesPage extends CompanyPreferencesPage {
+
+ public static final String ID = "org.jboss.tools.el.ui"; //$NON-NLS-1$
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.model.ui.preferences.CompanyPreferencesPage#getPrefsName()
+ */
+ @Override
+ protected String getPrefsName() {
+ return Messages.EL;
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/ELPreferencesPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/Messages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/Messages.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/Messages.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.common.el.ui.preferences.preferences"; //$NON-NLS-1$
+
+ public static String EL;
+
+ private Messages() {
+ }
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/Messages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/preferences.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/preferences.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/preferences.properties 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1 @@
+EL = Expression Language preferences.
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/preferences/preferences.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.properties 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.properties 2010-12-28 18:21:58 UTC (rev 27778)
@@ -22,8 +22,6 @@
PreferencePage_Project=Project
PreferencePage_JSFImplementations=JSF Environment
PreferencePage_JSFFlowTabbed=JSF Flow Diagram
-PreferencePage_Validator=Validator
-PreferencePage_JSFValidator=JSF Validator
NewWizardCat_JBossTools=JBoss Tools
NewWizardCat_JSF=JSF
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-12-28 18:21:58 UTC (rev 27778)
@@ -26,27 +26,8 @@
class="org.jboss.tools.jsf.ui.preferences.JSFFlowTabbedPreferencesPage"
id="org.jboss.tools.jsf.ui.jsfflowdiagram"
name="%PreferencePage_JSFFlowTabbed"/>
- <page
- category="org.jboss.tools.jsf.ui"
- class="org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"
- id="org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"
- name="%PreferencePage_Validator"/>
</extension>
- <extension
- point="org.eclipse.ui.propertyPages">
- <page
- name="%PreferencePage_JSFValidator"
- class="org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"
- id="org.jboss.tools.jsf.ui.propertyPages.JSFValidatorPreferencePage">
- <enabledWhen>
- <adapt type="org.eclipse.core.resources.IProject">
- <test property="org.eclipse.core.resources.projectNature" value="org.jboss.tools.jsf.jsfnature"/>
- </adapt>
- </enabledWhen>
- </page>
- </extension>
-
<extension id="e" name="XML Editors" point="org.jboss.tools.common.model.ui.xmlEditor">
<xmlEditor
class="org.jboss.tools.jsf.ui.editor.FacesConfigEditor"
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jsf.ui.preferences;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @author Viacheslav Kabanovich
- */
-public class JSFSeverityPreferencesMessages extends NLS {
-
- private static final String BUNDLE_NAME = "org.jboss.tools.jsf.ui.preferences.JSFSeverityPreferencesMessages"; //$NON-NLS-1$
-
- public static String JSF_VALIDATOR_CONFIGURATION_BLOCK_JSF_VALIDATOR_CONFIGURATION_BLOCK;
- public static String JSF_VALIDATOR_PREFERENCE_PAGE_JSF_VALIDATOR;
-
- //Validator Preference page
- public static String JSFValidatorConfigurationBlock_common_description;
-
- //Expression Language
- public static String JSFValidatorConfigurationBlock_section_el;
- public static String JSFValidatorConfigurationBlock_pb_elSyntaxError_label;
- public static String JSFValidatorConfigurationBlock_pb_unknownElVariableName_label;
- public static String JSFValidatorConfigurationBlock_pb_checkVars_label;
- public static String JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label;
- public static String JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label;
- public static String JSFValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, JSFSeverityPreferencesMessages.class);
- }
-}
\ No newline at end of file
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jsf.ui.preferences;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
-import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.jboss.tools.common.preferences.SeverityPreferences;
-import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
-import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
-
-/**
- * Find the instruction to Framework for Severity preferences in SeverityConfigurationBlock.java
- *
- * @author Viacheslav Kabanovich
- */
-public class JSFValidatorConfigurationBlock extends SeverityConfigurationBlock {
- private static final String SETTINGS_SECTION_NAME = JSFSeverityPreferencesMessages.JSF_VALIDATOR_CONFIGURATION_BLOCK_JSF_VALIDATOR_CONFIGURATION_BLOCK;
-
- private Button recognizeVarsCheckBox;
- private Button revalidateUnresolvedElCheckBox;
- private Combo elVariablesCombo;
- private Combo elPropertiesCombo;
-
- private static SectionDescription SECTION_EL = new SectionDescription(
- JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_section_el,
- new String[][] {
- {JSFSeverityPreferences.EL_SYNTAX_ERROR, JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_elSyntaxError_label},
- {JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariableName_label},
- {JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label},
- {JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label},
- },
- JSFModelPlugin.PLUGIN_ID
- );
-
- private static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
- SECTION_EL,
- };
-
- private static Key[] getKeys() {
- ArrayList<Key> keys = new ArrayList<Key>();
- for (int i = 0; i < ALL_SECTIONS.length; i++) {
- for (int j = 0; j < ALL_SECTIONS[i].options.length; j++) {
- keys.add(ALL_SECTIONS[i].options[j].key);
- }
- }
- keys.add(getKey(JSFModelPlugin.PLUGIN_ID, JSFSeverityPreferences.CHECK_VARS));
- keys.add(getKey(JSFModelPlugin.PLUGIN_ID, JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL));
- keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
- return keys.toArray(new Key[0]);
- }
-
- private static final Key MAX_NUMBER_OF_PROBLEMS_KEY = getKey(JSFModelPlugin.PLUGIN_ID, SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
-
- @Override
- protected Key getMaxNumberOfProblemsKey() {
- return MAX_NUMBER_OF_PROBLEMS_KEY;
- }
-
- public JSFValidatorConfigurationBlock(IStatusChangeListener context,
- IProject project,
- IWorkbenchPreferenceContainer container) {
- super(context, project, getKeys(), container);
- }
-
- @Override
- protected Composite createStyleTabContent(Composite folder) {
- int nColumns = 3;
-
- final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
-
- Composite composite = sc1.getBody();
-
- addMaxNumberOfMarkersField(composite);
-
- GridLayout layout= new GridLayout(nColumns, false);
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- composite.setLayout(layout);
-
- Label description= new Label(composite, SWT.LEFT | SWT.WRAP);
- description.setFont(description.getFont());
- description.setText(getCommonDescription());
- description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, nColumns - 1, 1));
-
- int defaultIndent = 0;
-
- for (int i = 0; i < ALL_SECTIONS.length; i++) {
- SectionDescription section = ALL_SECTIONS[i];
- String label = section.label;
- ExpandableComposite excomposite = createStyleSection(composite, label, nColumns);
-
- Composite inner = new Composite(excomposite, SWT.NONE);
- inner.setFont(composite.getFont());
- inner.setLayout(new GridLayout(nColumns, false));
- excomposite.setClient(inner);
-
- for (int j = 0; j < section.options.length; j++) {
- OptionDescription option = section.options[j];
- label = option.label;
- Combo combo = addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent);
- if(option.label == JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariableName_label) {
- elVariablesCombo = combo;
- combo.addSelectionListener(new SelectionListener(){
- public void widgetDefaultSelected(SelectionEvent e) {
- updateELCombox();
- }
- public void widgetSelected(SelectionEvent e) {
- updateELCombox();
- }
- });
- } else if(option.label == JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label) {
- elPropertiesCombo = combo;
- combo.addSelectionListener(new SelectionListener(){
- public void widgetDefaultSelected(SelectionEvent e) {
- updateELCombox();
- }
- public void widgetSelected(SelectionEvent e) {
- updateELCombox();
- }
- });
- }
- }
-
- if(section==SECTION_EL) {
- label = JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_checkVars_label;
- recognizeVarsCheckBox = addCheckBox(inner, label, getKey(JSFModelPlugin.PLUGIN_ID, JSFSeverityPreferences.CHECK_VARS), enableDisableValues, defaultIndent);
-
- label = JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label;
- revalidateUnresolvedElCheckBox = addCheckBox(inner, label, getKey(JSFModelPlugin.PLUGIN_ID, JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL), enableDisableValues, defaultIndent);
- }
- }
-
- restoreSectionExpansionStates(getDialogSettings());
-
- updateELCombox();
-
- return sc1;
- }
-
- @Override
- public void performDefaults() {
- super.performDefaults();
- updateELCombox();
- }
-
- private void updateELCombox() {
- boolean enable = elPropertiesCombo.getSelectionIndex()!=2 || elVariablesCombo.getSelectionIndex()!=2;
- recognizeVarsCheckBox.setEnabled(enable);
- revalidateUnresolvedElCheckBox.setEnabled(enable);
- }
-
- @Override
- protected SectionDescription[] getAllSections() {
- return ALL_SECTIONS;
- }
-
- @Override
- protected String getCommonDescription() {
- return JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_common_description;
- }
-
- @Override
- protected IDialogSettings getDialogSettings() {
- return JSFModelPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
- }
-}
\ No newline at end of file
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jsf.ui.preferences;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.jboss.tools.common.ui.preferences.SeverityPreferencePage;
-import org.jboss.tools.jsf.JSFModelPlugin;
-
-/**
- * @author Viacheslav Kabanovich
- */
-public class JSFValidatorPreferencePage extends SeverityPreferencePage {
- public static final String PREF_ID = "org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"; //$NON-NLS-1$
- public static final String PROP_ID = "org.jboss.tools.jsf.ui.propertyPages.JSFValidatorPreferencePage"; //$NON-NLS-1$
-
- public JSFValidatorPreferencePage() {
- setPreferenceStore(JSFModelPlugin.getDefault().getPreferenceStore());
- setTitle(JSFSeverityPreferencesMessages.JSF_VALIDATOR_PREFERENCE_PAGE_JSF_VALIDATOR);
- }
-
- @Override
- protected String getPreferencePageID() {
- return PREF_ID;
- }
-
- @Override
- protected String getPropertyPageID() {
- return PROP_ID;
- }
-
- @Override
- public void createControl(Composite parent) {
- IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
- fConfigurationBlock = new JSFValidatorConfigurationBlock(getNewStatusChangedListener(), getProject(), container);
-
- super.createControl(parent);
- }
-}
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/ELValidatorTest.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -19,13 +19,14 @@
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
-import org.jboss.tools.jsf.web.validation.ELValidator;
-import org.jboss.tools.jsf.web.validation.JSFValidationMessages;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
+import org.jboss.tools.jst.web.kb.internal.validation.ELValidationMessages;
+import org.jboss.tools.jst.web.kb.internal.validation.ELValidator;
import org.jboss.tools.jst.web.kb.internal.validation.SimpleValidatingProjectTree;
import org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager;
import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
+import org.jboss.tools.jst.web.kb.preferences.ELSeverityPreferences;
import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
import org.jboss.tools.jst.web.kb.validation.IValidator;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
@@ -43,16 +44,16 @@
}
public void testUnknownELVariable() throws CoreException, ValidationException {
- IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
- store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, JSFSeverityPreferences.ENABLE);
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.ERROR);
+ IPreferenceStore store = WebKbPlugin.getDefault().getPreferenceStore();
+ store.setValue(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, ELSeverityPreferences.ENABLE);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.ERROR);
try {
copyContentsFile("WebContent/WEB-INF/faces-config.xml", "WebContent/WEB-INF/faces-config.1");
assertMarkerIsCreatedForLine(
"WebContent/testElRevalidation.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new Object[] {"user"},
14);
@@ -61,26 +62,26 @@
assertMarkerIsNotCreatedForLine(
"WebContent/testElRevalidation.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new Object[] {"user"},
14);
} finally {
- store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, JSFSeverityPreferences.ENABLE);
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.IGNORE);
+ store.setValue(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, ELSeverityPreferences.ENABLE);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.IGNORE);
}
}
public void testRevalidationUnresolvedELs() throws CoreException, ValidationException{
- IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
- store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, JSFSeverityPreferences.DISABLE);
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.ERROR);
+ IPreferenceStore store = WebKbPlugin.getDefault().getPreferenceStore();
+ store.setValue(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, ELSeverityPreferences.DISABLE);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.ERROR);
try {
copyContentsFile("WebContent/WEB-INF/faces-config.xml", "WebContent/WEB-INF/faces-config.1");
assertMarkerIsCreatedForLine(
"WebContent/testElRevalidation.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new Object[] {"user"},
14);
@@ -89,7 +90,7 @@
assertMarkerIsNotCreatedForLine(
"WebContent/testElRevalidation.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new Object[] {"user"},
14, false);
@@ -101,12 +102,12 @@
assertMarkerIsNotCreatedForLine(
"WebContent/testElRevalidation.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new Object[] {"user"},
14, false);
} finally {
- store.setValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, JSFSeverityPreferences.ENABLE);
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.IGNORE);
+ store.setValue(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, ELSeverityPreferences.ENABLE);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.IGNORE);
}
}
@@ -116,7 +117,7 @@
* @throws ValidationException
*/
public void testELValidationEnablement() throws CoreException, ValidationException {
- JSFModelPlugin.getDefault().getPreferenceStore().setValue(JSFSeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, false);
+ WebKbPlugin.getDefault().getPreferenceStore().setValue(ELSeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, false);
try {
IFile file = project.getFile("WebContent/pages/el.jsp");
@@ -127,13 +128,13 @@
int number = getMarkersNumberByGroupName(IValidator.KB_PROBLEM_MARKER_TYPE, file, IValidator.MARKED_RESOURCE_MESSAGE_GROUP);
assertEquals("Problem marker was found.", 0, number);
- JSFModelPlugin.getDefault().getPreferenceStore().setValue(JSFSeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
+ WebKbPlugin.getDefault().getPreferenceStore().setValue(ELSeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
validateFile("WebContent/pages/el.jsp", 0);
number = getMarkersNumberByGroupName(IValidator.KB_PROBLEM_MARKER_TYPE, file, IValidator.MARKED_RESOURCE_MESSAGE_GROUP);
assertEquals("Problem marker was not found.", 1, number);
} finally {
- JSFModelPlugin.getDefault().getPreferenceStore().setValue(JSFSeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
+ WebKbPlugin.getDefault().getPreferenceStore().setValue(ELSeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
}
}
@@ -142,21 +143,21 @@
* @throws CoreException
*/
public void testMaxNumberOfMarkersPerFileLesThanDefault() throws CoreException {
- IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
+ IPreferenceStore store = WebKbPlugin.getDefault().getPreferenceStore();
int max = store.getInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
store.setValue(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, 1);
- String errorSeverity = store.getString(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME);
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.ERROR);
+ String errorSeverity = store.getString(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.ERROR);
try {
assertMarkerIsCreatedForLine(
"WebContent/pages/maxNumberOfMarkers.jsp",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
new Object[] {"wrongUserName"},
3);
assertMarkerIsNotCreatedForLine(
"WebContent/pages/maxNumberOfMarkers.jsp",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
new Object[] {"wrongUserName2"},
4);
@@ -164,17 +165,17 @@
assertMarkerIsCreatedForLine(
"WebContent/pages/maxNumberOfMarkers.jsp",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
new Object[] {"wrongUserName"},
3);
assertMarkerIsCreatedForLine(
"WebContent/pages/maxNumberOfMarkers.jsp",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
new Object[] {"wrongUserName2"},
4);
} finally {
store.setValue(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, max);
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, errorSeverity);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, errorSeverity);
}
}
@@ -183,12 +184,12 @@
* @throws CoreException
*/
public void testMaxNumberOfMarkersPerFileMoreThanDefault() throws CoreException, ValidationException {
- IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.ERROR);
+ IPreferenceStore store = WebKbPlugin.getDefault().getPreferenceStore();
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.ERROR);
try {
IFile file = project.getFile("WebContent/pages/lineNumbers.xhtml");
- String messagePattern = MessageFormat.format(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME, new Object[] {"wrongUserName"});
+ String messagePattern = MessageFormat.format(ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME, new Object[] {"wrongUserName"});
long time = validateFile("WebContent/pages/lineNumbers.xhtml", 100);
System.out.println("Validation time: " + time);
@@ -200,7 +201,7 @@
time = validateFile("WebContent/pages/lineNumbers.xhtml", 100);
System.out.println("Validation time: " + time);
} finally {
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.IGNORE);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.IGNORE);
}
}
@@ -210,8 +211,8 @@
* @throws ValidationException
*/
public void testPerformanceOfCalculatingLineNumbers() throws CoreException, ValidationException {
- IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.ERROR);
+ IPreferenceStore store = WebKbPlugin.getDefault().getPreferenceStore();
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.ERROR);
try {
IFile file = project.getFile("/pagesOutsideWebContent/lineCalculating.xhtml");
assertTrue("Test xhtml file is not accessible.", file.isAccessible());
@@ -242,7 +243,7 @@
System.out.println("IMarker creation time without line calculating: " + withLineNumber);
assertTrue("", withLineNumber<withoutLineNumber);
} finally {
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.IGNORE);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.IGNORE);
}
}
@@ -253,13 +254,13 @@
}
private long validateFile(Set<String> fileNames, int numberOfMarkers) throws ValidationException {
- IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
+ IPreferenceStore store = WebKbPlugin.getDefault().getPreferenceStore();
int max = store.getInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
if(numberOfMarkers>0) {
store.setValue(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, numberOfMarkers);
}
- String errorSeverity = store.getString(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME);
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.ERROR);
+ String errorSeverity = store.getString(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.ERROR);
try {
ELValidator validator = new ELValidator();
@@ -283,7 +284,7 @@
return result;
} finally {
store.setValue(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, max);
- store.setValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, errorSeverity);
+ store.setValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, errorSeverity);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2010-12-28 18:21:58 UTC (rev 27778)
@@ -24,7 +24,9 @@
org.eclipse.ui.ide,
org.eclipse.wst.css.core,
org.eclipse.wst.html.core,
- org.jboss.tools.common.el.ui
+ org.jboss.tools.common.el.ui,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.jst.j2ee
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
@@ -39,6 +41,7 @@
org.jboss.tools.jst.web.kb.internal.taglib.composite,
org.jboss.tools.jst.web.kb.internal.taglib.myfaces,
org.jboss.tools.jst.web.kb.internal.validation,
+ org.jboss.tools.jst.web.kb.preferences,
org.jboss.tools.jst.web.kb.refactoring,
org.jboss.tools.jst.web.kb.taglib,
org.jboss.tools.jst.web.kb.validation
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2010-12-28 18:21:58 UTC (rev 27778)
@@ -4,6 +4,7 @@
<extension-point id="tagLib" name="Kb Custom Tag Lib" schema="schema/tagLib.exsd"/>
<extension-point id="KbIncludeContext" name="Kb Include Context Buillder" schema="schema/include.exsd" />
<extension-point id="validator" name="KB Validator" schema="schema/validator.exsd"/>
+ <extension-point id="elValidationDelegate" name="EL Validation Delegate" schema="schema/elValidationDelegate.exsd"/>
<extension
id="kbbuilder"
@@ -210,6 +211,26 @@
</persistent>
</extension>
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.tools.jst.web.kb.preferences.ELPreferenceInitializer"/>
+ </extension>
+
+ <extension id="elproblem" name="%KBProblemName" point="org.eclipse.core.resources.markers">
+ <super type="org.jboss.tools.jst.web.kb.kbproblemmarker">
+ </super>
+ <persistent value="true">
+ </persistent>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.jst.web.kb.validator">
+ <validator
+ class="org.jboss.tools.jst.web.kb.internal.validation.ELValidator"
+ id="org.jboss.tools.jst.web.kb.ELValidator"
+ dependent="true">
+ </validator>
+ </extension>
+
<extension point="org.eclipse.wst.xml.core.catalogContributions">
<catalogContribution id="default">
<uri
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elValidationDelegate.exsd
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elValidationDelegate.exsd (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elValidationDelegate.exsd 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.jst.web.kb" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.jst.web.kb" id="elValidationDelegate" name="EL Validation Delegate"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="delegate" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="delegate">
+ <complexType>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.tools.jst.web.kb.validation.IELValidationDelegate"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elValidationDelegate.exsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd 2010-12-28 18:21:58 UTC (rev 27778)
@@ -1,119 +1,116 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.jboss.tools.jst.web.kb" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.jboss.tools.jst.web.kb" id="validator" name="KB Validator"/>
- </appInfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element />
- </appInfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="validator" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="validator">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn=":org.jboss.tools.jst.web.kb.validation.IValidator"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="extends" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="identifier" basedOn="org.jboss.tools.jst.web.kb.validator/validator/@id"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiinfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.jst.web.kb" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.jst.web.kb" id="validator" name="KB Validator"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="validator" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="validator">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.tools.jst.web.kb.validation.IValidator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="dependent" type="boolean">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidationMessages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidationMessages.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidationMessages.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,22 @@
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ELValidationMessages {
+ private static final String BUNDLE_NAME = "org.jboss.tools.jst.web.kb.internal.validation.messages"; //$NON-NLS-1$
+
+ public static String UNKNOWN_EL_VARIABLE_NAME;
+ public static String UNKNOWN_EL_VARIABLE_PROPERTY_NAME;
+ public static String UNPAIRED_GETTER_OR_SETTER;
+ public static String EL_SYNTAX_ERROR;
+
+ public static String VALIDATING_EL_FILE;
+
+ public static String EL_VALIDATOR_ERROR_VALIDATING;
+ public static String EL_VALIDATOR_SETTER;
+ public static String EL_VALIDATOR_GETTER;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ELValidationMessages.class);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidationMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,539 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+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.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.common.el.core.ELReference;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.parser.LexicalToken;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELContextImpl;
+import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.common.el.core.resolver.ELSegment;
+import org.jboss.tools.common.el.core.resolver.IVariable;
+import org.jboss.tools.common.el.core.resolver.JavaMemberELSegmentImpl;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
+import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
+import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.preferences.ELSeverityPreferences;
+import org.jboss.tools.jst.web.kb.validation.IELValidationDelegate;
+import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
+
+/**
+ * EL Validator
+ * @author Alexey Kazakov
+ */
+public class ELValidator extends KBValidator {
+
+ public static final String ID = "org.jboss.tools.jst.web.kb.ELValidator"; //$NON-NLS-1$
+ public static final String PROBLEM_TYPE = "org.jboss.tools.jst.web.kb.elproblem"; //$NON-NLS-1$
+
+ private static final String EXTENSION_POINT_ID = "org.jboss.tools.jst.web.kb.elValidationDelegate"; //$NON-NLS-1$
+
+ private static Set<IELValidationDelegate> DELEGATES;
+
+ private ELResolver[] resolvers;
+ protected ELParserFactory mainFactory;
+
+ private IProject currentProject;
+ private IResource[] currentSources;
+ private IContainer webRootFolder;
+ private boolean revalidateUnresolvedELs = false;
+ private boolean validateVars = true;
+
+ public ELValidator() {
+ if(DELEGATES==null) {
+ DELEGATES = new HashSet<IELValidationDelegate>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_ID);
+ if (extensionPoint != null) {
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for(int j=0; j<elements.length; j++) {
+ try {
+ IELValidationDelegate delegate = (IELValidationDelegate)elements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ DELEGATES.add(delegate);
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMarkerType()
+ */
+ @Override
+ public String getMarkerType() {
+ return PROBLEM_TYPE;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidator#isEnabled(org.eclipse.core.resources.IProject)
+ */
+ public boolean isEnabled(IProject project) {
+ return ELSeverityPreferences.isValidationEnabled(project) && ELSeverityPreferences.shouldValidateEL(project);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMaxNumberOfMarkersPerFile(org.eclipse.core.resources.IProject)
+ */
+ @Override
+ public int getMaxNumberOfMarkersPerFile(IProject project) {
+ return ELSeverityPreferences.getMaxNumberOfProblemMarkersPerFile(project);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.eclipse.wst.validation.internal.provisional.core.IValidator, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ @Override
+ public void init(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext context, org.eclipse.wst.validation.internal.provisional.core.IValidator manager, IReporter reporter) {
+ super.init(project, validationHelper, context, manager, reporter);
+ resolvers = ELResolverFactoryManager.getInstance().getResolvers(project);
+ mainFactory = ELParserUtil.getJbossFactory();
+ validateVars = ELSeverityPreferences.ENABLE.equals(ELSeverityPreferences.getInstance().getProjectPreference(validatingProject, ELSeverityPreferences.CHECK_VARS));
+ currentProject = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidator#validate(java.util.Set, org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public IStatus validate(Set<IFile> changedFiles, IProject project, ContextValidationHelper validationHelper, IProjectValidationContext context, ValidatorManager manager, IReporter reporter) throws ValidationException {
+ init(project, validationHelper, context, manager, reporter);
+ webRootFolder = null;
+ initRevalidationFlag();
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+
+ Set<IFile> filesToValidate = new HashSet<IFile>();
+ boolean containsJavaOrComponentsXml = false;
+ for (IFile file : changedFiles) {
+ if(file.isAccessible() && notValidatedYet(file)) {
+ filesToValidate.add(file);
+ if(!containsJavaOrComponentsXml) {
+ String fileName = file.getName().toLowerCase();
+ containsJavaOrComponentsXml = fileName.endsWith(".java") || fileName.endsWith(".properties") || fileName.equals("components.xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ }
+
+ if(containsJavaOrComponentsXml) {
+ if(revalidateUnresolvedELs) {
+ Set<IPath> unnamedResources = validationContext.getUnnamedElResources();
+ for (IPath path : unnamedResources) {
+ IFile file = wsRoot.getFile(path);
+ if(file!=null && file.isAccessible() && notValidatedYet(file)) {
+ filesToValidate.add(file);
+ }
+ }
+ }
+ }
+
+ Set<ELReference> els = validationContext.getElsForValidation(changedFiles, false);
+ validationContext.removeLinkedEls(filesToValidate);
+ Set<ELReference> elsToValidate = new HashSet<ELReference>();
+ if(revalidateUnresolvedELs) {
+ int i=0;
+ for (ELReference el : els) {
+ IResource resource = el.getResource();
+ if(resource!=null && resource.isAccessible() && !filesToValidate.contains(resource) && notValidatedYet(resource)) {
+ // Don't re-validate more than 1000 ELs.
+ if(i++>1000) {
+ break;
+ }
+ elsToValidate.add(el);
+ }
+ }
+ }
+ for (IFile file : filesToValidate) {
+ validateFile(file);
+ }
+ for (ELReference el : elsToValidate) {
+ validateEL(el);
+ coreHelper.getValidationContextManager().addValidatedProject(this, el.getResource().getProject());
+ }
+
+ validationContext.clearOldVariableNameForElValidation();
+ return OK_STATUS;
+ }
+
+ private void initRevalidationFlag() {
+ String revalidateUnresolvedELsString = ELSeverityPreferences.getInstance().getProjectPreference(validatingProject, ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL);
+ revalidateUnresolvedELs = ELSeverityPreferences.ENABLE.equals(revalidateUnresolvedELsString);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidator#validateAll(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public IStatus validateAll(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext context, ValidatorManager manager, IReporter reporter) throws ValidationException {
+ init(project, validationHelper, context, manager, reporter);
+ webRootFolder = null;
+ initRevalidationFlag();
+ Set<IFile> files = validationHelper.getProjectSetRegisteredFiles();
+ Set<IFile> filesToValidate = new HashSet<IFile>();
+ for (IFile file : files) {
+ if(file.isAccessible()) {
+ if(notValidatedYet(file)) {
+ filesToValidate.add(file);
+ }
+ } else {
+ validationContext.removeUnnamedElResource(file.getFullPath());
+ }
+ }
+ for (IFile file : filesToValidate) {
+ validateFile(file);
+ }
+ return OK_STATUS;
+ }
+
+ private static final String JAVA_EXT = "java"; //$NON-NLS-1$
+
+ private boolean enabled = true;
+
+ private boolean shouldFileBeValidated(IFile file) {
+ if(!file.isAccessible()) {
+ return false;
+ }
+ IProject project = file.getProject();
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)) {
+ // The resource is out of sync with the file system
+ // Just ignore this resource.
+ return false;
+ }
+ if(!project.equals(currentProject)) {
+ currentProject = project;
+ enabled = isEnabled(project);
+ if(!enabled) {
+ return false;
+ }
+ if(webRootFolder!=null && !project.equals(webRootFolder.getProject())) {
+ webRootFolder = null;
+ }
+ if(webRootFolder==null) {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(ELValidationMessages.EL_VALIDATOR_ERROR_VALIDATING, e);
+ }
+ if(facetedProject!=null && facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET)!=null) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component!=null) {
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+ webRootFolder = webRootVirtFolder.getUnderlyingFolder();
+ }
+ }
+ }
+ currentProject = project;
+ currentSources = EclipseResourceUtil.getJavaSourceRoots(project);
+ }
+ if(!enabled) {
+ return false;
+ }
+ // Validate all files from java source folders.
+ for (int i = 0; currentSources!=null && i < currentSources.length; i++) {
+ if(currentSources[i].getLocation().isPrefixOf(file.getLocation())) {
+ return true;
+ }
+ }
+ // If *.java is out of Java Source path then ignore it.
+ if(JAVA_EXT.equalsIgnoreCase(file.getFileExtension())) {
+ return false;
+ }
+ // Otherwise validate only files from Web-Content (in case of WTP project)
+ if(webRootFolder!=null) {
+ return webRootFolder.getLocation().isPrefixOf(file.getLocation());
+ }
+ return true;
+ }
+
+ private int markers;
+
+ private void validateFile(IFile file) {
+ if(reporter.isCancelled() || !shouldFileBeValidated(file)) {
+ return;
+ }
+ displaySubtask(ELValidationMessages.VALIDATING_EL_FILE, new String[]{file.getProject().getName(), file.getName()});
+ coreHelper.getValidationContextManager().addValidatedProject(this, file.getProject());
+ removeAllMessagesFromResource(file);
+ markers = 0;
+ ELContext context = PageContextFactory.createPageContext(file);
+ if(context!=null) {
+ ELReference[] references = context.getELReferences();
+ for (int i = 0; i < references.length; i++) {
+ if(!references[i].getSyntaxErrors().isEmpty()) {
+ for (SyntaxError error: references[i].getSyntaxErrors()) {
+ markers++;
+ addError(ELValidationMessages.EL_SYNTAX_ERROR, ELSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()}, references[i].getLineNumber(), 1, references[i].getStartPosition() + error.getPosition(), context.getResource());
+ }
+ }
+ if(markers<getMaxNumberOfMarkersPerFile(file.getProject())) {
+ validateEL(references[i]);
+ }
+ }
+ }
+ }
+
+ private void validateEL(ELReference el) {
+ if(!reporter.isCancelled()) {
+ displaySubtask(ELValidationMessages.VALIDATING_EL_FILE, new String[]{el.getResource().getProject().getName(), el.getResource().getName()});
+ el.deleteMarkers();
+ for (ELExpression expresion : el.getEl()) {
+ validateELExpression(el, expresion);
+ }
+ }
+ }
+
+ private void validateELExpression(ELReference elReference, ELExpression el) {
+ if(el == null) return;
+ List<ELInvocationExpression> es = el.getInvocations();
+ for (ELInvocationExpression token: es) {
+ validateElOperand(elReference, token);
+ }
+ }
+
+ private void validateElOperand(ELReference elReference, ELInvocationExpression operandToken) {
+ IFile file = elReference.getResource();
+ int documnetOffset = elReference.getStartPosition();
+ String operand = operandToken.getText();
+ if(operand.trim().length()==0) {
+ return;
+ }
+ String varName = operand;
+ int offsetOfVarName = documnetOffset + operandToken.getFirstToken().getStart();
+ int lengthOfVarName = varName.length();
+ boolean unresolvedTokenIsVariable = false;
+ if (!operand.endsWith(".")) { //$NON-NLS-1$
+ ELResolution resolution = null;
+ ELContext context = PageContextFactory.createPageContext(file);
+ if(context==null) {
+ context = new SimpleELContext();
+ context.setResource(file);
+ context.setElResolvers(resolvers);
+ }
+ int maxNumberOfResolvedSegments = -1;
+ List<Var> vars = null;
+ ELContextImpl c = null;
+ if(!validateVars && context instanceof ELContextImpl) {
+ c = (ELContextImpl)context;
+ vars = c.getAllVars();
+ c.setAllVars(new ArrayList<Var>());
+ }
+
+ for (int i = 0; i < resolvers.length; i++) {
+ ELResolution elResolution = resolvers[i].resolve(context, operandToken, documnetOffset);
+ if(elResolution==null) {
+ continue;
+ }
+ if(elResolution.isResolved()) {
+ resolution = elResolution;
+ break;
+ }
+ int number = elResolution.getNumberOfResolvedSegments();
+ if(number>maxNumberOfResolvedSegments) {
+ maxNumberOfResolvedSegments = number;
+ resolution = elResolution;
+ }
+ }
+
+ if(c!=null) {
+ c.setAllVars(vars);
+ }
+
+ if(!resolution.isResolved()) {
+ Set<String> names = findVariableNames(operandToken);
+ for (String name : names) {
+ validationContext.addLinkedEl(name, elReference);
+ }
+ }
+
+ List<ELSegment> segments = resolution.getSegments();
+ List<IVariable> usedVariables = new ArrayList<IVariable>();
+ for (ELSegment segment : segments) {
+ if(!segment.getVariables().isEmpty()) {
+ usedVariables.addAll(segment.getVariables());
+ }
+ // Check pair for getter/setter
+ if(segment instanceof JavaMemberELSegmentImpl) {
+ JavaMemberELSegmentImpl javaSegment = (JavaMemberELSegmentImpl)segment;
+ if(!javaSegment.getUnpairedGettersOrSetters().isEmpty()) {
+ TypeInfoCollector.MethodInfo unpairedMethod = javaSegment.getUnpairedGettersOrSetters().values().iterator().next();
+ String methodName = unpairedMethod.getName();
+ String propertyName = javaSegment.getUnpairedGettersOrSetters().keySet().iterator().next();
+ String missingMethodName = ELValidationMessages.EL_VALIDATOR_SETTER;
+ String existedMethodName = ELValidationMessages.EL_VALIDATOR_GETTER;
+ if(methodName.startsWith("s")) { //$NON-NLS-1$
+ missingMethodName = existedMethodName;
+ existedMethodName = ELValidationMessages.EL_VALIDATOR_SETTER;
+ }
+ int startPosition = documnetOffset + operandToken.getStartPosition();
+ int length = operandToken.getLength();
+ int startPr = operand.indexOf(propertyName);
+ if(startPr>-1) {
+ startPosition = startPosition + startPr;
+ length = propertyName.length();
+ }
+ markers++;
+ IMarker marker = addError(ELValidationMessages.UNPAIRED_GETTER_OR_SETTER, ELSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, elReference.getLineNumber(), length, startPosition, file);
+ elReference.addMarker(marker);
+ }
+ }
+ }
+ // Save links between resource and used variables names
+ for(IVariable variable: usedVariables) {
+ validationContext.addLinkedEl(variable.getName(), elReference);
+ }
+
+ if (resolution.isResolved()) {
+ // It's valid EL.
+ return;
+ }
+
+ ELSegment segment = resolution.getUnresolvedSegment();
+ if(segment==null) {
+ return;
+ }
+ LexicalToken token = segment.getToken();
+
+ varName = token.getText();
+ if(varName == null) {
+ //This is syntax error case. Reported by parser.
+ return;
+ }
+ offsetOfVarName = documnetOffset + token.getStart();
+ lengthOfVarName = varName == null ? 0 : varName.length();
+ if(usedVariables.isEmpty()) {
+ unresolvedTokenIsVariable = true;
+ }
+ }
+ markers++;
+ // Mark invalid EL
+ if(unresolvedTokenIsVariable) {
+ IMarker marker = addError(ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
+ elReference.addMarker(marker);
+ } else {
+ IMarker marker = addError(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, ELSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
+ elReference.addMarker(marker);
+ }
+ }
+
+ private Set<String> findVariableNames(ELInvocationExpression invocationExpression){
+ Set<String> names = new HashSet<String>();
+ while(invocationExpression != null) {
+ if(invocationExpression instanceof ELPropertyInvocation) {
+ String name = ((ELPropertyInvocation)invocationExpression).getQualifiedName();
+ if(name != null) {
+ names.add(name);
+ }
+ }
+ invocationExpression = invocationExpression.getLeft();
+ }
+ return names;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getPreference(org.eclipse.core.resources.IProject, java.lang.String)
+ */
+ @Override
+ protected String getPreference(IProject project, String preferenceKey) {
+ return ELSeverityPreferences.getInstance().getProjectPreference(project, preferenceKey);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidator#getId()
+ */
+ public String getId() {
+ return ID;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidator#getValidatingProjects(org.eclipse.core.resources.IProject)
+ */
+ public IValidatingProjectTree getValidatingProjects(IProject project) {
+ int max = 0;
+ IValidatingProjectTree result = null;
+ for (IELValidationDelegate delegate : DELEGATES) {
+ if(delegate.shouldValidate(project)) {
+ IValidatingProjectTree tree = delegate.getValidatingProjects(project);
+ if(tree.getAllProjects().size()>max) {
+ result = tree;
+ }
+ }
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse.core.resources.IProject)
+ */
+ public boolean shouldValidate(IProject project) {
+ if(isEnabled(project)) {
+ for (IELValidationDelegate delegate : DELEGATES) {
+ if(delegate.shouldValidate(project)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/KBValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/KBValidator.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/KBValidator.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+
+/**
+ * @author Alexey Kazakov
+ */
+public abstract class KBValidator extends ValidationErrorManager implements IValidator {
+
+ protected boolean notValidatedYet(IResource resource) {
+ IProject pr = resource.getProject();
+ return coreHelper==null || !coreHelper.getValidationContextManager().projectHasBeenValidated(this, pr);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/KBValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -32,7 +32,7 @@
// We should load/save these collections between eclipse sessions.
private Map<String, LinkCollection> coreLinks = new HashMap<String, LinkCollection>();
- private Map<String, ELValidatorContext> elLinks = new HashMap<String, ELValidatorContext>();
+ private ELValidatorContext elLinks = new ELValidatorContext("jboss.el"); //$NON-NLS-1$
private Map<String, Set<String>> oldVariableNamesForELValidation = new HashMap<String, Set<String>>();
@@ -47,15 +47,6 @@
return linkCollection;
}
- private ELValidatorContext getElLinks(String validatorId) {
- ELValidatorContext linkCollection = elLinks.get(validatorId);
- if(linkCollection==null) {
- linkCollection = new ELValidatorContext(validatorId);
- elLinks.put(validatorId, linkCollection);
- }
- return linkCollection;
- }
-
private Set<String> getOldVariableNamesForELValidation(String validatorId) {
Set<String> linkCollection = oldVariableNamesForELValidation.get(validatorId);
if(linkCollection==null) {
@@ -65,6 +56,13 @@
return linkCollection;
}
+ private Set<String> getIds() {
+ Set<String> ids = new HashSet<String>();
+ ids.addAll(coreLinks.keySet());
+ ids.addAll(oldVariableNamesForELValidation.keySet());
+ return ids;
+ }
+
/*
* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addLinkedCoreResource(java.lang.String, org.eclipse.core.runtime.IPath, boolean)
@@ -139,22 +137,10 @@
/*
* (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addUnnamedElResource(org.eclipse.core.runtime.IPath)
- */
- public void addUnnamedElResource(String validatorId, IPath fullPath) {
- getElLinks(validatorId).addUnnamedResource(fullPath);
- }
-
- /*
- * (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getUnnamedElResources()
*/
public Set<IPath> getUnnamedElResources() {
- Set<IPath> result = new HashSet<IPath>();
- for (ELValidatorContext elLinksCollection : elLinks.values()) {
- result.addAll(elLinksCollection.getUnnamedResources());
- }
- return result;
+ return elLinks.getUnnamedResources();
}
/*
@@ -162,9 +148,7 @@
* @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeUnnamedElResource(org.eclipse.core.runtime.IPath)
*/
public void removeUnnamedElResource(IPath fullPath) {
- for (ELValidatorContext links : elLinks.values()) {
- links.removeUnnamedResource(fullPath);
- }
+ elLinks.removeUnnamedResource(fullPath);
}
/*
@@ -180,9 +164,7 @@
* @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedEls(java.util.Set)
*/
public void removeLinkedEls(Set<IFile> resorces) {
- for (ELValidatorContext links : elLinks.values()) {
- links.removeLinkedEls(resorces);
- }
+ elLinks.removeLinkedEls(resorces);
}
/*
@@ -191,27 +173,28 @@
*/
public Set<ELReference> getElsForValidation(Set<IFile> changedFiles, boolean onlyChangedVariables) {
Set<ELReference> result = new HashSet<ELReference>();
- for (String id : elLinks.keySet()) {
- ELValidatorContext elLinksCollection = getElLinks(id);
+ for (String id : getIds()) {
Set<String> oldVariableNamesForELValidation = getOldVariableNamesForELValidation(id);
// Collect all ELs which use new variables names
for(IResource resource : changedFiles) {
Set<String> newNames = getVariableNamesByCoreResource(id, resource.getFullPath(), true);
if(newNames!=null) {
for (String newName : newNames) {
- if(!onlyChangedVariables || ! oldVariableNamesForELValidation.contains(newName)) {
- Set<ELReference> els = elLinksCollection.getElsByVariableName(newName);
+ if(!onlyChangedVariables || (oldVariableNamesForELValidation!=null && !oldVariableNamesForELValidation.contains(newName))) {
+ Set<ELReference> els = elLinks.getElsByVariableName(newName);
if(els!=null) {
result.addAll(els);
}
}
}
}
- for (String oldName :oldVariableNamesForELValidation) {
- if(!onlyChangedVariables || newNames==null || !newNames.contains(oldName)) {
- Set<ELReference> els = elLinksCollection.getElsByVariableName(oldName);
- if(els!=null) {
- result.addAll(els);
+ if(oldVariableNamesForELValidation!=null) {
+ for (String oldName :oldVariableNamesForELValidation) {
+ if(!onlyChangedVariables || newNames==null || !newNames.contains(oldName)) {
+ Set<ELReference> els = elLinks.getElsByVariableName(oldName);
+ if(els!=null) {
+ result.addAll(els);
+ }
}
}
}
@@ -229,10 +212,7 @@
links.clearAll();
}
coreLinks.clear();
- for (ELValidatorContext links : elLinks.values()) {
- links.clearAll();
- }
- elLinks.clear();
+ elLinks.clearAll();
oldVariableNamesForELValidation.clear();
}
@@ -249,9 +229,7 @@
* @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addLinkedEl(java.lang.String, org.jboss.tools.jst.web.kb.validation.ELReference)
*/
public void addLinkedEl(String variableName, ELReference el) {
- for (ELValidatorContext elLinksCollection : elLinks.values()) {
- elLinksCollection.addLinkedEl(variableName, el);
- }
+ elLinks.addLinkedEl(variableName, el);
}
/*
@@ -259,9 +237,7 @@
* @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedEl(java.lang.String, org.jboss.tools.jst.web.kb.validation.ELReference)
*/
public void removeLinkedEl(String name, ELReference el) {
- for (ELValidatorContext elLinksCollection : elLinks.values()) {
- elLinksCollection.removeLinkedEl(name, el);
- }
+ elLinks.removeLinkedEl(name, el);
}
/*
@@ -269,11 +245,7 @@
* @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getElsByVariableName(java.lang.String)
*/
public Set<ELReference> getElsByVariableName(String variableName) {
- Set<ELReference> result = new HashSet<ELReference>();
- for (ELValidatorContext elLinksCollection : elLinks.values()) {
- result.addAll(elLinksCollection.getElsByVariableName(variableName));
- }
- return result;
+ return elLinks.getElsByVariableName(variableName);
}
/*
@@ -287,11 +259,8 @@
core.setAttribute("validator-id", links.getId()); //$NON-NLS-1$
links.store(core);
}
- for (ELValidatorContext links : elLinks.values()) {
- Element el = XMLUtilities.createElement(validation, "el"); //$NON-NLS-1$
- el.setAttribute("validator-id", links.getId()); //$NON-NLS-1$
- links.store(el);
- }
+ Element el = XMLUtilities.createElement(validation, "el"); //$NON-NLS-1$
+ elLinks.store(el);
}
/*
@@ -310,10 +279,7 @@
}
Element[] els = XMLUtilities.getChildren(validation, "el"); //$NON-NLS-1$
for (Element el : els) {
- String id = el.getAttribute("validator-id"); //$NON-NLS-1$
- if(id!=null && id.trim().length()>0) {
- getElLinks(id).load(el);
- }
+ elLinks.load(el);
}
}
@@ -322,9 +288,7 @@
for (LinkCollection links : coreLinks.values()) {
result = result + links.getModificationsSinceLastStore();
}
- for (ELValidatorContext links : elLinks.values()) {
- result = result + links.getModificationsSinceLastStore();
- }
+ result = result + elLinks.getModificationsSinceLastStore();
return result;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -45,12 +45,12 @@
public ValidationContext(IProject project) {
if(ALL_VALIDATORS == null) {
- // Load all validators
+ // Load all the validators
ALL_VALIDATORS = new ArrayList<IValidator>();
+ List<IValidator> dependentValidators = new ArrayList<IValidator>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(IValidator.EXTENSION_POINT_ID);
if (extensionPoint != null) {
- Map<String, IValidator> extendsIds = new HashMap<String, IValidator>();
IExtension[] extensions = extensionPoint.getExtensions();
for (int i=0; i<extensions.length; i++) {
IExtension extension = extensions[i];
@@ -58,17 +58,10 @@
for(int j=0; j<elements.length; j++) {
try {
IValidator validator = (IValidator)elements[j].createExecutableExtension("class"); //$NON-NLS-1$
- String extendsId = elements[j].getAttribute("extends"); //$NON-NLS-1$
- if(extendsId!=null) {
- IValidator[] tempArray = ALL_VALIDATORS.toArray(new IValidator[0]);
- for (IValidator vld : tempArray) {
- if(extendsId.equals(vld.getId())) {
- ALL_VALIDATORS.remove(vld);
- }
- }
- extendsIds.put(extendsId, validator);
- }
- if(!extendsIds.containsKey(validator.getId())) {
+ String dependent = elements[j].getAttribute("dependent"); //$NON-NLS-1$
+ if(Boolean.parseBoolean(dependent)) {
+ dependentValidators.add(validator);
+ } else {
ALL_VALIDATORS.add(validator);
}
} catch (CoreException e) {
@@ -77,6 +70,8 @@
}
}
}
+ // We should add all the dependent validators (e.g. EL validator) to the very end of the list.
+ ALL_VALIDATORS.addAll(dependentValidators);
}
// Init context for given project.
@@ -243,6 +238,14 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#clearValidatedProjectsList()
+ */
+ public void clearValidatedProjectsList() {
+ validatedProjects.clear();
+ }
+
+ /*
+ * (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#projectHasBeenValidated(org.jboss.tools.jst.web.kb.validation.IValidator, org.eclipse.core.resources.IProject)
*/
public boolean projectHasBeenValidated(IValidator validator, IProject project) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -78,6 +78,7 @@
}
synchronized (validatingProjects) {
try {
+ validationContextManager.clearValidatedProjectsList();
Set<IFile> changedFiles = validationHelper.getChangedFiles();
if(!changedFiles.isEmpty()) {
status = validate(changedFiles, validationHelper, reporter);
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/messages.properties (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/messages.properties 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,23 @@
+#*******************************************************************************
+#* Copyright (c) 2007 Red Hat, Inc.
+#* Distributed under license by Red Hat, Inc. All rights reserved.
+#* This program is 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:
+#* Red Hat, Inc. - initial API and implementation
+#******************************************************************************/
+
+#Expression Language
+UNKNOWN_EL_VARIABLE_NAME="{0}" cannot be resolved
+UNKNOWN_EL_VARIABLE_PROPERTY_NAME="{0}" cannot be resolved
+UNPAIRED_GETTER_OR_SETTER=Property "{0}" has only {1}. {2} is missing.
+EL_SYNTAX_ERROR=EL syntax error: {0}.
+
+#Messages for Progress Monitor
+VALIDATING_EL_FILE=project "{0}"; EL in "{1}" (JSF EL Validator)
+
+EL_VALIDATOR_ERROR_VALIDATING=Error validating EL
+EL_VALIDATOR_SETTER=Setter
+EL_VALIDATOR_GETTER=Getter
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class ELPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ public ELPreferenceInitializer() {}
+
+ @Override
+ public void initializeDefaultPreferences() {
+
+ IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(WebKbPlugin.PLUGIN_ID);
+ defaultPreferences.putBoolean(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
+ for (String name : ELSeverityPreferences.SEVERITY_OPTION_NAMES) {
+ defaultPreferences.put(name, ELSeverityPreferences.ERROR);
+ }
+ defaultPreferences.put(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.IGNORE);
+ defaultPreferences.put(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, ELSeverityPreferences.WARNING);
+ defaultPreferences.put(ELSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, ELSeverityPreferences.IGNORE);
+ defaultPreferences.put(ELSeverityPreferences.EL_SYNTAX_ERROR, ELSeverityPreferences.WARNING);
+ defaultPreferences.put(ELSeverityPreferences.CHECK_VARS, ELSeverityPreferences.ENABLE);
+ defaultPreferences.put(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, ELSeverityPreferences.ENABLE);
+ defaultPreferences.putInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, SeverityPreferences.DEFAULT_MAX_NUMBER_OF_MARKERS_PER_FILE);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELPreferenceInitializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELSeverityPreferences.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELSeverityPreferences.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELSeverityPreferences.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.preferences;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ELSeverityPreferences extends SeverityPreferences {
+
+ public static final Set<String> SEVERITY_OPTION_NAMES = new HashSet<String>();
+
+ private static ELSeverityPreferences INSTANCE = new ELSeverityPreferences();
+
+ // Expression Language
+
+ // Mark EL Variable name which we can't resolve.
+ public static final String UNKNOWN_EL_VARIABLE_NAME = INSTANCE.createSeverityOption("unknownElVariableName"); //$NON-NLS-1$
+ // Check "var" attributes.
+ public static final String CHECK_VARS = INSTANCE.createSeverityOption("checkVars"); //$NON-NLS-1$
+ // Re-validate unresolved ELs.
+ public static final String RE_VALIDATE_UNRESOLVED_EL = INSTANCE.createSeverityOption("revalidateUnresolvedEl"); //$NON-NLS-1$
+ // Mark EL Variable property name which we can't resolve.
+ public static final String UNKNOWN_EL_VARIABLE_PROPERTY_NAME = INSTANCE.createSeverityOption("unknownElVariablePropertyName"); //$NON-NLS-1$
+ // If Expression use property of bean and this property has only setter(getter) without getter(setter) then mark it.
+ public static final String UNPAIRED_GETTER_OR_SETTER = INSTANCE.createSeverityOption("unpairedGetterOrSetter"); //$NON-NLS-1$
+
+ public static final String EL_SYNTAX_ERROR = INSTANCE.createSeverityOption("elSyntaxError"); //$NON-NLS-1$
+
+ /**
+ * @return the only instance of JSFSeverityPreferences
+ */
+ public static ELSeverityPreferences getInstance() {
+ return INSTANCE;
+ }
+
+ private ELSeverityPreferences() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#createSeverityOption(java.lang.String)
+ */
+ @Override
+ protected String createSeverityOption(String shortName) {
+ String name = getPluginId() + ".validator.problem." + shortName; //$NON-NLS-1$
+ SEVERITY_OPTION_NAMES.add(name);
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#getPluginId()
+ */
+ @Override
+ protected String getPluginId() {
+ return WebKbPlugin.PLUGIN_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#getSeverityOptionNames()
+ */
+ @Override
+ protected Set<String> getSeverityOptionNames() {
+ return SEVERITY_OPTION_NAMES;
+ }
+
+ public static boolean isValidationEnabled(IProject project) {
+ return INSTANCE.isEnabled(project);
+ }
+
+ public static int getMaxNumberOfProblemMarkersPerFile(IProject project) {
+ return INSTANCE.getMaxNumberOfProblemMarkersPerResource(project);
+ }
+
+ public static boolean shouldValidateEL(IProject project) {
+ return !(SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project, UNKNOWN_EL_VARIABLE_NAME)) &&
+ SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project, UNKNOWN_EL_VARIABLE_PROPERTY_NAME)) &&
+ SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project, EL_SYNTAX_ERROR)) &&
+ SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project, UNPAIRED_GETTER_OR_SETTER)));
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/ELSeverityPreferences.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IELValidationDelegate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IELValidationDelegate.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IELValidationDelegate.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.validation;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * Represents a delegate which is used be EL validator to collect all the
+ * projects which should be validated by EL validator.
+ *
+ * @author Alexey Kazakov
+ */
+public interface IELValidationDelegate {
+
+ /**
+ * @param project
+ * @return a set of projects which should be validated together with the
+ * given project.
+ */
+ IValidatingProjectTree getValidatingProjects(IProject project);
+
+ /**
+ * @param project
+ * @return true if the validator should validate the given project.
+ */
+ boolean shouldValidate(IProject project);
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IELValidationDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextManager.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextManager.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -49,4 +49,6 @@
void addValidatedProject(IValidator validator, IProject project);
boolean projectHasBeenValidated(IValidator validator, IProject project);
+
+ void clearValidatedProjectsList();
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -52,13 +52,13 @@
/**
* @param project
- * @return a set of projects which should be validated with given project.
+ * @return @return a set of projects which should be validated together with the given project.
*/
IValidatingProjectTree getValidatingProjects(IProject project);
/**
* @param project
- * @return true if this validator should validate given project.
+ * @return true if this validator should validate the given project.
*/
boolean shouldValidate(IProject project);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF 2010-12-28 18:21:58 UTC (rev 27778)
@@ -40,11 +40,15 @@
org.eclipse.debug.ui,
org.jboss.tools.jst.jsp;bundle-version="2.0.0",
org.eclipse.jface.text;bundle-version="3.5.0",
- org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.1.300",
+ org.eclipse.wst.common.emfworkbench.integration,
org.apache.velocity;bundle-version="1.5.0",
- org.eclipse.ui.workbench.texteditor;bundle-version="3.5.1",
- org.eclipse.wst.html.ui;bundle-version="1.0.401",
- org.jboss.tools.common.el.core;bundle-version="3.2.0"
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.wst.html.ui,
+ org.jboss.tools.common.el.core;bundle-version="3.2.0",
+ org.jboss.tools.common.ui,
+ org.jboss.tools.jst.web.kb,
+ org.eclipse.ui.forms,
+ org.jboss.tools.common.el.ui
Bundle-Version: 3.2.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties 2010-12-28 18:21:58 UTC (rev 27778)
@@ -54,3 +54,6 @@
Bundle-Name.0 = Web UI
NavigatorContent_FileContentProvider=JBoss Tools File Content Provider
NavigatorContent_ProjectContentProvider=JBoss Tools Project Content Provider
+
+PreferencePage_Validator = Validation
+PropertiesPage_Validator = Expression Language Validation
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-12-28 18:21:58 UTC (rev 27778)
@@ -57,7 +57,29 @@
class="org.jboss.tools.jst.web.ui.internal.preferences.ContentAssistPreferencePage"
id="org.jboss.tools.jsf.ui.editor.pref.contentassist">
</page>
+ <page
+ category="org.jboss.tools.el.ui"
+ class="org.jboss.tools.jst.web.ui.internal.preferences.ELValidatorPreferencePage"
+ id="org.jboss.tools.jst.web.ui.preferences.ELValidatorPreferencePage"
+ name="%PreferencePage_Validator"/>
</extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ name="%PropertiesPage_Validator"
+ class="org.jboss.tools.jst.web.ui.internal.preferences.ELValidatorPreferencePage"
+ id="org.jboss.tools.jst.web.ui.properties.ELValidatorPreferencePage">
+ <enabledWhen>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <or>
+ <test property="org.eclipse.core.resources.projectNature" value="org.jboss.tools.jsf.jsfnature"/>
+ <test property="org.eclipse.core.resources.projectNature" value="org.jboss.tools.cdi.core.cdinature"/>
+ <test property="org.eclipse.core.resources.projectNature" value="org.jboss.tools.seam.core.seamnature"/>
+ </or>
+ </adapt>
+ </enabledWhen>
+ </page>
+ </extension>
<extension point="org.eclipse.ui.editors">
<editor
class="org.jboss.tools.jst.web.ui.editors.TLDCompoundEditor"
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.web.ui.internal.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class ELSeverityPreferencesMessages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.jboss.tools.jst.web.ui.internal.preferences.ELSeverityPreferencesMessages"; //$NON-NLS-1$
+
+ public static String JSF_VALIDATOR_CONFIGURATION_BLOCK_JSF_VALIDATOR_CONFIGURATION_BLOCK;
+ public static String JSF_VALIDATOR_PREFERENCE_PAGE_JSF_VALIDATOR;
+
+ //Validator Preference page
+ public static String JSFValidatorConfigurationBlock_common_description;
+
+ //Expression Language
+ public static String JSFValidatorConfigurationBlock_section_el;
+ public static String JSFValidatorConfigurationBlock_pb_elSyntaxError_label;
+ public static String JSFValidatorConfigurationBlock_pb_unknownElVariableName_label;
+ public static String JSFValidatorConfigurationBlock_pb_checkVars_label;
+ public static String JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label;
+ public static String JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label;
+ public static String JSFValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ELSeverityPreferencesMessages.class);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.properties (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.properties 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,25 @@
+##################################################################################
+### Copyright (c) 2007 Red Hat, Inc.
+### Distributed under license by Red Hat, Inc. All rights reserved.
+### This program is 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:
+### Red Hat, Inc. - initial API and implementation
+##################################################################################
+
+#Preferences Page
+JSFValidatorConfigurationBlock_common_description=Select the severity level for the following optional JSF Validator problems:
+
+##Expression Language
+JSFValidatorConfigurationBlock_section_el=Expression language
+JSFValidatorConfigurationBlock_pb_elSyntaxError_label=EL Syntax Error
+JSFValidatorConfigurationBlock_pb_unknownElVariableName_label=Variable cannot be resolved:
+JSFValidatorConfigurationBlock_pb_checkVars_label=Recognize "var" attributes
+JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label=Revalidate unresolved ELs automatically.
+JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label=Property cannot be resolved:
+JSFValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label=Unpaired Getter/Setter:
+
+JSF_VALIDATOR_CONFIGURATION_BLOCK_JSF_VALIDATOR_CONFIGURATION_BLOCK=JSFValidatorConfigurationBlock
+JSF_VALIDATOR_PREFERENCE_PAGE_JSF_VALIDATOR=Expression Language Validator
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELSeverityPreferencesMessages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.web.ui.internal.preferences;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
+import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.preferences.ELSeverityPreferences;
+
+/**
+ * Find the instruction to Framework for Severity preferences in SeverityConfigurationBlock.java
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class ELValidatorConfigurationBlock extends SeverityConfigurationBlock {
+ private static final String SETTINGS_SECTION_NAME = ELSeverityPreferencesMessages.JSF_VALIDATOR_CONFIGURATION_BLOCK_JSF_VALIDATOR_CONFIGURATION_BLOCK;
+
+ private Button recognizeVarsCheckBox;
+ private Button revalidateUnresolvedElCheckBox;
+ private Combo elVariablesCombo;
+ private Combo elPropertiesCombo;
+
+ private static SectionDescription SECTION_EL = new SectionDescription(
+ ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_section_el,
+ new String[][] {
+ {ELSeverityPreferences.EL_SYNTAX_ERROR, ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_elSyntaxError_label},
+ {ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariableName_label},
+ {ELSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label},
+ {ELSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label},
+ },
+ WebKbPlugin.PLUGIN_ID
+ );
+
+ private static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
+ SECTION_EL,
+ };
+
+ private static Key[] getKeys() {
+ ArrayList<Key> keys = new ArrayList<Key>();
+ for (int i = 0; i < ALL_SECTIONS.length; i++) {
+ for (int j = 0; j < ALL_SECTIONS[i].options.length; j++) {
+ keys.add(ALL_SECTIONS[i].options[j].key);
+ }
+ }
+ keys.add(getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.CHECK_VARS));
+ keys.add(getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL));
+ keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
+ return keys.toArray(new Key[0]);
+ }
+
+ private static final Key MAX_NUMBER_OF_PROBLEMS_KEY = getKey(WebKbPlugin.PLUGIN_ID, SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
+
+ @Override
+ protected Key getMaxNumberOfProblemsKey() {
+ return MAX_NUMBER_OF_PROBLEMS_KEY;
+ }
+
+ public ELValidatorConfigurationBlock(IStatusChangeListener context,
+ IProject project,
+ IWorkbenchPreferenceContainer container) {
+ super(context, project, getKeys(), container);
+ }
+
+ @Override
+ protected Composite createStyleTabContent(Composite folder) {
+ int nColumns = 3;
+
+ final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
+
+ Composite composite = sc1.getBody();
+
+ addMaxNumberOfMarkersField(composite);
+
+ GridLayout layout= new GridLayout(nColumns, false);
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ composite.setLayout(layout);
+
+ Label description= new Label(composite, SWT.LEFT | SWT.WRAP);
+ description.setFont(description.getFont());
+ description.setText(getCommonDescription());
+ description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, nColumns - 1, 1));
+
+ int defaultIndent = 0;
+
+ for (int i = 0; i < ALL_SECTIONS.length; i++) {
+ SectionDescription section = ALL_SECTIONS[i];
+ String label = section.label;
+ ExpandableComposite excomposite = createStyleSection(composite, label, nColumns);
+
+ Composite inner = new Composite(excomposite, SWT.NONE);
+ inner.setFont(composite.getFont());
+ inner.setLayout(new GridLayout(nColumns, false));
+ excomposite.setClient(inner);
+
+ for (int j = 0; j < section.options.length; j++) {
+ OptionDescription option = section.options[j];
+ label = option.label;
+ Combo combo = addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent);
+ if(option.label == ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariableName_label) {
+ elVariablesCombo = combo;
+ combo.addSelectionListener(new SelectionListener(){
+ public void widgetDefaultSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ });
+ } else if(option.label == ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label) {
+ elPropertiesCombo = combo;
+ combo.addSelectionListener(new SelectionListener(){
+ public void widgetDefaultSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ });
+ }
+ }
+
+ if(section==SECTION_EL) {
+ label = ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_checkVars_label;
+ recognizeVarsCheckBox = addCheckBox(inner, label, getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.CHECK_VARS), enableDisableValues, defaultIndent);
+
+ label = ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label;
+ revalidateUnresolvedElCheckBox = addCheckBox(inner, label, getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL), enableDisableValues, defaultIndent);
+ }
+ }
+
+ restoreSectionExpansionStates(getDialogSettings());
+
+ updateELCombox();
+
+ return sc1;
+ }
+
+ @Override
+ public void performDefaults() {
+ super.performDefaults();
+ updateELCombox();
+ }
+
+ private void updateELCombox() {
+ boolean enable = elPropertiesCombo.getSelectionIndex()!=2 || elVariablesCombo.getSelectionIndex()!=2;
+ recognizeVarsCheckBox.setEnabled(enable);
+ revalidateUnresolvedElCheckBox.setEnabled(enable);
+ }
+
+ @Override
+ protected SectionDescription[] getAllSections() {
+ return ALL_SECTIONS;
+ }
+
+ @Override
+ protected String getCommonDescription() {
+ return ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_common_description;
+ }
+
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ return WebKbPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorPreferencePage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorPreferencePage.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorPreferencePage.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.internal.preferences;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.ui.preferences.SeverityPreferencePage;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class ELValidatorPreferencePage extends SeverityPreferencePage {
+ public static final String PREF_ID = "org.jboss.tools.jst.web.ui.preferences.ELValidatorPreferencePage"; //$NON-NLS-1$
+ public static final String PROP_ID = "org.jboss.tools.jst.web.ui.properties.ELValidatorPreferencePage"; //$NON-NLS-1$
+
+ public ELValidatorPreferencePage() {
+ setPreferenceStore(WebKbPlugin.getDefault().getPreferenceStore());
+ setTitle(ELSeverityPreferencesMessages.JSF_VALIDATOR_PREFERENCE_PAGE_JSF_VALIDATOR);
+ }
+
+ @Override
+ protected String getPreferencePageID() {
+ return PREF_ID;
+ }
+
+ @Override
+ protected String getPropertyPageID() {
+ return PROP_ID;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
+ fConfigurationBlock = new ELValidatorConfigurationBlock(getNewStatusChangedListener(), getProject(), container);
+
+ super.createControl(parent);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorPreferencePage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2010-12-28 18:21:58 UTC (rev 27778)
@@ -523,13 +523,15 @@
class="org.jboss.tools.seam.internal.core.validation.SeamCoreValidator"
id="org.jboss.tools.seam.core.CoreValidator">
</validator>
- <validator
- class="org.jboss.tools.seam.internal.core.validation.SeamELValidator"
- id="org.jboss.tools.seam.core.ELValidator"
- extends="org.jboss.tools.jsf.ELValidator">
- </validator>
</extension>
+ <extension
+ point="org.jboss.tools.jst.web.kb.elValidationDelegate">
+ <delegate
+ class="org.jboss.tools.seam.internal.core.validation.SeamELValidationDelegate">
+ </delegate>
+ </extension>
+
<!-- Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=315390 -->
<extension
id="excludeEJBValidation"
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -184,7 +184,6 @@
*/
public boolean shouldValidate(IProject project) {
try {
- // TODO check preferences for root web project only
return project!=null && project.isAccessible() && project.hasNature(ISeamProject.NATURE_ID) && isPreferencesEnabled(project);
} catch (CoreException e) {
SeamCorePlugin.getDefault().logError(e);
@@ -281,20 +280,21 @@
// Remove all links between collected resources and variables names because they will be linked again during validation.
validationContext.removeLinkedCoreResources(SHORT_ID, resources);
- IFile[] filesToValidate = new IFile[resources.size()];
- int i = 0;
+ Set<IFile> filesToValidate = new HashSet<IFile>();
// We have to remove markers from all collected source files first
for (IPath linkedResource : resources) {
- filesToValidate[i] = root.getFile(linkedResource);
- removeAllMessagesFromResource(filesToValidate[i++]);
+ IFile file = root.getFile(linkedResource);
+ if(file!=null && file.isAccessible()) {
+ filesToValidate.add(file);
+ removeAllMessagesFromResource(file);
+ }
}
- i = 0;
// Then we can validate them
- for (IPath linkedResource : resources) {
- validateComponent(linkedResource, checkedComponents, newResources);
- validateFactory(linkedResource, markedDuplicateFactoryNames);
- validatePageXML(filesToValidate[i]);
- validateXMLVersion(filesToValidate[i++]);
+ for (IFile file : filesToValidate) {
+ validateComponent(file.getFullPath(), checkedComponents, newResources);
+ validateFactory(file.getFullPath(), markedDuplicateFactoryNames);
+ validatePageXML(file);
+ validateXMLVersion(file);
}
// If changed files are *.java or component.xml then re-validate all unnamed resources.
@@ -303,7 +303,7 @@
newResources.addAll(unnamedResources);
for (IPath path : newResources) {
IFile file = root.getFile(path);
- if(file!=null && file.exists()) {
+ if(file!=null && file.isAccessible()) {
if(!resources.contains(path)) {
removeAllMessagesFromResource(file);
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationDelegate.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationDelegate.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.internal.core.validation;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.jst.web.kb.validation.IELValidationDelegate;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SeamELValidationDelegate implements IELValidationDelegate {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IELValidationDelegate#getValidatingProjects(org.eclipse.core.resources.IProject)
+ */
+ public IValidatingProjectTree getValidatingProjects(IProject project) {
+ return SeamCoreValidator.getSeamValidatingProjects(project);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IELValidationDelegate#shouldValidate(org.eclipse.core.resources.IProject)
+ */
+ public boolean shouldValidate(IProject project) {
+ try {
+ return project!=null && project.isAccessible() && project.hasNature(ISeamProject.NATURE_ID);
+ } catch (CoreException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+}
\ No newline at end of file
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidationDelegate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.validation;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.jsf.web.validation.ELValidator;
-import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
-import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
-import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
-import org.jboss.tools.seam.core.ISeamProject;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-
-/**
- * @author Alexey Kazakov
- */
-public class SeamELValidator extends ELValidator {
-
- public static final String ID = "org.jboss.tools.seam.core.ELValidator";
-
- /* (non-Javadoc)
- * @see org.jboss.tools.jsf.web.validation.ELValidator#getId()
- */
- @Override
- public String getId() {
- return ID;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.jsf.web.validation.ELValidator#getValidatingProjects(org.eclipse.core.resources.IProject)
- */
- @Override
- public IValidatingProjectTree getValidatingProjects(IProject project) {
- try {
- if(!project.hasNature(ISeamProject.NATURE_ID)) {
- return super.getValidatingProjects(project);
- }
- } catch (CoreException e) {
- SeamCorePlugin.getDefault().logError(e);
- }
-
- return SeamCoreValidator.getSeamValidatingProjects(project);
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.jsf.web.validation.ELValidator#shouldValidate(org.eclipse.core.resources.IProject)
- */
- @Override
- public boolean shouldValidate(IProject project) {
- try {
- return super.shouldValidate(project) || (project!=null && project.isAccessible() && project.hasNature(ISeamProject.NATURE_ID));
- } catch (CoreException e) {
- SeamCorePlugin.getDefault().logError(e);
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jsf.web.validation.ELValidator#init(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.eclipse.wst.validation.internal.provisional.core.IValidator, org.eclipse.wst.validation.internal.provisional.core.IReporter)
- */
- @Override
- public void init(IProject project,
- ContextValidationHelper validationHelper, IProjectValidationContext context, IValidator manager,
- IReporter reporter) {
- super.init(project, validationHelper, context, manager, reporter);
- mainFactory = ELParserUtil.getJbossFactory();
- }
-}
\ No newline at end of file
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -25,10 +25,10 @@
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
-import org.jboss.tools.jsf.web.validation.JSFValidationMessages;
import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.internal.validation.ELValidationMessages;
+import org.jboss.tools.jst.web.kb.preferences.ELSeverityPreferences;
import org.jboss.tools.jst.web.kb.validation.IValidator;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentMethod;
@@ -200,8 +200,8 @@
ELValidatorWrapper elValidator = new ELValidatorWrapper(project);
elValidator.validate(jbide1631XHTMLFile);
- assertTrue("Error marker not found", elValidator.isMessageCreated(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME, new Object[]{"foo1"}));
- assertTrue("Error marker not found", elValidator.isMessageCreated(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME, new Object[]{"foo2"}));
+ assertTrue("Error marker not found", elValidator.isMessageCreated(ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME, new Object[]{"foo1"}));
+ assertTrue("Error marker not found", elValidator.isMessageCreated(ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME, new Object[]{"foo2"}));
}
public void testDuplicateComponentNameValidator() throws CoreException, ValidationException {
@@ -636,7 +636,7 @@
assertMarkerIsNotCreatedForFile(new ELValidatorWrapper(project),
"WebContent/abcComponent.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
new Object[]{"bcComponent"});
// Context variable cannot be resolved
@@ -644,7 +644,7 @@
assertMarkerIsCreatedForLine(new ELValidatorWrapper(project),
"WebContent/abcComponent.xhtml",
"WebContent/abcComponent.2",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
new Object[]{"bcComponent"}, 22);
}
@@ -653,7 +653,7 @@
assertMarkerIsNotCreatedForFile(
new ELValidatorWrapper(project),
"WebContent/abcComponent.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new Object[]{"actionType2"});
// Property cannot be resolved
@@ -661,7 +661,7 @@
new ELValidatorWrapper(project),
"WebContent/abcComponent.xhtml",
"WebContent/abcComponent.3",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
new Object[]{"actionType2"},
22);
}
@@ -689,7 +689,7 @@
// new ELValidatorWrapper(project),
// "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java",
// "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.2",
-// JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
+// ELValidationMessages.UNPAIRED_GETTER_OR_SETTER,
// new Object[] {"actionType","Setter","Getter"},
// true);
@@ -697,7 +697,7 @@
wrapper,
"WebContent/abcComponent.xhtml",
"WebContent/abcComponent.4",
- JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
+ ELValidationMessages.UNPAIRED_GETTER_OR_SETTER,
new Object[] {"actionType","Setter","Getter"},
22);
} finally {
@@ -723,7 +723,7 @@
// new ELValidatorWrapper(project),
// "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java",
// "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.3",
-// JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
+// ELValidationMessages.UNPAIRED_GETTER_OR_SETTER,
// new Object[] {"actionType", "Getter", "Setter"},
// true);
@@ -731,7 +731,7 @@
wrapper,
"WebContent/abcComponent.xhtml",
"WebContent/abcComponent.original",
- JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
+ ELValidationMessages.UNPAIRED_GETTER_OR_SETTER,
new Object[] {"actionType", "Getter", "Setter"},
22);
} finally {
@@ -740,8 +740,8 @@
}
private void enableUnpairGetterOrSetterValidation(boolean enable) {
- IPreferenceStore store = JSFModelPlugin.getDefault().getPreferenceStore();
- store.putValue(JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, enable?SeamPreferences.ERROR:SeamPreferences.IGNORE);
+ IPreferenceStore store = WebKbPlugin.getDefault().getPreferenceStore();
+ store.putValue(ELSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, enable?SeamPreferences.ERROR:SeamPreferences.IGNORE);
if(store instanceof IPersistentPreferenceStore) {
try {
((IPersistentPreferenceStore)store).save();
@@ -797,7 +797,7 @@
assertMarkerIsCreatedForLine(
new ELValidatorWrapper(project),
"WebContent/markerTest.xhtml",
- JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
+ ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME,
new Object[] {"testtt"},
9);
}
@@ -856,11 +856,11 @@
}
}
- store = JSFModelPlugin.getDefault().getPreferenceStore();
- store.putValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, SeamPreferences.ERROR);
- store.putValue(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, SeamPreferences.ERROR);
- //store.putValue(JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, SeamPreferences.ERROR);
- store.putValue(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, SeamPreferences.ENABLE);
+ store = WebKbPlugin.getDefault().getPreferenceStore();
+ store.putValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, SeamPreferences.ERROR);
+ store.putValue(ELSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, SeamPreferences.ERROR);
+ //store.putValue(ELSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, SeamPreferences.ERROR);
+ store.putValue(ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, SeamPreferences.ENABLE);
if(store instanceof IPersistentPreferenceStore) {
try {
@@ -882,7 +882,7 @@
}
}
- store = JSFModelPlugin.getDefault().getPreferenceStore();
+ store = WebKbPlugin.getDefault().getPreferenceStore();
store.putValue(name, value);
if(store instanceof IPersistentPreferenceStore) {
@@ -892,8 +892,8 @@
SeamCorePlugin.getPluginLog().logError(e);
}
}
- }
-
+ }
+
private void refreshProject(IProject project){
JobUtils.waitForIdle();
}
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -8,7 +8,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.jboss.tools.jsf.web.validation.ELValidator;
+import org.jboss.tools.jst.web.kb.internal.validation.ELValidator;
public class ELValidatorWrapper extends ELValidator implements IValidatorSupport{
@@ -63,16 +63,19 @@
public void validate() throws ValidationException {
validatorSupport.validate();
}
+
public void validate(IFile file) throws ValidationException {
validatorSupport.addFile(file);
validatorSupport.validate();
}
+
public void add(IMarker message) {
validatorSupport.add(message);
}
+
public boolean isMessageCreatedOnLine(String markerTemplate,
Object[] parameters, int lineNumber) throws CoreException {
return validatorSupport.isMessageCreatedOnLine(markerTemplate, parameters, lineNumber);
}
-}
+}
\ No newline at end of file
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -25,11 +25,9 @@
public class SeamProjectPropertyValidatorWrapper extends SeamProjectPropertyValidator implements IValidatorSupport, IValidator, IValidationErrorManager{
ValidatorSupport support;
- private IProject project;
SeamValidationErrorManager errorManager;
public SeamProjectPropertyValidatorWrapper(IProject project) {
- this.project = project;
this.support = new ValidatorSupport(project,(IValidator)this);
}
Modified: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-12-28 18:21:58 UTC (rev 27778)
@@ -139,7 +139,7 @@
if(lines.isEmpty()) {
IMarker[] allMarkers = findMarkers(resource, null, ".*", true);
StringBuffer sb = new StringBuffer("Marker matches the '"); //$NON-NLS-1$
- sb.append(errorMessage).append("' pattern wasn't found. Here is a list of found markers in ").append(resource.getFullPath().toOSString()).append(" : [\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ sb.append(errorMessage).append("' pattern wasn't found. Here is a list of found markers in ").append(resource.getFullPath().toOSString()).append(allMarkers.length==0?" : [": " : [\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
int i=0;
for (IMarker marker : allMarkers) {
String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/.settings/org.eclipse.jdt.core.prefs 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/.settings/org.eclipse.jdt.core.prefs 2010-12-28 18:21:58 UTC (rev 27778)
@@ -1 +1,13 @@
+#Wed Nov 03 12:21:18 MSK 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2010-12-28 18:21:58 UTC (rev 27778)
@@ -6,7 +6,7 @@
source.maxmin=Maximize/Restore Source Part
visual.maxmin=Maximize/Restore Visual Part
visual.jumping=Jump
-PreferencePage_ElVariables=El Variables
+PreferencePage_ElVariables=Variables
visualEditorImpl_name=XulRunner Visual Editor
PreferencePage_VpeEditor=Visual Page Editor
exportUserTagsTemplatesWizardName=User specified tag templates
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2010-12-28 18:08:24 UTC (rev 27777)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2010-12-28 18:21:58 UTC (rev 27778)
@@ -33,7 +33,7 @@
name="%PreferencePage_VpeEditor">
</page>
<page
- category="org.jboss.tools.common.model.ui"
+ category="org.jboss.tools.el.ui"
class="org.jboss.tools.vpe.editor.preferences.ELVariablesPreferencePage"
id="org.jboss.tools.common.xstudio.elvariables"
name="%PreferencePage_ElVariables">
14 years
JBoss Tools SVN: r27777 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-28 13:08:24 -0500 (Tue, 28 Dec 2010)
New Revision: 27777
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFProjectBean.java
Log:
JBIDE-8011
https://issues.jboss.org/browse/JBIDE-8011
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFProjectBean.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFProjectBean.java 2010-12-28 18:05:32 UTC (rev 27776)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFProjectBean.java 2010-12-28 18:08:24 UTC (rev 27777)
@@ -16,6 +16,7 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.impl.RegularObjectImpl;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.util.BeanUtil;
import org.jboss.tools.jsf.JSFModelPlugin;
public class JSFProjectBean extends RegularObjectImpl {
@@ -129,13 +130,10 @@
if(!Flags.isPublic(ms[i].getFlags()) && !_type.isInterface()) continue;
String n = ms[i].getElementName();
boolean isProperty = false;
- if((isGetter(ms[i], "get") || isSetter(ms[i])) && n.length() > 3) {
- n = n.substring(3, 4).toLowerCase() + n.substring(4);
- isProperty = true;
- } else if(isGetter(ms[i], "is")) {
- String typeName = EclipseJavaUtil.getMemberTypeAsString(ms[i]);
- if("boolean".equals(typeName) || "java.lang.Boolean".equals(typeName)) {
- n = n.substring(2, 3).toLowerCase() + n.substring(3);
+ if(BeanUtil.isGetter(ms[i]) || BeanUtil.isSetter(ms[i])) {
+ String propertyName = BeanUtil.getPropertyName(n);
+ if(propertyName != null && checkPropertyReturnType(ms[i])) {
+ n = propertyName;
isProperty = true;
}
}
@@ -274,18 +272,20 @@
return true;
}
- private boolean isSetter(IMethod method) {
- if(method == null) return false;
- String name = method.getElementName();
- if(!name.startsWith("set") || name.length() <= 3) return false;
- try {
- String[] ps = method.getParameterNames();
- if(ps == null || ps.length != 1) return false;
- } catch (JavaModelException e) {
+ //TODO move this to BeanUtil.isGetter and isSetter
+ private boolean checkPropertyReturnType(IMethod method) {
+ if(method == null) {
return false;
}
-
+ String typeName = EclipseJavaUtil.getMemberTypeAsString(method);
+ if(typeName == null || typeName.equals("void")) {
+ return false;
+ }
+ if(method.getElementName().startsWith(BeanUtil.IS)) {
+ if(!"boolean".equals(typeName) && !"java.lang.Boolean".equals(typeName)) {
+ return false;
+ }
+ }
return true;
}
-
}
14 years
JBoss Tools SVN: r27776 - in trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui: marker and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-12-28 13:05:32 -0500 (Tue, 28 Dec 2010)
New Revision: 27776
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanComposite.java
Log:
https://issues.jboss.org/browse/JBIDE-7635
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-28 17:55:19 UTC (rev 27775)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-28 18:05:32 UTC (rev 27776)
@@ -85,6 +85,7 @@
public static String DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE;
public static String DELETE_ALL_INJECTED_CONSTRUCTORS_MARKER_RESOLUTION_TITLE;
public static String MAKE_INJECTED_POINT_UNAMBIGUOUS_TITLE;
+ public static String COLLECTING_MARKER_RESOLUTIONS;
public static String ADD_QUALIFIERS_TO_BEAN_WIZARD_TITLE;
public static String ADD_QUALIFIERS_TO_BEAN_WIZARD_AVAILABLE;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-28 17:55:19 UTC (rev 27775)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-28 18:05:32 UTC (rev 27776)
@@ -69,6 +69,7 @@
DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE=Delete @Disposes annotations from all methods except ''{0}'' method
DELETE_ALL_INJECTED_CONSTRUCTORS_MARKER_RESOLUTION_TITLE=Delete @Inject annotations from all constructors except ''{0}'' constructor
MAKE_INJECTED_POINT_UNAMBIGUOUS_TITLE=Make injected point unambiguous by specifying ''{0}'' bean
+COLLECTING_MARKER_RESOLUTIONS=Collecting CDI Marker Resolutions...
ADD_QUALIFIERS_TO_BEAN_WIZARD_TITLE=Add Qualifiers to the Bean
ADD_QUALIFIERS_TO_BEAN_WIZARD_AVAILABLE=Available:
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2010-12-28 17:55:19 UTC (rev 27775)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2010-12-28 18:05:32 UTC (rev 27776)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -17,6 +18,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -25,8 +27,11 @@
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator2;
+import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDIUtil;
@@ -34,6 +39,7 @@
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationErrorManager;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
@@ -45,6 +51,7 @@
public class CDIProblemMarkerResolutionGenerator implements
IMarkerResolutionGenerator2 {
private static final String JAVA_EXTENSION = "java"; //$NON-NLS-1$
+ IMarkerResolution[] resolutions;
public IMarkerResolution[] getResolutions(IMarker marker) {
try {
@@ -64,12 +71,12 @@
int messageId = attribute.intValue();
- IFile file = (IFile) marker.getResource();
+ final IFile file = (IFile) marker.getResource();
attribute = ((Integer) marker.getAttribute(IMarker.CHAR_START));
if (attribute == null)
return new IMarkerResolution[] {};
- int start = attribute.intValue();
+ final int start = attribute.intValue();
if (JAVA_EXTENSION.equals(file.getFileExtension())) {
if (messageId == CDIValidationErrorManager.ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN_ID) {
@@ -112,22 +119,76 @@
new DeleteAllInjectedConstructorsMarkerResolution(method, file)
};
}
- }else if(messageId == CDIValidationErrorManager.UNSATISFIED_INJECTION_POINTS_ID ||
- messageId == CDIValidationErrorManager.AMBIGUOUS_INJECTION_POINTS_ID){
+ }else if(messageId == CDIValidationErrorManager.AMBIGUOUS_INJECTION_POINTS_ID){
IInjectionPoint injectionPoint = findInjectionPoint(file, start);
if(injectionPoint != null){
List<IBean> beans = findBeans(injectionPoint);
IMarkerResolution[] resolutions = new IMarkerResolution[beans.size()];
for(int i = 0; i < beans.size(); i++){
- resolutions[i] = new MakeInjectedPointUnambiguousMarkerResolution(injectionPoint, beans, file, i);
+ resolutions[i] = new MakeInjectedPointUnambiguousMarkerResolution(injectionPoint, beans, i);
}
return resolutions;
}
+ }else if(messageId == CDIValidationErrorManager.UNSATISFIED_INJECTION_POINTS_ID){
+
+ if (Display.getCurrent() != null) {
+ try{
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress(){
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(CDIUIMessages.COLLECTING_MARKER_RESOLUTIONS, 10);
+ monitor.worked(3);
+ resolutions = collectMarkerResolutions(file, start);
+ monitor.worked(7);
+ }
+ });
+ }catch(InterruptedException ie){
+ CDIUIPlugin.getDefault().logError(ie);
+ }catch(InvocationTargetException ite){
+ CDIUIPlugin.getDefault().logError(ite);
+ }
+ } else {
+ resolutions = collectMarkerResolutions(file, start);
+ }
+ return resolutions;
}
}
return new IMarkerResolution[] {};
}
+ private IMarkerResolution[] collectMarkerResolutions(IFile file, int start){
+ IJavaElement element = findJavaElement(file, start);
+ if(element != null){
+ CDICoreNature cdiNature = CDIUtil.getCDINatureWithProgress(file.getProject());
+ if(cdiNature != null){
+ ICDIProject cdiProject = cdiNature.getDelegate();
+ if(cdiProject != null){
+ Set<IBean> allBeans = cdiProject.getBeans(file.getFullPath());
+
+ IInjectionPoint injectionPoint = CDIUtil.findInjectionPoint(allBeans, element, start);
+
+ IBean[] bs = cdiProject.getBeans();
+ ArrayList<IBean> beans = new ArrayList<IBean>();
+ try{
+ for(IBean b : bs){
+ if(Flags.isPublic(b.getBeanClass().getFlags()))
+ beans.add(b);
+ }
+
+ IMarkerResolution[] resolutions = new IMarkerResolution[beans.size()];
+ for(int i = 0; i < beans.size(); i++){
+ resolutions[i] = new MakeInjectedPointUnambiguousMarkerResolution(injectionPoint, beans, i);
+ }
+ return resolutions;
+ }catch(CoreException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ }
+ }
+ }
+ return new IMarkerResolution[]{};
+ }
+
private IInjectionPoint findInjectionPoint(IFile file, int start){
IJavaElement element = findJavaElement(file, start);
if(element == null)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java 2010-12-28 17:55:19 UTC (rev 27775)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java 2010-12-28 18:05:32 UTC (rev 27776)
@@ -33,6 +33,7 @@
import org.eclipse.ui.internal.Workbench;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IInjectionPointMethod;
@@ -49,13 +50,11 @@
*/
public class MakeInjectedPointUnambiguousMarkerResolution implements IMarkerResolution2 {
private String label;
- private IFile file;
private IInjectionPoint injectionPoint;
private List<IBean> beans;
private IBean selectedBean;
- public MakeInjectedPointUnambiguousMarkerResolution(IInjectionPoint injectionPoint, List<IBean> beans, IFile file, int index){
- this.file = file;
+ public MakeInjectedPointUnambiguousMarkerResolution(IInjectionPoint injectionPoint, List<IBean> beans, int index){
this.injectionPoint = injectionPoint;
this.beans = beans;
this.selectedBean = beans.get(index);
@@ -78,11 +77,20 @@
List<IQualifier> deployed = wizard.getDeployedQualifiers();
addQualifiersToBean(deployed);
try {
- Thread.sleep(3000);
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
} catch (InterruptedException e) {
// do nothing
}
+ // reload selectedBean
+ ICDIProject cdiProject = selectedBean.getCDIProject();
+ IBean[] beans = cdiProject.getBeans();
+ for(IBean bean : beans){
+ if(bean.getBeanClass().getFullyQualifiedName().equals(selectedBean.getBeanClass().getFullyQualifiedName())){
+ selectedBean = bean;
+ break;
+ }
+ }
+
}
addQualifiersToInjectedPoint();
}
@@ -96,7 +104,11 @@
IType type = compilationUnit.findPrimaryType();
if(type != null){
for(IQualifier qualifier : deployed){
- MarkerResolutionUtils.addAnnotation(qualifier.getSourceType().getFullyQualifiedName(), compilationUnit, type);
+ String qualifierName = qualifier.getSourceType().getFullyQualifiedName();
+ if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
+ MarkerResolutionUtils.addAnnotation(qualifier.getSourceType().getFullyQualifiedName(), compilationUnit, type);
+ }
+
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2010-12-28 17:55:19 UTC (rev 27775)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2010-12-28 18:05:32 UTC (rev 27776)
@@ -20,9 +20,7 @@
import org.eclipse.jdt.core.IImportDeclaration;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageDeclaration;
-import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
@@ -82,7 +80,11 @@
}
- public static void addAnnotation(String qualifiedName, ICompilationUnit compilationUnit, ISourceReference element) throws JavaModelException{
+ public static void addAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IType element) throws JavaModelException{
+ IAnnotation annotation = getAnnotation(element, qualifiedName);
+ if(annotation != null && annotation.exists())
+ return;
+
addImport(qualifiedName, compilationUnit);
String lineDelim = compilationUnit.findRecommendedLineSeparator();
@@ -98,6 +100,10 @@
}
public static void addQualifier(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element) throws JavaModelException{
+ IAnnotation annotation = getAnnotation(element, qualifiedName);
+ if(annotation != null && annotation.exists())
+ return;
+
addImport(qualifiedName, compilationUnit);
String lineDelim = SPACE;
@@ -105,7 +111,7 @@
IBuffer buffer = compilationUnit.getBuffer();
String shortName = getShortName(qualifiedName);
- IAnnotation annotation = getAnnotation(element, CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ annotation = getAnnotation(element, CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
buffer.replace(annotation.getSourceRange().getOffset()+annotation.getSourceRange().getLength(), 0, lineDelim+AT+shortName);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanComposite.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanComposite.java 2010-12-28 17:55:19 UTC (rev 27775)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanComposite.java 2010-12-28 18:05:32 UTC (rev 27776)
@@ -518,7 +518,11 @@
}
public ArrayList<IQualifier> getDeployedQualifiers(){
- return deployed;
+ total.clear();
+ total.addAll(originalQualifiers);
+ total.addAll(deployed);
+
+ return total;
}
class QualifiersListLabelProvider implements ILabelProvider{
14 years
JBoss Tools SVN: r27775 - trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/util/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-28 12:55:19 -0500 (Tue, 28 Dec 2010)
New Revision: 27775
Modified:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/util/test/BeanUtilTest.java
Log:
JBIDE-8011
https://issues.jboss.org/browse/JBIDE-8011
Modified: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/util/test/BeanUtilTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/util/test/BeanUtilTest.java 2010-12-28 17:53:54 UTC (rev 27774)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/util/test/BeanUtilTest.java 2010-12-28 17:55:19 UTC (rev 27775)
@@ -41,7 +41,7 @@
assertEquals("x", BeanUtil.getPropertyName("getX"));
assertEquals("x", BeanUtil.getPropertyName("setX"));
assertEquals("x", BeanUtil.getPropertyName("isX"));
- assertEquals("X0", BeanUtil.getPropertyName("isX0"));
+ assertEquals("x0", BeanUtil.getPropertyName("isX0"));
assertEquals("xo", BeanUtil.getPropertyName("isXo"));
assertEquals("XO", BeanUtil.getPropertyName("isXO"));
}
14 years
JBoss Tools SVN: r27774 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-28 12:53:54 -0500 (Tue, 28 Dec 2010)
New Revision: 27774
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/BeanUtil.java
Log:
JBIDE-8011
https://issues.jboss.org/browse/JBIDE-8011
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/BeanUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/BeanUtil.java 2010-12-28 17:11:05 UTC (rev 27773)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/BeanUtil.java 2010-12-28 17:53:54 UTC (rev 27774)
@@ -34,11 +34,11 @@
}
public static boolean isGetter(IMethod method) {
- return isGetter(method.getElementName(), method.getNumberOfParameters());
+ return method != null && isGetter(method.getElementName(), method.getNumberOfParameters());
}
public static boolean isSetter(IMethod method) {
- return isSetter(method.getElementName(), method.getNumberOfParameters());
+ return method != null && isSetter(method.getElementName(), method.getNumberOfParameters());
}
public static String getPropertyName(String methodName) {
@@ -49,7 +49,7 @@
} else {
name.delete(0, 3);
}
- if(name.length() < 2 || Character.isLowerCase(name.charAt(1))) {
+ if(name.length() < 2 || !Character.isUpperCase(name.charAt(1))) {
name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
}
return name.toString();
14 years
JBoss Tools SVN: r27773 - trunk/jsf/plugins/org.jboss.tools.jsf/META-INF.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-28 12:11:05 -0500 (Tue, 28 Dec 2010)
New Revision: 27773
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
Log:
JBIDE-8011
https://issues.jboss.org/browse/JBIDE-8011
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-12-28 17:06:16 UTC (rev 27772)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-12-28 17:11:05 UTC (rev 27773)
@@ -43,6 +43,7 @@
org.jboss.tools.jsf.web.validation.jsf2.util
Require-Bundle: org.jboss.tools.jst.web;visibility:=reexport,
org.jboss.tools.jst.web.kb;visibility:=reexport,
+ org.jboss.tools.common,
org.jboss.tools.common.el.core,
org.eclipse.jface.text,
org.eclipse.jdt.ui,
14 years
JBoss Tools SVN: r27772 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-28 12:06:16 -0500 (Tue, 28 Dec 2010)
New Revision: 27772
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldParticipant.java
Log:
JBIDE-8011
https://issues.jboss.org/browse/JBIDE-8011
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldParticipant.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldParticipant.java 2010-12-28 17:04:36 UTC (rev 27771)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameFieldParticipant.java 2010-12-28 17:06:16 UTC (rev 27772)
@@ -20,6 +20,7 @@
import org.jboss.tools.jsf.messages.JSFUIMessages;
import org.jboss.tools.common.model.refactoring.RenameModelObjectChange;
import org.jboss.tools.common.model.refactoring.RenameProcessorRunner;
+import org.jboss.tools.common.util.BeanUtil;
public class JSFRenameFieldParticipant extends RenameParticipant implements ISharableParticipant {
public static final String PARTICIPANT_NAME="jsf-RenameFieldParticipant"; //$NON-NLS-1$
@@ -80,10 +81,9 @@
XModel model = JSFRenameFieldChange.getModel(method);
if(model == null) return null;
XModelObject[] os = JSFRenameFieldHelper.getBeanList(model, method);
- String name = method.getElementName();
- if(!name.startsWith("get") && !name.startsWith("set")) return null;
- name = name.substring(3, 4).toLowerCase() + name.substring(4);
- os = getProperties(os, name);
+ String propertyName = BeanUtil.getPropertyName(method.getElementName());
+ if(propertyName == null) return null;
+ os = getProperties(os, propertyName);
RenameModelObjectChange c1 = RenameModelObjectChange.createChange(os, newName, "property-name"); //$NON-NLS-1$
return c1;
} else if(object != null) {
14 years
JBoss Tools SVN: r27771 - in trunk/gwt/plugins: org.jboss.tools.gwt.ui and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-28 12:04:36 -0500 (Tue, 28 Dec 2010)
New Revision: 27771
Added:
trunk/gwt/plugins/org.jboss.tools.gwt.ui/GWT Integration Facet.launch
Modified:
trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF
Log:
[JBIDE-7956] corrected google sdk plugin dependency to latest version (what a bad idea they had to put the version into the plugin name. I cannot use version ranges - osgi-style)
Modified: trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF 2010-12-28 16:49:12 UTC (rev 27770)
+++ trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF 2010-12-28 17:04:36 UTC (rev 27771)
@@ -8,7 +8,7 @@
Require-Bundle:
org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)",
com.google.gwt.eclipse.core;bundle-version="[1.3.3,2.0.0)",
- com.google.gwt.eclipse.sdkbundle.2.1.0;bundle-version="[2.1.0,3.0.0)",
+ com.google.gwt.eclipse.sdkbundle.2.1.1;bundle-version="2.1.1",
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
Added: trunk/gwt/plugins/org.jboss.tools.gwt.ui/GWT Integration Facet.launch
===================================================================
--- trunk/gwt/plugins/org.jboss.tools.gwt.ui/GWT Integration Facet.launch (rev 0)
+++ trunk/gwt/plugins/org.jboss.tools.gwt.ui/GWT Integration Facet.launch 2010-12-28 17:04:36 UTC (rev 27771)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="true"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="false"/>
+<booleanAttribute key="clearws" value="false"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/GWT Integration Facet"/>
+<booleanAttribute key="default" value="true"/>
+<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.rse.subsystems.shells.ssh,org.jboss.tools.ui.bot.ext,org.jboss.ide.eclipse.as.core,org.jboss.tools.common.projecttemplates,org.jboss.ide.eclipse.as.rse.core,org.jboss.tools.tests.performance,org.jboss.ide.eclipse.as.ui.mbeans,org.jboss.tools.common.el.core,org.jboss.tools.common.gef,org.jboss.ide.eclipse.as.archives.integration.test,org.jboss.tools.common.verification.test,org.jboss.ide.eclipse.archives.core,org.jboss.tools.common.verification,org.jboss.tools.jmx.core.test,org.jboss.ide.eclipse.archives.jdt.integration,org.jboss.ide.eclipse.as.classpath.core,org.eclipse.ui.net,org.jboss.ide.eclipse.archives.test,org.jboss.ide.eclipse.as.classpath.ui,org.jboss.tools.deltacloud.core,org.jboss.tools.deltacloud.integration,org.jboss.tools.common.ui,org.jboss.tools.usage.test,org.jboss.tools.common.text.ext,org.jboss.tools.jmx.ui,org.jboss.tools.ui.bot.ext.test,org.jboss.tools.common.el.core.test,org.jboss.to!
ols.common.model.ui.test,org.jboss.tools.tests,org.jboss.tools.common.text.xml,org.jboss.ide.eclipse.as.ui.test,org.jboss.tools.common.meta.ui,org.jboss.ide.eclipse.archives.webtools,org.jboss.tools.deltacloud.docs,org.jboss.tools.common.verification.ui.test,org.jboss.ide.eclipse.as.rse.ui,org.eclipse.jsch.core,com.jboss.jbds.usage.branding,org.jboss.tools.common.verification.ui,org.jboss.tools.common.test,org.jboss.tools.deltacloud.ui,org.eclipse.rse.connectorservice.ssh,org.jboss.tools.common.model.ui.capabilities,org.jboss.tools.common.resref.core,org.eclipse.jsch.ui,org.eclipse.rse.subsystems.files.ssh,org.jboss.ide.eclipse.archives.ui,org.jboss.ide.eclipse.as.test,org.jboss.tools.common.el.ui,org.jboss.tools.deltacloud.test,org.jboss.tools.jmx.ui.test,org.jboss.ide.eclipse.as.ssh,org.eclipse.rse.services.ssh,org.jboss.tools.common.resref.ui,org.jboss.ide.eclipse.as.ui,org.jboss.ide.eclipse.as.doc.user,org.jboss.ide.eclipse.archives.ui.test,org.jboss.tools.jmx.core,org.!
jboss.tools.common.model.ui,org.jboss.tools.common.model.test"!
/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../runtime-gwtfacet"/>
+<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.pde.ui.launcher.PDESourceLookupDirector"/>
+<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="true"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;default/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx1024m"/>
+<booleanAttribute key="pde.generated.config" value="false"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.ltk.ui.refactoring@default:default,com.ibm.icu@default:default,org.eclipse.ant.launching@default:default,org.eclipse.help.ui@default:default,org.junit4@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.osgi.services@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.jst.common.project.facet.core@default:default,org.eclipse.wst.jsdt.manipulation@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.ant.ui@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.pde.build@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.ssl@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.emf.edit.ui@default:default,org.eclip!
se.jst.j2ee.jca.ui@default:default,org.eclipse.jst.jsf.ui@default:default,org.eclipse.jst.common.project.facet.ui@default:default,org.eclipse.jst.jsf.common.ui@default:default,org.eclipse.wst.server.core@default:default,org.eclipse.wst.server.ui@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.ui@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.wst.jsdt.ui@default:default,org.eclipse.ant.core@default:default,org.eclipse.sdk@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.ui.editors@default:default,org.eclipse.jem@default:default,org.eclipse.jem.util@default:default,org.eclipse.jface@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.compare.core@default:default,org.eclipse.jst.server.core@default:default,org.eclipse.wst.common.modulecore.ui@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.jdt.launching@default:d!
efault,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,o!
rg.eclip
se.osgi@-1:true,org.eclipse.jst.jsp.ui@default:default,org.apache.xml.serializer@default:default,org.eclipse.wst.command.env.ui@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.jst.jee@default:default,org.eclipse.ui.intro@default:default,org.eclipse.jst.j2ee.ejb@default:default,org.eclipse.swt@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.jdt.core@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.security.ui@default:default,org.eclipse.jst.j2ee.core@default:default,org.sat4j.pb@default:default,org.eclipse.jst.j2ee.jca@default:default,org.eclipse.wst.common.snippets@default:default,org.eclipse.update.core@default:default,org.eclipse.wst.sse.core@default:default,javax.servlet@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.emf.codegen@default:default,org.eclipse.core.command!
s@default:default,org.eclipse.jem.workbench@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,com.google.gdt.eclipse.platform.e36@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.mortbay.jetty.util@default:default,org.eclipse.emf@default:default,org.eclipse.jst.common.annotations.controller@default:default,com.google.gwt.eclipse.core@default:default,org.eclipse.emf.common.ui@default:default,org.apache.commons.el@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.wst.server.discovery@default:default,org.eclipse.wst.common.ui@default:default,org.eclipse.wst.css.ui@default:default,org.eclipse.help.base@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.wst.css.core@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,javax.xml@default:default,org.eclipse.ui.forms@default:default,org.eclipse.core.databin!
ding@default:default,org.eclipse.wst.validation@default:defaul!
t,org.ap
ache.jasper@default:default,org.apache.lucene@default:default,com.google.appengine.eclipse.core@default:default,org.eclipse.team.core@default:default,com.google.gdt.eclipse.platform@default:default,org.eclipse.pde.core@default:default,org.eclipse.ui.cheatsheets@default:default,com.google.gwt.eclipse.oophm@default:default,org.eclipse.ui.console@default:default,org.apache.lucene.analysis@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.jst.j2ee.web@default:default,org.eclipse.platform@default:default,org.eclipse.core.variables@default:default,org.eclipse.swtbot.ant.optional.junit3@default:false,org.eclipse.jdt.debug@default:default,org.hamcrest.core@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.emf.edit@default:default,org.eclipse.wst.sse.ui@default:default,org.eclipse.equinox.app@default:default,org.eclipse.debug.ui@default:default,org.eclipse.jst.jsf.facesconfig@default:default,org.!
eclipse.wtp.epp.package.capabilities@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.wst.common.emf@default:default,com.google.gwt.eclipse.sdkbundle.2.1.1@default:default,org.eclipse.search@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.wst.web@default:default,org.eclipse.text@default:default,org.eclipse.core.runtime@default:true,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.jem.beaninfo.vm@default:default,org.eclipse.wst.html.ui@default:default,org.eclipse.wst.common.modulecore@default:default,org.eclipse.ui.ide@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.jface.text@default:default,org.eclipse.debug.core@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.wst.web.ui@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.jst.j!
sf.core@default:default,org.eclipse.equinox.simpleconfigurator!
@1:true,
org.eclipse.jem.beaninfo@default:default,org.eclipse.emf.common@default:default,org.eclipse.update.configurator@3:true,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.jst.j2ee@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.wst.common.project.facet.ui@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.jem.beaninfo.vm.common@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.jst.jee.ui@default:default,org.eclipse.jst.jsf.common@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.jst.j2ee.ejb.annotation.model@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.ecf.provider.filetransfer@default:default,com.google.gdt.eclipse.platform.shared@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:d!
efault,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.wst.command.env.core@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.wst.common.frameworks@default:default,org.eclipse.wst.common.uriresolver@default:default,com.google.gdt.eclipse.suite@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.wtp.jee.capabilities@default:default,org.eclipse.jdt@default:default,org.apache.xerces@default:default,org.sat4j.core@default:default,org.eclipse.wst.xml.ui@default:default,org.eclipse.jem.proxy@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.equinox.security@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.wst.html.core@default:default,org.eclipse.gef@default:default,org.eclipse.jst.common.frameworks@default:default,org.eclipse.ui.browser@default:default,org.eclipse.jst.server.ui@default:default,org.eclipse.core.jobs@default:default,org.eclip!
se.swtbot.ant.optional.junit4@default:false,org.eclipse.equino!
x.p2.cor
e@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.jst.common.annotations.core@default:default,org.eclipse.draw2d@default:default,org.eclipse.team.ui@default:default,org.eclipse.jst.j2ee.ui@default:default,org.eclipse.jst.jsf.common.runtime@default:default,com.google.gdt.eclipse.core@default:default,org.eclipse.wst.command.env@default:default,org.eclipse.jst.jsf.facelet.core@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.emf.ecore.edit@default:default,org.apache.xml.resolver@default:default,org.eclipse.jst.jsf.facelet.ui@default:default,org.eclipse.jdt.compiler.apt@default:false,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.jst.common.ui@default:default,org.eclipse.core.net@default:default,org.eclipse.ui.workbench@default:de!
fault,org.eclipse.wst.internet.monitor.core@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.jst.jee.web@default:default,org.eclipse.compare@default:default,org.eclipse.equinox.p2.director@default:default,org.apache.ant@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.core.resources@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.ui.views@default:default,org.eclipse.wst.jsdt.core@default:default,org.eclipse.osgi.util@default:default,org.eclipse.help@default:default,org.eclipse.core.filebuffers@default:default,javax.servlet.jsp@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.jst.j2ee.navigator.ui@default:default,org.eclipse.wst.common.frameworks.ui@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.ecf@default:default,org.eclipse.core.expressions@default:default,org!
.eclipse.jst.jsp.core@default:default,org.mortbay.jetty.server!
@default
:default,org.eclipse.wtp.web.capabilities@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.gwt.ui@default:default,org.jboss.tools.common@default:default,org.jboss.tools.common.model@default:default,org.eclipse.jst.j2ee.core@default:default,org.jboss.tools.gwt.core@default:default,org.jboss.tools.usage@default:default,org.jboss.ide.eclipse.as.wtp.ui@default:default,org.jboss.ide.eclipse.as.wtp.core@default:default"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<booleanAttribute key="useProduct" value="true"/>
+<booleanAttribute key="usefeatures" value="false"/>
+</launchConfiguration>
Property changes on: trunk/gwt/plugins/org.jboss.tools.gwt.ui/GWT Integration Facet.launch
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27770 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-28 11:49:12 -0500 (Tue, 28 Dec 2010)
New Revision: 27770
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
Log:
JBIDE-8011
https://issues.jboss.org/browse/JBIDE-8011
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2010-12-28 16:46:41 UTC (rev 27769)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2010-12-28 16:49:12 UTC (rev 27770)
@@ -48,6 +48,7 @@
import org.jboss.tools.common.el.core.resolver.SimpleELContext;
import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.BeanUtil;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jst.web.kb.PageContextFactory;
@@ -385,36 +386,12 @@
match(file, offset, length);
}
- // TODO: move to util class
- public static boolean isGetter(IMethod method) {
- String name = method.getElementName();
- int numberOfParameters = method.getNumberOfParameters();
-
- return (((name.startsWith(GET) && !name.equals(GET)) || name.startsWith(IS)) && numberOfParameters == 0);
- }
-
- // TODO: move to util class
- public static boolean isSetter(IMethod method) {
- String name = method.getElementName();
- int numberOfParameters = method.getNumberOfParameters();
-
- return ((name.startsWith(SET) && !name.equals(SET)) && numberOfParameters == 1);
- }
-
- // TODO: move to util class
public static String getPropertyName(IMethod method, String methodName){
- if (isGetter(method) || isSetter(method)) {
- StringBuffer name = new StringBuffer(methodName);
- if(methodName.startsWith("i")) { //$NON-NLS-1$
- name.delete(0, 2);
- } else {
- name.delete(0, 3);
+ if (BeanUtil.isGetter(method) || BeanUtil.isSetter(method)) {
+ String propertyName = BeanUtil.getPropertyName(methodName);
+ if(propertyName != null) {
+ return propertyName;
}
- if(name.length()<2 || Character.isLowerCase(name.charAt(1))) {
- name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
- }
- String propertyName = name.toString();
- return propertyName;
}
return methodName;
}
14 years