JBoss Tools SVN: r18108 - in trunk/hibernatetools/docs/reference/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2009-10-15 10:01:19 -0400 (Thu, 15 Oct 2009)
New Revision: 18108
Modified:
trunk/hibernatetools/docs/reference/en/images/plugins/dali_integration3.png
trunk/hibernatetools/docs/reference/en/modules/plugins.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-881 - DDL Generation wizard discription is updated
Modified: trunk/hibernatetools/docs/reference/en/images/plugins/dali_integration3.png
===================================================================
(Binary files differ)
Modified: trunk/hibernatetools/docs/reference/en/modules/plugins.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/plugins.xml 2009-10-15 13:48:55 UTC (rev 18107)
+++ trunk/hibernatetools/docs/reference/en/modules/plugins.xml 2009-10-15 14:01:19 UTC (rev 18108)
@@ -2324,8 +2324,8 @@
<para>By enabling Hibernate platform specific features you can now generate DDL and Entities.
For that find <emphasis>
- <property>JPA Tools > Generate DDL/Generate Entities</property>
- </emphasis> options in the context menu of your JPA project.</para>
+ <property>JPA Tools > Generate Tables from Entities/Generate Entities from Tables</property>
+ </emphasis> options in the context menu of your JPA project.</para>
<figure>
<title>Generate DDL/Entities</title>
@@ -2343,7 +2343,7 @@
project.</para>
</note>
- <para>The <property>Generate DDL/Entities wizards</property> first will ask you to choose the directory where all
+ <para>The <property>Generate Entities wizard</property> first will ask you to choose the directory where all
output will be written.</para>
<figure>
@@ -2386,6 +2386,15 @@
</listitem>
</itemizedlist>
+<para>All the same you do with Generate Entities Wizard you can do with Generate DDL wizard. Special feature for Generate DDL wizard is possible automatic execution of Generation DDL in the database. </para>
+ <figure>
+ <title>Generate DDL Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration6.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
<para>Thus, you can now have the Hibernate runtime support in Eclipse JPA projects.</para>
</section>
</chapter>
14 years, 8 months
JBoss Tools SVN: r18107 - in trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet: META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-10-15 09:48:55 -0400 (Thu, 15 Oct 2009)
New Revision: 18107
Added:
trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/plugin.properties
Modified:
trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/build.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-4571
missing provider names were fixed
Modified: trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/META-INF/MANIFEST.MF 2009-10-15 13:11:18 UTC (rev 18106)
+++ trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/META-INF/MANIFEST.MF 2009-10-15 13:48:55 UTC (rev 18107)
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Cheatsheet
+Bundle-Name: %pluginName
Bundle-SymbolicName: org.jboss.tools.bpel.cheatsheet;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.tools.bpel.cheatsheet.Activator
@@ -9,3 +9,4 @@
org.eclipse.ui.cheatsheets
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
Modified: trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/build.properties
===================================================================
--- trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/build.properties 2009-10-15 13:11:18 UTC (rev 18106)
+++ trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/build.properties 2009-10-15 13:48:55 UTC (rev 18107)
@@ -3,4 +3,5 @@
bin.includes = META-INF/,\
.,\
cheatsheets/,\
- plugin.xml
+ plugin.xml,\
+ plugin.properties
Added: trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/plugin.properties
===================================================================
--- trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/plugin.properties (rev 0)
+++ trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/plugin.properties 2009-10-15 13:48:55 UTC (rev 18107)
@@ -0,0 +1,2 @@
+pluginName=BPEL Cheatsheet
+providerName=JBoss by Red Hat
\ No newline at end of file
Property changes on: trunk/bpel/plugins/org.jboss.tools.bpel.cheatsheet/plugin.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 8 months
JBoss Tools SVN: r18106 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb: internal/validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-10-15 09:11:18 -0400 (Thu, 15 Oct 2009)
New Revision: 18106
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4978
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java 2009-10-15 13:11:18 UTC (rev 18106)
@@ -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.jst.web.kb;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class KbMessages {
+ private static final String BUNDLE_NAME = "org.jboss.tools.jst.web.kb.KBMessages"; //$NON-NLS-1$
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, KbMessages.class);
+ }
+
+ public static String VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL;
+ public static String VALIDATION_CONTEXT_VARIABLE_NAME_MUST_NOT_BE_NULL;
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties 2009-10-15 13:11:18 UTC (rev 18106)
@@ -0,0 +1,2 @@
+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\!
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbMessages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java 2009-10-15 13:11:18 UTC (rev 18106)
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+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.xml.XMLUtilities;
+import org.jboss.tools.jst.web.kb.validation.ELReference;
+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>>();
+
+ /**
+ * 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.
+ linkedEls.add(el);
+
+ // Save link between EL and variable names.
+ Set<String> variableNames = variableNamesByEl.get(el);
+ if(variableNames==null) {
+ variableNames = new HashSet<String>();
+ variableNamesByEl.put(el, variableNames);
+ }
+ variableNames.add(variableName);
+
+ // 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);
+ }
+ els.add(el);
+ }
+
+ 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) {
+ elsByResource.remove(resource.getFullPath());
+ 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) {
+ linkedEls.remove(el);
+ }
+ if(linkedEls.isEmpty()) {
+ elsByVariableName.remove(name);
+ }
+
+ // Remove link between EL and variable names.
+ Set<String> variableNames = variableNamesByEl.get(el);
+ if(variableNames!=null) {
+ variableNames.remove(name);
+ }
+ 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 ELReference();
+ el.load(linkedEls[i]);
+ el.setNeedToInitMarkers(true);
+ addLinkedEl(name, el);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java 2009-10-15 13:11:18 UTC (rev 18106)
@@ -0,0 +1,277 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+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.xml.XMLUtilities;
+import org.jboss.tools.jst.web.kb.KbMessages;
+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>();
+
+ /**
+ * 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(KbMessages.VALIDATION_CONTEXT_LINKED_RESOURCE_PATH_MUST_NOT_BE_NULL);
+ }
+ if(variableName==null) {
+ throw new IllegalArgumentException(KbMessages.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.
+ linkedResources.add(linkedResourcePath);
+ }
+
+ // 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);
+ }
+ variableNames.add(variableName);
+
+ 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.
+ linkedResources.add(linkedResourcePath);
+ }
+
+ // 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);
+ }
+ variableNames.add(variableName);
+ }
+ }
+
+ /**
+ * 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.
+ linkedResources.remove(linkedResourcePath);
+ }
+ if(linkedResources.isEmpty()) {
+ resourcesByVariableName.remove(name);
+ }
+ }
+ // Remove link between resource and declaring variable names.
+ Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
+ if(variableNames!=null) {
+ variableNames.remove(name);
+ }
+ if(variableNames.isEmpty()) {
+ variableNamesByResource.remove(linkedResourcePath);
+ }
+ synchronized(this) {
+ Set<IPath> linkedResources = resourcesByDeclaringVariableName.get(name);
+ if(linkedResources!=null) {
+ // remove linked resource.
+ linkedResources.remove(linkedResourcePath);
+ }
+ if(linkedResources.isEmpty()) {
+ resourcesByDeclaringVariableName.remove(name);
+ }
+ }
+ // Remove link between resource and declaring variable names.
+ variableNames = declaringVariableNamesByResource.get(linkedResourcePath);
+ if(variableNames!=null) {
+ variableNames.remove(name);
+ }
+ 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) {
+ linkedResources.remove(resource);
+ if(linkedResources.isEmpty()) {
+ resourcesByVariableName.remove(name);
+ }
+ }
+ }
+ }
+ variableNamesByResource.remove(resource);
+
+ resourceNames = declaringVariableNamesByResource.get(resource);
+ if(resourceNames!=null) {
+ for (String name : resourceNames) {
+ Set<IPath> linkedResources = resourcesByDeclaringVariableName.get(name);
+ if(linkedResources!=null) {
+ linkedResources.remove(resource);
+ if(linkedResources.isEmpty()) {
+ resourcesByDeclaringVariableName.remove(name);
+ }
+ }
+ }
+ }
+ declaringVariableNamesByResource.remove(resource);
+ }
+
+ 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) {
+ unnamedResources.add(fullPath);
+ }
+
+ /**
+ * @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) {
+ unnamedResources.remove(fullPath);
+ }
+
+ /**
+ * Clear all references
+ */
+ public synchronized void clearAll() {
+ resourcesByVariableName.clear();
+ variableNamesByResource.clear();
+ declaringVariableNamesByResource.clear();
+ resourcesByDeclaringVariableName.clear();
+ unnamedResources.clear();
+ }
+
+ /**
+ * 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$
+ }
+ }
+
+ 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;
+ }
+ /**
+ * 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);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/LinkCollection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java 2009-10-15 13:11:18 UTC (rev 18106)
@@ -0,0 +1,343 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import java.util.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.IPath;
+import org.jboss.tools.common.xml.XMLUtilities;
+import org.jboss.tools.jst.web.kb.validation.ELReference;
+import org.jboss.tools.jst.web.kb.validation.IValidationContext;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+import org.w3c.dom.Element;
+
+/**
+ * Contains information for validators that must be saved between
+ * validation invoking.
+ * @author Alexey Kazakov
+ */
+public class ProjectValidationContext implements IValidationContext {
+
+ // We should load/save these collections between eclipse sessions.
+ private LinkCollection coreLinks = new LinkCollection();
+ private ELValidatorContext elLinks = new ELValidatorContext();
+
+ private Set<IFile> removedFiles = new HashSet<IFile>();
+ private Set<IFile> registeredResources = new HashSet<IFile>();
+ private Set<String> oldVariableNamesForELValidation = new HashSet<String>();
+
+ /*
+ * (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 variableName, IPath linkedResourcePath, boolean declaration) {
+ coreLinks.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 name, IPath linkedResourcePath) {
+ coreLinks.removeLinkedResource(name, linkedResourcePath);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedCoreResources(java.util.Set)
+ */
+ public void removeLinkedCoreResources(Set<IPath> resources) {
+ coreLinks.removeLinkedResources(resources);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void removeLinkedCoreResource(IPath resource) {
+ coreLinks.removeLinkedResource(resource);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getCoreResourcesByVariableName(java.lang.String, boolean)
+ */
+ public Set<IPath> getCoreResourcesByVariableName(String variableName, boolean declaration) {
+ return coreLinks.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(IPath fullPath, boolean declaration) {
+ return coreLinks.getVariableNamesByResource(fullPath, declaration);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addUnnamedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void addUnnamedCoreResource(IPath fullPath) {
+ coreLinks.addUnnamedResource(fullPath);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getUnnamedCoreResources()
+ */
+ public Set<IPath> getUnnamedCoreResources() {
+ return coreLinks.getUnnamedResources();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#removeUnnamedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void removeUnnamedCoreResource(IPath fullPath) {
+ coreLinks.removeUnnamedResource(fullPath);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addUnnamedElResource(org.eclipse.core.runtime.IPath)
+ */
+ public void addUnnamedElResource(IPath fullPath) {
+ elLinks.addUnnamedResource(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 name) {
+ oldVariableNamesForELValidation.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>();
+ // Collect all ELs which use new variables names
+ for(IResource resource : changedFiles) {
+ Set<String> newNames = getVariableNamesByCoreResource(resource.getFullPath(), true);
+ if(newNames!=null) {
+ for (String newName : newNames) {
+ if(!onlyChangedVariables || !oldVariableNamesForELValidation.contains(newName)) {
+ Set<ELReference> els = elLinks.getElsByVariableName(newName);
+ if(els!=null) {
+ result.addAll(els);
+ }
+ }
+ }
+ }
+ for (String oldName : oldVariableNamesForELValidation) {
+ if(!onlyChangedVariables || newNames==null || !newNames.contains(oldName)) {
+ Set<ELReference> els = 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() {
+ removedFiles.clear();
+ synchronized (registeredResources) {
+ registeredResources.clear();
+ }
+ oldVariableNamesForELValidation.clear();
+ coreLinks.clearAll();
+ elLinks.clearAll();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#clearAllResourceLinks()
+ */
+ public void clearAllResourceLinks() {
+ oldVariableNamesForELValidation.clear();
+ coreLinks.clearAll();
+ elLinks.clearAll();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#clearRegisteredFiles()
+ */
+ public void clearRegisteredFiles() {
+ removedFiles.clear();
+ synchronized (registeredResources) {
+ registeredResources.clear();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#clearElResourceLinks()
+ */
+ public void clearElResourceLinks() {
+ oldVariableNamesForELValidation.clear();
+ elLinks.clearAll();
+ }
+
+ /*
+ * (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$
+ Element core = XMLUtilities.createElement(validation, "core"); //$NON-NLS-1$
+ coreLinks.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 core = XMLUtilities.getUniqueChild(validation, "core"); //$NON-NLS-1$
+ if(core != null) {
+ coreLinks.load(core);
+ }
+ Element el = XMLUtilities.getUniqueChild(validation, "el"); //$NON-NLS-1$
+ if(el != null) {
+ elLinks.load(el);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getRemovedFiles()
+ */
+ public Set<IFile> getRemovedFiles() {
+ return removedFiles;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#addRemovedFile(org.eclipse.core.resources.IFile)
+ */
+ public void addRemovedFile(IFile file) {
+ removedFiles.add(file);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getRegisteredFiles()
+ */
+ public Set<IFile> getRegisteredFiles() {
+ Set<IFile> copy = new HashSet<IFile>();
+ synchronized (registeredResources) {
+ copy.addAll(registeredResources);
+ }
+ return copy;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#registerFile(org.eclipse.core.resources.IFile)
+ */
+ public void registerFile(IFile file) {
+ synchronized (registeredResources) {
+ registeredResources.add(file);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getRootProject()
+ */
+ public IProject getRootProject() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getValidators()
+ */
+ public List<IValidator> getValidators() {
+ return null;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 8 months
JBoss Tools SVN: r18105 - in trunk: common/plugins/org.jboss.tools.common/src/org/jboss/tools/common and 18 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-10-15 08:31:45 -0400 (Thu, 15 Oct 2009)
New Revision: 18105
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityConfigurationBlock.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencePage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.properties
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.properties
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatingProjectSet.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidatingProjectSet.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextProvider.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java
trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.properties
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4978
Modified: trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2009-10-15 12:31:45 UTC (rev 18105)
@@ -13,14 +13,7 @@
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.jboss.tools.common;singleton:=true
Bundle-Localization: plugin
-Export-Package: org.jboss.tools.common,
- org.jboss.tools.common.log,
- org.jboss.tools.common.reporting,
- org.jboss.tools.common.text,
- org.jboss.tools.common.util,
- org.jboss.tools.common.xml,
- org.jboss.tools.common.zip,
- org.apache.commons.codec,
+Export-Package: org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.codec.digest,
org.apache.commons.codec.language,
@@ -127,6 +120,14 @@
org.apache.xml.resolver.readers,
org.apache.xml.resolver.tools,
org.apache.xml.serialize,
+ org.jboss.tools.common,
+ org.jboss.tools.common.log,
+ org.jboss.tools.common.preferences,
+ org.jboss.tools.common.reporting,
+ org.jboss.tools.common.text,
+ org.jboss.tools.common.util,
+ org.jboss.tools.common.xml,
+ org.jboss.tools.common.zip,
org.w3c.dom.html,
org.w3c.dom.ls
Require-Bundle: org.eclipse.core.runtime,
@@ -136,7 +137,9 @@
org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.wst.common.uriresolver;visibility:=reexport,
- org.eclipse.core.net
+ org.eclipse.core.net,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.ui
Bundle-Version: 2.0.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-ManifestVersion: 2
Added: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.preferences;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * Constants for names of seam preferences.
+ * Static accesses to seam preferences.
+ *
+ * Framework for Severity preferences.
+ * 1) Create a class which extends SeverityPreferences
+ * 2) Add constant using static method createSeverityOption(String)
+ * Put it under relevant section, e.g. //components, or create new section
+ * in the sub-class
+ * 3) Add in messages.properties in core plug-in of the sub-class
+ * error message with the same name
+ * 4) Add constant and property named <ID>ValidatorConfigurationBlock_pb_%name%_label,
+ * where %name% is produced from constant name in Preferences like AAA_BBB_CCC -> aaaBbbCcc
+ * to <ID>PreferencesMessages.java
+ * and <ID>PreferencesMessages.properties
+ * in UI plug-in.
+ * Put these entries under relevant section. For a new section add constant and property
+ * <ID>ValidatorConfigurationBlock_section_%newSectionName%
+ * 5) In class <ID>ValidatorConfigurationBlock (in UI plug-in)
+ * modify SectionDescription constants, according to instruction there.
+ *
+ * @author Viacheslav Kabanovich, Alexey Kazakov
+ */
+public abstract class SeverityPreferences {
+
+ public static final String ERROR = "error"; //$NON-NLS-1$
+ public static final String WARNING = "warning"; //$NON-NLS-1$
+ public static final String IGNORE = "ignore"; //$NON-NLS-1$
+
+ public static final String ENABLE = JavaCore.ENABLED;
+ public static final String DISABLE = JavaCore.DISABLED;
+
+ abstract protected Set<String> getSeverityOptionNames();
+
+ abstract protected String createSeverityOption(String shortName);
+
+ abstract protected String getPluginId();
+
+ public IEclipsePreferences getProjectPreferences(IProject project) {
+ return new ProjectScope(project).getNode(getPluginId());
+ }
+
+ public IEclipsePreferences getDefaultPreferences() {
+ return new DefaultScope().getNode(getPluginId());
+ }
+
+ public IEclipsePreferences getInstancePreferences() {
+ return new InstanceScope().getNode(getPluginId());
+ }
+
+ public String getProjectPreference(IProject project, String key) {
+ IEclipsePreferences p = getProjectPreferences(project);
+ if(p == null) {
+ return null;
+ }
+ String value = p.get(key, null);
+ return value != null ? value : getInstancePreference(key);
+ }
+
+ public String getInstancePreference(String key) {
+ IEclipsePreferences p = getInstancePreferences();
+ String value = p == null ? null : p.get(key, null);
+ return value != null ? value : getDefaultPreference(key);
+ }
+
+ public String getDefaultPreference(String key) {
+ IEclipsePreferences p = getDefaultPreferences();
+ if(p == null) {
+ return null;
+ }
+ return p.get(key, null);
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/preferences/SeverityPreferences.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -71,4 +71,9 @@
* @return last segment. May return null.
*/
ELSegment getLastSegment();
+
+ /**
+ * @return the number of resolved segments
+ */
+ int getNumberOfResolvedSegments();
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -207,4 +207,20 @@
}
return null;
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELResolution#getNumberOfResolvedSegments()
+ */
+ public int getNumberOfResolvedSegments() {
+ int i = 0;
+ for (ELSegment segment : segments) {
+ if(segment.isResolved()) {
+ i++;
+ } else {
+ break;
+ }
+ }
+ return i;
+ }
}
\ No newline at end of file
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityConfigurationBlock.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityConfigurationBlock.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityConfigurationBlock.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * 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.model.ui.preferences;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock;
+import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+
+/**
+ * Find in SeverirtyPreferences the instruction to Framework for Severity preferences
+ * To modify section descriptions:
+ * 1) If new option is to be added to existing description,
+ * add array of two String objects, where first is the preference name
+ * defined in SeverityPreferences, and second is label defined in
+ * SeverityPreferencesMessages (do not forget put property to SeverirtyPreferencesMessages.properties
+ * and constant to SeverityPreferencesMessages.java)
+ *
+ * 2) If new section named A is to be created create constant
+ * private static SectionDescription SECTION_A = new SectionDescription(
+ * SeamPreferencesMessages.SeamValidatorConfigurationBlock_section_a,
+ * new String[][]{
+ * }
+ * );
+ * create required constant and property in SeverityPreferencesMessages,
+ * and add SECTION_A to array ALL_SECTIONS.
+ *
+ * @author Viacheslav Kabanovich
+ */
+abstract public class SeverityConfigurationBlock extends OptionsConfigurationBlock {
+
+ protected static final String ERROR = SeverityPreferences.ERROR;
+ protected static final String WARNING = SeverityPreferences.WARNING;
+ protected static final String IGNORE = SeverityPreferences.IGNORE;
+
+ protected static final String ENABLED = JavaCore.ENABLED;
+ protected static final String DISABLED = JavaCore.DISABLED;
+
+ protected abstract Composite createStyleTabContent(Composite folder);
+
+ public SeverityConfigurationBlock(IStatusChangeListener context,
+ IProject project, Key[] allKeys,
+ IWorkbenchPreferenceContainer container) {
+ super(context, project, allKeys, container);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ setShell(parent.getShell());
+
+ Composite mainComp = new Composite(parent, SWT.NONE);
+ mainComp.setFont(parent.getFont());
+ GridLayout layout= new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ mainComp.setLayout(layout);
+
+ Composite commonComposite = createStyleTabContent(mainComp);
+ GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
+ gridData.heightHint = convertHeightInCharsToPixels(parent,20);
+ commonComposite.setLayoutData(gridData);
+
+ validateSettings(null, null, null);
+
+ return mainComp;
+ }
+
+ private int convertHeightInCharsToPixels(Control control,int chars) {
+ Font font = control.getFont();
+ GC gc = new GC(font.getDevice());
+ gc.setFont(font);
+ FontMetrics fFontMetrics = gc.getFontMetrics();
+ gc.dispose();
+ return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars);
+ }
+
+ @Override
+ protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
+ String title= SeverityPreferencesMessages.ValidatorConfigurationBlock_needsbuild_title;
+ String message;
+ if (workspaceSettings) {
+ message= SeverityPreferencesMessages.ValidatorConfigurationBlock_needsfullbuild_message;
+ } else {
+ message= SeverityPreferencesMessages.ValidatorConfigurationBlock_needsprojectbuild_message;
+ }
+ return new String[] { title, message };
+ }
+
+ @Override
+ protected void validateSettings(Key changedKey, String oldValue,
+ String newValue) {
+ if (!areSettingsEnabled()) {
+ return;
+ }
+
+ fContext.statusChanged(new StatusInfo());
+ }
+
+ public static class SectionDescription {
+ public String label;
+ public OptionDescription[] options;
+
+ public SectionDescription(String label, String[][] optionLabelsAndKeys, String pluginId) {
+ this.label = label;
+ options = new OptionDescription[optionLabelsAndKeys.length];
+ for (int i = 0; i < options.length; i++) {
+ options[i] = new OptionDescription(optionLabelsAndKeys[i][0], optionLabelsAndKeys[i][1], pluginId);
+ }
+ }
+ }
+
+ public static class OptionDescription {
+ public String label;
+ public Key key;
+
+ public OptionDescription(String keyName, String label, String pluginId) {
+ this.label = label;
+ key = getKey(pluginId, keyName);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityConfigurationBlock.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencePage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencePage.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencePage.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.model.ui.preferences;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public abstract class SeverityPreferencePage extends PropertyAndPreferencePage {
+
+ protected abstract SeverityConfigurationBlock getConfigurationBlock();
+
+ @Override
+ protected Control createPreferenceContent(Composite composite) {
+ return getConfigurationBlock().createContents(composite);
+ }
+
+ @Override
+ protected boolean hasProjectSpecificOptions(IProject project) {
+ return getConfigurationBlock().hasProjectSpecificOptions(project);
+ }
+
+ /*
+ * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+ */
+ @Override
+ public void dispose() {
+ if (getConfigurationBlock() != null) {
+ getConfigurationBlock().dispose();
+ }
+ super.dispose();
+ }
+
+ /*
+ * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#enableProjectSpecificSettings(boolean)
+ */
+ @Override
+ protected void enableProjectSpecificSettings(boolean useProjectSpecificSettings) {
+ super.enableProjectSpecificSettings(useProjectSpecificSettings);
+ if (getConfigurationBlock() != null) {
+ getConfigurationBlock().useProjectSpecificSettings(useProjectSpecificSettings);
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
+ */
+ @Override
+ protected void performDefaults() {
+ super.performDefaults();
+ if (getConfigurationBlock() != null) {
+ getConfigurationBlock().performDefaults();
+ }
+ }
+
+ /*
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ if (getConfigurationBlock() != null && !getConfigurationBlock().performOk()) {
+ return false;
+ }
+ return super.performOk();
+ }
+
+ /*
+ * @see org.eclipse.jface.preference.IPreferencePage#performApply()
+ */
+ @Override
+ public void performApply() {
+ if (getConfigurationBlock() != null) {
+ getConfigurationBlock().performApply();
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencePage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.model.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeverityPreferencesMessages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.jboss.tools.common.model.ui.preferences.SeverityPreferencesMessages"; //$NON-NLS-1$
+
+ public static String ValidatorConfigurationBlock_needsbuild_title;
+ public static String ValidatorConfigurationBlock_needsfullbuild_message;
+ public static String ValidatorConfigurationBlock_needsprojectbuild_message;
+
+ public static String VALIDATOR_CONFIGURATION_BLOCK_ERROR;
+ public static String VALIDATOR_CONFIGURATION_BLOCK_IGNORE;
+ public static String VALIDATOR_CONFIGURATION_BLOCK_WARNING;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, SeverityPreferencesMessages.class);
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.properties (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.properties 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,19 @@
+##################################################################################
+### Copyright (c) 2007 Red Hat, Inc.
+### Distributed under license by Red Hat, Inc. All rights reserved.
+### This program is made available under the terms of the
+### Eclipse Public License v1.0 which accompanies this distribution,
+### and is available at http://www.eclipse.org/legal/epl-v10.html
+###
+### Contributors:
+### Red Hat, Inc. - initial API and implementation
+##################################################################################
+
+#Preferences Page
+ValidatorConfigurationBlock_needsbuild_title=Validator Settings Changed
+ValidatorConfigurationBlock_needsfullbuild_message=The validator settings have changed. A full rebuild is required for changes to take effect. Do the full build now?
+ValidatorConfigurationBlock_needsprojectbuild_message=The validator settings have changed. A rebuild of the project is required for changes to take effect. Build the project now?
+
+VALIDATOR_CONFIGURATION_BLOCK_ERROR=Error
+VALIDATOR_CONFIGURATION_BLOCK_WARNING=Warning
+VALIDATOR_CONFIGURATION_BLOCK_IGNORE=Ignore
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/SeverityPreferencesMessages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2009-10-15 12:31:45 UTC (rev 18105)
@@ -6,8 +6,9 @@
Bundle-SymbolicName: org.jboss.tools.jsf;singleton:=true
Bundle-Localization: plugin
Export-Package: org.jboss.tools.jsf,
+ org.jboss.tools.jsf.facelet.model,
+ org.jboss.tools.jsf.jsf2.model,
org.jboss.tools.jsf.messages,
- org.jboss.tools.jsf.facelet.model,
org.jboss.tools.jsf.model,
org.jboss.tools.jsf.model.handlers,
org.jboss.tools.jsf.model.handlers.bean,
@@ -22,12 +23,13 @@
org.jboss.tools.jsf.model.impl,
org.jboss.tools.jsf.model.pv,
org.jboss.tools.jsf.model.pv.handler,
+ org.jboss.tools.jsf.preferences,
org.jboss.tools.jsf.project,
org.jboss.tools.jsf.project.capabilities,
org.jboss.tools.jsf.web,
org.jboss.tools.jsf.web.helpers.context,
org.jboss.tools.jsf.web.pattern,
- org.jboss.tools.jsf.jsf2.model
+ org.jboss.tools.jsf.web.validation
Require-Bundle: org.jboss.tools.jst.web;visibility:=reexport,
org.jboss.tools.jst.web.kb;visibility:=reexport,
org.jboss.tools.common.el.core,
@@ -40,7 +42,8 @@
org.eclipse.wst.common.frameworks,
org.eclipse.wst.common.modulecore,
org.eclipse.wst.validation,
- org.eclipse.jdt.core.manipulation;bundle-version="1.3.0"
+ org.eclipse.jdt.core.manipulation,
+ org.eclipse.jst.j2ee
Bundle-Version: 2.0.0
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2009-10-15 12:31:45 UTC (rev 18105)
@@ -462,4 +462,8 @@
</contribution>
</extension>
-</plugin>
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.tools.jsf.preferences.JSFPreferenceInitializer"/>
+ </extension>
+
+</plugin>
\ No newline at end of file
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.jboss.tools.jsf.JSFModelPlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class JSFPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ public JSFPreferenceInitializer() {}
+
+ @Override
+ public void initializeDefaultPreferences() {
+
+ IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(JSFModelPlugin.PLUGIN_ID);
+ for (String name : JSFSeverityPreferences.SEVERITY_OPTION_NAMES) {
+ defaultPreferences.put(name, JSFSeverityPreferences.ERROR);
+ }
+ defaultPreferences.put(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.IGNORE);
+ defaultPreferences.put(JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, JSFSeverityPreferences.WARNING);
+ defaultPreferences.put(JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, JSFSeverityPreferences.IGNORE);
+ defaultPreferences.put(JSFSeverityPreferences.EL_SYNTAX_ERROR, JSFSeverityPreferences.WARNING);
+ defaultPreferences.put(JSFSeverityPreferences.CHECK_VARS, JSFSeverityPreferences.ENABLE);
+ defaultPreferences.put(JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL, JSFSeverityPreferences.ENABLE);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFPreferenceInitializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.jsf.preferences;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jsf.JSFModelPlugin;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class JSFSeverityPreferences extends SeverityPreferences {
+
+ public static final Set<String> SEVERITY_OPTION_NAMES = new HashSet<String>();
+
+ private static JSFSeverityPreferences INSTANCE = new JSFSeverityPreferences();
+
+ // Expression Language
+
+ // Mark EL Variable name which we can't resolve.
+ public static final String UNKNOWN_EL_VARIABLE_NAME = INSTANCE.createSeverityOption("unknownElVariableName"); //$NON-NLS-1$
+ // Check "var" attributes.
+ public static final String CHECK_VARS = INSTANCE.createSeverityOption("checkVars"); //$NON-NLS-1$
+ // Re-validate unresolved ELs.
+ public static final String RE_VALIDATE_UNRESOLVED_EL = INSTANCE.createSeverityOption("revalidateUnresolvedEl"); //$NON-NLS-1$
+ // Mark EL Variable property name which we can't resolve.
+ public static final String UNKNOWN_EL_VARIABLE_PROPERTY_NAME = INSTANCE.createSeverityOption("unknownElVariablePropertyName"); //$NON-NLS-1$
+ // If Expression use property of bean and this property has only setter(getter) without getter(setter) then mark it.
+ public static final String UNPAIRED_GETTER_OR_SETTER = INSTANCE.createSeverityOption("unpairedGetterOrSetter"); //$NON-NLS-1$
+
+ public static final String EL_SYNTAX_ERROR = INSTANCE.createSeverityOption("elSyntaxError"); //$NON-NLS-1$
+
+ /**
+ * @return the only instance of JSFSeverityPreferences
+ */
+ public static JSFSeverityPreferences getInstance() {
+ return INSTANCE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#createSeverityOption(java.lang.String)
+ */
+ @Override
+ protected String createSeverityOption(String shortName) {
+ String name = getPluginId() + ".validator.problem." + shortName; //$NON-NLS-1$
+ SEVERITY_OPTION_NAMES.add(name);
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#getPluginId()
+ */
+ @Override
+ protected String getPluginId() {
+ return JSFModelPlugin.PLUGIN_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#getSeverityOptionNames()
+ */
+ @Override
+ protected Set<String> getSeverityOptionNames() {
+ return SEVERITY_OPTION_NAMES;
+ }
+
+ public static boolean shouldValidateEL(IProject project) {
+ return !(SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project, UNKNOWN_EL_VARIABLE_NAME)) &&
+ SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project, UNKNOWN_EL_VARIABLE_PROPERTY_NAME)) &&
+ SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project, EL_SYNTAX_ERROR)) &&
+ SeverityPreferences.IGNORE.equals(INSTANCE.getProjectPreference(project, UNPAIRED_GETTER_OR_SETTER)));
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/preferences/JSFSeverityPreferences.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,558 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.web.validation;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
+import org.eclipse.jdt.ui.text.IJavaPartitions;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.parser.LexicalToken;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
+import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.common.el.core.resolver.ELSegment;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.IVariable;
+import org.jboss.tools.common.el.core.resolver.JavaMemberELSegmentImpl;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
+import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
+import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
+import org.jboss.tools.jst.web.kb.validation.ELReference;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.validation.IValidationContext;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * EL Validator
+ * @author Alexey Kazakov
+ */
+public class ELValidator extends ValidationErrorManager implements IValidator {
+
+ protected static final String UNKNOWN_EL_VARIABLE_NAME_MESSAGE_ID = "UNKNOWN_EL_VARIABLE_NAME"; //$NON-NLS-1$
+ protected static final String UNKNOWN_EL_VARIABLE_PROPERTY_NAME_MESSAGE_ID = "UNKNOWN_EL_VARIABLE_PROPERTY_NAME"; //$NON-NLS-1$
+ protected static final String UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID = "UNPAIRED_GETTER_OR_SETTER"; //$NON-NLS-1$
+ protected static final String SYNTAX_ERROR_MESSAGE_ID = "EL_SYNTAX_ERROR"; //$NON-NLS-1$
+
+ protected static final String VALIDATING_EL_FILE_MESSAGE_ID = "VALIDATING_EL_FILE"; //$NON-NLS-1$
+
+ private ELResolver[] resolvers;
+ private ELParserFactory mainFactory;
+
+ private List<Var> varListForCurentValidatedNode = new ArrayList<Var>();
+ private IProject currentProject;
+ private IProject rootProject;
+ private IResource[] currentSources;
+ private IContainer webRootFolder;
+ private boolean revalidateUnresolvedELs = false;
+
+ public ELValidator() {
+ }
+
+ private boolean isEnabled(IProject project) {
+ return JSFSeverityPreferences.shouldValidateEL(project);
+ }
+
+ protected void init(IProject project, ContextValidationHelper validationHelper, ValidatorManager manager, IReporter reporter, IValidationContext validationContext) {
+ super.init(project, validationHelper, manager, reporter, validationContext);
+ resolvers = ELResolverFactoryManager.getInstance().getResolvers(project);
+ mainFactory = ELParserUtil.getDefaultFactory();
+ }
+
+ public IStatus validate(Set<IFile> changedFiles, IProject project, ContextValidationHelper validationHelper, ValidatorManager manager, IReporter reporter, IValidationContext validationContext) throws ValidationException {
+ init(project, validationHelper, manager, reporter, validationContext);
+ webRootFolder = null;
+ initRevalidationFlag();
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+
+ Set<IFile> filesToValidate = new HashSet<IFile>();
+ boolean containsJavaOrComponentsXml = false;
+ for (IFile file : changedFiles) {
+ filesToValidate.add(file);
+ if(!containsJavaOrComponentsXml) {
+ String fileName = file.getName().toLowerCase();
+ containsJavaOrComponentsXml = fileName.endsWith(".java") || fileName.endsWith(".properties") || fileName.equals("components.xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ if(containsJavaOrComponentsXml) {
+ if(revalidateUnresolvedELs) {
+ Set<IPath> unnamedResources = validationContext.getUnnamedElResources();
+ for (IPath path : unnamedResources) {
+ IFile file = wsRoot.getFile(path);
+ if(file.exists()) {
+ filesToValidate.add(file);
+ }
+ }
+ }
+ }
+
+ Set<ELReference> elsToValidate = validationContext.getElsForValidation(changedFiles, false);
+ validationContext.removeLinkedEls(filesToValidate);
+ for (IFile file : filesToValidate) {
+ if(!reporter.isCancelled()) {
+ validateFile(file);
+ }
+ }
+ if(revalidateUnresolvedELs) {
+ for (ELReference el : elsToValidate) {
+ if(!filesToValidate.contains(el.getResource())) {
+ validateEL(el);
+ }
+ }
+ }
+
+ validationContext.clearOldVariableNameForElValidation();
+ return OK_STATUS;
+ }
+
+ private void initRevalidationFlag() {
+ String revalidateUnresolvedELsString = JSFSeverityPreferences.getInstance().getProjectPreference(rootProject, JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL);
+ revalidateUnresolvedELs = JSFSeverityPreferences.ENABLE.equals(revalidateUnresolvedELsString);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidator#validateAll()
+ */
+ public IStatus validateAll(IProject project, ContextValidationHelper validationHelper, ValidatorManager manager, IReporter reporter, IValidationContext validationContext) throws ValidationException {
+ init(project, validationHelper, manager, reporter, validationContext);
+ webRootFolder = null;
+ initRevalidationFlag();
+ Set<IFile> files = validationContext.getRegisteredFiles();
+ for (IFile file : files) {
+ if(!reporter.isCancelled()) {
+ if(file.exists()) {
+ validateFile(file);
+ } else {
+ validationContext.removeUnnamedElResource(file.getFullPath());
+ }
+ }
+ }
+ return OK_STATUS;
+ }
+
+ private static final String JAVA_EXT = "java"; //$NON-NLS-1$
+
+ private boolean enabled = true;
+
+ private boolean shouldFileBeValidated(IFile file) {
+ IProject project = file.getProject();
+ if(currentProject==null || !project.equals(currentProject)) {
+ enabled = isEnabled(project);
+ }
+ if(!enabled) {
+ return false;
+ }
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)) {
+ // The resource is out of sync with the file system
+ // Just ignore this resource.
+ return false;
+ }
+ if(!project.equals(currentProject)) {
+ if(webRootFolder!=null && !project.equals(webRootFolder.getProject())) {
+ webRootFolder = null;
+ }
+ if(webRootFolder==null) {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ } catch (CoreException e) {
+ JSFModelPlugin.getDefault().logError(JSFValidationMessages.EL_VALIDATOR_ERROR_VALIDATING, e);
+ }
+ if(facetedProject!=null && facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET)!=null) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component!=null) {
+ IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new Path("/")); //$NON-NLS-1$
+ webRootFolder = webRootVirtFolder.getUnderlyingFolder();
+ }
+ }
+ }
+ currentProject = project;
+ currentSources = EclipseResourceUtil.getJavaSourceRoots(project);
+ }
+ // Validate all files from java source folders.
+ for (int i = 0; i < currentSources.length; i++) {
+ if(currentSources[i].getLocation().isPrefixOf(file.getLocation())) {
+ return true;
+ }
+ }
+ // If *.java is out of Java Source path then ignore it.
+ if(JAVA_EXT.equalsIgnoreCase(file.getFileExtension())) {
+ return false;
+ }
+ // Otherwise validate only files from Web-Content (in case of WTP project)
+ if(webRootFolder!=null) {
+ return webRootFolder.getLocation().isPrefixOf(file.getLocation());
+ }
+ return true;
+ }
+
+ private void validateFile(IFile file) {
+ if(!shouldFileBeValidated(file)) {
+ return;
+ }
+ removeAllMessagesFromResource(file);
+ displaySubtask(VALIDATING_EL_FILE_MESSAGE_ID, new String[]{file.getProject().getName(), file.getName()});
+ String ext = file.getFileExtension();
+ String content = null;
+ try {
+ content = FileUtil.readStream(file.getContents());
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ return;
+ }
+ if(ext.equalsIgnoreCase(JAVA_EXT)) {
+ validateJava(file, content);
+ } else {
+ validateDom(file, content);
+ }
+ }
+
+ private void validateEL(ELReference el) {
+ el.deleteMarkers();
+ for (ELExpression expresion : el.getEl()) {
+ validateELExpression(el, expresion);
+ }
+ }
+
+ private void validateJava(IFile file, String content) {
+ try {
+ FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
+ Document document = new Document(content);
+ scaner.setRange(document, 0, document.getLength());
+ IToken token = scaner.nextToken();
+ while(token!=null && token!=Token.EOF && !reporter.isCancelled()) {
+ if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
+ int length = scaner.getTokenLength();
+ int offset = scaner.getTokenOffset();
+ String value = document.get(offset, length);
+ if(value.indexOf('{')>-1) {
+ validateString(file, value, offset);
+ }
+ }
+ token = scaner.nextToken();
+ }
+ } catch (BadLocationException e) {
+ JSFModelPlugin.getDefault().logError(JSFValidationMessages.EL_VALIDATOR_ERROR_VALIDATING, e);
+ }
+ }
+
+ private void validateDom(IFile file, String content) {
+ varListForCurentValidatedNode.clear();
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager == null) {
+ // this can happen if plugin org.eclipse.wst.sse.core
+ // is stopping or uninstalled, that is Eclipse is shutting down.
+ // there is no need to report it, just stop validation.
+ return;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ validateChildNodes(file, document);
+ }
+ } catch (CoreException e) {
+ JSFModelPlugin.getDefault().logError(JSFValidationMessages.EL_VALIDATOR_ERROR_VALIDATING, e);
+ } catch (IOException e) {
+ JSFModelPlugin.getDefault().logError(JSFValidationMessages.EL_VALIDATOR_ERROR_VALIDATING, e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
+ }
+ return;
+ }
+
+ private void validateChildNodes(IFile file, Node parent) {
+ String preferenceValue = JSFSeverityPreferences.getInstance().getProjectPreference(rootProject, JSFSeverityPreferences.CHECK_VARS);
+ NodeList children = parent.getChildNodes();
+ for(int i=0; i<children.getLength() && !reporter.isCancelled(); i++) {
+ Node curentValidatedNode = children.item(i);
+ Var var = null;
+ if(Node.ELEMENT_NODE == curentValidatedNode.getNodeType()) {
+ if (JSFSeverityPreferences.ENABLE.equals(preferenceValue)) {
+ var = ElVarSearcher.findVar(curentValidatedNode, mainFactory);
+ }
+ if(var!=null) {
+ varListForCurentValidatedNode.add(var);
+ }
+ validateNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE);
+ } else if(Node.TEXT_NODE == curentValidatedNode.getNodeType()) {
+ validateNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_CONTENT);
+ }
+ validateChildNodes(file, curentValidatedNode);
+ if(var!=null) {
+ varListForCurentValidatedNode.remove(var);
+ }
+ }
+ }
+
+ private void validateNodeContent(IFile file, IStructuredDocumentRegion node, String regionType) {
+ ITextRegionList regions = node.getRegions();
+ for(int i=0; i<regions.size(); i++) {
+ ITextRegion region = regions.get(i);
+ if(region.getType() == regionType) {
+ String text = node.getFullText(region);
+ if(text.indexOf("{")>-1) { //$NON-NLS-1$
+ int offset = node.getStartOffset() + region.getStart();
+ validateString(file, text, offset);
+ }
+ }
+ }
+ }
+
+ /**
+ * @param offset - offset of string in file
+ * @param length - length of string in file
+ */
+ private void validateString(IFile file, String string, int offset) {
+ int startEl = string.indexOf("#{"); //$NON-NLS-1$
+ if(startEl>-1) {
+ ELParser parser = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = parser.parse(string);
+ List<ELInstance> is = model.getInstances();
+
+ ELReference elReference = new ELReference();
+ elReference.setResource(file);
+ elReference.setEl(is);
+ elReference.setLength(string.length());
+ elReference.setStartPosition(offset);
+
+ List<SyntaxError> errors = model.getSyntaxErrors();
+ if(!errors.isEmpty()) {
+ for (SyntaxError error: errors) {
+ IMarker marker = addError(SYNTAX_ERROR_MESSAGE_ID, JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()}, 1, offset + error.getPosition(), file);
+ elReference.addMarker(marker);
+ }
+ }
+ for (ELInstance i : is) {
+ if (reporter.isCancelled()) {
+ return;
+ }
+ if(!i.getErrors().isEmpty()) {
+ //Already reported syntax problem in this piece of EL.
+ continue;
+ }
+ validateELExpression(elReference, i.getExpression());
+ }
+ }
+ }
+
+ private void validateELExpression(ELReference elReference, ELExpression el) {
+ if(el == null) return;
+ List<ELInvocationExpression> es = el.getInvocations();
+ for (ELInvocationExpression token: es) {
+ validateElOperand(elReference, token);
+ }
+ }
+
+ private SimpleELContext context = new SimpleELContext();
+
+ private void validateElOperand(ELReference elReference, ELInvocationExpression operandToken) {
+ IFile file = elReference.getResource();
+ int documnetOffset = elReference.getStartPosition();
+ String operand = operandToken.getText();
+ String varName = operand;
+ int offsetOfVarName = documnetOffset + operandToken.getFirstToken().getStart();
+ int lengthOfVarName = varName.length();
+ boolean unresolvedTokenIsVariable = false;
+ if (!operand.endsWith(".")) { //$NON-NLS-1$
+ ELResolution resolution = null;
+ context.setVars(varListForCurentValidatedNode);
+ context.setElResolvers(resolvers);
+ context.setResource(file);
+ int maxNumberOfResolvedSegments = -1;
+ for (int i = 0; i < resolvers.length; i++) {
+ ELResolution elResolution = resolvers[i].resolve(context, operandToken);
+ if(elResolution.isResolved()) {
+ resolution = elResolution;
+ break;
+ }
+ int number = resolution.getNumberOfResolvedSegments();
+ if(number>maxNumberOfResolvedSegments) {
+ maxNumberOfResolvedSegments = number;
+ resolution = elResolution;
+ }
+ }
+
+ if(!resolution.isResolved()) {
+ Set<String> names = findVariableNames(operandToken);
+ for (String name : names) {
+ validationContext.addLinkedEl(name, elReference);
+ }
+ }
+
+ List<ELSegment> segments = resolution.getSegments();
+ List<IVariable> usedVariables = new ArrayList<IVariable>();
+ for (ELSegment segment : segments) {
+ if(!segment.getVariables().isEmpty()) {
+ usedVariables.addAll(segment.getVariables());
+ }
+ // Check pair for getter/setter
+ if(segment instanceof JavaMemberELSegmentImpl) {
+ JavaMemberELSegmentImpl javaSegment = (JavaMemberELSegmentImpl)segment;
+ if(!javaSegment.getUnpairedGettersOrSetters().isEmpty()) {
+ TypeInfoCollector.MethodInfo unpairedMethod = javaSegment.getUnpairedGettersOrSetters().values().iterator().next();
+ String methodName = unpairedMethod.getName();
+ String propertyName = javaSegment.getUnpairedGettersOrSetters().keySet().iterator().next();
+ String missingMethodName = JSFValidationMessages.EL_VALIDATOR_SETTER;
+ String existedMethodName = JSFValidationMessages.EL_VALIDATOR_GETTER;
+ if(methodName.startsWith("s")) { //$NON-NLS-1$
+ missingMethodName = existedMethodName;
+ existedMethodName = JSFValidationMessages.EL_VALIDATOR_SETTER;
+ }
+ int startPosition = documnetOffset + operandToken.getStartPosition();
+ int length = operandToken.getLength();
+ int startPr = operand.indexOf(propertyName);
+ if(startPr>-1) {
+ startPosition = startPosition + startPr;
+ length = propertyName.length();
+ }
+ IMarker marker = addError(UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID, JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, length, startPosition, file);
+ elReference.addMarker(marker);
+ }
+ }
+ }
+ // Save links between resource and used variables names
+ for(IVariable variable: usedVariables) {
+ validationContext.addLinkedEl(variable.getName(), elReference);
+ }
+
+ if (resolution.isResolved()) {
+ // It's valid EL.
+ return;
+ }
+
+ ELSegment segment = resolution.getUnresolvedSegment();
+ LexicalToken token = segment.getToken();
+
+ varName = token.getText();
+ if(varName == null) {
+ //This is syntax error case. Reported by parser.
+ return;
+ }
+ offsetOfVarName = documnetOffset + token.getStart();
+ lengthOfVarName = varName == null ? 0 : varName.length();
+ if(usedVariables.isEmpty()) {
+ unresolvedTokenIsVariable = true;
+ }
+ }
+ // Mark invalid EL
+ if(unresolvedTokenIsVariable) {
+ IMarker marker = addError(UNKNOWN_EL_VARIABLE_NAME_MESSAGE_ID, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
+ elReference.addMarker(marker);
+ } else {
+ IMarker marker = addError(UNKNOWN_EL_VARIABLE_PROPERTY_NAME_MESSAGE_ID, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
+ elReference.addMarker(marker);
+ }
+ }
+
+ private Set<String> findVariableNames(ELInvocationExpression invocationExpression){
+ Set<String> names = new HashSet<String>();
+ while(invocationExpression != null) {
+ if(invocationExpression instanceof ELPropertyInvocation) {
+ String name = ((ELPropertyInvocation)invocationExpression).getQualifiedName();
+ if(name != null) {
+ names.add(name);
+ }
+ }
+ invocationExpression = invocationExpression.getLeft();
+ }
+ return names;
+ }
+
+ @Override
+ protected String getPreference(IProject project, String preferenceKey) {
+ // TODO
+ return null;
+ }
+
+ public String getId() {
+ // TODO
+ return null;
+ }
+
+ public IValidatingProjectSet getValidatingProjects(IProject project) {
+ List<IProject> projects = new ArrayList<IProject>();
+ projects.add(project);
+ IKbProject kbProject = KbProjectFactory.getKbProject(project, false);
+ if(kbProject!=null) {
+ // IValidationContext context = kbProject.getValidationContext();
+
+ }
+ return null;
+ }
+
+ public boolean shouldValidate(IProject project) {
+ // TODO
+ return false;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,15 @@
+package org.jboss.tools.jsf.web.validation;
+
+import org.eclipse.osgi.util.NLS;
+
+public class JSFValidationMessages {
+ private static final String BUNDLE_NAME = "org.jboss.tools.jsf.web.validation.messages"; //$NON-NLS-1$
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, JSFValidationMessages.class);
+ }
+
+ public static String EL_VALIDATOR_ERROR_VALIDATING;
+ public static String EL_VALIDATOR_SETTER;
+ public static String EL_VALIDATOR_GETTER;
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/JSFValidationMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,23 @@
+#*******************************************************************************
+#* Copyright (c) 2007 Red Hat, Inc.
+#* Distributed under license by Red Hat, Inc. All rights reserved.
+#* This program is made available under the terms of the
+#* Eclipse Public License v1.0 which accompanies this distribution,
+#* and is available at http://www.eclipse.org/legal/epl-v10.html
+#*
+#* Contributors:
+#* Red Hat, Inc. - initial API and implementation
+#******************************************************************************/
+
+#Expression Language
+UNKNOWN_EL_VARIABLE_NAME="{0}" cannot be resolved
+UNKNOWN_EL_VARIABLE_PROPERTY_NAME="{0}" cannot be resolved
+UNPAIRED_GETTER_OR_SETTER=Property "{0}" has only {1}. {2} is missing.
+EL_SYNTAX_ERROR=EL syntax error: {0}.
+
+#Messages for Progress Monitor
+VALIDATING_EL_FILE=project "{0}"; EL in "{1}"
+
+EL_VALIDATOR_ERROR_VALIDATING=Error validating EL
+EL_VALIDATOR_SETTER=Setter
+EL_VALIDATOR_GETTER=Getter
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF 2009-10-15 12:31:45 UTC (rev 18105)
@@ -45,6 +45,7 @@
org.eclipse.gef,
org.eclipse.ui.workbench.texteditor,
org.eclipse.core.expressions,
+ org.eclipse.ui.forms,
org.jboss.tools.common.gef;bundle-version="2.0.0"
Bundle-Version: 2.0.0
Bundle-ActivationPolicy: lazy
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.properties 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.properties 2009-10-15 12:31:45 UTC (rev 18105)
@@ -23,6 +23,8 @@
PreferencePage_JSFImplementations=JSF Environment
PreferencePage_JSFPages=JSF Pages
PreferencePage_JSFFlowTabbed=JSF Flow Diagram
+PreferencePage_Validator=Validator
+PreferencePage_JSFValidator=JSF Validator
NewWizardCat_JBossTools=JBoss Tools
NewWizardCat_JSF=JSF
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-10-15 12:31:45 UTC (rev 18105)
@@ -30,9 +30,28 @@
class="org.jboss.tools.jsf.ui.preferences.JSFFlowTabbedPreferencesPage"
id="org.jboss.tools.jsf.ui.jsfflowdiagram"
name="%PreferencePage_JSFFlowTabbed"/>
+ <page
+ category="org.jboss.tools.jsf.ui"
+ class="org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"
+ id="org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"
+ name="%PreferencePage_Validator">
+ </page>
</extension>
-
-
+
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ name="%PreferencePage_JSFValidator"
+ class="org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"
+ id="org.jboss.tools.jsf.ui.propertyPages.JSFValidatorPreferencePage">
+ <enabledWhen>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test property="org.eclipse.core.resources.projectNature" value="org.jboss.tools.jsf.jsfnature"/>
+ </adapt>
+ </enabledWhen>
+ </page>
+ </extension>
+
<extension id="e" name="XML Editors" point="org.jboss.tools.common.model.ui.xmlEditor">
<xmlEditor
class="org.jboss.tools.jsf.ui.editor.FacesConfigEditor"
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class JSFSeverityPreferencesMessages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.jboss.tools.jsf.ui.preferences.JSFSeverityPreferencesMessages"; //$NON-NLS-1$
+
+ public static String JSF_VALIDATOR_CONFIGURATION_BLOCK_JSF_VALIDATOR_CONFIGURATION_BLOCK;
+ public static String JSF_VALIDATOR_PREFERENCE_PAGE_JSF_VALIDATOR;
+
+ //Validator Preference page
+ public static String JSFValidatorConfigurationBlock_common_description;
+
+ //Expression Language
+ public static String JSFValidatorConfigurationBlock_section_el;
+ public static String JSFValidatorConfigurationBlock_pb_elSyntaxError_label;
+ public static String JSFValidatorConfigurationBlock_pb_unknownElVariableName_label;
+ public static String JSFValidatorConfigurationBlock_pb_checkVars_label;
+ public static String JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label;
+ public static String JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label;
+ public static String JSFValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, JSFSeverityPreferencesMessages.class);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.properties (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.properties 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,25 @@
+##################################################################################
+### Copyright (c) 2007 Red Hat, Inc.
+### Distributed under license by Red Hat, Inc. All rights reserved.
+### This program is made available under the terms of the
+### Eclipse Public License v1.0 which accompanies this distribution,
+### and is available at http://www.eclipse.org/legal/epl-v10.html
+###
+### Contributors:
+### Red Hat, Inc. - initial API and implementation
+##################################################################################
+
+#Preferences Page
+JSFValidatorConfigurationBlock_common_description=Select the severity level for the following optional JSF Validator problems:
+
+##Expression Language
+JSFValidatorConfigurationBlock_section_el=Expression language
+JSFValidatorConfigurationBlock_pb_elSyntaxError_label=EL Syntax Error
+JSFValidatorConfigurationBlock_pb_unknownElVariableName_label=Variable cannot be resolved:
+JSFValidatorConfigurationBlock_pb_checkVars_label=Recognize "var" attributes
+JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label=Revalidate unresolved ELs automatically.
+JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label=Property cannot be resolved:
+JSFValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label=Unpaired Getter/Setter:
+
+JSF_VALIDATOR_CONFIGURATION_BLOCK_JSF_VALIDATOR_CONFIGURATION_BLOCK=JSFValidatorConfigurationBlock
+JSF_VALIDATOR_PREFERENCE_PAGE_JSF_VALIDATOR=JSF Validator
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFSeverityPreferencesMessages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.preferences;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
+import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.model.ui.preferences.SeverityConfigurationBlock;
+import org.jboss.tools.common.model.ui.preferences.SeverityPreferencesMessages;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
+
+/**
+ * Find the instruction to Framework for Severity preferences in SeverityConfigurationBlock.java
+ *
+ * @author Viacheslav Kabanovich
+ */
+public class JSFValidatorConfigurationBlock extends SeverityConfigurationBlock {
+ private static final String SETTINGS_SECTION_NAME = JSFSeverityPreferencesMessages.JSF_VALIDATOR_CONFIGURATION_BLOCK_JSF_VALIDATOR_CONFIGURATION_BLOCK;
+
+ private Button recognizeVarsCheckBox;
+ private Button revalidateUnresolvedElCheckBox;
+ private Combo elVariablesCombo;
+ private Combo elPropertiesCombo;
+
+ private static SectionDescription SECTION_EL = new SectionDescription(
+ JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_section_el,
+ new String[][] {
+ {JSFSeverityPreferences.EL_SYNTAX_ERROR, JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_elSyntaxError_label},
+ {JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariableName_label},
+ {JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label},
+ {JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label},
+ },
+ JSFModelPlugin.PLUGIN_ID
+ );
+
+ private static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
+ SECTION_EL,
+ };
+
+ private static Key[] getKeys() {
+ ArrayList<Key> keys = new ArrayList<Key>();
+ for (int i = 0; i < ALL_SECTIONS.length; i++) {
+ for (int j = 0; j < ALL_SECTIONS[i].options.length; j++) {
+ keys.add(ALL_SECTIONS[i].options[j].key);
+ }
+ }
+ keys.add(getKey(JSFModelPlugin.PLUGIN_ID, JSFSeverityPreferences.CHECK_VARS));
+ return keys.toArray(new Key[0]);
+ }
+
+ public JSFValidatorConfigurationBlock(IStatusChangeListener context,
+ IProject project,
+ IWorkbenchPreferenceContainer container) {
+ super(context, project, getKeys(), container);
+ }
+
+ @Override
+ protected Composite createStyleTabContent(Composite folder) {
+ String[] errorWarningIgnore = new String[] {ERROR, WARNING, IGNORE};
+ String[] enableDisableValues= new String[] {ENABLED, DISABLED};
+
+ String[] errorWarningIgnoreLabels = new String[] {
+ SeverityPreferencesMessages.VALIDATOR_CONFIGURATION_BLOCK_ERROR,
+ SeverityPreferencesMessages.VALIDATOR_CONFIGURATION_BLOCK_WARNING,
+ SeverityPreferencesMessages.VALIDATOR_CONFIGURATION_BLOCK_IGNORE
+ };
+
+ int nColumns = 3;
+
+ final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
+
+ Composite composite = sc1.getBody();
+ GridLayout layout= new GridLayout(nColumns, false);
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ composite.setLayout(layout);
+
+ Label description= new Label(composite, SWT.LEFT | SWT.WRAP);
+ description.setFont(description.getFont());
+ description.setText(JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_common_description);
+ description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, nColumns - 1, 1));
+
+ int defaultIndent = 0;
+
+ for (int i = 0; i < ALL_SECTIONS.length; i++) {
+ SectionDescription section = ALL_SECTIONS[i];
+ String label = section.label;
+ ExpandableComposite excomposite = createStyleSection(composite, label, nColumns);
+
+ Composite inner = new Composite(excomposite, SWT.NONE);
+ inner.setFont(composite.getFont());
+ inner.setLayout(new GridLayout(nColumns, false));
+ excomposite.setClient(inner);
+
+ for (int j = 0; j < section.options.length; j++) {
+ OptionDescription option = section.options[j];
+ label = option.label;
+ Combo combo = addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent);
+ if(option.label == JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariableName_label) {
+ elVariablesCombo = combo;
+ combo.addSelectionListener(new SelectionListener(){
+ public void widgetDefaultSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ });
+ } else if(option.label == JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label) {
+ elPropertiesCombo = combo;
+ combo.addSelectionListener(new SelectionListener(){
+ public void widgetDefaultSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ });
+ }
+ }
+
+ if(section==SECTION_EL) {
+ label = JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_checkVars_label;
+ recognizeVarsCheckBox = addCheckBox(inner, label, getKey(JSFModelPlugin.PLUGIN_ID, JSFSeverityPreferences.CHECK_VARS), enableDisableValues, defaultIndent);
+
+ label = JSFSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label;
+ revalidateUnresolvedElCheckBox = addCheckBox(inner, label, getKey(JSFModelPlugin.PLUGIN_ID, JSFSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL), enableDisableValues, defaultIndent);
+ }
+ }
+
+ IDialogSettings section = JSFModelPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
+ restoreSectionExpansionStates(section);
+
+ updateELCombox();
+
+ return sc1;
+ }
+
+ @Override
+ public void performDefaults() {
+ super.performDefaults();
+ updateELCombox();
+ }
+
+ private void updateELCombox() {
+ boolean enable = elPropertiesCombo.getSelectionIndex()!=2 || elVariablesCombo.getSelectionIndex()!=2;
+ recognizeVarsCheckBox.setEnabled(enable);
+ revalidateUnresolvedElCheckBox.setEnabled(enable);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorConfigurationBlock.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.preferences;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.model.ui.preferences.SeverityConfigurationBlock;
+import org.jboss.tools.common.model.ui.preferences.SeverityPreferencePage;
+import org.jboss.tools.jsf.JSFModelPlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class JSFValidatorPreferencePage extends SeverityPreferencePage {
+ public static final String PREF_ID = "org.jboss.tools.jsf.ui.preferences.JSFValidatorPreferencePage"; //$NON-NLS-1$
+ public static final String PROP_ID = "org.jboss.tools.jsf.ui.propertyPages.JSFValidatorPreferencePage"; //$NON-NLS-1$
+
+ private JSFValidatorConfigurationBlock fConfigurationBlock;
+
+ public JSFValidatorPreferencePage() {
+ setPreferenceStore(JSFModelPlugin.getDefault().getPreferenceStore());
+ setTitle(JSFSeverityPreferencesMessages.JSF_VALIDATOR_PREFERENCE_PAGE_JSF_VALIDATOR);
+ }
+
+ @Override
+ protected String getPreferencePageID() {
+ return PREF_ID;
+ }
+
+ @Override
+ protected String getPropertyPageID() {
+ return PROP_ID;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
+ fConfigurationBlock = new JSFValidatorConfigurationBlock(getNewStatusChangedListener(), getProject(), container);
+
+ super.createControl(parent);
+ }
+
+ @Override
+ protected SeverityConfigurationBlock getConfigurationBlock() {
+ return fConfigurationBlock;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFValidatorPreferencePage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-10-15 12:31:45 UTC (rev 18105)
@@ -13,7 +13,9 @@
org.eclipse.jface.text,
org.eclipse.wst.sse.core,
org.eclipse.wst.xml.ui;bundle-version="1.1.0",
- org.eclipse.jdt.ui;bundle-version="3.5.0"
+ org.eclipse.jdt.ui;bundle-version="3.5.0",
+ org.eclipse.wst.validation;bundle-version="1.2.102",
+ org.eclipse.ui.editors;bundle-version="3.5.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
@@ -22,5 +24,7 @@
org.jboss.tools.jst.web.kb.internal,
org.jboss.tools.jst.web.kb.internal.scanner,
org.jboss.tools.jst.web.kb.internal.taglib,
+ org.jboss.tools.jst.web.kb.internal.taglib.composite,
+ org.jboss.tools.jst.web.kb.internal.validation,
org.jboss.tools.jst.web.kb.taglib,
- org.jboss.tools.jst.web.kb.internal.taglib.composite
+ org.jboss.tools.jst.web.kb.validation
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2009-10-15 11:23:11 UTC (rev 18104)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2009-10-15 12:31:45 UTC (rev 18105)
@@ -2,6 +2,7 @@
<?eclipse version="3.0"?>
<plugin>
<extension-point id="tagLib" name="Kb Custom Tag Lib" schema="schema/tagLib.exsd"/>
+ <extension-point id="validator" name="KB Validator" schema="schema/validator.exsd"/>
<extension
id="kbbuilder"
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.jst.web.kb" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.jst.web.kb" id="validator" name="KB Validator"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="validator" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="validator">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.tools.jst.web.kb.validation.IValidator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="extends" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier" basedOn="org.jboss.tools.jst.web.kb.validator/validator/@id"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/validator.exsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+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.jboss.tools.jst.web.kb.validation.IValidationContext;
+
+/**
+ * Helper for Validators that use Validator Context.
+ * @author Alexey Kazakov
+ */
+public class ContextValidationHelper extends WorkbenchContext {
+
+ protected IValidationContext validationContext;
+ protected TextFileDocumentProvider documentProvider = new TextFileDocumentProvider();
+
+ /*
+ * (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(!file.exists()) {
+ getValidationContext().addRemovedFile(file);
+ } else {
+ getValidationContext().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();
+ for (int i = 0; i < uris.length; i++) {
+ IFile currentFile = root.getFile(new Path(uris[i]));
+ result.add(currentFile);
+ }
+ result.addAll(getValidationContext().getRemovedFiles());
+ return result;
+ }
+
+ public IValidationContext getValidationContext() {
+ if(validationContext==null) {
+ validationContext = new ValidationContext(getProject());
+ }
+ return validationContext;
+ }
+
+ public void setValidationContext(IValidationContext context) {
+ validationContext = context;
+ }
+
+ public TextFileDocumentProvider getDocumentProvider(){
+ return documentProvider;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ContextValidationHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatingProjectSet.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatingProjectSet.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatingProjectSet.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.validation.IValidationContext;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidatingProjectSet implements IValidatingProjectSet {
+
+ protected IProject rootProject;
+ protected List<IProject> allProjects;
+ protected IValidationContext rootContext;
+
+ /**
+ * @param rootProject
+ * @param allProjects
+ * @param rootContext
+ */
+ public ValidatingProjectSet(IProject rootProject, List<IProject> allProjects, IValidationContext rootContext) {
+ this.rootProject = rootProject;
+ this.allProjects = allProjects;
+ this.rootContext = rootContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getAllProjests()
+ */
+ public List<IProject> getAllProjests() {
+ return allProjects;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getRootContext()
+ */
+ public IValidationContext 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
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatingProjectSet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+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.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.validation.ELReference;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.validation.IValidationContext;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+import org.w3c.dom.Element;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class ValidationContext implements IValidationContext {
+
+ private IValidationContext rootContext;
+ private IProject rootProject;
+ private static List<IValidator> ALL_VALIDATORS;
+ private List<IValidator> validators;
+
+ public ValidationContext(IProject project) {
+ if(ALL_VALIDATORS == null) {
+ // Load all validators
+ ALL_VALIDATORS = new ArrayList<IValidator>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry.getExtensionPoint(IValidator.EXTENSION_POINT_ID);
+ if (extensionPoint != null) {
+ Map<String, IValidator> extendsIds = new HashMap<String, IValidator>();
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for(int j=0; j<elements.length; j++) {
+ try {
+ IValidator validator = (IValidator)elements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ String extendsId = elements[j].getAttribute("extends"); //$NON-NLS-1$
+ if(extendsId!=null) {
+ IValidator[] tempArray = ALL_VALIDATORS.toArray(new IValidator[0]);
+ for (IValidator vld : tempArray) {
+ if(extendsId.equals(vld.getId())) {
+ ALL_VALIDATORS.remove(vld);
+ }
+ }
+ extendsIds.put(extendsId, validator);
+ }
+ if(!extendsIds.containsKey(validator.getId())) {
+ ALL_VALIDATORS.add(validator);
+ }
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ }
+ }
+ }
+ }
+
+ // Init context for given project.
+ for (IValidator validator : ALL_VALIDATORS) {
+ if(validator.shouldValidate(project)) {
+ validators.add(validator);
+ }
+ }
+ for (IValidator validator : validators) {
+ IValidatingProjectSet prSet = validator.getValidatingProjects(project);
+ IProject vProject = prSet.getRootProject();
+ if(vProject!=project) {
+ rootProject = vProject;
+ rootContext = prSet.getRootContext();
+ } else if(rootContext==null) {
+ rootContext = prSet.getRootContext();
+ }
+ }
+ if(rootProject==null) {
+ rootProject = project;
+ }
+ }
+
+ /*
+ * (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#addLinkedCoreResource(java.lang.String, org.eclipse.core.runtime.IPath, boolean)
+ */
+ public void addLinkedCoreResource(String variableName, IPath linkedResourcePath, boolean declaration) {
+ rootContext.addLinkedCoreResource(variableName, linkedResourcePath, declaration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#addLinkedEl(java.lang.String, org.jboss.tools.seam.internal.core.validation.ELReference)
+ */
+ public void addLinkedEl(String variableName, ELReference el) {
+ rootContext.addLinkedEl(variableName, el);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#addRemovedFile(org.eclipse.core.resources.IFile)
+ */
+ public void addRemovedFile(IFile file) {
+ rootContext.addRemovedFile(file);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#addUnnamedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void addUnnamedCoreResource(IPath fullPath) {
+ rootContext.addUnnamedCoreResource(fullPath);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#addUnnamedElResource(org.eclipse.core.runtime.IPath)
+ */
+ public void addUnnamedElResource(IPath fullPath) {
+ rootContext.addUnnamedElResource(fullPath);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#addVariableNameForELValidation(java.lang.String)
+ */
+ public void addVariableNameForELValidation(String name) {
+ rootContext.addVariableNameForELValidation(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#clearAll()
+ */
+ public void clearAll() {
+ rootContext.clearAll();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#clearAllResourceLinks()
+ */
+ public void clearAllResourceLinks() {
+ rootContext.clearAllResourceLinks();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#clearElResourceLinks()
+ */
+ public void clearElResourceLinks() {
+ rootContext.clearElResourceLinks();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#clearOldVariableNameForElValidation()
+ */
+ public void clearOldVariableNameForElValidation() {
+ rootContext.clearOldVariableNameForElValidation();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#clearRegisteredFiles()
+ */
+ public void clearRegisteredFiles() {
+ rootContext.clearRegisteredFiles();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#getCoreResourcesByVariableName(java.lang.String, boolean)
+ */
+ public Set<IPath> getCoreResourcesByVariableName(String variableName, boolean declaration) {
+ return rootContext.getCoreResourcesByVariableName(variableName, declaration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#getElsByVariableName(java.lang.String)
+ */
+ public Set<ELReference> getElsByVariableName(String variableName) {
+ return rootContext.getElsByVariableName(variableName);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#getElsForValidation(java.util.Set, boolean)
+ */
+ public Set<ELReference> getElsForValidation(Set<IFile> changedFiles, boolean onlyChangedVariables) {
+ return rootContext.getElsForValidation(changedFiles, onlyChangedVariables);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#getRegisteredFiles()
+ */
+ public Set<IFile> getRegisteredFiles() {
+ return rootContext.getRegisteredFiles();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#getRemovedFiles()
+ */
+ public Set<IFile> getRemovedFiles() {
+ return rootContext.getRemovedFiles();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#getUnnamedCoreResources()
+ */
+ public Set<IPath> getUnnamedCoreResources() {
+ return rootContext.getUnnamedCoreResources();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#getUnnamedElResources()
+ */
+ public Set<IPath> getUnnamedElResources() {
+ return rootContext.getUnnamedElResources();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#getVariableNamesByCoreResource(org.eclipse.core.runtime.IPath, boolean)
+ */
+ public Set<String> getVariableNamesByCoreResource(IPath fullPath, boolean declaration) {
+ return rootContext.getVariableNamesByCoreResource(fullPath, declaration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#load(org.w3c.dom.Element)
+ */
+ public void load(Element root) {
+ rootContext.load(root);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#registerFile(org.eclipse.core.resources.IFile)
+ */
+ public void registerFile(IFile file) {
+ rootContext.registerFile(file);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#removeLinkedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void removeLinkedCoreResource(IPath resource) {
+ rootContext.removeLinkedCoreResource(resource);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#removeLinkedCoreResource(java.lang.String, org.eclipse.core.runtime.IPath)
+ */
+ public void removeLinkedCoreResource(String name, IPath linkedResourcePath) {
+ rootContext.removeLinkedCoreResource(name, linkedResourcePath);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#removeLinkedCoreResources(java.util.Set)
+ */
+ public void removeLinkedCoreResources(Set<IPath> resources) {
+ rootContext.removeLinkedCoreResources(resources);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#removeLinkedEl(java.lang.String, org.jboss.tools.seam.internal.core.validation.ELReference)
+ */
+ public void removeLinkedEl(String name, ELReference el) {
+ rootContext.removeLinkedEl(name, el);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#removeLinkedEls(java.util.Set)
+ */
+ public void removeLinkedEls(Set<IFile> resorces) {
+ rootContext.removeLinkedEls(resorces);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#removeUnnamedCoreResource(org.eclipse.core.runtime.IPath)
+ */
+ public void removeUnnamedCoreResource(IPath fullPath) {
+ rootContext.removeUnnamedCoreResource(fullPath);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#removeUnnamedElResource(org.eclipse.core.runtime.IPath)
+ */
+ public void removeUnnamedElResource(IPath fullPath) {
+ rootContext.removeUnnamedElResource(fullPath);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.validation.ISeamValidationContext#store(org.w3c.dom.Element)
+ */
+ public void store(Element root) {
+ rootContext.store(root);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#getRootProject()
+ */
+ public IProject getRootProject() {
+ return rootProject;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,297 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.internal.validation;
+
+import java.util.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.wst.validation.internal.TaskListUtility;
+import org.eclipse.wst.validation.internal.core.Message;
+import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
+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.model.project.ext.ITextSourceReference;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.jboss.tools.jst.web.kb.validation.IValidationContext;
+import org.jboss.tools.jst.web.kb.validation.IValidationErrorManager;
+
+/**
+ * @author Alexey Kazakov
+ */
+public abstract class ValidationErrorManager implements IValidationErrorManager {
+
+ 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 rootProject;
+ protected String markerId;
+ protected String baseName;
+ protected IValidationContext validationContext;
+
+ /**
+ * Constructor
+ */
+ public ValidationErrorManager() {
+ }
+
+ protected void init(IProject project, ContextValidationHelper validationHelper, ValidatorManager manager, IReporter reporter, IValidationContext validationContext) {
+ setRootProject(project);
+ setCoreHelper(validationHelper);
+ setValidationManager(manager);
+ setReporter(reporter);
+ setValidationContext(validationContext);
+ }
+
+ /**
+ * @param baseName the baseName to set
+ */
+ public void setBaseName(String baseName) {
+ this.baseName = baseName;
+ }
+
+ /**
+ * @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 setRootProject(IProject rootProject) {
+ this.rootProject = rootProject;
+ }
+
+ /**
+ * @param markerId the markerId to set
+ */
+ public void setMarkerId(String markerId) {
+ this.markerId = markerId;
+ }
+
+ /**
+ * @param validationContext the validationContext to set
+ */
+ public void setValidationContext(IValidationContext validationContext) {
+ this.validationContext = validationContext;
+ }
+
+ protected String getBaseName() {
+ return baseName;
+ }
+
+ /*
+ * (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 messageId, String preferenceKey,
+ String[] messageArguments, ITextSourceReference location,
+ IResource target) {
+ return addError(messageId, preferenceKey, messageArguments, 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 messageId, String preferenceKey,
+ ITextSourceReference location, IResource target) {
+ return addError(messageId, 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 messageId, String preferenceKey,
+ String[] messageArguments, IResource target) {
+ return addError(messageId, preferenceKey, messageArguments, 0, 0, target);
+ }
+
+ private String getMarkerId() {
+ return markerId;
+ }
+
+ /**
+ * @param project
+ * @param preferenceKey
+ * @return
+ */
+ protected abstract String getPreference(IProject project, String preferenceKey);
+
+ /*
+ * (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 messageId, String preferenceKey,
+ String[] messageArguments, int length, int offset, IResource target) {
+ String preferenceValue = getPreference(target.getProject(), preferenceKey);
+ boolean ignore = false;
+ int messageSeverity = IMessage.HIGH_SEVERITY;
+ if (SeverityPreferences.WARNING.equals(preferenceValue)) {
+ messageSeverity = IMessage.NORMAL_SEVERITY;
+ } else if (SeverityPreferences.IGNORE.equals(preferenceValue)) {
+ ignore = true;
+ }
+
+ if (ignore) {
+ return null;
+ }
+
+ IMessage message = new Message(getBaseName(), messageSeverity,
+ messageId, messageArguments, target,
+ getMarkerId());
+ message.setLength(length);
+ message.setOffset(offset);
+ try {
+ if (coreHelper != null) {
+ coreHelper.getDocumentProvider().connect(target);
+ message.setLineNo(coreHelper.getDocumentProvider().getDocument(
+ target).getLineOfOffset(offset) + 1);
+ }
+ } catch (BadLocationException e) {
+ WebKbPlugin.getDefault().logError(
+ "Exception occurred during error line number calculation",
+ e);
+ return null;
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(
+ "Exception occurred during error line number calculation",
+ e);
+ return null;
+ } finally {
+ if(coreHelper!=null) {
+ coreHelper.getDocumentProvider().disconnect(target);
+ }
+ }
+
+ int severity = message.getSeverity();
+ try {
+ return TaskListUtility.addTask(this.getClass().getName().intern(), target, ""+message.getLineNumber(), message.getId(),
+ message.getText(this.getClass().getClassLoader()), severity, null, message.getGroupName(), message.getOffset(), message.getLength());
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ return null;
+ }
+
+ /*
+ * (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 messageId, int severity, String[] messageArguments, int length, int offset, IResource target) {
+ IMessage message = new Message(getBaseName(), severity,
+ messageId, messageArguments, target,
+ getMarkerId());
+ message.setLength(length);
+ message.setOffset(offset);
+ try {
+ if (coreHelper != null) {
+ coreHelper.getDocumentProvider().connect(target);
+ message.setLineNo(coreHelper.getDocumentProvider().getDocument(
+ target).getLineOfOffset(offset) + 1);
+ }
+ } catch (BadLocationException e) {
+ WebKbPlugin.getDefault().logError(
+ "Exception occurred during error line number calculation",
+ e);
+ return null;
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(
+ "Exception occurred during error line number calculation",
+ e);
+ return null;
+ }
+
+ try {
+ return TaskListUtility.addTask(this.getClass().getName().intern(), target, ""+message.getLineNumber(), message.getId(),
+ message.getText(this.getClass().getClassLoader()), severity, null, message.getGroupName(), message.getOffset(), message.getLength());
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ return null;
+ }
+
+ /*
+ * (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 messageId, String[] messageArguments) {
+ IMessage message = new Message(getBaseName(), IMessage.NORMAL_SEVERITY,
+ messageId, messageArguments);
+ reporter.displaySubtask(validationManager, message);
+ }
+
+ /*
+ * (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[]{this.getClass().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[]{this.getClass().getName()}, null);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,119 @@
+ /*******************************************************************************
+ * 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.jst.web.kb.internal.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.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.jst.web.kb.validation.IValidator;
+
+/**
+ * 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 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 {
+ ContextValidationHelper validationHelper = (ContextValidationHelper)helper;
+ IProject project = validationHelper.getProject();
+ if(project==null) {
+ return OK_STATUS;
+ }
+ IProject rootProject = validationHelper.getValidationContext().getRootProject();
+ IStatus status = OK_STATUS;
+ synchronized (validatingProjects) {
+ if(validatingProjects.contains(rootProject)) {
+ return OK_STATUS;
+ }
+ validatingProjects.add(rootProject);
+ }
+ synchronized (validatingProjects) {
+ org.jboss.tools.jst.web.kb.validation.IValidationContext validationContext = null;
+ try {
+ validationContext = new ValidationContext(project);
+ validationHelper.setValidationContext(validationContext);
+
+ List<IValidator> validators = validationHelper.getValidationContext().getValidators();
+ Set<IFile> changedFiles = validationHelper.getChangedFiles();
+ if(!changedFiles.isEmpty()) {
+ status = validate(validators, changedFiles, rootProject, validationHelper, reporter);
+ } else if(!validationContext.getRegisteredFiles().isEmpty()) {
+ validationContext.clearAllResourceLinks();
+ status = validateAll(validators, rootProject, validationHelper, reporter);
+ }
+ } finally {
+ if(validationContext!=null) {
+ validationContext.clearRegisteredFiles();
+ }
+ validatingProjects.remove(rootProject);
+ }
+ }
+ return status;
+ }
+
+ private IStatus validate(List<IValidator> validators, Set<IFile> changedFiles, IProject rootProject, ContextValidationHelper validationHelper, IReporter reporter) throws ValidationException {
+ for (IValidator validator : validators) {
+ validator.validate(changedFiles, rootProject, validationHelper, this, reporter, validationHelper.getValidationContext());
+ }
+ return OK_STATUS;
+ }
+
+ private IStatus validateAll(List<IValidator> validators, IProject rootProject, ContextValidationHelper validationHelper, IReporter reporter) throws ValidationException {
+ for (IValidator validator : validators) {
+ validator.validateAll(rootProject, validationHelper, this, reporter, validationHelper.getValidationContext());
+ }
+ return OK_STATUS;
+ }
+
+ /*
+ * (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);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.validation;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
+import org.jboss.tools.common.model.project.ext.ITextSourceReference;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
+import org.w3c.dom.Element;
+
+/**
+ * Represents a reference to EL in a resource
+ * @author Alexey Kazakov
+ */
+public class ELReference implements ITextSourceReference {
+
+ private IFile resource;
+ private IPath path;
+ private int length;
+ private int startPosition;
+ private ELExpression[] el;
+ private Set<IMarker> markers;
+ private IMarker[] markerArray;
+ private boolean needToInitMarkers = false;
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamTextSourceReference#getLength()
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.core.ISeamTextSourceReference#getStartPosition()
+ */
+ public int getStartPosition() {
+ return startPosition;
+ }
+
+ /**
+ * @param length
+ */
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ /**
+ * @param startPosition
+ */
+ public void setStartPosition(int startPosition) {
+ this.startPosition = startPosition;
+ }
+
+ /**
+ * @return the resource
+ */
+ public IFile getResource() {
+ if(resource==null) {
+ IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ resource = wsRoot.getFile(path);
+ }
+ return resource;
+ }
+
+ /**
+ * @param resource the resource to set
+ */
+ public void setResource(IFile resource) {
+ this.resource = resource;
+ if(resource!=null) {
+ this.path = resource.getFullPath();
+ }
+ }
+
+ /**
+ * @return the path
+ */
+ public IPath getPath() {
+ return path;
+ }
+
+ /**
+ * @param path the path to set
+ */
+ public void setPath(IPath path) {
+ this.path = path;
+ }
+
+ /**
+ * @return the el
+ */
+ public ELExpression[] getEl() {
+ if(el==null) {
+ Set<ELExpression> exps = new HashSet<ELExpression>();
+ try {
+ String content = FileUtil.readStream(getResource().getContents());
+ String elText = content.substring(startPosition, startPosition + length);
+ int startEl = elText.indexOf("#{"); //$NON-NLS-1$
+ if(startEl>-1) {
+ ELParser parser = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = parser.parse(elText);
+ List<SyntaxError> errors = model.getSyntaxErrors();
+ if(!errors.isEmpty()) {
+ WebKbPlugin.getDefault().logWarning("ELObject hold incorrect information. Maybe resource " + getResource() + " has been changed.");
+ return null;
+ }
+ List<ELInstance> is = model.getInstances();
+ for (ELInstance i : is) {
+ if(!i.getErrors().isEmpty()) {
+ WebKbPlugin.getDefault().logWarning("ELObject hold incorrect information. Maybe resource " + getResource() + " has been changed.");
+ continue;
+ }
+ exps.add(i.getExpression());
+ }
+ }
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ el = exps.toArray(new ELExpression[0]);
+ }
+ return el;
+ }
+
+ /**
+ * @param el the el to set
+ */
+ public void setEl(ELExpression[] el) {
+ this.el = el;
+ }
+
+ /**
+ * @param insts
+ */
+ public void setEl(List<ELInstance> insts) {
+ Set<ELExpression> exps = new HashSet<ELExpression>();
+ for (ELInstance el : insts) {
+ exps.add(el.getExpression());
+ }
+ el = exps.toArray(new ELExpression[0]);
+ }
+
+ private IMarker[] EMPTY_MARKER_ARRAY = new IMarker[0];
+
+ private void initMarkers() {
+ if(markers==null) {
+ markers = new HashSet<IMarker>();
+ if(needToInitMarkers) {
+ IFile file = getResource();
+ if(file!=null) {
+ IMarker[] markers = null;
+ try {
+ markers = file.findMarkers(null, true, IResource.DEPTH_INFINITE);
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ for(int i=0; i<markers.length; i++){
+ String groupName = markers[i].getAttribute("groupName", null); //$NON-NLS-1$
+ if(groupName!=null && (groupName.equals(groupName.equals(IValidator.MARKED_RESOURCE_MESSAGE_GROUP)))) {
+ int start = markers[i].getAttribute(IMarker.CHAR_START, -1);
+ int end = markers[i].getAttribute(IMarker.CHAR_END, -1);
+ if(start>=startPosition && end<=startPosition+length) {
+ addMarker(markers[i]);
+ }
+ }
+ }
+ }
+ }
+ needToInitMarkers = false;
+ }
+ }
+
+ /**
+ * @param needToInitMarkers the needToInitMarkers to set
+ */
+ public synchronized void setNeedToInitMarkers(boolean needToInitMarkers) {
+ this.needToInitMarkers = needToInitMarkers;
+ }
+
+ public synchronized void setMarkers(Set<IMarker> markers) {
+ this.markers = markers;
+ }
+
+ /**
+ * @return the markers
+ */
+ public synchronized IMarker[] getMarkers() {
+ initMarkers();
+ if(markerArray==null) {
+ if(markers.isEmpty()) {
+ markerArray = EMPTY_MARKER_ARRAY;
+ } else {
+ markerArray = markers.toArray(new IMarker[0]);
+ }
+ }
+ return markerArray;
+ }
+
+ /**
+ * @param markers the markers to set
+ */
+ public synchronized void addMarker(IMarker marker) {
+ if(marker==null) {
+ return;
+ }
+ markerArray = null;
+ if(markers==null) {
+ markers = new HashSet<IMarker>();
+ }
+ markers.add(marker);
+ }
+
+ /**
+ * Removes all markers from this EL.
+ */
+ public synchronized void deleteMarkers() {
+ initMarkers();
+ for (IMarker marker : markers) {
+ try {
+ marker.delete();
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ }
+ markers.clear();
+ markerArray = null;
+ }
+
+ /**
+ * Store this EL into XML element.
+ * @param element
+ */
+ public synchronized void store(Element element) {
+ element.setAttribute("path", path.toString()); //$NON-NLS-1$
+ element.setAttribute("offset", "" + startPosition); //$NON-NLS-1$ //$NON-NLS-2$
+ element.setAttribute("length", "" + length); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Load this EL from XML element.
+ * @param element
+ */
+ public synchronized void load(Element element) {
+ path = new Path(element.getAttribute("path")); //$NON-NLS-1$
+ startPosition = new Integer(element.getAttribute("offset")); //$NON-NLS-1$
+ length = new Integer(element.getAttribute("length")); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj) {
+ return true;
+ }
+ ELReference el = (ELReference)obj;
+ return this.path.equals(el.path) && this.startPosition == el.startPosition;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return path.hashCode() + startPosition;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/ELReference.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidatingProjectSet.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidatingProjectSet.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidatingProjectSet.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -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.jst.web.kb.validation;
+
+import java.util.List;
+
+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 projects of the set.
+ */
+ List<IProject> getAllProjests();
+
+ /**
+ * @return Root validating context which is associated with the root project.
+ */
+ IValidationContext getRootContext();
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidatingProjectSet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.validation;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.w3c.dom.Element;
+
+/**
+ * Contains information for validators that must be saved between validation invoking.
+ * @author Alexey Kazakov
+ */
+public interface IValidationContext {
+
+ /**
+ * @return IProject which holds this context. One context could store information for a few dependent projects.
+ * But the only one project should store a context for all dependent projects. Such root project will be returned by this method.
+ */
+ IProject getRootProject();
+
+ /**
+ * 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 variableName, IPath linkedResourcePath, boolean declaration);
+
+ /**
+ * Removes link between core resource and variable name.
+ * @param oldVariableName
+ * @param linkedResourcePath
+ */
+ void removeLinkedCoreResource(String name, IPath linkedResourcePath);
+
+ /**
+ * Removes link between core resources and variable names.
+ * @param linkedResources
+ */
+ void removeLinkedCoreResources(Set<IPath> resources);
+
+ /**
+ * Removes link between core resource and variable names.
+ * @param linkedResource
+ */
+ void removeLinkedCoreResource(IPath resource);
+
+ Set<IPath> getCoreResourcesByVariableName(String variableName, boolean declaration);
+
+ Set<String> getVariableNamesByCoreResource(IPath fullPath, boolean declaration);
+
+ /**
+ * Adds core resource without any link to any context variable name.
+ * @param fullPath
+ */
+ void addUnnamedCoreResource(IPath fullPath);
+
+ /**
+ * @return Set of coreresources without any link to any context variable name.
+ * @param fullPath
+ */
+ Set<IPath> getUnnamedCoreResources();
+
+ /**
+ * Removes unnamed EL resource.
+ * @param fullPath
+ */
+ void removeUnnamedCoreResource(IPath fullPath);
+
+ /**
+ * Adds EL resource without any link to any context variable name.
+ * @param fullPath
+ */
+ void addUnnamedElResource(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 name);
+
+ void removeLinkedEls(Set<IFile> resorces);
+
+ /**
+ * Get ELs which should be validated
+ * @param changedFiles
+ * @param onlyChangedVariables
+ * @return
+ */
+ Set<ELReference> getElsForValidation(Set<IFile> changedFiles, boolean onlyChangedVariables);
+
+ void clearAll();
+
+ void clearAllResourceLinks();
+
+ void clearRegisteredFiles();
+
+ void clearElResourceLinks();
+
+ void clearOldVariableNameForElValidation();
+
+ /**
+ * 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);
+
+ Set<IFile> getRemovedFiles();
+
+ void addRemovedFile(IFile file);
+
+ Set<IFile> getRegisteredFiles();
+
+ void registerFile(IFile file);
+
+ /**
+ * @return a list of validators which are associated with this context.
+ */
+ List<IValidator> getValidators();
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContext.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextProvider.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextProvider.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.validation;
+
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IValidationContextProvider {
+
+ /**
+ * @return validation context
+ */
+ public IValidationContext getValidationContext();
+
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationContextProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,104 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.validation;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.jboss.tools.common.model.project.ext.ITextSourceReference;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface IValidationErrorManager {
+
+ /**
+ * Adds a marker to the resource
+ * @param messageId
+ * @param preferenceKey
+ * @param messageArguments
+ * @param location
+ * @param target
+ */
+ IMarker addError(String messageId, String preferenceKey,
+ String[] messageArguments, ITextSourceReference location,
+ IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param messageId
+ * @param preferenceKey
+ * @param messageArguments
+ * @param target
+ */
+ IMarker addError(String messageId, String preferenceKey,
+ String[] messageArguments,
+ IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param messageId
+ * @param preferenceKey
+ * @param location
+ * @param target
+ */
+ IMarker addError(String messageId, String preferenceKey,
+ ITextSourceReference location, IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param messageId
+ * @param preferenceKey
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ */
+ IMarker addError(String messageId, String preferenceKey,
+ String[] messageArguments, int length, int offset, IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param messageId
+ * @param severity
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ */
+ IMarker addError(String messageId, int severity, String[] messageArguments, int length, int offset, IResource target);
+
+ /**
+ * Displays a subtask in the progress view.
+ * @param messageId
+ */
+ void displaySubtask(String messageId);
+
+ /**
+ * Displays a subtask in the progress view.
+ * @param messageId
+ * @param messageArguments
+ */
+ void displaySubtask(String messageId, 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
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java 2009-10-15 12:31:45 UTC (rev 18105)
@@ -0,0 +1,63 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.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;
+import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
+
+/**
+ * Represents a validator that is managed by ValidatorManager.
+ * @author Alexey Kazakov
+ */
+public interface IValidator {
+
+ public static final String MARKED_RESOURCE_MESSAGE_GROUP = "markedKbResource"; //$NON-NLS-1$
+ public static final String RESOURCE_MESSAGE_ID = "org.jboss.tools.kb.problem"; //$NON-NLS-1$
+ public static final String EXTENSION_POINT_ID = "org.jboss.tools.jst.web.kb.validator"; //$NON-NLS-1$
+
+ /**
+ * Incremental Validation
+ * @return
+ * @throws ValidationException
+ */
+ IStatus validate(Set<IFile> changedFiles, IProject project, ContextValidationHelper validationHelper, ValidatorManager manager, IReporter reporter, IValidationContext validationContext) throws ValidationException;
+
+ /**
+ * Full Validation
+ * @return
+ * @throws ValidationException
+ */
+ IStatus validateAll(IProject project, ContextValidationHelper validationHelper, ValidatorManager manager, IReporter reporter, IValidationContext validationContext) throws ValidationException;
+
+ /**
+ * @return unique ID of the validator
+ */
+ String getId();
+
+ /**
+ * @param project
+ * @return a set of projects which should be validated with given project.
+ */
+ IValidatingProjectSet getValidatingProjects(IProject project);
+
+ /**
+ * @param project
+ * @return true if this validator should validate given project.
+ */
+ boolean shouldValidate(IProject project);
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 8 months
JBoss Tools SVN: r18104 - in trunk: common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-10-15 07:23:11 -0400 (Thu, 15 Oct 2009)
New Revision: 18104
Added:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java
Removed:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4856
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml 2009-10-15 09:22:41 UTC (rev 18103)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/plugin.xml 2009-10-15 11:23:11 UTC (rev 18104)
@@ -10,6 +10,23 @@
nature="org.jboss.tools.jsf.jsfnature">
</queryParticipant>
</extension>
+<extension
+ point="org.eclipse.ltk.core.refactoring.renameParticipants">
+ <renameParticipant
+ class="org.jboss.tools.common.el.ui.refactoring.RenameMethodParticipant"
+ id="org.jboss.tools.common.el.ui.refactoring.RenameMethodParticipant"
+ name="seam-RenameMethodParticipant">
+ <enablement>
+ <with
+ variable="element">
+ <or>
+ <instanceof
+ value="org.eclipse.jdt.core.IMethod">
+ </instanceof>
+ </or>
+ </with>
+ </enablement>
+ </renameParticipant>
+ </extension>
-
</plugin>
Deleted: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java 2009-10-15 09:22:41 UTC (rev 18103)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java 2009-10-15 11:23:11 UTC (rev 18104)
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.el.ui.refactoring;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IContainer;
-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.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
-import org.eclipse.ltk.internal.core.refactoring.Messages;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELMethodInvocation;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.refactoring.RefactorSearcher;
-import org.jboss.tools.common.el.ui.ElUiCoreMessages;
-
-public class RenameMethodParticipant extends RenameParticipant{
- private IMethod method;
- private String oldName;
- private String newName;
- private RenameMethodSearcher searcher;
- private RefactoringStatus status;
- private CompositeChange rootChange;
- private TextFileChange lastChange;
- private ArrayList<String> keys = new ArrayList<String>();
-
- private static boolean added = false;
-
-
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor pm,
- CheckConditionsContext context) throws OperationCanceledException {
- if(searcher == null)
- return status;
-
- if(method != null && !added){
- if(searcher.isGetter(method))
- status.addWarning(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_GETTER_WARNING);
- else if(searcher.isSetter(method))
- status.addWarning(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_SETTER_WARNING);
- added = true;
- }
-
- searcher.findELReferences();
-
- // TODO: find good phrase and externalize it
- //status.addWarning("Some cases may not be found.");
-
- return status;
- }
-
- @Override
- public Change createChange(IProgressMonitor pm) throws CoreException,
- OperationCanceledException {
- return rootChange;
- }
-
- @Override
- public String getName() {
- return oldName;
- }
-
- @Override
- protected boolean initialize(Object element) {
- if(element instanceof IMethod){
- status = new RefactoringStatus();
-
- rootChange = new CompositeChange("");
- method = (IMethod)element;
-
- oldName = method.getElementName();
-
- newName = getArguments().getNewName();
- searcher = new RenameMethodSearcher((IFile)method.getResource(), oldName);
- added = false;
- return true;
- }
- return false;
- }
-
- protected TextFileChange getChange(IFile file){
- if(lastChange != null && lastChange.getFile().equals(file))
- return lastChange;
-
- for(int i=0; i < rootChange.getChildren().length; i++){
- TextFileChange change = (TextFileChange)rootChange.getChildren()[i];
- if(change.getFile().equals(file)){
- lastChange = change;
- return lastChange;
- }
- }
- lastChange = new TextFileChange(file.getName(), file);
- MultiTextEdit root = new MultiTextEdit();
- lastChange.setEdit(root);
- rootChange.add(lastChange);
-
- return lastChange;
- }
-
- private void change(IFile file, int offset, int length, String text){
- //System.out.println("change file - "+file.getFullPath()+" offset - "+offset+" len - "+length+" text <"+text+">");
- String key = file.getFullPath().toString()+" "+offset;
- if(!keys.contains(key)){
- TextFileChange change = getChange(file);
- TextEdit edit = new ReplaceEdit(offset, length, text);
- change.addEdit(edit);
- keys.add(key);
- }
- }
-
- class RenameMethodSearcher extends RefactorSearcher{
- public RenameMethodSearcher(IFile file, String name){
- super(file, name, method);
- }
-
- @Override
- protected boolean isFileCorrect(IFile file) {
- if(!file.isSynchronized(IResource.DEPTH_ZERO)){
- status.addFatalError(Messages.format(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_OUT_OF_SYNC_FILE, file.getFullPath().toString()));
- return false;
- }else if(file.isPhantom()){
- status.addFatalError(Messages.format(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
- return false;
- }else if(file.isReadOnly()){
- status.addFatalError(Messages.format(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
- return false;
- }
- return true;
- }
-
- protected IProject[] getProjects(){
- IProject[] projects = new IProject[1];
- projects[0] = baseFile.getProject();
- return projects;
- }
-
- protected IContainer getViewFolder(IProject project){
- return null;
- }
-
-// protected ELInvocationExpression findComponentReference(ELInvocationExpression invocationExpression){
-// ELInvocationExpression invExp = invocationExpression;
-// while(invExp != null){
-// if(invExp instanceof ELMethodInvocation || invExp instanceof ELPropertyInvocation){
-// if(invExp.getMemberName() != null && invExp.getMemberName().equals(propertyName))
-// return invExp;
-// else
-// invExp = invExp.getLeft();
-// }else{
-// invExp = invExp.getLeft();
-// }
-// }
-// return null;
-// }
-
- @Override
- protected void match(IFile file, int offset, int length) {
- change(file, offset, length, newName);
- }
- }
-
-}
Added: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java 2009-10-15 11:23:11 UTC (rev 18104)
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * 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.el.ui.refactoring;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IContainer;
+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.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.ltk.internal.core.refactoring.Messages;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.jboss.tools.common.el.core.refactoring.ELProjectSetExtension;
+import org.jboss.tools.common.el.core.refactoring.ProjectsSet;
+import org.jboss.tools.common.el.core.refactoring.RefactorSearcher;
+import org.jboss.tools.common.el.ui.ElUiCoreMessages;
+import org.jboss.tools.common.model.project.ProjectHome;
+
+public class RenameMethodParticipant extends RenameParticipant{
+ private IMethod method;
+ private String oldName;
+ private String newName;
+ private SeamRenameMethodSearcher searcher;
+ private RefactoringStatus status;
+ private CompositeChange rootChange;
+ private TextFileChange lastChange;
+ private ArrayList<String> keys = new ArrayList<String>();
+
+ private static boolean added = false;
+
+
+ @Override
+ public RefactoringStatus checkConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws OperationCanceledException {
+ if(searcher == null)
+ return status;
+
+ if(method != null && !added){
+ if(searcher.isGetter(method))
+ status.addWarning(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_GETTER_WARNING);
+ else if(searcher.isSetter(method))
+ status.addWarning(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_SETTER_WARNING);
+ added = true;
+ }
+
+ searcher.findELReferences();
+
+ return status;
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ return rootChange;
+ }
+
+ @Override
+ public String getName() {
+ return oldName;
+ }
+
+ @Override
+ protected boolean initialize(Object element) {
+ if(element instanceof IMethod){
+ status = new RefactoringStatus();
+
+ rootChange = new CompositeChange("");
+ method = (IMethod)element;
+
+ oldName = method.getElementName();
+
+ newName = getArguments().getNewName();
+ searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
+ added = false;
+ return true;
+ }
+ return false;
+ }
+
+ protected TextFileChange getChange(IFile file){
+ if(lastChange != null && lastChange.getFile().equals(file))
+ return lastChange;
+
+ for(int i=0; i < rootChange.getChildren().length; i++){
+ TextFileChange change = (TextFileChange)rootChange.getChildren()[i];
+ if(change.getFile().equals(file)){
+ lastChange = change;
+ return lastChange;
+ }
+ }
+ lastChange = new TextFileChange(file.getName(), file);
+ MultiTextEdit root = new MultiTextEdit();
+ lastChange.setEdit(root);
+ rootChange.add(lastChange);
+
+ return lastChange;
+ }
+
+ private void change(IFile file, int offset, int length, String text){
+ String key = file.getFullPath().toString()+" "+offset;
+ if(!keys.contains(key)){
+ TextFileChange change = getChange(file);
+ TextEdit edit = new ReplaceEdit(offset, length, text);
+ change.addEdit(edit);
+ keys.add(key);
+ }
+ }
+
+ class SeamRenameMethodSearcher extends RefactorSearcher{
+ ProjectsSet projectSet=null;
+ public SeamRenameMethodSearcher(IFile file, String name){
+ super(file, name, method);
+ ELProjectSetExtension[] extensions = ELProjectSetExtension.getInstances();
+ if(extensions.length > 0){
+ projectSet = extensions[0].getProjectSet();
+ if(projectSet != null)
+ projectSet.init(file.getProject());
+ }
+ }
+
+ @Override
+ protected boolean isFileCorrect(IFile file) {
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ status.addFatalError(Messages.format(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_OUT_OF_SYNC_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isPhantom()){
+ status.addFatalError(Messages.format(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isReadOnly()){
+ status.addFatalError(Messages.format(ElUiCoreMessages.RENAME_METHOD_PARTICIPANT_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected void match(IFile file, int offset, int length) {
+ change(file, offset, length, newName);
+ }
+
+ protected IProject[] getProjects(){
+ if(projectSet != null){
+ return projectSet.getLinkedProjects();
+ }
+ return new IProject[]{baseFile.getProject()};
+ }
+
+ protected IContainer getViewFolder(IProject project){
+ if(projectSet != null){
+ return projectSet.getViewFolder(project);
+ }
+
+ IPath path = ProjectHome.getFirstWebContentPath(baseFile.getProject()).removeFirstSegments(1);
+
+ return baseFile.getProject().getFolder(path);
+ }
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-10-15 09:22:41 UTC (rev 18103)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-10-15 11:23:11 UTC (rev 18104)
@@ -532,21 +532,6 @@
</with>
</enablement>
</renameParticipant>
- <renameParticipant
- class="org.jboss.tools.seam.internal.core.refactoring.SeamRenameMethodParticipant"
- id="org.jboss.tools.seam.internal.core.refactoring.SeamRenameMethodParticipant"
- name="seam-RenameMethodParticipant">
- <enablement>
- <with
- variable="element">
- <or>
- <instanceof
- value="org.eclipse.jdt.core.IMethod">
- </instanceof>
- </or>
- </with>
- </enablement>
- </renameParticipant>
</extension>
<extension
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.java 2009-10-15 09:22:41 UTC (rev 18103)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.java 2009-10-15 11:23:11 UTC (rev 18104)
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.refactoring;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IContainer;
-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.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
-import org.eclipse.ltk.internal.core.refactoring.Messages;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELMethodInvocation;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.refactoring.RefactorSearcher;
-import org.jboss.tools.seam.core.SeamCoreMessages;
-import org.jboss.tools.seam.core.SeamProjectsSet;
-
-public class SeamRenameMethodParticipant extends RenameParticipant{
- private IMethod method;
- private String oldName;
- private String newName;
- private SeamRenameMethodSearcher searcher;
- private RefactoringStatus status;
- private CompositeChange rootChange;
- private TextFileChange lastChange;
- private ArrayList<String> keys = new ArrayList<String>();
-
- private static boolean added = false;
-
-
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor pm,
- CheckConditionsContext context) throws OperationCanceledException {
- if(searcher == null)
- return status;
-
- if(method != null && !added){
- if(searcher.isGetter(method))
- status.addWarning(SeamCoreMessages.SEAM_RENAME_METHOD_PARTICIPANT_GETTER_WARNING);
- else if(searcher.isSetter(method))
- status.addWarning(SeamCoreMessages.SEAM_RENAME_METHOD_PARTICIPANT_SETTER_WARNING);
- added = true;
- }
-
- searcher.findELReferences();
-
- // TODO: find good phrase and externalize it
- //status.addWarning("Some changes were not resolved.");
-
- return status;
- }
-
- @Override
- public Change createChange(IProgressMonitor pm) throws CoreException,
- OperationCanceledException {
- return rootChange;
- }
-
- @Override
- public String getName() {
- return oldName;
- }
-
- @Override
- protected boolean initialize(Object element) {
- if(element instanceof IMethod){
- status = new RefactoringStatus();
-
- rootChange = new CompositeChange("");
- method = (IMethod)element;
-
- oldName = method.getElementName();
-
- newName = getArguments().getNewName();
- searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
- added = false;
- return true;
- }
- return false;
- }
-
- protected TextFileChange getChange(IFile file){
- if(lastChange != null && lastChange.getFile().equals(file))
- return lastChange;
-
- for(int i=0; i < rootChange.getChildren().length; i++){
- TextFileChange change = (TextFileChange)rootChange.getChildren()[i];
- if(change.getFile().equals(file)){
- lastChange = change;
- return lastChange;
- }
- }
- lastChange = new TextFileChange(file.getName(), file);
- MultiTextEdit root = new MultiTextEdit();
- lastChange.setEdit(root);
- rootChange.add(lastChange);
-
- return lastChange;
- }
-
- private void change(IFile file, int offset, int length, String text){
- String key = file.getFullPath().toString()+" "+offset;
- if(!keys.contains(key)){
- TextFileChange change = getChange(file);
- TextEdit edit = new ReplaceEdit(offset, length, text);
- change.addEdit(edit);
- keys.add(key);
- }
- }
-
- class SeamRenameMethodSearcher extends SeamRefactorSearcher{
- public SeamRenameMethodSearcher(IFile file, String name){
- super(file, name, method);
- }
-
- @Override
- protected boolean isFileCorrect(IFile file) {
- if(!file.isSynchronized(IResource.DEPTH_ZERO)){
- status.addFatalError(Messages.format(SeamCoreMessages.SEAM_RENAME_PROCESSOR_OUT_OF_SYNC_FILE, file.getFullPath().toString()));
- return false;
- }else if(file.isPhantom()){
- status.addFatalError(Messages.format(SeamCoreMessages.SEAM_RENAME_PROCESSOR_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
- return false;
- }else if(file.isReadOnly()){
- status.addFatalError(Messages.format(SeamCoreMessages.SEAM_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
- return false;
- }
- return true;
- }
-
- @Override
- protected void match(IFile file, int offset, int length) {
- change(file, offset, length, newName);
- }
- }
-
-}
14 years, 8 months
JBoss Tools SVN: r18103 - trunk/hibernatetools/docs/reference/en/images/plugins.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-15 05:22:41 -0400 (Thu, 15 Oct 2009)
New Revision: 18103
Modified:
trunk/hibernatetools/docs/reference/en/images/plugins/dali_integration1.png
trunk/hibernatetools/docs/reference/en/images/plugins/dali_integration2.png
Log:
https://jira.jboss.org/jira/browse/JBDS-893 - updating the screenshots;
Modified: trunk/hibernatetools/docs/reference/en/images/plugins/dali_integration1.png
===================================================================
(Binary files differ)
Modified: trunk/hibernatetools/docs/reference/en/images/plugins/dali_integration2.png
===================================================================
(Binary files differ)
14 years, 8 months
JBoss Tools SVN: r18102 - trunk/jsf/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-15 03:51:32 -0400 (Thu, 15 Oct 2009)
New Revision: 18102
Modified:
trunk/jsf/docs/userguide/en/modules/editors.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-878 - renaming and restructuring the 'Advanced options' section (now 'VPE toolbar'), updating the screens and the description according to the new buttons added to the VPE toolbar;
Modified: trunk/jsf/docs/userguide/en/modules/editors.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/editors.xml 2009-10-15 07:46:21 UTC (rev 18101)
+++ trunk/jsf/docs/userguide/en/modules/editors.xml 2009-10-15 07:51:32 UTC (rev 18102)
@@ -863,52 +863,7 @@
</imageobject>
</mediaobject>
</figure>
-
-
- <para><property>Visual Page Editor</property> provides the option for displaying
- non-visual tags in Visual mode of the editor. To enable this option expand the
- submenu in the top left corner of the Visual part and select <emphasis>
- <property>Show Non-visual tags</property>.</emphasis></para>
-
- <figure>
- <title>Enabling the Option for Showing Non-visual Tags</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_4a.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>On the figure you can see non-visual elements with gray dashed borders.</para>
-
- <figure>
- <title>Non-visual Tag in the VPE</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_4b.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>To disable this option again expand the same submenu and select <emphasis>
- <property>Hide Non-visual tags</property>.</emphasis></para>
-
- <figure>
- <title>Non-visual Tag in the VPE</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_4c.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>You can also switch on this option in the VPE preferences, having clicked on the <emphasis><property>Preferences</property>
- </emphasis> button
- (<inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/icon_1.png"/>
- </imageobject>
- </inlinemediaobject>).</para>
+
<para>Visual Page Editor also displays custom tags correctly if they are configured properly.
The picture below shows an example how custom tags <emphasis><property>"pagination"</property></emphasis> and <emphasis><property>"echo"</property></emphasis> will be displayed in VPE.
</para>
@@ -927,10 +882,10 @@
<itemizedlist>
<listitem><para>echo.xhtml: </para>
<programlisting role="XML"><![CDATA[
- <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets">
- <span class="message">#{msg}</span>
- </ui:composition>
- ]]></programlisting></listitem>
+<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets">
+ <span class="message">#{msg}</span>
+</ui:composition>
+]]></programlisting></listitem>
<listitem><para>paginator.xhtml:</para>
@@ -1085,8 +1040,12 @@
<para>In the Visual part of the <property>VPE</property> there is a graphical
toolbar, use it to add inline styling to JSF and Struts tags on your page. The
- toolbar can be hidden by selecting the <emphasis>
- <property>Hide Text Formatting</property></emphasis> option in the submenu on the left pane.</para>
+ toolbar can be hidden with the help of the special button (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/formatting_bar_icon.png"/>
+ </imageobject>
+ </inlinemediaobject>) on the VPE toolbar.</para>
<figure>
<title>Text Formatting</title>
@@ -1345,73 +1304,104 @@
<section id="AdvancedSettings954">
- <title>Advanced Settings</title>
+ <title>VPE Toolbar</title>
- <para>In the left vertical pane of the Visual part there are four buttons: <emphasis>
- <property>Preferences</property></emphasis>
- (
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/icon_1.png"/>
- </imageobject>
- </inlinemediaobject>
- ),
+ <para>The Visual Page Editor toolbar includes the next buttons: </para>
-
-
-
- <emphasis>
- <property>Refresh</property>
- </emphasis>
- (
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/icon_2.png"/>
- </imageobject>
- </inlinemediaobject>
- )
- ,<emphasis>
- <property>Page Design Options</property> </emphasis>(
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/icon_3.png"/>
- </imageobject>
- </inlinemediaobject>
- )
- and some of the next buttons:
- <emphasis>
- <property>Vertical Source on top</property> </emphasis>(
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/source_top.png"/>
- </imageobject>
- </inlinemediaobject>),
- <emphasis>
- <property>Vertical Visual on top</property> </emphasis>(
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/source_bottom.png"/>
- </imageobject>
- </inlinemediaobject>),
- <emphasis>
- <property>Horizontal Source to the left</property> </emphasis>(
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/source_left.png"/>
- </imageobject>
- </inlinemediaobject>),
- <emphasis>
- <property>Horizontal Visual to the left</property> </emphasis>(
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/source_right.png"/>
- </imageobject>
- </inlinemediaobject>),
- depending on the current Visual/Source layout
- .</para>
-
+ <itemizedlist>
+ <listitem><para><link linkend="vpe_preferences">Preferences</link>
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/icon_1.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ )</para>
+ </listitem>
+
+ <listitem><para><link linkend="vpe_refresh">Refresh</link>
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/icon_2.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ )</para>
+ </listitem>
+
+ <listitem><para><link linkend="vpe_page_design_options">Page Design Options</link>
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/icon_3.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ )
+ </para>
+ </listitem>
+
+ <listitem>
+ <para><link linkend="splitting_buttons">the button to switch the current Visual/Source layout</link>
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/source_top.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para>
+ </listitem>
+
+ <listitem>
+ <para><link linkend="vpe_show_border">Show border for unknown tags</link>
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/show_border_button.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para>
+ </listitem>
+
+ <listitem>
+ <para><link linkend="vpe_show_nonvisual_tags">Show non-visual tags</link>
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/show_nonvisual.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para>
+ </listitem>
+
+ <listitem>
+ <para><link linkend="vpe_show_selection_bar">Show selection bar</link>
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/show_selection_bar.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para>
+ </listitem>
+
+ <listitem>
+ <para><link linkend="inline_styling">Show text formatting bar</link>
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/formatting_bar_icon.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para>
+ </listitem>
+
+ <listitem>
+ <para>Show bundle's messages as EL expressions (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/show_bundles_mess_button.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para>
+ </listitem>
+ </itemizedlist>
+
<figure>
- <title>Buttons on the Visual Part of VPE</title>
+ <title>Buttons on the VPE Toolbar</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/visual_page/visual_page_8.png"/>
@@ -1419,293 +1409,345 @@
</mediaobject>
</figure>
- <itemizedlist>
- <listitem id="vpe_preferences">
- <para><emphasis>
- <property>Preferences</property>
- </emphasis> button
- (
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/icon_1.png"/>
- </imageobject>
- </inlinemediaobject>
- )
- provides a quick access to <property>Visual Page
- Editor</property> preferences.</para>
-
- <figure>
- <title>Visual Page Editor Preferences Window</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_9.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>This page provides a number of options associated with the editor representation.
- The more detailed description on each one you can find in the <property>"JBoss Tools Preferences"</property> chapter
- under <link linkend="VisualPageEditor2">Visual Page Editor</link>.</para>
-
- </listitem>
- <listitem>
- <para>Clicking on <emphasis>
- <property>Refresh</property>
- </emphasis> button
- (
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/icon_2.png"/>
- </imageobject>
- </inlinemediaobject>
- )
- you refresh the displayed information.</para>
- </listitem>
-
- <listitem>
- <para><emphasis>
- <property>Page Design Options</property>
- </emphasis> button
- (
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/icon_3.png"/>
- </imageobject>
- </inlinemediaobject>
- )
- leads to a window which helps you specify necessary
- references of the resources. It is represented by a window with 4 tabs. The
- first one, <emphasis>
- <property>Actual Run-Time folders</property>,
- </emphasis> is used to replace absolute and relative path values when
- generating a preview: </para>
- <figure>
- <title>Page Design Options: Actual Run-Time folders</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_10.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
-
- <para>The second tab, <emphasis>
- <property>Included CSS files</property>
- </emphasis>, is used to add CSS files to be linked by Visual Page Editor
- when generating a preview:</para>
-
- <figure>
- <title>Page Design Options: Included CSS files</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_10_2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>The third one, <emphasis>
- <property>Included tag libs</property></emphasis>, can be used to add Taglibs that can be used by the editor for
- getting appropriate templates to generate a preview:</para>
-
- <figure>
- <title>Page Design Options: Included tag libs</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_10_3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para id="el_exp_para">And finally, the <emphasis>
- <property>Substituted El expressions</property>
- </emphasis> tab is used to add El expressions that will be substituted by
- the editor when generating a preview:</para>
-
- <figure>
- <title>Page Design Options: Substituted El expressions</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_10_4.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
-
- <para>The first two tabs of the window let you define actual runtime folders.
- The example below will help you understand how this can be done.</para>
-
- <para>Suppose you have the following project structure:</para>
-
- <programlisting role="XML"><![CDATA[WebContent/
+ <section id="vpe_preferences">
+ <title>Preferences</title>
+
+ <para>The <emphasis>
+ <property>Preferences</property>
+ </emphasis> button
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/icon_1.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ )
+ provides a quick access to the <property>Visual Page
+ Editor</property> preferences.</para>
+
+ <figure>
+ <title>Visual Page Editor Preferences Window</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_9.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>This page provides a number of options associated with the editor representation.
+ The more detailed description on each one you can find in the <property>"JBoss Tools Preferences"</property> chapter
+ under <link linkend="VisualPageEditor2">Visual Page Editor</link>.</para>
+ </section>
+
+ <section id="vpe_refresh">
+ <title>Refresh</title>
+
+ <para>Clicking on the <emphasis>
+ <property>Refresh</property>
+ </emphasis> button
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/icon_2.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ )
+ refreshes the displayed information.</para>
+ </section>
+
+ <section id="vpe_page_design_options">
+ <title>Page Design Options</title>
+
+ <para>The <emphasis>
+ <property>Page Design Options</property>
+ </emphasis> button
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/icon_3.png"/>
+ </imageobject>
+ </inlinemediaobject>
+ )
+ leads to a window which helps you specify necessary
+ references of the resources. It is represented by a window with 4 tabs. The
+ first one, <emphasis>
+ <property>Actual Run-Time folders</property>,
+ </emphasis> is used to replace absolute and relative path values when
+ generating a preview: </para>
+ <figure>
+ <title>Page Design Options: Actual Run-Time folders</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_10.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+
+ <para>The second tab, <emphasis>
+ <property>Included CSS files</property>
+ </emphasis>, is used to add CSS files to be linked by Visual Page Editor
+ when generating a preview:</para>
+
+ <figure>
+ <title>Page Design Options: Included CSS files</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_10_2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>The third one, <emphasis>
+ <property>Included tag libs</property></emphasis>, can be used to add Taglibs that can be used by the editor for
+ getting appropriate templates to generate a preview:</para>
+
+ <figure>
+ <title>Page Design Options: Included tag libs</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_10_3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para id="el_exp_para">And finally, the <emphasis>
+ <property>Substituted El expressions</property>
+ </emphasis> tab is used to add El expressions that will be substituted by
+ the editor when generating a preview:</para>
+
+ <figure>
+ <title>Page Design Options: Substituted El expressions</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_10_4.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+
+ <para>The first two tabs of the window let you define actual runtime folders.
+ The example below will help you understand how this can be done.</para>
+
+ <para>Suppose you have the following project structure:</para>
+
+ <programlisting role="XML"><![CDATA[WebContent/
pages/
img/
a.gif
header.jsp
main.jsp
]]></programlisting>
-
- <para>The content of the <emphasis>
- <property>header.jsp</property>
- </emphasis> is:</para>
- <programlisting role="XML"><![CDATA[My Header
+
+ <para>The content of the <emphasis>
+ <property>header.jsp</property>
+ </emphasis> is:</para>
+ <programlisting role="XML"><![CDATA[My Header
<img src="img/a.gif"/>
]]></programlisting>
- <para>and <emphasis>
- <property>main.jsp</property>
- </emphasis> content is:</para>
- <programlisting role="XML"><![CDATA[<jsp:include page="pages/header.jsp" />
+ <para>and <emphasis>
+ <property>main.jsp</property>
+ </emphasis> content is:</para>
+ <programlisting role="XML"><![CDATA[<jsp:include page="pages/header.jsp" />
]]></programlisting>
- <para> When you open <emphasis>
- <property>main.jsp</property>
- </emphasis> in <property>Visual Page Editor</property>, it will not be able
- to resolve the image from the header, however, it will work fine in runtime.
- To fix this in design time, click the <emphasis>
- <property>Page Design Options</property>
- </emphasis> button and set <emphasis>
- <property>Actual Run-Time Relative Folder</property>
- </emphasis> to <emphasis>'projectName > WebContent >
- pages'</emphasis> and you will see the image appeared.</para>
- <para/>
-
- <para>Let' consider an example for other tabs. For instance, the
- definition of your CSS on the page is the next:</para>
-
- <programlisting role="XML"><![CDATA[<link rel="stylesheet" type="text/css"
+ <para> When you open <emphasis>
+ <property>main.jsp</property>
+ </emphasis> in <property>Visual Page Editor</property>, it will not be able
+ to resolve the image from the header, however, it will work fine in runtime.
+ To fix this in design time, click the <emphasis>
+ <property>Page Design Options</property>
+ </emphasis> button and set <emphasis>
+ <property>Actual Run-Time Relative Folder</property>
+ </emphasis> to <emphasis>'projectName > WebContent >
+ pages'</emphasis> and you will see the image appeared.</para>
+ <para/>
+
+ <para>Let' consider an example for other tabs. For instance, the
+ definition of your CSS on the page is the next:</para>
+
+ <programlisting role="XML"><![CDATA[<link rel="stylesheet" type="text/css"
href="#{facesContext.externalContext.requestContextPath}/style.css"/>
]]></programlisting>
+
+ <para>This will work fine in runtime, but the <property>Visual Page
+ Editor</property> doesn't know what
+ <emphasis>requestContextPath</emphasis> in design time is. In order to
+ see the necessary styles applied in design time your should add a path to
+ your stylesheet in the <property>CSS File Path</property> section.</para>
+
+ <para>The next <property>URI</property> section lets you add URI taglibs so that
+ the editor knows where to find the tag libraries.</para>
+
+ <para>And the last <property>Substituted EL expressions</property> section is
+ provided to specify the values for specific EL variables. It can be useful
+ for a preview generation.</para>
+ <para>As an example look at the figure below:</para>
+ <figure>
+ <title>EL Expression</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_12.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Here bath in Source and Visual modes you see the EL expression
+ <emphasis>#{user.name}</emphasis>. When you switch to <property>Preview
+ view</property>, you'll also see this expression. Now press <emphasis>
+ <property>Page Design Options</property>
+ </emphasis> button and set the value for the
+ <emphasis>"user.name"</emphasis> as
+ <emphasis><property>World</property>.</emphasis></para>
+
+ <figure>
+ <title>Setting the Value for the EL Expression</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_13.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>As a result in Visual mode and Preview view the word <emphasis>
+ <property>World</property>
+ </emphasis> is displayed.</para>
+ <figure>
+ <title>The EL Expression Value</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_14.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
- <para>This will work fine in runtime, but the <property>Visual Page
- Editor</property> doesn't know what
- <emphasis>requestContextPath</emphasis> in design time is. In order to
- see the necessary styles applied in design time your should add a path to
- your stylesheet in the <property>CSS File Path</property> section.</para>
-
- <para>The next <property>URI</property> section lets you add URI taglibs so that
- the editor knows where to find the tag libraries.</para>
-
- <para>And the last <property>Substituted EL expressions</property> section is
- provided to specify the values for specific EL variables. It can be useful
- for a preview generation.</para>
- <para>As an example look at the figure below:</para>
- <figure>
- <title>EL Expression</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_12.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Here bath in Source and Visual modes you see the EL expression
- <emphasis>#{user.name}</emphasis>. When you switch to <property>Preview
- view</property>, you'll also see this expression. Now press <emphasis>
- <property>Page Design Options</property>
- </emphasis> button and set the value for the
- <emphasis>"user.name"</emphasis> as
- <emphasis><property>World</property>.</emphasis></para>
-
- <figure>
- <title>Setting the Value for the EL Expression</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_13.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>As a result in Visual mode and Preview view the word <emphasis>
- <property>World</property>
- </emphasis> is displayed.</para>
- <figure>
- <title>The EL Expression Value</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_14.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </listitem>
- <listitem id="splitting_buttons">
- <para><emphasis>
- <property>Visual/Source Editors splitting buttons</property></emphasis>
- provide the possibility to choose one of the four possible layouts for the Visual/Source Editor.
- </para>
-
-
- <para>The available layouts and corresponding buttons are as follows:
- <itemizedlist>
- <listitem><para>Vertical Source on top(<inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/source_top.png"/>
- </imageobject>
- </inlinemediaobject>)</para></listitem>
- <listitem><para>Vertical Visual on top ( <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/source_bottom.png"/>
- </imageobject>
- </inlinemediaobject>)</para></listitem>
- <listitem><para>Horizontal Source to the left ( <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/source_left.png"/>
- </imageobject>
- </inlinemediaobject>)</para></listitem>
- <listitem><para>Horizontal Visual to the left ( <inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/source_right.png"/>
- </imageobject>
- </inlinemediaobject>)</para></listitem>
-
- </itemizedlist>
- <figure>
- <title>Visual Page Editor Before Layout Changing </title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_24.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- Note, at the current view there is only <emphasis>
- <property> one</property></emphasis> button, that proposes the possibility to change it in order the Source and the View are moved <emphasis>
- <property>in a clockwise direction</property></emphasis>.
- <figure>
- <title>Visual Page Editor After Layout Changing </title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_25.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </para>
- </listitem>
- </itemizedlist>
-
- <para>You can find useful one more functionality provided by VPE. At the bottom of the
- <property>Visual/Source view</property> there is a <property>Selection Tag
- Bar</property>. It allows to see tags tree for a current component selected in
- Visual or Source mode.</para>
-
- <figure>
- <title>Selection Tag Bar</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/visual_page_15.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>If you want to hide the <property>Selection Tag Bar</property>, use the button in
- the form of a red cross on the lower right side. To reset it again you should check
- the <emphasis>
- <property>Show Selection Bar</property></emphasis> option in the submenu on the left pane.</para>
+ <section id="splitting_buttons">
+ <title>Visual/Source Editors splitting buttons</title>
+
+ <para>The <emphasis>
+ <property>Visual/Source Editors splitting buttons</property></emphasis>
+ provide the possibility to choose one of the four possible layouts for the Visual/Source Editor.
+ </para>
+
+
+ <para>The available layouts and corresponding buttons are as follows:
+ <itemizedlist>
+ <listitem><para>Vertical Source on top(<inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/source_top.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para></listitem>
+ <listitem><para>Vertical Visual on top ( <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/source_bottom.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para></listitem>
+ <listitem><para>Horizontal Source to the left ( <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/source_left.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para></listitem>
+ <listitem><para>Horizontal Visual to the left ( <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/source_right.png"/>
+ </imageobject>
+ </inlinemediaobject>)</para></listitem>
+
+ </itemizedlist>
+ <figure>
+ <title>Visual Page Editor Before Layout Changing </title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_24.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ Note, at the current view there is only <emphasis>
+ <property> one</property></emphasis> button, that proposes the possibility to change it in order the Source and the View are moved <emphasis>
+ <property>in a clockwise direction</property></emphasis>.
+ <figure>
+ <title>Visual Page Editor After Layout Changing </title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_25.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </para>
+ </section>
- <figure>
- <title>Show the Selection Tag Bar</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/visual_page/show_selection_bar.png"/>
- </imageobject>
- </mediaobject>
- </figure>
+ <section id="vpe_show_border">
+ <title>Show Border for Unknown Tags</title>
+
+ <para>The option is a self explanatory, i. e. if you want unknown tags to be wrapped in a border in the VPE visual part, just press the
+ <emphasis>
+ <property>Show border for unknown tags</property></emphasis> button
+ (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/show_border_button.png"/>
+ </imageobject>
+ </inlinemediaobject>) on the toolbar.</para>
+ </section>
+
+ <section id="vpe_show_nonvisual_tags">
+ <title>Show Non-visual Tags</title>
+
+ <para><property>Visual Page Editor</property> provides the option for displaying
+ non-visual tags in Visual mode of the editor. To enable it select the <emphasis>
+ <property>Show non-visual tags</property></emphasis> button (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/show_nonvisual.png"/>
+ </imageobject>
+ </inlinemediaobject>) on the VPE toolbar.</para>
+
+ <para>On the figure you can see non-visual elements with gray dashed borders.</para>
+
+ <figure>
+ <title>Non-visual Tag in the VPE</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_4b.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>You can also switch on this option in the VPE preferences, having clicked on the <emphasis><property>Preferences</property>
+ </emphasis> button
+ (<inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/icon_1.png"/>
+ </imageobject>
+ </inlinemediaobject>).</para>
+ </section>
+
+ <section id="vpe_show_selection_bar">
+ <title>Show Selection Bar</title>
+
+ <para>You can find useful one more functionality provided by VPE. At the bottom of the
+ <property>Visual/Source view</property> there is a <property>Selection Tag
+ Bar</property>. It allows to see tags tree for a current component selected in
+ Visual or Source mode.</para>
+
+ <figure>
+ <title>Selection Tag Bar</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/visual_page_15.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>If you want to hide the <property>Selection Tag Bar</property>, use
+ the <emphasis>
+ <property>Show Selection Bar</property></emphasis> button (
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/visual_page/show_selection_bar.png"/>
+ </imageobject>
+ </inlinemediaobject>) on the VPE toolbar.</para>
+ </section>
</section>
<section id="page_preview">
14 years, 8 months
JBoss Tools SVN: r18101 - trunk/jsf/docs/userguide/en/images/visual_page.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-15 03:46:21 -0400 (Thu, 15 Oct 2009)
New Revision: 18101
Modified:
trunk/jsf/docs/userguide/en/images/visual_page/show_selection_bar.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_1.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_12.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_14.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_15.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_2.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_23a.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_23b.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_24.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_25.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_3.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4b.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4d.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4e.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_5.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_7a.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_8.png
Log:
https://jira.jboss.org/jira/browse/JBDS-878 - updating the images according to new icons added onto the VPE toolbar;
Modified: trunk/jsf/docs/userguide/en/images/visual_page/show_selection_bar.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_1.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_12.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_14.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_15.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_2.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_23a.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_23b.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_24.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_25.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_3.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4b.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4d.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4e.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_5.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_7a.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_8.png
===================================================================
(Binary files differ)
14 years, 8 months
JBoss Tools SVN: r18100 - trunk/jsf/docs/userguide/en/images/visual_page.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-15 03:44:25 -0400 (Thu, 15 Oct 2009)
New Revision: 18100
Added:
trunk/jsf/docs/userguide/en/images/visual_page/formatting_bar_icon.png
trunk/jsf/docs/userguide/en/images/visual_page/show_border_button.png
trunk/jsf/docs/userguide/en/images/visual_page/show_bundles_mess_button.png
trunk/jsf/docs/userguide/en/images/visual_page/show_nonvisual.png
Log:
https://jira.jboss.org/jira/browse/JBDS-878 - adding the images of new icons on the VPE toolbar;
Added: trunk/jsf/docs/userguide/en/images/visual_page/formatting_bar_icon.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/visual_page/formatting_bar_icon.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en/images/visual_page/show_border_button.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/visual_page/show_border_button.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en/images/visual_page/show_bundles_mess_button.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/visual_page/show_bundles_mess_button.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/docs/userguide/en/images/visual_page/show_nonvisual.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/visual_page/show_nonvisual.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 8 months
JBoss Tools SVN: r18099 - trunk/jsf/docs/userguide/en/images/visual_page.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-15 03:43:21 -0400 (Thu, 15 Oct 2009)
New Revision: 18099
Removed:
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4a.png
trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4c.png
Log:
https://jira.jboss.org/jira/browse/JBDS-878 - deleting unused images;
Deleted: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4a.png
===================================================================
(Binary files differ)
Deleted: trunk/jsf/docs/userguide/en/images/visual_page/visual_page_4c.png
===================================================================
(Binary files differ)
14 years, 8 months