Author: akazakov
Date: 2012-08-10 17:40:20 -0400 (Fri, 10 Aug 2012)
New Revision: 42982
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
Log:
https://issues.jboss.org/browse/JBIDE-12417 KB validators should report problems in order
as they appears in the file.
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2012-08-10
21:35:24 UTC (rev 42981)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2012-08-10
21:40:20 UTC (rev 42982)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.common.el.core.resolver;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
@@ -79,7 +79,7 @@
*
* @return
*/
- Set<ELReference> getELReferences(IRegion region);
+ Collection<ELReference> getELReferences(IRegion region);
/**
* Returns true if the file was modified in some editor and has not been saved yet.
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2012-08-10
21:35:24 UTC (rev 42981)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2012-08-10
21:40:20 UTC (rev 42982)
@@ -11,10 +11,9 @@
package org.jboss.tools.common.el.core.resolver;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
@@ -145,8 +144,8 @@
}
@Override
- public synchronized Set<ELReference> getELReferences(IRegion region) {
- Set<ELReference> references = new HashSet<ELReference>();
+ public synchronized Collection<ELReference> getELReferences(IRegion region) {
+ List<ELReference> references = new ArrayList<ELReference>();
if(elReferenceSet != null) {
for (ELReference ref: elReferenceSet) {
if(region.getOffset() + region.getLength() >= ref.getStartPosition() &&
region.getOffset() <= ref.getStartPosition() + ref.getLength()) {
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2012-08-10
21:35:24 UTC (rev 42981)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2012-08-10
21:40:20 UTC (rev 42982)
@@ -11,9 +11,9 @@
package org.jboss.tools.common.el.core.resolver;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
@@ -111,8 +111,8 @@
}
@Override
- public Set<ELReference> getELReferences(IRegion region) {
- return Collections.emptySet();
+ public Collection<ELReference> getELReferences(IRegion region) {
+ return Collections.emptyList();
}
/*
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java 2012-08-10
21:35:24 UTC (rev 42981)
+++
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java 2012-08-10
21:40:20 UTC (rev 42982)
@@ -55,6 +55,7 @@
private EditorValidationContext context;
private Map<IValidator, IProject> rootProjects;
private int count;
+ private static boolean disabled;
private static Set<IDocument> reporters = new HashSet<IDocument>();
@@ -130,6 +131,9 @@
}
private boolean init(IValidationContext helper, IReporter reporter) {
+ if(disabled) {
+ return false;
+ }
if(context==null) {
synchronized (reporters) {
reporters.add(document);
@@ -222,4 +226,16 @@
@Override
public void validate(IValidationContext helper, IReporter reporter) throws
ValidationException {
}
+
+ public static boolean isDisabled() {
+ return disabled;
+ }
+
+ /**
+ * Disable As-you-type validation
+ * @param disabled
+ */
+ public static void setDisabled(boolean disabled) {
+ AsYouTypeValidatorManager.disabled = disabled;
+ }
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2012-08-10
21:35:24 UTC (rev 42981)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2012-08-10
21:40:20 UTC (rev 42982)
@@ -258,13 +258,10 @@
this.document = validationContext.getDocument();
ELContext elContext =
PageContextFactory.createPageContext(validationContext.getDocument(), true);
elContext.setDirty(true);
- Set<ELReference> references = null;
- if(dirtyRegions.size()==1) {
- references = elContext.getELReferences(dirtyRegions.iterator().next());
- } else {
- ELReference[] ref = elContext.getELReferences();
- references = new HashSet<ELReference>(ref.length);
- for (ELReference elReference : ref) {
+ Collection<ELReference> references = new ArrayList<ELReference>();
+ for (IRegion region : dirtyRegions) {
+ Collection<ELReference> regionReferences = elContext.getELReferences(region);
+ for (ELReference elReference : regionReferences) {
references.add(elReference);
}
}