Author: akazakov
Date: 2011-08-23 13:45:45 -0400 (Tue, 23 Aug 2011)
New Revision: 34175
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionLogger.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java
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/ProjectValidationContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/SimpleValidatingProjectTree.java
Log:
https://issues.jboss.org/browse/JBIDE-6153
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionLogger.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionLogger.java 2011-08-23
17:34:09 UTC (rev 34174)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionLogger.java 2011-08-23
17:45:45 UTC (rev 34175)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.core.test.tck.validation;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.ILogListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.jboss.tools.jst.web.kb.validation.KBValidationException;
-
-/**
- * @author Alexey Kazakov
- */
-public class ValidationExceptionLogger implements ILogListener {
-
- private Map<String, Set<IStatus>> exceptions = new HashMap<String,
Set<IStatus>>();
-
- public ValidationExceptionLogger() {
- Platform.addLogListener(this);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime.IStatus,
java.lang.String)
- */
- public void logging(IStatus status, String plugin) {
- String id = status.getPlugin();
- if(id==null) {
- id = plugin;
- }
- Set<IStatus> statuses = exceptions.get(id);
- if(statuses==null) {
- statuses = new HashSet<IStatus>();
- exceptions.put(id, statuses);
- }
- statuses.add(status);
- }
-
- public boolean hasExceptions() {
- return !getExceptions().isEmpty();
- }
-
- public Set<IStatus> getExceptions() {
- Set<IStatus> result = new HashSet<IStatus>();
- Set<IStatus> statuses = exceptions.get(WebKbPlugin.PLUGIN_ID);
- if(statuses!=null) {
- for (IStatus status : statuses) {
- Throwable exception = status.getException();
- if(exception instanceof KBValidationException) {
- result.add(status);
- }
- }
- }
- return result;
- }
-}
\ No newline at end of file
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTest.java 2011-08-23
17:34:09 UTC (rev 34174)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/ValidationExceptionTest.java 2011-08-23
17:45:45 UTC (rev 34175)
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.core.test.tck.validation;
-
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.IStatus;
-import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.jboss.tools.jst.web.kb.validation.KBValidationException;
-
-/**
- * @author Alexey Kazakov
- */
-public class ValidationExceptionTest extends TestCase {
-
- private static ValidationExceptionLogger LOGGER;
-
- public static ValidationExceptionLogger initLogger() {
- LOGGER = new ValidationExceptionLogger();
- return LOGGER;
- }
-
- public void testExceptions() {
- Set<IStatus> exceptions = LOGGER.getExceptions();
- StringBuffer error = new StringBuffer("The following exceptions were thrown during
project validation:");
- for (IStatus status : exceptions) {
- Throwable cause = status.getException().getCause();
- error.append("\r\n").append(status.toString()).append(":
").append(cause.toString()).append(":
").append(cause.getStackTrace()[0].toString());
- }
- assertTrue(error.toString(), exceptions.isEmpty());
- }
-
- public void testLogger() {
- WebKbPlugin.getDefault().logError(new KBValidationException("Test exception",
null));
- Set<IStatus> exceptions = LOGGER.getExceptions();
- assertEquals(1, exceptions.size());
- }
-}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java 2011-08-23
17:34:09 UTC (rev 34174)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/KbELReference.java 2011-08-23
17:45:45 UTC (rev 34175)
@@ -1,28 +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.jst.web.kb.el;
-
-import org.jboss.tools.common.el.core.ELReference;
-import org.jboss.tools.jst.web.kb.validation.IValidator;
-
-/**
- * @author Alexey Kazakov
- */
-public class KbELReference extends ELReference {
-
- /* (non-Javadoc)
- * @see org.jboss.tools.common.el.core.ELReference#getMarkerGroupId()
- */
- @Override
- protected String getMarkerGroupId() {
- return IValidator.MARKED_RESOURCE_MESSAGE_GROUP;
- }
-}
\ No newline at end of file
Deleted:
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 2011-08-23
17:34:09 UTC (rev 34174)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java 2011-08-23
17:45:45 UTC (rev 34175)
@@ -1,211 +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.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.el.core.ELReference;
-import org.jboss.tools.common.xml.XMLUtilities;
-import org.jboss.tools.jst.web.kb.el.KbELReference;
-import org.w3c.dom.Element;
-
-/**
- * @author Alexey Kazakov
- */
-public class ELValidatorContext extends LinkCollection {
-
- private Map<String, Set<ELReference>> elsByVariableName = new
HashMap<String, Set<ELReference>>();
- private Map<ELReference, Set<String>> variableNamesByEl = new
HashMap<ELReference, Set<String>>();
- private Map<IPath, Set<ELReference>> elsByResource = new HashMap<IPath,
Set<ELReference>>();
-
- public ELValidatorContext(String id) {
- super(id);
- }
-
- /**
- * Save link between EL and variable name.
- * @param variableName
- * @param el
- */
- public synchronized void addLinkedEl(String variableName, ELReference el) {
- Set<ELReference> linkedEls = elsByVariableName.get(variableName);
- if(linkedEls==null) {
- // create set of linked ELs with variable name.
- linkedEls = new HashSet<ELReference>();
- elsByVariableName.put(variableName, linkedEls);
- }
- // save linked ELs.
- // don't save links if there are more than 500 ELs for the var name.
- if(linkedEls.size()<500) {
- if(linkedEls.add(el)) {
- modifications++;
- }
- // Save link between EL and variable names.
- Set<String> variableNames = variableNamesByEl.get(el);
- if(variableNames==null) {
- variableNames = new HashSet<String>();
- variableNamesByEl.put(el, variableNames);
- }
- if(variableNames.add(variableName)) {
- modifications++;
- }
- }
-
- // Save link between EL and resource.
- Set<ELReference> els = elsByResource.get(el.getPath());
- if(els==null) {
- els = new HashSet<ELReference>();
- elsByResource.put(el.getPath(), els);
- }
- if(els.add(el)) {
- modifications++;
- }
- }
-
- public synchronized void removeLinkedEls(Set<IFile> resorces) {
- for (IFile file : resorces) {
- removeLinkedEls(file);
- }
- }
-
- public synchronized void removeLinkedEls(IFile resource) {
- Set<ELReference> els = elsByResource.get(resource.getFullPath());
- if(els!=null) {
- if(elsByResource.remove(resource.getFullPath()) != null) {
- modifications++;
- }
- for (ELReference el : els) {
- Set<String> names = variableNamesByEl.get(el);
- if(names!=null) {
- String[] nameStrins = names.toArray(new String[0]);
- for (int i = 0; i < nameStrins.length; i++) {
- removeLinkedEl(nameStrins[i], el);
- }
- }
- }
- }
- }
-
- /**
- * Removes link between EL and variable name.
- * @param name
- * @param el
- */
- public synchronized void removeLinkedEl(String name, ELReference el) {
- Set<ELReference> linkedEls = elsByVariableName.get(name);
- if(linkedEls!=null) {
- if(linkedEls.remove(el)) {
- modifications++;
- }
- }
- if(linkedEls.isEmpty()) {
- elsByVariableName.remove(name);
- }
-
- // Remove link between EL and variable names.
- Set<String> variableNames = variableNamesByEl.get(el);
- if(variableNames!=null) {
- if(variableNames.remove(name)) {
- modifications++;
- }
- }
- if(variableNames.isEmpty()) {
- variableNamesByEl.remove(el);
- }
- }
-
- /**
- * Return ELs with given variable name
- * @param variableName
- * @return
- */
- public synchronized Set<ELReference> getElsByVariableName(String variableName) {
- return elsByVariableName.get(variableName);
- }
-
- /**
- * @param names
- * @return
- */
- public synchronized Set<ELReference> getElsByVariableNames(Set<String>
names) {
- Set<ELReference> result = new HashSet<ELReference>();
- for(String name : names) {
- Set<ELReference> els = getElsByVariableName(name);
- if(els!=null) {
- result.addAll(els);
- }
- }
- return result;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.internal.validation.LinkCollection#clearAll()
- */
- @Override
- public synchronized void clearAll() {
- super.clearAll();
- elsByVariableName.clear();
- variableNamesByEl.clear();
- elsByResource.clear();
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.internal.validation.LinkCollection#store(org.w3c.dom.Element)
- */
- @Override
- public synchronized void store(Element root) {
- super.store(root);
- Set<String> variables = elsByVariableName.keySet();
- for (String name: variables) {
- Set<ELReference> els = elsByVariableName.get(name);
- if(els == null) {
- continue;
- }
- for (ELReference el: els) {
- Element linkedEl = XMLUtilities.createElement(root, "linked-el");
//$NON-NLS-1$
- linkedEl.setAttribute("name", name); //$NON-NLS-1$
- el.store(linkedEl);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.internal.validation.LinkCollection#load(org.w3c.dom.Element)
- */
- @Override
- public synchronized void load(Element root) {
- super.load(root);
- if(root == null) {
- return;
- }
- Element[] linkedEls = XMLUtilities.getChildren(root, "linked-el");
//$NON-NLS-1$
- if(linkedEls != null) {
- for (int i = 0; i < linkedEls.length; i++) {
- String name = linkedEls[i].getAttribute("name"); //$NON-NLS-1$
- if(name == null || name.trim().length() == 0) {
- continue;
- }
- ELReference el = new KbELReference();
- el.load(linkedEls[i]);
- el.setNeedToInitMarkers(true);
- addLinkedEl(name, el);
- }
- }
- }
-}
\ No newline at end of file
Deleted:
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 2011-08-23
17:34:09 UTC (rev 34174)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ProjectValidationContext.java 2011-08-23
17:45:45 UTC (rev 34175)
@@ -1,310 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.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.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.jboss.tools.common.el.core.ELReference;
-import org.jboss.tools.common.xml.XMLUtilities;
-import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
-import org.w3c.dom.Element;
-
-/**
- * Contains information for validators that must be saved between
- * validation invoking.
- * @author Alexey Kazakov
- */
-public class ProjectValidationContext implements IProjectValidationContext {
-
- // We should load/save these collections between eclipse sessions.
- private Map<String, LinkCollection> coreLinks = new HashMap<String,
LinkCollection>();
- private ELValidatorContext elLinks = new ELValidatorContext("jboss.el");
//$NON-NLS-1$
-
- private Map<String, Set<String>> oldVariableNamesForELValidation = new
HashMap<String, Set<String>>();
-
- private ValidationResourceRegister validationResourceRegister;
-
- public LinkCollection getCoreLinks(String validatorId) {
- LinkCollection linkCollection = coreLinks.get(validatorId);
- if(linkCollection==null) {
- linkCollection = new LinkCollection(validatorId);
- coreLinks.put(validatorId, linkCollection);
- }
- return linkCollection;
- }
-
- private Set<String> getOldVariableNamesForELValidation(String validatorId) {
- Set<String> linkCollection = oldVariableNamesForELValidation.get(validatorId);
- if(linkCollection==null) {
- linkCollection = new HashSet<String>();
- oldVariableNamesForELValidation.put(validatorId, linkCollection);
- }
- return linkCollection;
- }
-
- private Set<String> getIds() {
- Set<String> ids = new HashSet<String>();
- ids.addAll(coreLinks.keySet());
- ids.addAll(oldVariableNamesForELValidation.keySet());
- return ids;
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#addLinkedCoreResource(java.lang.String,
org.eclipse.core.runtime.IPath, boolean)
- */
- public void addLinkedCoreResource(String validatorId, String variableName, IPath
linkedResourcePath, boolean declaration) {
- getCoreLinks(validatorId).addLinkedResource(variableName, linkedResourcePath,
declaration);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedCoreResource(java.lang.String,
org.eclipse.core.runtime.IPath)
- */
- public void removeLinkedCoreResource(String validatorId, String name, IPath
linkedResourcePath) {
- getCoreLinks(validatorId).removeLinkedResource(name, linkedResourcePath);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedCoreResources(java.util.Set)
- */
- public void removeLinkedCoreResources(String validatorId, Set<IPath> resources) {
- getCoreLinks(validatorId).removeLinkedResources(resources);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedCoreResource(org.eclipse.core.runtime.IPath)
- */
- public void removeLinkedCoreResource(String validatorId, IPath resource) {
- getCoreLinks(validatorId).removeLinkedResource(resource);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#getCoreResourcesByVariableName(java.lang.String,
boolean)
- */
- public Set<IPath> getCoreResourcesByVariableName(String validatorId, String
variableName, boolean declaration) {
- return getCoreLinks(validatorId).getResourcesByVariableName(variableName,
declaration);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#getVariableNamesByCoreResource(org.eclipse.core.runtime.IPath,
boolean)
- */
- public Set<String> getVariableNamesByCoreResource(String validatorId, IPath
fullPath, boolean declaration) {
- return getCoreLinks(validatorId).getVariableNamesByResource(fullPath, declaration);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#addUnnamedCoreResource(org.eclipse.core.runtime.IPath)
- */
- public void addUnnamedCoreResource(String validatorId, IPath fullPath) {
- getCoreLinks(validatorId).addUnnamedResource(fullPath);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#getUnnamedCoreResources()
- */
- public Set<IPath> getUnnamedCoreResources(String validatorId) {
- return getCoreLinks(validatorId).getUnnamedResources();
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#removeUnnamedCoreResource(org.eclipse.core.runtime.IPath)
- */
- public void removeUnnamedCoreResource(String validatorId, IPath fullPath) {
- getCoreLinks(validatorId).removeUnnamedResource(fullPath);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#getUnnamedElResources()
- */
- public Set<IPath> getUnnamedElResources() {
- return elLinks.getUnnamedResources();
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#removeUnnamedElResource(org.eclipse.core.runtime.IPath)
- */
- public void removeUnnamedElResource(IPath fullPath) {
- elLinks.removeUnnamedResource(fullPath);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#addVariableNameForELValidation(java.lang.String)
- */
- public void addVariableNameForELValidation(String validatorId, String name) {
- getOldVariableNamesForELValidation(validatorId).add(name);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedEls(java.util.Set)
- */
- public void removeLinkedEls(Set<IFile> resorces) {
- elLinks.removeLinkedEls(resorces);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#getElsForValidation(java.util.Set,
boolean)
- */
- public Set<ELReference> getElsForValidation(Set<IFile> changedFiles, boolean
onlyChangedVariables) {
- Set<ELReference> result = new HashSet<ELReference>();
- for (String id : getIds()) {
- Set<String> oldVariableNamesForELValidation =
getOldVariableNamesForELValidation(id);
- // Collect all ELs which use new variables names
- for(IResource resource : changedFiles) {
- Set<String> newNames = getVariableNamesByCoreResource(id,
resource.getFullPath(), true);
- if(newNames!=null) {
- for (String newName : newNames) {
- if(!onlyChangedVariables || (oldVariableNamesForELValidation!=null &&
!oldVariableNamesForELValidation.contains(newName))) {
- Set<ELReference> els = elLinks.getElsByVariableName(newName);
- if(els!=null) {
- result.addAll(els);
- }
- }
- }
- }
- if(oldVariableNamesForELValidation!=null) {
- for (String oldName :oldVariableNamesForELValidation) {
- if(!onlyChangedVariables || newNames==null || !newNames.contains(oldName)) {
- Set<ELReference> els = elLinks.getElsByVariableName(oldName);
- if(els!=null) {
- result.addAll(els);
- }
- }
- }
- }
- }
- }
- return result;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidationContext#clearAll()
- */
- public void clearAll() {
- for (LinkCollection links : coreLinks.values()) {
- links.clearAll();
- }
- coreLinks.clear();
- elLinks.clearAll();
- oldVariableNamesForELValidation.clear();
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#clearOldVariableNameForElValidation()
- */
- public void clearOldVariableNameForElValidation() {
- oldVariableNamesForELValidation.clear();
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#addLinkedEl(java.lang.String,
org.jboss.tools.jst.web.kb.validation.ELReference)
- */
- public void addLinkedEl(String variableName, ELReference el) {
- elLinks.addLinkedEl(variableName, el);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#removeLinkedEl(java.lang.String,
org.jboss.tools.jst.web.kb.validation.ELReference)
- */
- public void removeLinkedEl(String name, ELReference el) {
- elLinks.removeLinkedEl(name, el);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#getElsByVariableName(java.lang.String)
- */
- public Set<ELReference> getElsByVariableName(String variableName) {
- return elLinks.getElsByVariableName(variableName);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#store(org.w3c.dom.Element)
- */
- public void store(Element root) {
- Element validation = XMLUtilities.createElement(root, "validation");
//$NON-NLS-1$
- for (LinkCollection links : coreLinks.values()) {
- Element core = XMLUtilities.createElement(validation, "core");
//$NON-NLS-1$
- core.setAttribute("validator-id", links.getId()); //$NON-NLS-1$
- links.store(core);
- }
- Element el = XMLUtilities.createElement(validation, "el"); //$NON-NLS-1$
- elLinks.store(el);
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidationContext#load(org.w3c.dom.Element)
- */
- public void load(Element root) {
- Element validation = XMLUtilities.getUniqueChild(root, "validation");
//$NON-NLS-1$
- if(validation == null) return;
- Element[] cores = XMLUtilities.getChildren(validation, "core");
//$NON-NLS-1$
- for (Element core : cores) {
- String id = core.getAttribute("validator-id"); //$NON-NLS-1$
- if(id!=null && id.trim().length()>0) {
- getCoreLinks(id).load(core);
- }
- }
- Element[] els = XMLUtilities.getChildren(validation, "el"); //$NON-NLS-1$
- for (Element el : els) {
- elLinks.load(el);
- }
- }
-
- public int getModificationsSinceLastStore() {
- int result = 0;
- for (LinkCollection links : coreLinks.values()) {
- result = result + links.getModificationsSinceLastStore();
- }
- result = result + elLinks.getModificationsSinceLastStore();
- return result;
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IProjectValidationContext#setValidationResourceRegister(org.jboss.tools.jst.web.kb.internal.validation.ValidationResourceRegister)
- */
- public void setValidationResourceRegister(ValidationResourceRegister
validationResourceRegister) {
- this.validationResourceRegister = validationResourceRegister;
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IProjectValidationContext#getValidationResourceRegister()
- */
- public ValidationResourceRegister getValidationResourceRegister() {
- return validationResourceRegister;
- }
-}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/SimpleValidatingProjectTree.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/SimpleValidatingProjectTree.java 2011-08-23
17:34:09 UTC (rev 34174)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/SimpleValidatingProjectTree.java 2011-08-23
17:45:45 UTC (rev 34175)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.web.kb.internal.validation;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
-import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
-import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
-
-/**
- * Represents a validating project tree with the only brunch.
- * @author Alexey Kazakov
- */
-public class SimpleValidatingProjectTree implements IValidatingProjectTree,
IValidatingProjectSet {
-
- private Map<IProject, IValidatingProjectSet> brunches = new HashMap<IProject,
IValidatingProjectSet>();
- private IValidatingProjectSet brunch;
- private Set<IProject> validatingProjects = new HashSet<IProject>();
-
- public SimpleValidatingProjectTree(IProject project) {
- addProject(project);
- }
-
- public SimpleValidatingProjectTree(IValidatingProjectSet brunch) {
- this.brunch = brunch;
- brunches.put(brunch.getRootProject(), brunch);
- validatingProjects.add(brunch.getRootProject());
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree#getBrunches()
- */
- public Map<IProject, IValidatingProjectSet> getBrunches() {
- return brunches;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getRootProject()
- */
- public IProject getRootProject() {
- return brunch.getRootProject();
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getAllProjests()
- */
- public Set<IProject> getAllProjects() {
- return brunch.getAllProjects();
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet#getRootContext()
- */
- public IProjectValidationContext getRootContext() {
- return brunch.getRootContext();
- }
-
- /*
- * (non-Javadoc)
- * @see
org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree#addProject(org.eclipse.core.resources.IProject)
- */
- public void addProject(IProject project) {
- if(project!=null && !validatingProjects.contains(project)) {
- Set<IProject> allProjects = new HashSet<IProject>();
- allProjects.add(project);
- brunch = new ValidatingProjectSet(project, allProjects, new
ProjectValidationContext());
- brunches.put(brunch.getRootProject(), brunch);
- validatingProjects.add(project);
- }
- }
-}
\ No newline at end of file