JBoss Tools SVN: r34155 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-08-22 20:01:11 -0400 (Mon, 22 Aug 2011)
New Revision: 34155
Modified:
trunk/build/pom.xml
Log:
fix for smooks-bootstrap profile which should include common
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2011-08-22 23:05:30 UTC (rev 34154)
+++ trunk/build/pom.xml 2011-08-23 00:01:11 UTC (rev 34155)
@@ -337,6 +337,7 @@
<id>smooks-bootstrap</id>
<modules>
<module>../tests</module>
+ <module>../common</module>
<module>../smooks</module>
</modules>
</profile>
14 years, 7 months
JBoss Tools SVN: r34154 - in trunk/common/tests: org.jboss.tools.common.validation.test and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-08-22 19:05:30 -0400 (Mon, 22 Aug 2011)
New Revision: 34154
Added:
trunk/common/tests/org.jboss.tools.common.validation.test/
trunk/common/tests/org.jboss.tools.common.validation.test/.classpath
trunk/common/tests/org.jboss.tools.common.validation.test/.project
trunk/common/tests/org.jboss.tools.common.validation.test/META-INF/
trunk/common/tests/org.jboss.tools.common.validation.test/META-INF/MANIFEST.MF
trunk/common/tests/org.jboss.tools.common.validation.test/build.properties
trunk/common/tests/org.jboss.tools.common.validation.test/plugin.xml
trunk/common/tests/org.jboss.tools.common.validation.test/pom.xml
trunk/common/tests/org.jboss.tools.common.validation.test/projects/
trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/
trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/.classpath
trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/.project
trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/bin/
trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/src/
trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/src/test/
trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/src/test/Test.java
trunk/common/tests/org.jboss.tools.common.validation.test/src/
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/CommonValidationAllTests.java
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java
trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/ValidationTest.java
Modified:
trunk/common/tests/pom.xml
Log:
JBIDE-6153
Added: trunk/common/tests/org.jboss.tools.common.validation.test/.classpath
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/.classpath (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/.classpath 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/tests/org.jboss.tools.common.validation.test/.project
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/.project (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/.project 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.common.validation.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/tests/org.jboss.tools.common.validation.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/META-INF/MANIFEST.MF 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Common Validation Test
+Bundle-SymbolicName: org.jboss.tools.common.validation.test;singleton:=true
+Bundle-Version: 3.3.0.qualifier
+Bundle-Vendor: JBoss by Red Hat
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.jboss.tools.tests,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.junit,
+ org.jboss.tools.common.validation,
+ org.eclipse.jdt.core,
+ org.eclipse.wst.validation,
+ org.jboss.tools.common,
+ org.jboss.tools.common.base.test,
+ org.eclipse.ui
+Export-Package: org.jboss.tools.common.validation.test
Added: trunk/common/tests/org.jboss.tools.common.validation.test/build.properties
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/build.properties (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/build.properties 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ build.properties,\
+ projects/
Added: trunk/common/tests/org.jboss.tools.common.validation.test/plugin.xml
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/plugin.xml (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/plugin.xml 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ id="TestValidator"
+ point="org.jboss.tools.common.validation.validator">
+ <validator
+ class="org.jboss.tools.common.validation.test.TestValidator"
+ name="TestValidator"
+ id="org.jboss.common.validation.test.TestValidator">
+ </validator>
+ </extension>
+</plugin>
Added: trunk/common/tests/org.jboss.tools.common.validation.test/pom.xml
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/pom.xml (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/pom.xml 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.common</groupId>
+ <artifactId>tests</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.common.tests</groupId>
+ <artifactId>org.jboss.tools.common.validation.test</artifactId>
+
+ <packaging>eclipse-test-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <configuration>
+ <product>org.jboss.tools.tests.product</product>
+ <explodedBundles>
+ <bundle>org.jboss.tools.common.validation.test</bundle>
+ </explodedBundles>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/.classpath
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/.classpath (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/.classpath 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/.project
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/.project (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/.project 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>JavaProject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/src/test/Test.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/src/test/Test.java (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/projects/JavaProject/src/test/Test.java 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,5 @@
+package test;
+
+public class Test {
+
+}
\ No newline at end of file
Added: trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/CommonValidationAllTests.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/CommonValidationAllTests.java (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/CommonValidationAllTests.java 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.common.validation.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jdt.internal.core.JavaModelManager;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.jboss.tools.common.base.test.validation.ValidationExceptionTest;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CommonValidationAllTests {
+
+ public static Test suite() {
+ // it could be done here because it is not needed to be enabled back
+ JavaModelManager.getIndexManager().disable();
+ ValidationFramework.getDefault().suspendAllValidation(true);
+
+ ValidationExceptionTest.initLogger();
+
+ TestSuite suiteAll = new TestSuite("Common Validation Tests");
+
+ TestSuite suite = new TestSuite(ValidationTest.class.getName());
+ suite.addTestSuite(ValidationTest.class);
+
+ ProjectImportTestSetup testSetup = new ProjectImportTestSetup(suite,
+ "org.jboss.tools.common.validation.test",
+ new String[]{"projects/JavaProject"},
+ new String[]{"JavaProject"});
+ suiteAll.addTest(testSetup);
+
+ return suiteAll;
+ }
+}
\ No newline at end of file
Added: trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/TestValidator.java 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.validation.test;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.IProjectValidationContext;
+import org.jboss.tools.common.validation.IValidatingProjectTree;
+import org.jboss.tools.common.validation.IValidator;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.common.validation.ValidatorManager;
+import org.jboss.tools.common.validation.internal.SimpleValidatingProjectTree;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class TestValidator extends ValidationErrorManager implements IValidator {
+
+ @Override
+ public IStatus validate(Set<IFile> changedFiles, IProject project,
+ ContextValidationHelper validationHelper,
+ IProjectValidationContext validationContext,
+ ValidatorManager manager, IReporter reporter)
+ throws ValidationException {
+ init(project, validationHelper, validationContext, manager, reporter);
+
+ validate();
+
+ return OK_STATUS;
+ }
+
+ @Override
+ public IStatus validateAll(IProject project,
+ ContextValidationHelper validationHelper,
+ IProjectValidationContext validationContext,
+ ValidatorManager manager, IReporter reporter)
+ throws ValidationException {
+ init(project, validationHelper, validationContext, manager, reporter);
+
+ validate();
+
+ return OK_STATUS;
+ }
+
+ private void validate() {
+ throw new RuntimeException("Test excpetion");
+ }
+
+ @Override
+ public String getId() {
+ return "org.jboss.common.validation.test.TestValidator";
+ }
+
+ @Override
+ public String getBuilderId() {
+ return null;
+ }
+
+ @Override
+ public IValidatingProjectTree getValidatingProjects(IProject project) {
+ return new SimpleValidatingProjectTree(project);
+ }
+
+ @Override
+ public boolean shouldValidate(IProject project) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled(IProject project) {
+ return true;
+ }
+
+ @Override
+ protected String getPreference(IProject project, String preferenceKey) {
+ return SeverityPreferences.WARNING;
+ }
+
+ @Override
+ public int getMaxNumberOfMarkersPerFile(IProject project) {
+ return 20;
+ }
+
+ @Override
+ public String getMarkerType() {
+ return ValidationErrorManager.DEFAULT_VALIDATION_MARKER;
+ }
+}
\ No newline at end of file
Added: trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/ValidationTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/ValidationTest.java (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.validation.test/src/org/jboss/tools/common/validation/test/ValidationTest.java 2011-08-22 23:05:30 UTC (rev 34154)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.validation.test;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.jboss.tools.common.base.test.validation.TestUtil;
+import org.jboss.tools.common.base.test.validation.ValidationExceptionTest;
+import org.jboss.tools.common.validation.CommonValidationPlugin;
+import org.jboss.tools.common.validation.JBTValidationException;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidationTest extends ValidationExceptionTest {
+
+ @Override
+ public void testExceptions() throws Exception {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("JavaProject");
+ TestUtil._waitForValidation(project);
+ Set<IStatus> exceptions = LOGGER.getExceptions();
+ assertFalse(exceptions.isEmpty());
+ }
+
+ @Override
+ public void testLogger() {
+ initLogger();
+ CommonValidationPlugin.getDefault().logError(new JBTValidationException("Test logger", null));
+ Set<IStatus> exceptions = LOGGER.getExceptions();
+ assertEquals(1, exceptions.size());
+ }
+}
\ No newline at end of file
Modified: trunk/common/tests/pom.xml
===================================================================
--- trunk/common/tests/pom.xml 2011-08-22 22:58:39 UTC (rev 34153)
+++ trunk/common/tests/pom.xml 2011-08-22 23:05:30 UTC (rev 34154)
@@ -15,6 +15,7 @@
<module>org.jboss.tools.common.model.test</module>
<module>org.jboss.tools.common.model.ui.test</module>
<module>org.jboss.tools.common.test</module>
+ <module>org.jboss.tools.common.validation.test</module>
<module>org.jboss.tools.common.verification.test</module>
<module>org.jboss.tools.common.verification.ui.test</module>
</modules>
14 years, 7 months
JBoss Tools SVN: r34153 - in trunk/common/plugins/org.jboss.tools.common.validation: META-INF and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-08-22 18:58:39 -0400 (Mon, 22 Aug 2011)
New Revision: 34153
Added:
trunk/common/plugins/org.jboss.tools.common.validation/.classpath
trunk/common/plugins/org.jboss.tools.common.validation/.project
trunk/common/plugins/org.jboss.tools.common.validation/META-INF/
trunk/common/plugins/org.jboss.tools.common.validation/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.validation/about.html
trunk/common/plugins/org.jboss.tools.common.validation/build.properties
trunk/common/plugins/org.jboss.tools.common.validation/plugin.properties
trunk/common/plugins/org.jboss.tools.common.validation/plugin.xml
trunk/common/plugins/org.jboss.tools.common.validation/pom.xml
trunk/common/plugins/org.jboss.tools.common.validation/schema/
trunk/common/plugins/org.jboss.tools.common.validation/schema/validator.exsd
trunk/common/plugins/org.jboss.tools.common.validation/src/
trunk/common/plugins/org.jboss.tools.common.validation/src/org/
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/CommonValidationPlugin.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ContextValidationHelper.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IELValidationDelegate.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IProjectValidationContext.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidatingProjectSet.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidatingProjectTree.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationContextManager.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationContextProvider.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationErrorManager.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidator.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/JBTValidationException.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ProblemMessage.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/Validation.properties
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationContext.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationELReference.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationMessages.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationResourceRegister.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationUtil.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidatorManager.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ELValidatorContext.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/LinkCollection.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ProjectValidationContext.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/SimpleValidatingProjectTree.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ValidatingProjectSet.java
Log:
Added: trunk/common/plugins/org.jboss.tools.common.validation/.classpath
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/.classpath (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/.classpath 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/common/plugins/org.jboss.tools.common.validation/.project
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/.project (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/.project 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.common.validation</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/plugins/org.jboss.tools.common.validation/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/META-INF/MANIFEST.MF (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/META-INF/MANIFEST.MF 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.tools.common.validation;singleton:=true
+Bundle-Version: 3.3.0.qualifier
+Bundle-Activator: org.jboss.tools.common.validation.CommonValidationPlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.jboss.tools.common,
+ org.eclipse.core.resources;bundle-version="3.7.100",
+ org.jboss.tools.common.el.core,
+ org.eclipse.wst.validation;bundle-version="1.2.300",
+ org.eclipse.ui.editors;bundle-version="3.7.0",
+ org.eclipse.jface.text;bundle-version="3.7.0",
+ org.eclipse.swt;bundle-version="3.7.0",
+ org.eclipse.ui.ide;bundle-version="3.7.0",
+ org.eclipse.jface;bundle-version="3.7.0",
+ org.eclipse.ui;bundle-version="3.7.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %providerName
+Export-Package: org.jboss.tools.common.validation,
+ org.jboss.tools.common.validation.internal
Added: trunk/common/plugins/org.jboss.tools.common.validation/about.html
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/about.html (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/about.html 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>©2007 Red Hat, Inc. All rights reserved</P>
+
+<H3>License</H3>
+
+<P>Red Hat Inc., through its JBoss division, makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from Red Hat Inc., the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+ <A href="http://www.jboss.org/tools">http://www.jboss.org/tools</A>.</P>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/build.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/build.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/build.properties 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ schema/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
Added: trunk/common/plugins/org.jboss.tools.common.validation/plugin.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/plugin.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/plugin.properties 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,4 @@
+providerName=JBoss by Red Hat
+# START NON-TRANSLATABLE
+Bundle-Name.0 = Common Validation Plug-in
+# END NON-TRANSLATABLE
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/plugin.xml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/plugin.xml 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension-point id="validator" name="KB Validator" schema="schema/validator.exsd"/>
+
+ <extension
+ point="org.eclipse.wst.validation.validator"
+ id="cd"
+ name="JBoss Tools Project Validator">
+ <validator>
+ <runStrategy project="true"/>
+ <projectNature id="org.eclipse.jdt.core.javanature" />
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.java"/>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.xml"/>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.xhtml"/>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jsp">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jspf">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jsf">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jsv">
+ </filter>
+ <filter
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.jtpl">
+ </filter>
+ <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.jspsource"/>
+ <contentTypeBinding contentTypeId="org.jboss.tools.jst.jsp.jspincludesource"/>
+ <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.jspfragmentsource"/>
+ <contentTypeBinding contentTypeId="org.eclipse.jst.jsp.core.tagsource"/>
+ <markerId
+ markerIdValue="JBTValidationProblem">
+ </markerId>
+ <helper
+ class="org.jboss.tools.common.validation.ContextValidationHelper">
+ </helper>
+ <run
+ class="org.jboss.tools.common.validation.ValidatorManager"
+ incremental="true"
+ fullBuild="true"
+ />
+ </validator>
+ </extension>
+
+ <extension
+ id="JBTValidationProblem"
+ name="JBoss Tools Validation Problem"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.wst.validation.problemmarker"/>
+ <attribute name="kind"/>
+ <persistent
+ value="true">
+ </persistent>
+ </extension>
+
+</plugin>
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/pom.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/pom.xml (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/pom.xml 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.common</groupId>
+ <artifactId>plugins</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.common.plugins</groupId>
+ <artifactId>org.jboss.tools.common.validation</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/schema/validator.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/schema/validator.exsd (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/schema/validator.exsd 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,123 @@
+<?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>
+ <attribute name="name" type="string">
+ <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/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/CommonValidationPlugin.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/CommonValidationPlugin.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/CommonValidationPlugin.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.validation;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.jboss.tools.common.log.IPluginLog;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CommonValidationPlugin extends BaseUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.common.validation"; //$NON-NLS-1$
+ protected static CommonValidationPlugin INSTANCE;
+
+ public CommonValidationPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ INSTANCE = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ INSTANCE = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CommonValidationPlugin getDefault() {
+ return INSTANCE;
+ }
+
+ /**
+ * @return IPluginLog object
+ */
+ public static IPluginLog getPluginLog() {
+ return getDefault();
+ }
+
+ public static boolean makeBuilderLast(IProject project, String builderId) throws CoreException {
+ IProjectDescription d = project.getDescription();
+ ICommand[] bs = d.getBuildSpec();
+ ICommand v = null;
+ boolean updated = false;
+ for (int i = 0; i < bs.length; i++) {
+ if(builderId.equals(bs[i].getBuilderName())) {
+ v = bs[i];
+ }
+ if(v != null) {
+ if(i + 1 < bs.length) {
+ bs[i] = bs[i + 1];
+ updated = true;
+ } else if(updated) {
+ bs[i] = v;
+ }
+ }
+ }
+ if(updated) {
+ d.setBuildSpec(bs);
+ project.setDescription(d, IProject.FORCE, new NullProgressMonitor());
+ }
+ return updated;
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ContextValidationHelper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ContextValidationHelper.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ContextValidationHelper.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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.common.validation;
+
+import java.text.MessageFormat;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.editors.text.TextFileDocumentProvider;
+import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
+import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
+import org.jboss.tools.common.CommonPlugin;
+
+/**
+ * Helper for Validators that use Validator Context.
+ * @author Alexey Kazakov
+ */
+public class ContextValidationHelper extends WorkbenchContext {
+
+ protected IValidationContextManager validationContextManager;
+ protected TextFileDocumentProvider documentProvider = new TextFileDocumentProvider();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#initialize()
+ */
+ @Override
+ public void initialize() {
+ super.initialize();
+ cleanup();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#deleting()
+ */
+ @Override
+ public void deleting() {
+ super.deleting();
+ cleanup();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#cleanup(org.eclipse.wst.validation.internal.operations.WorkbenchReporter)
+ */
+ @Override
+ public void cleanup(WorkbenchReporter reporter) {
+ super.cleanup(reporter);
+ cleanup();
+ }
+
+ public void cleanup() {
+ if(validationContextManager!=null) {
+ validationContextManager.setValidationResourceRegister(null);
+ }
+ validationContextManager = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.operations.WorkbenchContext#registerResource(org.eclipse.core.resources.IResource)
+ */
+ @Override
+ public void registerResource(IResource resource) {
+ if(resource instanceof IFile) {
+ IFile file = (IFile)resource;
+ if(validationContextManager == null) {
+ validationContextManager = new ValidationContext(file.getProject());
+ } else if(validationContextManager.isObsolete()) {
+ validationContextManager.init(file.getProject()); // https://issues.jboss.org/browse/JBIDE-8726
+ }
+ validationContextManager.addProject(file.getProject());
+ if(!file.exists()) {
+ validationContextManager.addRemovedFile(file);
+ } else {
+ validationContextManager.registerFile(file);
+ }
+ }
+ }
+
+ /**
+ * @return Set of changed resources
+ */
+ public Set<IFile> getChangedFiles() {
+ Set<IFile> result = new HashSet<IFile>();
+ String[] uris = getURIs();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ Set<IProject> projects = getAllProjects();
+ for (int i = 0; i < uris.length; i++) {
+ IFile currentFile = root.getFile(new Path(uris[i]));
+ if(projects.contains(currentFile.getProject())) {
+ result.add(currentFile);
+ }
+ }
+ Set<IFile> removedFiles = getValidationContextManager().getRemovedFiles();
+ for (IFile file : removedFiles) {
+ if(projects.contains(file.getProject())) {
+ result.add(file);
+ }
+ }
+ return result;
+ }
+
+ public Set<IFile> getProjectSetRegisteredFiles() {
+ Set<IFile> result = new HashSet<IFile>();
+ Set<IFile> files = getValidationContextManager().getRegisteredFiles();
+ Set<IProject> projects = getAllProjects();
+ for (IFile file : files) {
+ if(projects.contains(file.getProject())) {
+ result.add(file);
+ }
+ }
+ return result;
+ }
+
+ private Set<IProject> getAllProjects() {
+ IProject project = getProject();
+ if(!project.isAccessible()) {
+ return Collections.emptySet();
+ }
+
+ List<IValidator> validators = getValidationContextManager().getValidators();
+ Set<IProject> projects = new HashSet<IProject>();
+ for (IValidator validator : validators) {
+ IValidatingProjectTree tree = validator.getValidatingProjects(project);
+ if(tree == null) {
+ CommonPlugin.getDefault().logError(new IllegalStateException(MessageFormat.format(ValidationMessages.ERR_ILLIGAL_VALIDATION_STATE,validator,getProject(),getProject().exists()))); //$NON-NLS-1$
+ } else {
+ projects.addAll(tree.getAllProjects());
+ }
+ }
+ return projects;
+ }
+
+ public IValidationContextManager getValidationContextManager() {
+ return getValidationContextManager(true);
+ }
+
+ public IValidationContextManager getValidationContextManager(boolean initialize) {
+ if(!initialize) {
+ return validationContextManager;
+ }
+ if(validationContextManager==null) {
+ validationContextManager = new ValidationContext(getProject());
+ }
+ return validationContextManager;
+ }
+
+ public void setValidationContextManager(IValidationContextManager context) {
+ validationContextManager = context;
+ }
+
+ public TextFileDocumentProvider getDocumentProvider() {
+ return documentProvider;
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IELValidationDelegate.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IELValidationDelegate.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IELValidationDelegate.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -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.common.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
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IProjectValidationContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IProjectValidationContext.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IProjectValidationContext.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * 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.common.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.el.core.ELReference;
+import org.w3c.dom.Element;
+
+/**
+ * Contains information for validators that must be saved between validation invoking.
+ * @author Alexey Kazakov
+ */
+public interface IProjectValidationContext {
+
+ /**
+ * Save link between core resource and variable name.
+ * It's needed for incremental validation because we must save all linked resources of changed java file.
+ */
+ void addLinkedCoreResource(String validatorId, String variableName, IPath linkedResourcePath, boolean declaration);
+
+ /**
+ * Removes link between core resource and variable name.
+ * @param oldVariableName
+ * @param linkedResourcePath
+ */
+ void removeLinkedCoreResource(String validatorId, String name, IPath linkedResourcePath);
+
+ /**
+ * Removes link between core resources and variable names.
+ * @param linkedResources
+ */
+ void removeLinkedCoreResources(String validatorId, Set<IPath> resources);
+
+ /**
+ * Removes link between core resource and variable names.
+ * @param linkedResource
+ */
+ void removeLinkedCoreResource(String validatorId, IPath resource);
+
+ Set<IPath> getCoreResourcesByVariableName(String validatorId, String variableName, boolean declaration);
+
+ Set<String> getVariableNamesByCoreResource(String validatorId, IPath fullPath, boolean declaration);
+
+ /**
+ * Adds core resource without any link to any context variable name.
+ * @param fullPath
+ */
+ void addUnnamedCoreResource(String validatorId, IPath fullPath);
+
+ /**
+ * @return Set of coreresources without any link to any context variable name.
+ * @param fullPath
+ */
+ Set<IPath> getUnnamedCoreResources(String validatorId);
+
+ /**
+ * Removes unnamed EL resource.
+ * @param fullPath
+ */
+ void removeUnnamedCoreResource(String validatorId, IPath fullPath);
+
+ /**
+ * @return Set of EL resources without any link to any context variable name.
+ * @param fullPath
+ */
+ Set<IPath> getUnnamedElResources();
+
+ /**
+ * Removes unnamed EL resource.
+ * @param fullPath
+ */
+ void removeUnnamedElResource(IPath fullPath);
+
+ /**
+ * We should validate all EL resources which use these names.
+ * @param name
+ */
+ void addVariableNameForELValidation(String validatorId, String name);
+
+ void removeLinkedEls(Set<IFile> resorces);
+
+ void clearAll();
+
+ void clearOldVariableNameForElValidation();
+
+ /**
+ * Get ELs which should be validated
+ * @param changedFiles
+ * @param onlyChangedVariables
+ * @return
+ */
+ Set<ELReference> getElsForValidation(Set<IFile> changedFiles, boolean onlyChangedVariables);
+
+ /**
+ * Save link between EL and variable name.
+ * @param variableName
+ * @param el
+ */
+ void addLinkedEl(String variableName, ELReference el);
+
+ /**
+ * Removes link between EL and variable name.
+ * @param name
+ * @param el
+ */
+ void removeLinkedEl(String name, ELReference el);
+
+ /**
+ * Return ELs with given variable name
+ * @param variableName
+ * @return
+ */
+ Set<ELReference> getElsByVariableName(String variableName);
+
+ /**
+ * Stores context to XML element
+ * @param root
+ */
+ void store(Element root);
+
+ /**
+ * Loads context from XML element
+ * @param root
+ */
+ void load(Element root);
+
+ void setValidationResourceRegister(ValidationResourceRegister validationResourceRegister);
+
+ ValidationResourceRegister getValidationResourceRegister();
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidatingProjectSet.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidatingProjectSet.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidatingProjectSet.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.common.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * Represents a set of projects which are being validated.
+ * @author Alexey Kazakov
+ */
+public interface IValidatingProjectSet {
+
+ /**
+ * @return the root project which holds a link to validating context for this project set.
+ */
+ IProject getRootProject();
+
+ /**
+ * @return all the projects of the set.
+ */
+ Set<IProject> getAllProjects();
+
+ /**
+ * @return Root validating context which is associated with the root project.
+ */
+ IProjectValidationContext getRootContext();
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidatingProjectTree.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidatingProjectTree.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidatingProjectTree.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.validation;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * Represents a tree of related projects which are being validated.
+ *
+ * @author Alexey Kazakov
+ */
+public interface IValidatingProjectTree {
+
+ /**
+ * Returns the the map of chains of dependent projects. We can call treat such chains of projects as brunches of the tree.
+ * Each chain ends with a root project which depends (directly or indirectly) on all the project in the brunch there is not other projects which depends on it.
+ * Map key is a root project, map value is a brunch for the root project.
+ *
+ * @return
+ */
+ Map<IProject, IValidatingProjectSet> getBrunches();
+
+ /**
+ * @return all the projects of the tree.
+ */
+ Set<IProject> getAllProjects();
+
+ /**
+ * Add brunches for of the project.
+ * @param project
+ */
+ void addProject(IProject project);
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationContextManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationContextManager.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationContextManager.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.validation;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IValidationContextManager {
+
+ IValidatingProjectTree getValidatingProjectTree(IValidator validator);
+
+ void addProject(IProject project);
+
+ void clearAll();
+
+ void clearRegisteredFiles();
+
+ void clearAllResourceLinks();
+
+ Set<IFile> getRemovedFiles();
+
+ void addRemovedFile(IFile file);
+
+ Set<IFile> getRegisteredFiles();
+
+ void registerFile(IFile file);
+
+ void init(IProject project);
+
+ /**
+ * If the context is obsolete then it should be re-initialized.
+ * See https://issues.jboss.org/browse/JBIDE-8726
+ * @return
+ */
+ boolean isObsolete();
+
+ /**
+ * @return a list of validators which are associated with this context.
+ */
+ List<IValidator> getValidators();
+
+ Set<IProject> getRootProjects();
+
+ void addValidatedProject(IValidator validator, IProject project);
+
+ boolean projectHasBeenValidated(IValidator validator, IProject project);
+
+ void clearValidatedProjectsList();
+
+ void setValidationResourceRegister(ValidationResourceRegister validationResourceRegister);
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationContextProvider.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationContextProvider.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationContextProvider.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.common.validation;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IValidationContextProvider {
+
+ /**
+ * @return validation context
+ */
+ public IProjectValidationContext getValidationContext();
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationErrorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationErrorManager.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidationErrorManager.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,128 @@
+ /*******************************************************************************
+ * 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.common.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+import org.jboss.tools.common.text.ITextSourceReference;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IValidationErrorManager {
+
+ /**
+ * inits validator error manager
+ * @param project
+ * @param validationHelper
+ * @param manager
+ * @param reporter
+ */
+ void init(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext validationContext, IValidator manager, IReporter reporter);
+
+ /**
+ * Adds a marker to the resource
+ * @param message
+ * @param preferenceKey
+ * @param messageArguments
+ * @param location
+ * @param target
+ */
+ IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, ITextSourceReference location,
+ IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param message
+ * @param preferenceKey
+ * @param messageArguments
+ * @param target
+ */
+ IMarker addError(String message, String preferenceKey,
+ String[] messageArguments,
+ IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param message
+ * @param preferenceKey
+ * @param location
+ * @param target
+ */
+ IMarker addError(String message, String preferenceKey,
+ ITextSourceReference location, IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param message
+ * @param preferenceKey
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ */
+ IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int lineNumber, int length, int offset, IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param message
+ * @param preferenceKey
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ */
+ IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int length, int offset, IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param message
+ * @param severity
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ */
+ IMarker addError(String message, int severity, String[] messageArguments, int lineNumber, int length, int offset, IResource target);
+
+ /**
+ * Displays a subtask in the progress view.
+ * @param message
+ */
+ void displaySubtask(String message);
+
+ /**
+ * Displays a subtask in the progress view.
+ * @param message
+ * @param messageArguments
+ */
+ void displaySubtask(String message, String[] messageArguments);
+
+ /**
+ * Removes all markers for the resources
+ * @param resources
+ */
+ void removeMessagesFromResources(Set<IResource> resources);
+
+ /**
+ * Remove all validation messages for the resource.
+ * @param resource
+ */
+ void removeAllMessagesFromResource(IResource resource);
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidator.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/IValidator.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,73 @@
+ /*******************************************************************************
+ * 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.common.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+
+/**
+ * Represents a validator that is managed by ValidatorManager.
+ * @author Alexey Kazakov
+ */
+public interface IValidator {
+
+ public static final String KB_PROBLEM_MARKER_TYPE = "org.jboss.tools.common.validation.JBTValidationProblem"; //$NON-NLS-1$
+ public static final String MARKED_RESOURCE_MESSAGE_GROUP = "markedKbResource"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_ID = "org.jboss.tools.common.validation.validator"; //$NON-NLS-1$
+
+ /**
+ * Incremental Validation
+ * @return
+ * @throws ValidationException
+ */
+ IStatus validate(Set<IFile> changedFiles, IProject project, ContextValidationHelper validationHelper, IProjectValidationContext validationContext, ValidatorManager manager, IReporter reporter) throws ValidationException;
+
+ /**
+ * Full Validation
+ * @return
+ * @throws ValidationException
+ */
+ IStatus validateAll(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext validationContext, ValidatorManager manager, IReporter reporter) throws ValidationException;
+
+ /**
+ * @return unique ID of the validator
+ */
+ String getId();
+
+ /**
+ * @return ID of required builder that creates and updates model to be validated.
+ */
+ String getBuilderId();
+
+ /**
+ * @param 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 the given project.
+ */
+ boolean shouldValidate(IProject project);
+
+ /**
+ * Returns "true" if this validator is enabled in the preferences store.
+ * @param project
+ * @return
+ */
+ boolean isEnabled(IProject project);
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/JBTValidationException.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/JBTValidationException.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/JBTValidationException.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.validation;
+
+/**
+ * Presents an exception that can be thrown during KB validation.
+ *
+ * @author Alexey Kazakov
+ */
+public class JBTValidationException extends Exception {
+
+ private static final long serialVersionUID = -1958111192543021067L;
+
+ public JBTValidationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ProblemMessage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ProblemMessage.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ProblemMessage.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.common.validation;
+
+import java.util.Locale;
+
+import org.eclipse.wst.validation.internal.core.Message;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ProblemMessage extends Message {
+
+ private String message;
+
+ public ProblemMessage(String message, int severity, String[] params, Object targetObject, String groupName) {
+ super(null, severity, null, params, targetObject, groupName);
+ this.message = message;
+ }
+
+ public ProblemMessage(String message, int severity, String[] params) {
+ super(null, severity, null, params, null);
+ this.message = message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.core.Message#getText()
+ */
+ @Override
+ public String getText() {
+ if (getParams() != null) {
+ return java.text.MessageFormat.format(message, getParams());
+ }
+
+ return message;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.core.Message#getText(java.lang.ClassLoader)
+ */
+ @Override
+ public String getText(ClassLoader classLoader) {
+ return getText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.core.Message#getText(java.util.Locale, java.lang.ClassLoader)
+ */
+ @Override
+ public String getText(Locale locale, ClassLoader classLoader) {
+ return getText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.core.Message#getText(java.util.Locale)
+ */
+ @Override
+ public String getText(Locale locale) {
+ return getText();
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/Validation.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/Validation.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/Validation.properties 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,8 @@
+VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL=Linked resource path must not be null\!
+VALIDATION_CONTEXT_VARIABLE_NAME_MUST_NOT_BE_NULL=Variable name must not be null\!
+
+ILLEGAL_CONTENTTYPE=Unknown contentType argument value: {0}
+
+EXCEPTION_DURING_CREATING_MARKER=Exception occurred during creating marker for validation error on ''{0}''
+
+ERR_ILLIGAL_VALIDATION_STATE=Validator has no tree "{0}" for project "{1}" Project exists = {2}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationContext.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationContext.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ * 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.common.validation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+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.Platform;
+import org.jboss.tools.common.CommonPlugin;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidationContext implements IValidationContextManager {
+
+ private ValidationResourceRegister validationResourceRegister;
+ private Map<IValidator, IValidatingProjectTree> projectTree = new HashMap<IValidator, IValidatingProjectTree>();
+ private static List<IValidator> ALL_VALIDATORS;
+ private List<IValidator> validators = new ArrayList<IValidator>();
+ private Map<IValidator, Set<IProject>> validatedProjects = new HashMap<IValidator, Set<IProject>>();
+
+ public ValidationContext(IProject project) {
+ init(project);
+ }
+
+ public void init(IProject project) {
+ projectTree.clear();
+ validators.clear();
+ validationResourceRegister = null;
+ if(ALL_VALIDATORS == null) {
+ // 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) {
+ 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 {
+ IValidator validator = (IValidator)elements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ String dependent = elements[j].getAttribute("dependent"); //$NON-NLS-1$
+ if(Boolean.parseBoolean(dependent)) {
+ dependentValidators.add(validator);
+ } else {
+ ALL_VALIDATORS.add(validator);
+ }
+ } catch (CoreException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
+ }
+ }
+ }
+ // 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.
+ for (IValidator validator : ALL_VALIDATORS) {
+ if(validator.shouldValidate(project)) {
+ IValidatingProjectTree prTree = validator.getValidatingProjects(project);
+ if(prTree!=null) {
+ validators.add(validator);
+ projectTree.put(validator, prTree);
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#isObsolete()
+ */
+ public boolean isObsolete() {
+ return validationResourceRegister!=null && validationResourceRegister.isObsolete();
+ }
+
+ private ValidationResourceRegister getValidationResourceRegister() {
+ if(validationResourceRegister==null && !projectTree.isEmpty()) {
+ // Initialize the register
+ for (IValidatingProjectTree tree : projectTree.values()) {
+ boolean inited = false;
+ if(!tree.getBrunches().isEmpty()) {
+ for (IValidatingProjectSet brunch : tree.getBrunches().values()) {
+ IProjectValidationContext context = brunch.getRootContext();
+ ValidationResourceRegister register = context.getValidationResourceRegister();
+ if(register==null) {
+ if(validationResourceRegister==null) {
+ validationResourceRegister = new ValidationResourceRegister();
+ }
+ context.setValidationResourceRegister(validationResourceRegister);
+ } else {
+ validationResourceRegister = register;
+ inited = true;
+ break;
+ }
+ }
+ }
+ if(inited) {
+ break;
+ }
+ }
+ }
+ if(validationResourceRegister==null) {
+ validationResourceRegister = new ValidationResourceRegister();
+ }
+ return validationResourceRegister;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#setValidationResourceRegister(org.jboss.tools.jst.web.kb.internal.validation.ValidationResourceRegister)
+ */
+ public void setValidationResourceRegister(
+ ValidationResourceRegister validationResourceRegister) {
+ this.validationResourceRegister = validationResourceRegister;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getValidators()
+ */
+ public List<IValidator> getValidators() {
+ return validators;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#clearAll()
+ */
+ public void clearAll() {
+ clearRegisteredFiles();
+ for (IValidatingProjectTree tree : projectTree.values()) {
+ for (IValidatingProjectSet brunch : tree.getBrunches().values()) {
+ brunch.getRootContext().clearAll();
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#clearRegisteredFiles()
+ */
+ public void clearRegisteredFiles() {
+ getValidationResourceRegister().clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getRemovedFiles()
+ */
+ public Set<IFile> getRemovedFiles() {
+ return getValidationResourceRegister().getRemovedFiles();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addRemovedFile(org.eclipse.core.resources.IFile)
+ */
+ public void addRemovedFile(IFile file) {
+ getValidationResourceRegister().addRemovedFile(file);
+ for (IValidatingProjectTree tree : projectTree.values()) {
+ tree.addProject(file.getProject());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getRegisteredFiles()
+ */
+ public Set<IFile> getRegisteredFiles() {
+ return getValidationResourceRegister().getRegisteredFiles();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#registerFile(org.eclipse.core.resources.IFile)
+ */
+ public void registerFile(IFile file) {
+ getValidationResourceRegister().registerFile(file);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#getValidatingProjectTree(org.jboss.tools.jst.web.kb.validation.IValidator)
+ */
+ public IValidatingProjectTree getValidatingProjectTree(IValidator validator) {
+ return projectTree.get(validator);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#addProject(org.eclipse.core.resources.IProject)
+ */
+ public void addProject(IProject project) {
+ for (IValidator validator : validators) {
+ projectTree.get(validator).addProject(project);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#getRootProjects()
+ */
+ public Set<IProject> getRootProjects() {
+ Set<IProject> roots = new HashSet<IProject>();
+ for (IValidatingProjectTree tree : projectTree.values()) {
+ for (IValidatingProjectSet brunch : tree.getBrunches().values()) {
+ roots.add(brunch.getRootProject());
+ }
+ }
+ return roots;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#clearAllResourceLinks()
+ */
+ public void clearAllResourceLinks() {
+ for (IValidatingProjectTree tree : projectTree.values()) {
+ for (IValidatingProjectSet brunch : tree.getBrunches().values()) {
+ brunch.getRootContext().clearAll();
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContextManager#addValidatedProject(org.jboss.tools.jst.web.kb.validation.IValidator, org.eclipse.core.resources.IProject)
+ */
+ public void addValidatedProject(IValidator validator, IProject project) {
+ Set<IProject> projects = validatedProjects.get(validator);
+ if(projects==null) {
+ projects = new HashSet<IProject>();
+ validatedProjects.put(validator, projects);
+ }
+ projects.add(project);
+ }
+
+ /*
+ * (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) {
+ Set<IProject> projects = validatedProjects.get(validator);
+ return projects==null?false:projects.contains(project);
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationELReference.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationELReference.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationELReference.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.common.validation;
+
+import org.jboss.tools.common.el.core.ELReference;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidationELReference extends ELReference {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.ELReference#getMarkerGroupId()
+ */
+ @Override
+ protected String getMarkerGroupId() {
+ return IValidator.MARKED_RESOURCE_MESSAGE_GROUP;
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,481 @@
+/*******************************************************************************
+ * 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.common.validation;
+
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.editors.text.TextFileDocumentProvider;
+import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+import org.jboss.tools.common.CommonPlugin;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.common.text.ITextSourceReference;
+
+/**
+ * @author Alexey Kazakov
+ */
+public abstract class ValidationErrorManager implements IValidationErrorManager {
+
+ public static String DEFAULT_VALIDATION_MARKER = ValidationPlugin.PLUGIN_ID + ".problemmarker"; //$NON-NLS-1$
+ static String VALIDATION_MARKER_OWNER = "owner"; //$NON-NLS-1$
+ static String VALIDATION_MARKER_GROUP = "groupName"; //$NON-NLS-1$
+
+ protected IStatus OK_STATUS = new Status(IStatus.OK,
+ "org.eclipse.wst.validation", 0, "OK", null); //$NON-NLS-1$ //$NON-NLS-2$
+
+ protected IValidator validationManager;
+ protected ContextValidationHelper coreHelper;
+ protected IReporter reporter;
+ protected IProject validatingProject;
+ protected String markerId;
+ protected IProjectValidationContext validationContext;
+ protected TextFileDocumentProvider documentProvider;
+
+ private String messageIdQuickFixAttributeName;
+
+ /**
+ * Constructor
+ */
+ public ValidationErrorManager() {
+ }
+
+ /**
+ * @param messageIdQuickFixAttributeName the messageIdQuickFixAttributeName to set
+ */
+ public void setMessageIdQuickFixAttributeName(
+ String messageIdQuickFixAttributeName) {
+ this.messageIdQuickFixAttributeName = messageIdQuickFixAttributeName;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationErrorManager#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)
+ */
+ public void init(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext validationContext, IValidator manager, IReporter reporter) {
+ cleanSavedMarkers();
+ setProject(project);
+ setCoreHelper(validationHelper);
+ setValidationManager(manager);
+ setReporter(reporter);
+ setValidationContext(validationContext);
+ setMarkerId(org.jboss.tools.common.validation.IValidator.MARKED_RESOURCE_MESSAGE_GROUP);
+ }
+
+ public void init(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext validationContext, IValidator manager, IReporter reporter, String messageIdQuickFixAttributeName) {
+ this.init(project, validationHelper, validationContext, manager, reporter);
+ setMessageIdQuickFixAttributeName(messageIdQuickFixAttributeName);
+ }
+
+ /**
+ * @param validationManager the validationManager to set
+ */
+ public void setValidationManager(IValidator validationManager) {
+ this.validationManager = validationManager;
+ }
+
+ /**
+ * @param coreHelper the coreHelper to set
+ */
+ public void setCoreHelper(ContextValidationHelper coreHelper) {
+ this.coreHelper = coreHelper;
+ }
+
+ /**
+ * @param reporter the reporter to set
+ */
+ public void setReporter(IReporter reporter) {
+ this.reporter = reporter;
+ }
+
+ /**
+ * @param rootProject the rootProject to set
+ */
+ public void setProject(IProject rootProject) {
+ this.validatingProject = rootProject;
+ }
+
+ /**
+ * @param markerId the markerId to set
+ */
+ public void setMarkerId(String markerId) {
+ this.markerId = markerId;
+ }
+
+ /**
+ * @param validationContext the validationContext to set
+ */
+ public void setValidationContext(IProjectValidationContext validationContext) {
+ this.validationContext = validationContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String,
+ * java.lang.String, java.lang.String[],
+ * org.jboss.tools.seam.core.ISeamTextSourceReference,
+ * org.eclipse.core.resources.IResource)
+ */
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, ITextSourceReference location,
+ IResource target) {
+ if(location == null) {
+ //
+ } else if(location.getResource() != null && location.getResource().exists()) {
+ if(!location.getResource().equals(target)) {
+ target = location.getResource();
+ }
+ } else {
+ //
+ }
+ return addError(message, preferenceKey, messageArguments, 0, location
+ .getLength(), location.getStartPosition(), target);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String,
+ * java.lang.String,
+ * org.jboss.tools.seam.core.ISeamTextSourceReference,
+ * org.eclipse.core.resources.IResource)
+ */
+ public IMarker addError(String message, String preferenceKey,
+ ITextSourceReference location, IResource target) {
+ return addError(message, preferenceKey, new String[0], location, target);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String, java.lang.String, java.lang.String[], org.eclipse.core.resources.IResource)
+ */
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, IResource target) {
+ return addError(message, preferenceKey, messageArguments, 0, 0, 0, target);
+ }
+
+ private String getMarkerId() {
+ return markerId;
+ }
+
+ /**
+ * @param project
+ * @param preferenceKey
+ * @return
+ */
+ protected abstract String getPreference(IProject project, String preferenceKey);
+
+ private Set<MarkerID> markers = new HashSet<MarkerID>();
+
+ private static class MarkerID {
+
+ String preferenceKey;
+ int length;
+ int offset;
+ String path;
+
+ public MarkerID(String preferenceKey, int length, int offset, String path) {
+ super();
+ this.preferenceKey = preferenceKey;
+ this.length = length;
+ this.offset = offset;
+ this.path = path;
+ }
+
+ @Override
+ public int hashCode() {
+ return toString().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj instanceof MarkerID && toString().equals(obj.toString());
+ }
+
+ @Override
+ public String toString() {
+ return path + ":" + preferenceKey + ":" + length + ":" + offset; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Returns true if the manager should not add a problem markers with the same location and preference key twice.
+ * @return
+ */
+ protected boolean shouldCheckDuplicateMarkers() {
+ return false;
+ }
+
+ protected void cleanSavedMarkers() {
+ markers.clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String, java.lang.String, java.lang.String[], int, int, org.eclipse.core.resources.IResource)
+ */
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int lineNumber, int length, int offset, IResource target) {
+ String preferenceValue = getPreference(target.getProject(), preferenceKey);
+ IMarker marker = null;
+ if (!SeverityPreferences.IGNORE.equals(preferenceValue)) {
+ int severity = IMessage.HIGH_SEVERITY;
+ if (SeverityPreferences.WARNING.equals(preferenceValue)) {
+ severity = IMessage.NORMAL_SEVERITY;
+ }
+ if(shouldCheckDuplicateMarkers()) {
+ MarkerID id = new MarkerID(preferenceKey, length, offset, target.getFullPath().toOSString());
+ if(!markers.contains(id)) {
+ marker = addError(message, severity, messageArguments, lineNumber, length, offset, target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
+ if(marker!=null) {
+ markers.add(id);
+ }
+ }
+ } else {
+ marker = addError(message, severity, messageArguments, lineNumber, length, offset, target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
+ }
+ }
+ return marker;
+ }
+
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int length, int offset, IResource target) {
+ return addError(message, preferenceKey, messageArguments, 0, length, offset, target);
+ }
+
+ public TextFileDocumentProvider getDocumentProvider() {
+ if(documentProvider==null) {
+ if(coreHelper!=null) {
+ documentProvider = coreHelper.getDocumentProvider();
+ } else {
+ documentProvider = new TextFileDocumentProvider();
+ }
+ }
+ return documentProvider;
+ }
+
+ protected Class getMarkerOwner() {
+ return this.getClass();
+ }
+
+ public IProjectValidationContext getValidationContext() {
+ return validationContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String, int, java.lang.String[], int, int, org.eclipse.core.resources.IResource)
+ */
+ public IMarker addError(String message, int severity, String[] messageArguments, int lineNumber, int length, int offset, IResource target) {
+ return addError(message, severity, messageArguments, lineNumber, length, offset, target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
+ }
+
+ public static IMarker addError(String message, int severity, Object[] messageArguments, int lineNumber, int length, int offset, IResource target, TextFileDocumentProvider documentProvider, String markerId, Class markerOwner, int maxNumberOfMarkersPerFile, String markerType) {
+ IMarker marker = null;
+ boolean connected = false;
+ try {
+ if(lineNumber<1) {
+ if (documentProvider != null) {
+ connected = true;
+ documentProvider.connect(target);
+ IDocument doc = documentProvider.getDocument(target);
+ if(doc != null){
+ try {
+ lineNumber = doc.getLineOfOffset(offset) + 1;
+ } catch (BadLocationException e) {
+ CommonPlugin.getDefault().logError("Wrong offset [" + offset + "] of the problem marker [" + MessageFormat.format(message, messageArguments) + "] for resource: " + target.getFullPath().toOSString(), e); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
+ }
+ }
+ }
+ }
+ marker = addTask(markerOwner.getName().intern(), target, lineNumber,
+ MessageFormat.format(message, messageArguments),
+ severity, null, markerId, offset, length, maxNumberOfMarkersPerFile, markerType);
+ } catch (CoreException e) {
+ CommonPlugin.getDefault().logError(
+ NLS.bind(ValidationMessages.EXCEPTION_DURING_CREATING_MARKER, target.getFullPath()), e);
+ } finally {
+ if (documentProvider != null && connected) {
+ documentProvider.disconnect(target);
+ }
+ }
+
+ return marker;
+ }
+
+ /**
+ * Create a problem marker and add to the marker an attribute with the message ID for QuickFix.
+ *
+ * @param message
+ * @param preferenceKey
+ * @param location
+ * @param target
+ * @param messageId
+ * @return
+ */
+ public IMarker addError(String message, String preferenceKey,
+ ITextSourceReference location, IResource target, int messageId) {
+ IMarker marker = addError(message, preferenceKey, location, target);
+ try {
+ if(marker!=null) {
+ marker.setAttribute(messageIdQuickFixAttributeName, new Integer(messageId));
+ }
+ } catch(CoreException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
+ return marker;
+ }
+
+ /**
+ *
+ * @param message
+ * @param severity
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ * @param documentProvider
+ * @param markerId
+ * @param markerOwner
+ * @return
+ */
+ public IMarker addError(String message, int severity, Object[] messageArguments, int lineNumber, int length, int offset, IResource target, TextFileDocumentProvider documentProvider, String markerId, Class markerOwner) {
+ return addError(message, severity, messageArguments, lineNumber, length, offset, target, documentProvider, markerId, markerOwner, getMaxNumberOfMarkersPerFile(target.getProject()), getMarkerType());
+ }
+
+ abstract public int getMaxNumberOfMarkersPerFile(IProject project);
+
+ public abstract String getMarkerType();
+
+ private static IMarker addTask(String pluginId, IResource resource, int location,
+ String message, int severityEnumValue, String targetObjectName,
+ String groupName, int offset, int length, int maxNumberOfMarkersPerFile, String markerType) throws CoreException {
+
+ if ((message == null) || (resource == null) || (!resource.exists())) {
+ return null;
+ }
+ int severity = getSeverity(severityEnumValue);
+
+ if(markerType==null) {
+ markerType = DEFAULT_VALIDATION_MARKER;
+ }
+ if(maxNumberOfMarkersPerFile>0) {
+ int existingMarkers = resource.findMarkers(markerType, true, IResource.DEPTH_ZERO).length;
+ if(existingMarkers>maxNumberOfMarkersPerFile) {
+ return null;
+ }
+ }
+
+ IMarker item = resource.createMarker(markerType); // add a validation marker
+
+ boolean offsetSet = ((offset != IMessage.OFFSET_UNSET) && (length != IMessage.OFFSET_UNSET));
+ int size = (offsetSet) ? 7 : 5;
+ String[] attribNames = new String[size];
+ Object[] attribValues = new Object[size];
+
+ attribNames[0] = VALIDATION_MARKER_OWNER;
+ attribValues[0] = pluginId;
+ attribNames[1] = VALIDATION_MARKER_GROUP;
+ attribValues[1] = ((groupName == null) ? "" : groupName); //$NON-NLS-1$
+ attribNames[2] = IMarker.MESSAGE;
+ attribValues[2] = message;
+ attribNames[3] = IMarker.SEVERITY;
+ attribValues[3] = new Integer(severity);
+
+ Integer lineNumber = Integer.valueOf(location);
+ attribNames[4] = IMarker.LINE_NUMBER;
+ attribValues[4] = lineNumber;
+
+ if (offsetSet) {
+ attribNames[5] = IMarker.CHAR_START;
+ attribValues[5] = new Integer(offset);
+ attribNames[6] = IMarker.CHAR_END;
+ attribValues[6] = new Integer(offset + length);
+ }
+
+ item.setAttributes(attribNames, attribValues);
+
+ return item;
+ }
+
+ private static int getSeverity(int severityEnumValue) {
+ switch (severityEnumValue) {
+ case (IMessage.HIGH_SEVERITY) : {
+ return IMarker.SEVERITY_ERROR;
+ }
+ case (IMessage.LOW_SEVERITY) : {
+ return IMarker.SEVERITY_INFO;
+ }
+ case (IMessage.NORMAL_SEVERITY) : {
+ return IMarker.SEVERITY_WARNING;
+ }
+ case (IMessage.ALL_MESSAGES) :
+ case (IMessage.ERROR_AND_WARNING) :
+ default : {
+ // assume it's a warning.
+ return IMarker.SEVERITY_WARNING;
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#displaySubtask(java.lang.String)
+ */
+ public void displaySubtask(String messageId) {
+ displaySubtask(messageId, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#displaySubtask(java.lang.String,
+ * java.lang.String[])
+ */
+ public void displaySubtask(String message, String[] messageArguments) {
+ IMessage problemMessage = new ProblemMessage(message, IMessage.NORMAL_SEVERITY, messageArguments);
+ reporter.displaySubtask(validationManager, problemMessage);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#removeMessagesFromResources(java.util.Set)
+ */
+ public void removeMessagesFromResources(Set<IResource> resources) {
+ for (IResource r : resources) {
+ WorkbenchReporter.removeAllMessages(r, new String[]{getMarkerOwner().getName()}, null);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#removeAllMessagesFromResource(org.eclipse.core.resources.IResource)
+ */
+ public void removeAllMessagesFromResource(IResource resource) {
+// reporter.removeAllMessages(validationManager, resource);
+ WorkbenchReporter.removeAllMessages(resource, new String[]{getMarkerOwner().getName()}, null);
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationMessages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationMessages.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationMessages.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.validation;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidationMessages {
+
+ private static final String BUNDLE_NAME = "org.jboss.tools.common.validation.Validation"; //$NON-NLS-1$
+
+ public static String VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL;
+ public static String VALIDATION_CONTEXT_VARIABLE_NAME_MUST_NOT_BE_NULL;
+
+ public static String ILLEGAL_CONTENTTYPE;
+
+ public static String EXCEPTION_DURING_CREATING_MARKER;
+
+ public static String ERR_ILLIGAL_VALIDATION_STATE;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ValidationMessages.class);
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationResourceRegister.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationResourceRegister.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationResourceRegister.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidationResourceRegister {
+ private Set<IFile> removedFiles = new HashSet<IFile>();
+ private Set<IFile> registeredResources = new HashSet<IFile>();
+ private boolean obsolete = false;
+
+ public void clear() {
+ synchronized (removedFiles) {
+ removedFiles.clear();
+ }
+ synchronized (registeredResources) {
+ registeredResources.clear();
+ }
+ obsolete = true;
+ }
+
+ public Set<IFile> getRemovedFiles() {
+ return removedFiles;
+ }
+
+ public void addRemovedFile(IFile file) {
+ removedFiles.add(file);
+ }
+
+ public Set<IFile> getRegisteredFiles() {
+ Set<IFile> copy = new HashSet<IFile>();
+ synchronized (registeredResources) {
+ copy.addAll(registeredResources);
+ }
+ return copy;
+ }
+
+ public void registerFile(IFile file) {
+ obsolete = false;
+ synchronized (registeredResources) {
+ registeredResources.add(file);
+ }
+ }
+
+ /**
+ * @return the obsolete
+ */
+ public boolean isObsolete() {
+ return obsolete;
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationUtil.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationUtil.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidationUtil {
+
+ public final static Set<String> EXTNS;
+ static {
+ EXTNS = new HashSet<String>();
+ EXTNS.add("java"); //$NON-NLS-1$
+ EXTNS.add("xml"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns true if the file name has "java" or "xml" extension.
+ * @param file
+ * @return
+ */
+ public static boolean checkFileExtensionForJavaAndXml(IFile file) {
+ String ext = file.getFileExtension();
+ if(ext!=null) {
+ ext = ext.toLowerCase();
+ }
+ return EXTNS.contains(ext);
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidatorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidatorManager.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidatorManager.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,181 @@
+ /*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.validation;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.common.CommonPlugin;
+
+/**
+ * This Manager invokes all dependent validators that should be invoked in one job.
+ * We need this one because wst validation framework does not let us invoke
+ * dependent validators in the same job.
+ * @author Alexey Kazakov
+ */
+public class ValidatorManager implements IValidatorJob {
+
+ private static Set<IProject> validatingProjects = new HashSet<IProject>();
+ public static final String SLEEPING = "Sleeping"; //$NON-NLS-1$
+ public static final String RUNNING = "Running"; //$NON-NLS-1$
+ private static String STATUS = SLEEPING;
+
+ public ValidatorManager() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#getSchedulingRule(org.eclipse.wst.validation.internal.provisional.core.IValidationContext)
+ */
+ public ISchedulingRule getSchedulingRule(IValidationContext helper) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
+ STATUS = RUNNING;
+ try {
+ ContextValidationHelper validationHelper = (ContextValidationHelper)helper;
+ IProject project = validationHelper.getProject();
+ if(project==null) {
+ return OK_STATUS;
+ }
+ IValidationContextManager validationContextManager = validationHelper.getValidationContextManager();
+ Set<IProject> rootProjects = validationContextManager.getRootProjects();
+ IStatus status = OK_STATUS;
+ synchronized (validatingProjects) {
+ for (IProject rootProject : rootProjects) {
+ if(validatingProjects.contains(rootProject)) {
+ return OK_STATUS;
+ }
+ validatingProjects.add(rootProject);
+ }
+ }
+ synchronized (validatingProjects) {
+ try {
+ validationContextManager.clearValidatedProjectsList();
+ Set<IFile> changedFiles = validationHelper.getChangedFiles();
+ if(!changedFiles.isEmpty()) {
+ status = validate(changedFiles, validationHelper, reporter);
+ } else if(!validationContextManager.getRegisteredFiles().isEmpty()) {
+ validationContextManager.clearAllResourceLinks();
+ status = validateAll(validationHelper, reporter);
+ }
+ } finally {
+ if(validationContextManager!=null) {
+ validationContextManager.clearRegisteredFiles();
+ }
+ validationHelper.cleanup(); // See https://issues.jboss.org/browse/JBIDE-8726
+ for (IProject rootProject : rootProjects) {
+ validatingProjects.remove(rootProject);
+ }
+ }
+ }
+ return status;
+ } catch(Exception e) {
+ // We need to catch exceptions and wrap them in KBValidationException to let JUnit tests catch validation exceptions reported to eclipse log.
+ CommonPlugin.getDefault().logError(new JBTValidationException(e.getMessage(), e));
+ return OK_STATUS;
+ } finally {
+ STATUS = SLEEPING;
+ }
+ }
+
+ private IStatus validate(Set<IFile> changedFiles, ContextValidationHelper validationHelper, IReporter reporter) throws ValidationException {
+ IValidationContextManager validationContextManager = validationHelper.getValidationContextManager();
+ List<IValidator> validators = validationContextManager.getValidators();
+ Set<IProject> rootProjects = validationContextManager.getRootProjects();
+ removeMarkers(changedFiles);
+ for (IValidator validator : validators) {
+ for (IProject rootProject : rootProjects) {
+ IValidatingProjectSet projectBrunch = validationHelper.getValidationContextManager().getValidatingProjectTree(validator).getBrunches().get(rootProject);
+ if(projectBrunch!=null) {
+ validator.validate(changedFiles, rootProject, validationHelper, projectBrunch.getRootContext(), this, reporter);
+ }
+ }
+ }
+ return OK_STATUS;
+ }
+
+ private IStatus validateAll(ContextValidationHelper validationHelper, IReporter reporter) throws ValidationException {
+ IValidationContextManager validationContextManager = validationHelper.getValidationContextManager();
+ List<IValidator> validators = validationContextManager.getValidators();
+ Set<IProject> rootProjects = validationContextManager.getRootProjects();
+ removeMarkers(validationHelper.getProjectSetRegisteredFiles());
+ for (IValidator validator : validators) {
+ for (IProject rootProject : rootProjects) {
+ IValidatingProjectSet projectBrunch = validationHelper.getValidationContextManager().getValidatingProjectTree(validator).getBrunches().get(rootProject);
+ if(projectBrunch!=null) {
+ validator.validateAll(rootProject, validationHelper, projectBrunch.getRootContext(), this, reporter);
+ }
+ }
+ }
+ return OK_STATUS;
+ }
+
+ private void removeMarkers(Set<IFile> files) {
+ try {
+ for (IFile file : files) {
+ if(file.isAccessible()) {
+ file.deleteMarkers(IValidator.KB_PROBLEM_MARKER_TYPE, true, IResource.DEPTH_ZERO);
+ }
+ }
+ } catch (CoreException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidator#cleanup(org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public void cleanup(IReporter reporter) {
+ reporter = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.validation.internal.provisional.core.IValidator#validate(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
+ validateInJob(helper, reporter);
+ }
+
+ /**
+ * This method returns a string with status message of the validator. This method is supposed to be used in unit tests.
+ * @return
+ */
+ public static String getStatus() {
+ return STATUS;
+ }
+
+ /**
+ * This method is supposed to be used in unit tests.
+ * @param status
+ */
+ public static void setStatus(String status) {
+ STATUS = status;
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ELValidatorContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ELValidatorContext.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ELValidatorContext.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * 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.common.validation.internal;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.el.core.ELReference;
+import org.jboss.tools.common.validation.ValidationELReference;
+import org.jboss.tools.common.xml.XMLUtilities;
+import org.w3c.dom.Element;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ELValidatorContext extends LinkCollection {
+
+ private Map<String, Set<ELReference>> elsByVariableName = new HashMap<String, Set<ELReference>>();
+ private Map<ELReference, Set<String>> variableNamesByEl = new HashMap<ELReference, Set<String>>();
+ private Map<IPath, Set<ELReference>> elsByResource = new HashMap<IPath, Set<ELReference>>();
+
+ public ELValidatorContext(String id) {
+ super(id);
+ }
+
+ /**
+ * Save link between EL and variable name.
+ * @param variableName
+ * @param el
+ */
+ public synchronized void addLinkedEl(String variableName, ELReference el) {
+ Set<ELReference> linkedEls = elsByVariableName.get(variableName);
+ if(linkedEls==null) {
+ // create set of linked ELs with variable name.
+ linkedEls = new HashSet<ELReference>();
+ elsByVariableName.put(variableName, linkedEls);
+ }
+ // save linked ELs.
+ // don't save links if there are more than 500 ELs for the var name.
+ if(linkedEls.size()<500) {
+ if(linkedEls.add(el)) {
+ modifications++;
+ }
+ // Save link between EL and variable names.
+ Set<String> variableNames = variableNamesByEl.get(el);
+ if(variableNames==null) {
+ variableNames = new HashSet<String>();
+ variableNamesByEl.put(el, variableNames);
+ }
+ if(variableNames.add(variableName)) {
+ modifications++;
+ }
+ }
+
+ // Save link between EL and resource.
+ Set<ELReference> els = elsByResource.get(el.getPath());
+ if(els==null) {
+ els = new HashSet<ELReference>();
+ elsByResource.put(el.getPath(), els);
+ }
+ if(els.add(el)) {
+ modifications++;
+ }
+ }
+
+ public synchronized void removeLinkedEls(Set<IFile> resorces) {
+ for (IFile file : resorces) {
+ removeLinkedEls(file);
+ }
+ }
+
+ public synchronized void removeLinkedEls(IFile resource) {
+ Set<ELReference> els = elsByResource.get(resource.getFullPath());
+ if(els!=null) {
+ if(elsByResource.remove(resource.getFullPath()) != null) {
+ modifications++;
+ }
+ for (ELReference el : els) {
+ Set<String> names = variableNamesByEl.get(el);
+ if(names!=null) {
+ String[] nameStrins = names.toArray(new String[0]);
+ for (int i = 0; i < nameStrins.length; i++) {
+ removeLinkedEl(nameStrins[i], el);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes link between EL and variable name.
+ * @param name
+ * @param el
+ */
+ public synchronized void removeLinkedEl(String name, ELReference el) {
+ Set<ELReference> linkedEls = elsByVariableName.get(name);
+ if(linkedEls!=null) {
+ if(linkedEls.remove(el)) {
+ modifications++;
+ }
+ }
+ if(linkedEls.isEmpty()) {
+ elsByVariableName.remove(name);
+ }
+
+ // Remove link between EL and variable names.
+ Set<String> variableNames = variableNamesByEl.get(el);
+ if(variableNames!=null) {
+ if(variableNames.remove(name)) {
+ modifications++;
+ }
+ }
+ if(variableNames.isEmpty()) {
+ variableNamesByEl.remove(el);
+ }
+ }
+
+ /**
+ * Return ELs with given variable name
+ * @param variableName
+ * @return
+ */
+ public synchronized Set<ELReference> getElsByVariableName(String variableName) {
+ return elsByVariableName.get(variableName);
+ }
+
+ /**
+ * @param names
+ * @return
+ */
+ public synchronized Set<ELReference> getElsByVariableNames(Set<String> names) {
+ Set<ELReference> result = new HashSet<ELReference>();
+ for(String name : names) {
+ Set<ELReference> els = getElsByVariableName(name);
+ if(els!=null) {
+ result.addAll(els);
+ }
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.LinkCollection#clearAll()
+ */
+ @Override
+ public synchronized void clearAll() {
+ super.clearAll();
+ elsByVariableName.clear();
+ variableNamesByEl.clear();
+ elsByResource.clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.LinkCollection#store(org.w3c.dom.Element)
+ */
+ @Override
+ public synchronized void store(Element root) {
+ super.store(root);
+ Set<String> variables = elsByVariableName.keySet();
+ for (String name: variables) {
+ Set<ELReference> els = elsByVariableName.get(name);
+ if(els == null) {
+ continue;
+ }
+ for (ELReference el: els) {
+ Element linkedEl = XMLUtilities.createElement(root, "linked-el"); //$NON-NLS-1$
+ linkedEl.setAttribute("name", name); //$NON-NLS-1$
+ el.store(linkedEl);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.LinkCollection#load(org.w3c.dom.Element)
+ */
+ @Override
+ public synchronized void load(Element root) {
+ super.load(root);
+ if(root == null) {
+ return;
+ }
+ Element[] linkedEls = XMLUtilities.getChildren(root, "linked-el"); //$NON-NLS-1$
+ if(linkedEls != null) {
+ for (int i = 0; i < linkedEls.length; i++) {
+ String name = linkedEls[i].getAttribute("name"); //$NON-NLS-1$
+ if(name == null || name.trim().length() == 0) {
+ continue;
+ }
+ ELReference el = new ValidationELReference();
+ el.load(linkedEls[i]);
+ el.setNeedToInitMarkers(true);
+ addLinkedEl(name, el);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/LinkCollection.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/LinkCollection.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/LinkCollection.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,328 @@
+/*******************************************************************************
+ * 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.common.validation.internal;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.validation.ValidationMessages;
+import org.jboss.tools.common.xml.XMLUtilities;
+import org.w3c.dom.Element;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class LinkCollection {
+ protected Map<String, Set<IPath>> resourcesByVariableName = new HashMap<String, Set<IPath>>();
+ protected Map<IPath, Set<String>> variableNamesByResource = new HashMap<IPath, Set<String>>();
+ protected Map<String, Set<IPath>> resourcesByDeclaringVariableName = new HashMap<String, Set<IPath>>();
+ protected Map<IPath, Set<String>> declaringVariableNamesByResource = new HashMap<IPath, Set<String>>();
+ protected Set<IPath> unnamedResources = new HashSet<IPath>();
+ private String id;
+
+ public LinkCollection(String id) {
+ this.id = id;
+ }
+
+ protected int modifications = 0;
+
+ /**
+ * Save link between resource and variable name.
+ * It's needed for incremental validation because we must save all linked resources of changed java file.
+ */
+ public void addLinkedResource(String variableName, IPath linkedResourcePath, boolean declaration) {
+ if(linkedResourcePath==null) {
+ throw new IllegalArgumentException(ValidationMessages.VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL);
+ }
+ if(variableName==null) {
+ throw new IllegalArgumentException(ValidationMessages.VALIDATION_CONTEXT_VARIABLE_NAME_MUST_NOT_BE_NULL);
+ }
+
+ synchronized(this) {
+ Set<IPath> linkedResources = resourcesByVariableName.get(variableName);
+ if(linkedResources==null) {
+ // create set of linked resources with variable name.
+ linkedResources = new HashSet<IPath>();
+ resourcesByVariableName.put(variableName, linkedResources);
+ }
+ // save linked resources.
+ if(linkedResources.add(linkedResourcePath)) {
+ modifications++;
+ }
+ }
+
+ // Save link between resource and variable names. It's needed if variable name changes in resource file.
+ Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
+ if(variableNames==null) {
+ variableNames = new HashSet<String>();
+ variableNamesByResource.put(linkedResourcePath, variableNames);
+ }
+ if(variableNames.add(variableName)) {
+ modifications++;
+ }
+
+ if(declaration) {
+ synchronized(this) {
+ Set<IPath> linkedResources = resourcesByDeclaringVariableName.get(variableName);
+ if(linkedResources==null) {
+ // create set of linked resources with declaring variable name.
+ linkedResources = new HashSet<IPath>();
+ resourcesByDeclaringVariableName.put(variableName, linkedResources);
+ }
+ // save linked resources.
+ if(linkedResources.add(linkedResourcePath)) {
+ modifications++;
+ }
+ }
+
+ // Save link between resource and declaring variable names. It's needed if variable name changes in resource file.
+ variableNames = declaringVariableNamesByResource.get(linkedResourcePath);
+ if(variableNames==null) {
+ variableNames = new HashSet<String>();
+ declaringVariableNamesByResource.put(linkedResourcePath, variableNames);
+ }
+ if(variableNames.add(variableName)) {
+ modifications++;
+ }
+ }
+ }
+
+ /**
+ * Removes link between resource and variable name.
+ * @param oldVariableName
+ * @param linkedResourcePath
+ */
+ public void removeLinkedResource(String name, IPath linkedResourcePath) {
+ synchronized(this) {
+ Set<IPath> linkedResources = resourcesByVariableName.get(name);
+ if(linkedResources!=null) {
+ // remove linked resource.
+ if(linkedResources.remove(linkedResourcePath)) {
+ modifications++;
+ }
+ }
+ if(linkedResources.isEmpty()) {
+ resourcesByVariableName.remove(name);
+ }
+ }
+ // Remove link between resource and declaring variable names.
+ Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
+ if(variableNames!=null) {
+ if(variableNames.remove(name)) {
+ modifications++;
+ }
+ }
+ if(variableNames.isEmpty()) {
+ variableNamesByResource.remove(linkedResourcePath);
+ }
+ synchronized(this) {
+ Set<IPath> linkedResources = resourcesByDeclaringVariableName.get(name);
+ if(linkedResources!=null) {
+ // remove linked resource.
+ if(linkedResources.remove(linkedResourcePath)) {
+ modifications++;
+ }
+ }
+ if(linkedResources.isEmpty()) {
+ resourcesByDeclaringVariableName.remove(name);
+ }
+ }
+ // Remove link between resource and declaring variable names.
+ variableNames = declaringVariableNamesByResource.get(linkedResourcePath);
+ if(variableNames!=null) {
+ if(variableNames.remove(name)) {
+ modifications++;
+ }
+ }
+ if(variableNames.isEmpty()) {
+ declaringVariableNamesByResource.remove(linkedResourcePath);
+ }
+ }
+
+ /**
+ * Removes link between resources and variable names.
+ * @param linkedResources
+ */
+ public void removeLinkedResources(Set<IPath> resources) {
+ for (IPath resource : resources) {
+ removeLinkedResource(resource);
+ }
+ }
+
+ /**
+ * Removes link between resource and variable names.
+ * @param linkedResources
+ */
+ public synchronized void removeLinkedResource(IPath resource) {
+ Set<String> resourceNames = variableNamesByResource.get(resource);
+ if(resourceNames!=null) {
+ for (String name : resourceNames) {
+ Set<IPath> linkedResources = resourcesByVariableName.get(name);
+ if(linkedResources!=null) {
+ if(linkedResources.remove(resource)) {
+ modifications++;
+ }
+ if(linkedResources.isEmpty()) {
+ resourcesByVariableName.remove(name);
+ }
+ }
+ }
+ }
+ if(variableNamesByResource.remove(resource) != null) {
+ modifications++;
+ }
+
+ resourceNames = declaringVariableNamesByResource.get(resource);
+ if(resourceNames!=null) {
+ for (String name : resourceNames) {
+ Set<IPath> linkedResources = resourcesByDeclaringVariableName.get(name);
+ if(linkedResources!=null) {
+ if(linkedResources.remove(resource)) {
+ modifications++;
+ }
+ if(linkedResources.isEmpty()) {
+ resourcesByDeclaringVariableName.remove(name);
+ }
+ }
+ }
+ }
+ if(declaringVariableNamesByResource.remove(resource) != null) {
+ modifications++;
+ }
+ }
+
+ public Set<IPath> getResourcesByVariableName(String variableName, boolean declaration) {
+ return declaration?resourcesByDeclaringVariableName.get(variableName):resourcesByVariableName.get(variableName);
+ }
+
+ public synchronized Set<String> getVariableNamesByResource(IPath fullPath, boolean declaration) {
+ return declaration?declaringVariableNamesByResource.get(fullPath):variableNamesByResource.get(fullPath);
+ }
+
+ /**
+ * Adds resource without any link to any context variable name.
+ * @param fullPath
+ */
+ public void addUnnamedResource(IPath fullPath) {
+ if(unnamedResources.add(fullPath)) {
+ modifications++;
+ }
+ }
+
+ /**
+ * @return Set of resources without any link to any context variable name.
+ * @param fullPath
+ */
+ public Set<IPath> getUnnamedResources() {
+ return unnamedResources;
+ }
+
+ /**
+ * Removes unnamed resource.
+ * @param fullPath
+ */
+ public void removeUnnamedResource(IPath fullPath) {
+ if(unnamedResources.remove(fullPath)) {
+ modifications++;
+ }
+ }
+
+ /**
+ * Clear all references
+ */
+ public synchronized void clearAll() {
+ resourcesByVariableName.clear();
+ variableNamesByResource.clear();
+ declaringVariableNamesByResource.clear();
+ resourcesByDeclaringVariableName.clear();
+ unnamedResources.clear();
+ modifications = 0;
+ }
+
+ /**
+ * Store the collection to XML
+ * @param root
+ */
+ public synchronized void store(Element root) {
+ Set<String> variables = resourcesByVariableName.keySet();
+ for (String name: variables) {
+ Set<IPath> paths = resourcesByVariableName.get(name);
+ if(paths == null) continue;
+ for (IPath path: paths) {
+ Element linkedResource = XMLUtilities.createElement(root, "linked-resource"); //$NON-NLS-1$
+ linkedResource.setAttribute("name", name); //$NON-NLS-1$
+ linkedResource.setAttribute("path", path.toString()); //$NON-NLS-1$
+ if(checkDeclaration(path, name)) {
+ linkedResource.setAttribute("declaration", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+ for (IPath unnamedPath: unnamedResources) {
+ Element unnamedPathElement = XMLUtilities.createElement(root, "unnamed-path"); //$NON-NLS-1$
+ unnamedPathElement.setAttribute("path", unnamedPath.toString()); //$NON-NLS-1$
+ }
+ modifications = 0;
+ }
+
+ /**
+ * Load the collection from XML
+ * @param root
+ */
+ public void load(Element root) {
+ if(root == null) return;
+ Element[] linkedResources = XMLUtilities.getChildren(root, "linked-resource"); //$NON-NLS-1$
+ if(linkedResources != null) for (int i = 0; i < linkedResources.length; i++) {
+ String name = linkedResources[i].getAttribute("name"); //$NON-NLS-1$
+ if(name == null || name.trim().length() == 0) continue;
+ String path = linkedResources[i].getAttribute("path"); //$NON-NLS-1$
+ if(path == null || path.trim().length() == 0) continue;
+ String declaration = linkedResources[i].getAttribute("declaration"); //$NON-NLS-1$
+ boolean declarationFlag = "true".equals(declaration); //$NON-NLS-1$
+ IPath pathObject = new Path(path);
+ addLinkedResource(name, pathObject, declarationFlag);
+ }
+ Element[] unnamedPathElement = XMLUtilities.getChildren(root, "unnamed-path"); //$NON-NLS-1$
+ if(unnamedPathElement != null) for (int i = 0; i < unnamedPathElement.length; i++) {
+ String path = unnamedPathElement[i].getAttribute("path"); //$NON-NLS-1$
+ IPath pathObject = new Path(path);
+ addUnnamedResource(pathObject);
+ }
+ modifications = 0;
+ }
+
+ private boolean checkDeclaration(IPath resource, String variableName) {
+ Set<IPath> paths = resourcesByDeclaringVariableName.get(variableName);
+ if(paths!=null) {
+ for (IPath path : paths) {
+ if(path.equals(resource)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public int getModificationsSinceLastStore() {
+ return modifications;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public boolean isEmpty() {
+ return resourcesByVariableName.isEmpty() && variableNamesByResource.isEmpty() && resourcesByDeclaringVariableName.isEmpty() && declaringVariableNamesByResource.isEmpty() && unnamedResources.isEmpty();
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ProjectValidationContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ProjectValidationContext.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ProjectValidationContext.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,311 @@
+ /*******************************************************************************
+ * 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.common.validation.internal;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.el.core.ELReference;
+import org.jboss.tools.common.validation.IProjectValidationContext;
+import org.jboss.tools.common.validation.ValidationResourceRegister;
+import org.jboss.tools.common.xml.XMLUtilities;
+import org.w3c.dom.Element;
+
+/**
+ * Contains information for validators that must be saved between
+ * validation invoking.
+ * @author Alexey Kazakov
+ */
+public class ProjectValidationContext implements IProjectValidationContext {
+
+ // We should load/save these collections between eclipse sessions.
+ private Map<String, LinkCollection> coreLinks = new HashMap<String, LinkCollection>();
+ private ELValidatorContext elLinks = new ELValidatorContext("jboss.el"); //$NON-NLS-1$
+
+ private Map<String, Set<String>> oldVariableNamesForELValidation = new HashMap<String, Set<String>>();
+
+ private ValidationResourceRegister validationResourceRegister;
+
+ public LinkCollection getCoreLinks(String validatorId) {
+ LinkCollection linkCollection = coreLinks.get(validatorId);
+ if(linkCollection==null) {
+ linkCollection = new LinkCollection(validatorId);
+ coreLinks.put(validatorId, linkCollection);
+ }
+ return linkCollection;
+ }
+
+ private Set<String> getOldVariableNamesForELValidation(String validatorId) {
+ Set<String> linkCollection = oldVariableNamesForELValidation.get(validatorId);
+ if(linkCollection==null) {
+ linkCollection = new HashSet<String>();
+ oldVariableNamesForELValidation.put(validatorId, linkCollection);
+ }
+ 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)
+ */
+ public void addLinkedCoreResource(String validatorId, String variableName, IPath linkedResourcePath, boolean declaration) {
+ getCoreLinks(validatorId).addLinkedResource(variableName, linkedResourcePath, declaration);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedCoreResource(java.lang.String, org.eclipse.core.runtime.IPath)
+ */
+ public void removeLinkedCoreResource(String validatorId, String name, IPath linkedResourcePath) {
+ getCoreLinks(validatorId).removeLinkedResource(name, linkedResourcePath);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedCoreResources(java.util.Set)
+ */
+ public void removeLinkedCoreResources(String validatorId, Set<IPath> resources) {
+ getCoreLinks(validatorId).removeLinkedResources(resources);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void removeLinkedCoreResource(String validatorId, IPath resource) {
+ getCoreLinks(validatorId).removeLinkedResource(resource);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getCoreResourcesByVariableName(java.lang.String, boolean)
+ */
+ public Set<IPath> getCoreResourcesByVariableName(String validatorId, String variableName, boolean declaration) {
+ return getCoreLinks(validatorId).getResourcesByVariableName(variableName, declaration);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getVariableNamesByCoreResource(org.eclipse.core.runtime.IPath, boolean)
+ */
+ public Set<String> getVariableNamesByCoreResource(String validatorId, IPath fullPath, boolean declaration) {
+ return getCoreLinks(validatorId).getVariableNamesByResource(fullPath, declaration);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addUnnamedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void addUnnamedCoreResource(String validatorId, IPath fullPath) {
+ getCoreLinks(validatorId).addUnnamedResource(fullPath);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getUnnamedCoreResources()
+ */
+ public Set<IPath> getUnnamedCoreResources(String validatorId) {
+ return getCoreLinks(validatorId).getUnnamedResources();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeUnnamedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void removeUnnamedCoreResource(String validatorId, IPath fullPath) {
+ getCoreLinks(validatorId).removeUnnamedResource(fullPath);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getUnnamedElResources()
+ */
+ public Set<IPath> getUnnamedElResources() {
+ return elLinks.getUnnamedResources();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeUnnamedElResource(org.eclipse.core.runtime.IPath)
+ */
+ public void removeUnnamedElResource(IPath fullPath) {
+ elLinks.removeUnnamedResource(fullPath);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addVariableNameForELValidation(java.lang.String)
+ */
+ public void addVariableNameForELValidation(String validatorId, String name) {
+ getOldVariableNamesForELValidation(validatorId).add(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedEls(java.util.Set)
+ */
+ public void removeLinkedEls(Set<IFile> resorces) {
+ elLinks.removeLinkedEls(resorces);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getElsForValidation(java.util.Set, boolean)
+ */
+ public Set<ELReference> getElsForValidation(Set<IFile> changedFiles, boolean onlyChangedVariables) {
+ Set<ELReference> result = new HashSet<ELReference>();
+ 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!=null && !oldVariableNamesForELValidation.contains(newName))) {
+ Set<ELReference> els = elLinks.getElsByVariableName(newName);
+ 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);
+ }
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#clearAll()
+ */
+ public void clearAll() {
+ for (LinkCollection links : coreLinks.values()) {
+ links.clearAll();
+ }
+ coreLinks.clear();
+ elLinks.clearAll();
+ oldVariableNamesForELValidation.clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#clearOldVariableNameForElValidation()
+ */
+ public void clearOldVariableNameForElValidation() {
+ oldVariableNamesForELValidation.clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @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) {
+ elLinks.addLinkedEl(variableName, el);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @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) {
+ elLinks.removeLinkedEl(name, el);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getElsByVariableName(java.lang.String)
+ */
+ public Set<ELReference> getElsByVariableName(String variableName) {
+ return elLinks.getElsByVariableName(variableName);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#store(org.w3c.dom.Element)
+ */
+ public void store(Element root) {
+ Element validation = XMLUtilities.createElement(root, "validation"); //$NON-NLS-1$
+ for (LinkCollection links : coreLinks.values()) {
+ Element core = XMLUtilities.createElement(validation, "core"); //$NON-NLS-1$
+ core.setAttribute("validator-id", links.getId()); //$NON-NLS-1$
+ links.store(core);
+ }
+ Element el = XMLUtilities.createElement(validation, "el"); //$NON-NLS-1$
+ elLinks.store(el);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#load(org.w3c.dom.Element)
+ */
+ public void load(Element root) {
+ Element validation = XMLUtilities.getUniqueChild(root, "validation"); //$NON-NLS-1$
+ if(validation == null) return;
+ Element[] cores = XMLUtilities.getChildren(validation, "core"); //$NON-NLS-1$
+ for (Element core : cores) {
+ String id = core.getAttribute("validator-id"); //$NON-NLS-1$
+ if(id!=null && id.trim().length()>0) {
+ getCoreLinks(id).load(core);
+ }
+ }
+ Element[] els = XMLUtilities.getChildren(validation, "el"); //$NON-NLS-1$
+ for (Element el : els) {
+ elLinks.load(el);
+ }
+ }
+
+ public int getModificationsSinceLastStore() {
+ int result = 0;
+ for (LinkCollection links : coreLinks.values()) {
+ result = result + links.getModificationsSinceLastStore();
+ }
+ result = result + elLinks.getModificationsSinceLastStore();
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IProjectValidationContext#setValidationResourceRegister(org.jboss.tools.jst.web.kb.internal.validation.ValidationResourceRegister)
+ */
+ public void setValidationResourceRegister(ValidationResourceRegister validationResourceRegister) {
+ this.validationResourceRegister = validationResourceRegister;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IProjectValidationContext#getValidationResourceRegister()
+ */
+ public ValidationResourceRegister getValidationResourceRegister() {
+ return validationResourceRegister;
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/SimpleValidatingProjectTree.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/SimpleValidatingProjectTree.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/SimpleValidatingProjectTree.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.validation.internal;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.validation.IProjectValidationContext;
+import org.jboss.tools.common.validation.IValidatingProjectSet;
+import org.jboss.tools.common.validation.IValidatingProjectTree;
+
+/**
+ * Represents a validating project tree with the only brunch.
+ * @author Alexey Kazakov
+ */
+public class SimpleValidatingProjectTree implements IValidatingProjectTree, IValidatingProjectSet {
+
+ private Map<IProject, IValidatingProjectSet> brunches = new HashMap<IProject, IValidatingProjectSet>();
+ private IValidatingProjectSet brunch;
+ private Set<IProject> validatingProjects = new HashSet<IProject>();
+
+ public SimpleValidatingProjectTree(IProject project) {
+ addProject(project);
+ }
+
+ public SimpleValidatingProjectTree(IValidatingProjectSet brunch) {
+ this.brunch = brunch;
+ brunches.put(brunch.getRootProject(), brunch);
+ validatingProjects.add(brunch.getRootProject());
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree#getBrunches()
+ */
+ public Map<IProject, IValidatingProjectSet> getBrunches() {
+ return brunches;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getRootProject()
+ */
+ public IProject getRootProject() {
+ return brunch.getRootProject();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getAllProjests()
+ */
+ public Set<IProject> getAllProjects() {
+ return brunch.getAllProjects();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getRootContext()
+ */
+ public IProjectValidationContext getRootContext() {
+ return brunch.getRootContext();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree#addProject(org.eclipse.core.resources.IProject)
+ */
+ public void addProject(IProject project) {
+ if(project!=null && !validatingProjects.contains(project)) {
+ Set<IProject> allProjects = new HashSet<IProject>();
+ allProjects.add(project);
+ brunch = new ValidatingProjectSet(project, allProjects, new ProjectValidationContext());
+ brunches.put(brunch.getRootProject(), brunch);
+ validatingProjects.add(project);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ValidatingProjectSet.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ValidatingProjectSet.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/internal/ValidatingProjectSet.java 2011-08-22 22:58:39 UTC (rev 34153)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.common.validation.internal;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.validation.IProjectValidationContext;
+import org.jboss.tools.common.validation.IValidatingProjectSet;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidatingProjectSet implements IValidatingProjectSet {
+
+ protected IProject rootProject;
+ protected Set<IProject> allProjects;
+ protected IProjectValidationContext rootContext;
+
+ protected ValidatingProjectSet() {
+ }
+
+ /**
+ * @param rootProject
+ * @param allProjects
+ * @param rootContext
+ */
+ public ValidatingProjectSet(IProject rootProject, Set<IProject> allProjects, IProjectValidationContext rootContext) {
+ this.rootProject = rootProject;
+ this.allProjects = allProjects;
+ this.rootContext = rootContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getAllProjests()
+ */
+ public Set<IProject> getAllProjects() {
+ return allProjects;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getRootContext()
+ */
+ public IProjectValidationContext getRootContext() {
+ return rootContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getRootProject()
+ */
+ public IProject getRootProject() {
+ return rootProject;
+ }
+}
\ No newline at end of file
14 years, 7 months
JBoss Tools SVN: r34152 - in trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui: marker and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-08-22 18:54:56 -0400 (Mon, 22 Aug 2011)
New Revision: 34152
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
Log:
https://issues.jboss.org/browse/JBIDE-9476
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-08-22 22:37:34 UTC (rev 34151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-08-22 22:54:56 UTC (rev 34152)
@@ -125,6 +125,7 @@
public static String ADD_QUALIFIERS_TO_BEAN_WIZARD_REMOVE;
public static String ADD_QUALIFIERS_TO_BEAN_WIZARD_REMOVE_ALL;
public static String ADD_QUALIFIERS_TO_BEAN_WIZARD_CREATE_NEW_QUALIFIER;
+ public static String ADD_QUALIFIERS_TO_BEAN_WIZARD_EDIT_QUALIFIER_VALUE;
public static String ADD_QUALIFIERS_TO_BEAN_WIZARD_SET_IS_NOT_UNIQUE;
public static String ADD_QUALIFIERS_TO_BEAN_WIZARD_ENTER_QUALIFIER_NAME;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-08-22 22:37:34 UTC (rev 34151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-08-22 22:54:56 UTC (rev 34152)
@@ -96,12 +96,11 @@
QUESTION=Question
DECREASING_FIELD_VISIBILITY_MAY_CAUSE_COMPILATION_PROBLEMS=Decreasing field visibility may cause compilation problems. Do you want to continue?
-
SELECT_BEAN_WIZARD_TITLE=Specify CDI Bean for the Injection Point
SELECT_BEAN_WIZARD_ENTER_BEAN_NAME=Enter CDI Bean name prefix or pattern (? = any character, * = any string):
SELECT_BEAN_WIZARD_SELECT_BEAN=Select CDI Bean:
-ADD_QUALIFIERS_TO_BEAN_WIZARD_TITLE=Add Qualifiers to the Bean
+ADD_QUALIFIERS_TO_BEAN_WIZARD_TITLE=Add/Remove Qualifiers to/from the Bean
ADD_QUALIFIERS_TO_BEAN_WIZARD_AVAILABLE=Available:
ADD_QUALIFIERS_TO_BEAN_WIZARD_IN_BEAN=In the Bean:
ADD_QUALIFIERS_TO_BEAN_WIZARD_MESSAGE=Move qualifiers to the right to add them to the ''{0}'' bean
@@ -110,6 +109,7 @@
ADD_QUALIFIERS_TO_BEAN_WIZARD_REMOVE=< Remove
ADD_QUALIFIERS_TO_BEAN_WIZARD_REMOVE_ALL=<< Remove All
ADD_QUALIFIERS_TO_BEAN_WIZARD_CREATE_NEW_QUALIFIER=Create New Qualifier...
+ADD_QUALIFIERS_TO_BEAN_WIZARD_EDIT_QUALIFIER_VALUE=Edit Value...
ADD_QUALIFIERS_TO_BEAN_WIZARD_SET_IS_NOT_UNIQUE=This set of qualifiers is not unique
ADD_QUALIFIERS_TO_BEAN_WIZARD_ENTER_QUALIFIER_NAME=Enter CDI Qualifier name prefix or pattern (? = any character, * = any string):
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-08-22 22:37:34 UTC (rev 34151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-08-22 22:54:56 UTC (rev 34152)
@@ -324,26 +324,6 @@
return false;
}
- public static void deleteQualifierAnnotation(ICompilationUnit compilationUnit, IJavaElement element, IQualifier qualifier) throws JavaModelException{
- if(element instanceof IAnnotatable){
- String fullName = qualifier.getSourceType().getFullyQualifiedName();
- String shortName = getShortName(fullName);
- IAnnotation annotation = ((IAnnotatable)element).getAnnotation(fullName);
- if(!annotation.exists()){
- annotation = ((IAnnotatable)element).getAnnotation(shortName);
- }
- if(annotation.exists()){
- IBuffer buffer = compilationUnit.getBuffer();
-
- buffer.replace(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), "");
-
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
- }
- }
- }
-
private static List<IQualifier> findQualifiersToDelete(IInjectionPoint injectionPoint, Set<IQualifierDeclaration> qualifiers){
ArrayList<IQualifier> list = new ArrayList<IQualifier>();
Set<IQualifierDeclaration> declarations = injectionPoint.getQualifierDeclarations();
@@ -445,7 +425,7 @@
List<IQualifier> toDelete = findQualifiersToDelete(injectionPoint, declarations);
for(IQualifier qualifier : toDelete){
- deleteQualifierAnnotation(compilationUnit, element, qualifier);
+ deleteAnnotation(qualifier.getSourceType().getFullyQualifiedName(), compilationUnit, element);
}
for(IQualifierDeclaration declaration : declarations){
@@ -479,10 +459,19 @@
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
+
+ for(IQualifierDeclaration declaration : bean.getQualifierDeclarations()){
+ IQualifier qualifier = declaration.getQualifier();
+ String qualifierName = qualifier.getSourceType().getFullyQualifiedName();
+ if(!deployed.contains(qualifier)){
+ deleteAnnotation(qualifierName, compilationUnit, beanElement);
+ }
+ }
+
for(IQualifier qualifier : deployed){
String qualifierName = qualifier.getSourceType().getFullyQualifiedName();
if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
- MarkerResolutionUtils.addAnnotation(qualifier.getSourceType().getFullyQualifiedName(), compilationUnit, beanElement);
+ MarkerResolutionUtils.addAnnotation(qualifierName, compilationUnit, beanElement);
}
}
@@ -616,6 +605,10 @@
if(checkImport(text, qualifiedName))
importDeclaration.delete(false, new NullProgressMonitor());
}
+
+ synchronized(compilationUnit) {
+ compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
}
}
@@ -675,13 +668,13 @@
return findQualifierValue(declaration);
}
- private static String findQualifierValue(IQualifierDeclaration declaration){
+ public static String findQualifierValue(IQualifierDeclaration declaration){
Object value = declaration.getMemberValue(null);
return value == null ? "" : value.toString();
}
- private static IQualifierDeclaration findQualifierDeclaration(IBean bean, IQualifier qualifier){
+ public static IQualifierDeclaration findQualifierDeclaration(IBean bean, IQualifier qualifier){
Set<IQualifierDeclaration> declarations = bean.getQualifierDeclarations();
if(declarations == null)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-08-22 22:37:34 UTC (rev 34151)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-08-22 22:54:56 UTC (rev 34152)
@@ -17,7 +17,6 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.Set;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -88,13 +87,13 @@
private WizardPage wizard;
private Text pattern;
- // original qualifiers on the bean
+ // original qualifiers on the bean without declarations it means they can not be deleted from bean
private ArrayList<ValuedQualifier> originalQualifiers = new ArrayList<ValuedQualifier>();
// qualifiers available to be added to the bean
private ArrayList<ValuedQualifier> qualifiers = new ArrayList<ValuedQualifier>();
- // current qualifiers on the bean
+ // original qualifiers on the bean with declaration + currently added qualifiers on the bean
private ArrayList<ValuedQualifier> deployed = new ArrayList<ValuedQualifier>();
// original + deployed
@@ -104,7 +103,7 @@
private TableViewer deployedTableViewer;
private Button add, addAll;
- private Button remove, removeAll;
+ private Button remove, editQualifierValue, removeAll;
private Label nLabel;
@@ -130,10 +129,19 @@
public void init(IBean bean){
this.bean = bean;
- originalQualifiers = new ArrayList<ValuedQualifier>();
+ originalQualifiers.clear();
+ deployed.clear();
for(IQualifier q : bean.getQualifiers()){
- String value = MarkerResolutionUtils.findQualifierValue(bean, q);
- originalQualifiers.add(new ValuedQualifier(q, value));
+ IQualifierDeclaration declaration = MarkerResolutionUtils.findQualifierDeclaration(bean, q);
+ if(declaration != null){
+ String value = MarkerResolutionUtils.findQualifierValue(declaration);
+ ValuedQualifier vq = new ValuedQualifier(q, value);
+ //originalQualifiers.add(vq);
+ //deployedTableViewer.add(vq);
+ deployed.add(vq);
+ }else{
+ originalQualifiers.add(new ValuedQualifier(q, ""));
+ }
}
defaultQualifier = new ValuedQualifier(bean.getCDIProject().getQualifier(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME));
@@ -146,8 +154,12 @@
}
}
- deployedTableViewer.setInput(originalQualifiers);
+ total.clear();
+ total.addAll(originalQualifiers);
+ total.addAll(deployed);
+ deployedTableViewer.setInput(total);
+
qualifiers.clear();
loadAvailableQualifiers();
@@ -465,6 +477,18 @@
}
});
+ label = new Label(this, SWT.NONE);
+ label.setText("");
+
+ label = new Label(this, SWT.NONE);
+ label.setText("");
+
+ editQualifierValue = new Button(this, SWT.PUSH);
+ editQualifierValue.setText(CDIUIMessages.ADD_QUALIFIERS_TO_BEAN_WIZARD_EDIT_QUALIFIER_VALUE);
+
+ editQualifierValue.addSelectionListener(new SelectionAdapter() {
+ });
+
setEnablement();
Dialog.applyDialogFont(this);
@@ -516,6 +540,7 @@
ms = getDeployedSelection();
if (ms == null || ms.length == 0) {
remove.setEnabled(false);
+ editQualifierValue.setEnabled(false);
} else {
boolean enabled = false;
for (int i = 0; i < ms.length; i++) {
@@ -529,8 +554,13 @@
}
}
remove.setEnabled(enabled);
+
+ if(enabled && ms.length == 1){
+ editQualifierValue.setEnabled(true);
+ }else{
+ editQualifierValue.setEnabled(false);
+ }
}
-
removeAll.setEnabled(deployed.size() > 0);
// check uniqueness of qualifiers
@@ -542,7 +572,7 @@
wizard.setPageComplete(isComplete);
}
-
+
protected void add(boolean all) {
if (all) {
ValuedQualifier[] qualifiers2 = new ValuedQualifier[qualifiers.size()];
14 years, 7 months
JBoss Tools SVN: r34150 - trunk/jbpm/tests/org.jboss.tools.jbpm.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-08-22 18:08:40 -0400 (Mon, 22 Aug 2011)
New Revision: 34150
Modified:
trunk/jbpm/tests/org.jboss.tools.jbpm.ui.bot.test/
Log:
screenshots and swtbot.properties added to ignored resources
Property changes on: trunk/jbpm/tests/org.jboss.tools.jbpm.ui.bot.test
___________________________________________________________________
Modified: svn:ignore
- target
buildlog.latest.txt
bin
build
+ target
buildlog.latest.txt
bin
build
screenshots
swtbot.properties
14 years, 7 months
JBoss Tools SVN: r34149 - in trunk/cdi/tests: org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-08-22 14:36:05 -0400 (Mon, 22 Aug 2011)
New Revision: 34149
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TD.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7636
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TD.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TD.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TD.java 2011-08-22 18:36:05 UTC (rev 34149)
@@ -0,0 +1,17 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+import javax.lang.model.element.Element;
+
+@Decorator
+(a)javax.inject.Named("aaa")
+public abstract class TD implements Element {
+
+ @Inject
+ @Delegate
+ @Any
+ private Element element;
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TD.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-08-22 18:13:36 UTC (rev 34148)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-08-22 18:36:05 UTC (rev 34149)
@@ -805,6 +805,17 @@
CDIValidationErrorManager.DECORATOR_HAS_NAME_ID,
DeleteAnnotationMarkerResolution.class);
}
+
+ public void testFullyQualifedNamedDecoratorResolution() throws CoreException{
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/TD.java",
+ },
+ CDICoreValidator.PROBLEM_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.DECORATOR_HAS_NAME_ID,
+ DeleteAnnotationMarkerResolution.class);
+ }
public void testTypedInStereotypeResolution() throws CoreException{
checkResolution(tckProject,
14 years, 7 months
JBoss Tools SVN: r34148 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-08-22 14:13:36 -0400 (Mon, 22 Aug 2011)
New Revision: 34148
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-7636
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-08-22 18:04:09 UTC (rev 34147)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-08-22 18:13:36 UTC (rev 34148)
@@ -296,6 +296,8 @@
IAnnotation annotation = ((IAnnotatable)element).getAnnotation(qualifiedName);
if (!annotation.exists()) {
annotation = ((IAnnotatable)element).getAnnotation(name);
+ }else{
+ return annotation;
}
IType type=null;
if(element instanceof IType){
14 years, 7 months
JBoss Tools SVN: r34147 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-08-22 14:04:09 -0400 (Mon, 22 Aug 2011)
New Revision: 34147
Modified:
trunk/build/pom-core.xml
Log:
add gwt site to pom-core.xml
Modified: trunk/build/pom-core.xml
===================================================================
--- trunk/build/pom-core.xml 2011-08-22 17:59:28 UTC (rev 34146)
+++ trunk/build/pom-core.xml 2011-08-22 18:04:09 UTC (rev 34147)
@@ -433,7 +433,16 @@
<modules>
<module>../gwt</module>
</modules>
- </profile>
+ <repositories>
+ <repository>
+ <id>gwt-e37</id>
+ <url>http://dl.google.com/eclipse/plugin/3.7/</url>
+ <layout>p2</layout>
+ <snapshots><enabled>true</enabled></snapshots>
+ <releases><enabled>true</enabled></releases>
+ </repository>
+ </repositories>
+ </profile>
<profile>
<id>deltacloud</id>
14 years, 7 months
JBoss Tools SVN: r34146 - trunk/requirements/smooks-1.2.4.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-08-22 13:59:28 -0400 (Mon, 22 Aug 2011)
New Revision: 34146
Modified:
trunk/requirements/smooks-1.2.4/build.properties
Log:
fix link to Smooks 1.2
Modified: trunk/requirements/smooks-1.2.4/build.properties
===================================================================
--- trunk/requirements/smooks-1.2.4/build.properties 2011-08-22 17:23:20 UTC (rev 34145)
+++ trunk/requirements/smooks-1.2.4/build.properties 2011-08-22 17:59:28 UTC (rev 34146)
@@ -1,5 +1,6 @@
#jbossas.build.uri=http://downloads.sourceforge.net/sourceforge/jboss
-smooks124.build.uri=http://downloads.sourceforge.net/project/smooks/Smooks\ v1.2/Smooks\ v1.2
+# Note: http://sourceforge.net/projects/smooks/files/Smooks%20v1.4/smooks-1.4.zip is available too
+smooks124.build.uri=http://downloads.sourceforge.net/project/smooks/Smooks%20v1.2/Smooks%20v1.2
smooks124.build.name=smooks-1.2.4
smooks124.build.archive=${smooks124.build.name}.zip
smooks124.build.archive.md5=d0fe4ce1965f24eee8e3f894882d0d50
14 years, 7 months