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">