[jbosstools-commits] JBoss Tools SVN: r42452 - in trunk/common/plugins: org.jboss.tools.common.validation/src/org/jboss/tools/common/validation and 1 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Fri Jul 6 19:56:29 EDT 2012
Author: akazakov
Date: 2012-07-06 19:56:29 -0400 (Fri, 06 Jul 2012)
New Revision: 42452
Added:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblem.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblemAnnotation.java
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
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/java/JavaDirtyRegionProcessor.java
Log:
https://issues.jboss.org/browse/JBIDE-10611 As-you-type CDI validation
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java 2012-07-06 23:48:20 UTC (rev 42451)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java 2012-07-06 23:56:29 UTC (rev 42452)
@@ -30,7 +30,7 @@
import org.jboss.tools.common.quickfix.IQuickFixGenerator;
import org.jboss.tools.common.ui.CommonUIPlugin;
import org.jboss.tools.common.validation.ValidationErrorManager;
-import org.jboss.tools.common.validation.java.JavaDirtyRegionProcessor.JavaProblemAnnotation;
+import org.jboss.tools.common.validation.java.TempJavaProblemAnnotation;
/**
* @author Daniel Azarov
@@ -121,9 +121,9 @@
String attribute = (String)((TemporaryAnnotation)annotation).getAttributes().get(ValidationErrorManager.PREFERENCE_KEY_ATTRIBUTE_NAME);
return attribute;
}
- }else if(annotation instanceof JavaProblemAnnotation){
- if(((JavaProblemAnnotation)annotation).getAttributes() != null){
- String attribute = (String)((JavaProblemAnnotation)annotation).getAttributes().get(ValidationErrorManager.PREFERENCE_KEY_ATTRIBUTE_NAME);
+ }else if(annotation instanceof TempJavaProblemAnnotation){
+ if(((TempJavaProblemAnnotation)annotation).getAttributes() != null){
+ String attribute = (String)((TempJavaProblemAnnotation)annotation).getAttributes().get(ValidationErrorManager.PREFERENCE_KEY_ATTRIBUTE_NAME);
return attribute;
}
}
@@ -136,9 +136,9 @@
String attribute = (String)((TemporaryAnnotation)annotation).getAttributes().get(ValidationErrorManager.PREFERENCE_PAGE_ID_NAME);
return attribute;
}
- }else if(annotation instanceof JavaProblemAnnotation){
- if(((JavaProblemAnnotation)annotation).getAttributes() != null){
- String attribute = (String)((JavaProblemAnnotation)annotation).getAttributes().get(ValidationErrorManager.PREFERENCE_PAGE_ID_NAME);
+ }else if(annotation instanceof TempJavaProblemAnnotation){
+ if(((TempJavaProblemAnnotation)annotation).getAttributes() != null){
+ String attribute = (String)((TempJavaProblemAnnotation)annotation).getAttributes().get(ValidationErrorManager.PREFERENCE_PAGE_ID_NAME);
return attribute;
}
}
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-07-06 23:48:20 UTC (rev 42451)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java 2012-07-06 23:56:29 UTC (rev 42452)
@@ -38,6 +38,7 @@
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
import org.jboss.tools.common.util.EclipseUIUtil;
+import org.jboss.tools.common.validation.java.TempJavaProblemAnnotation;
/**
* This Manager is responsible for as-you-type validation.
@@ -108,6 +109,9 @@
} else if(o instanceof DisabledAnnotation) {
DisabledAnnotation annotation = (DisabledAnnotation)o;
anModel.removeAnnotation(annotation);
+ } else if(o instanceof TempJavaProblemAnnotation) {
+ TempJavaProblemAnnotation annotation = (TempJavaProblemAnnotation)o;
+ anModel.removeAnnotation(annotation);
}
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-07-06 23:48:20 UTC (rev 42451)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-07-06 23:56:29 UTC (rev 42452)
@@ -20,8 +20,6 @@
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.compiler.CategorizedProblem;
-import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.ProblemAnnotation;
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPartitioningException;
@@ -84,10 +82,6 @@
private int fStartRegionToProcess = -1;
private int fEndRegionToProcess = -1;
- // AsYouType EL Validation 'marker type' name.
- // marker type is used in the quickFixProcessor extension point
- public static final String MARKER_TYPE= "org.jboss.tools.common.validation.el"; //$NON-NLS-1$
-
public final class JavaELProblemReporter implements IReporter {
private IFile fFile;
private ICompilationUnit fCompilationUnit;
@@ -218,10 +212,10 @@
if (editorInput != null) {
boolean cleanAllAnnotations = Boolean.TRUE.equals(message.getAttribute(TempMarkerManager.CLEAN_ALL_ANNOTATIONS_ATTRIBUTE));
Position position = new Position(valMessage.getOffset(), valMessage.getLength());
- CoreELProblem problem= new CoreELProblem(valMessage,
+ TempJavaProblem problem = new TempJavaProblem(valMessage,
editorInput.getName());
if (fCompilationUnit != null) {
- JavaProblemAnnotation problemAnnotation = new JavaProblemAnnotation(problem, fCompilationUnit);
+ TempJavaProblemAnnotation problemAnnotation = new TempJavaProblemAnnotation(problem, fCompilationUnit);
addAnnotation(problemAnnotation, position, cleanAllAnnotations);
}
}
@@ -235,166 +229,6 @@
}
}
- public class JavaProblemAnnotation extends ProblemAnnotation{
- CoreELProblem problem;
-
- public JavaProblemAnnotation(CoreELProblem problem, ICompilationUnit cu) {
- super(problem, cu);
- this.problem = problem;
- }
-
- @SuppressWarnings("rawtypes")
- public Map getAttributes() {
- return problem.getAttributes();
- }
- }
-
- class CoreELProblem extends CategorizedProblem {
- /** The end offset of the problem */
- private int fSourceEnd= 0;
-
- /** The line number of the problem */
- private int fLineNumber= 1;
-
- /** The start offset of the problem */
- private int fSourceStart= 0;
-
- /** The description of the problem */
- private String fMessage;
-
- private boolean fIsError;
-
- /** The originating file name */
- private String fOrigin;
-
- private ValidationMessage vMessage;
-
- public static final int EL_PROBLEM_ID= 0x88000000;
-
- /**
- * Initialize with the given parameters.
- *
- * @param message ValidationMessage
- * @param document the document
- * @param origin the originating file name
- */
- public CoreELProblem(ValidationMessage message, String origin) {
- super();
- fSourceStart= message.getOffset();
- fSourceEnd= message.getOffset() + message.getLength() - 1;
- fLineNumber= message.getLineNumber();
- fMessage= message.getText();
- fOrigin= origin;
- fIsError = (IMessage.NORMAL_SEVERITY != message.getSeverity());
- vMessage = message;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#getArguments()
- */
- public String[] getArguments() {
- return new String[0];
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#getID()
- */
- public int getID() {
- return EL_PROBLEM_ID;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#getMessage()
- */
- public String getMessage() {
- return fMessage;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#getOriginatingFileName()
- */
- public char[] getOriginatingFileName() {
- return fOrigin.toCharArray();
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#getSourceEnd()
- */
- public int getSourceEnd() {
- return fSourceEnd;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#getSourceLineNumber()
- */
- public int getSourceLineNumber() {
- return fLineNumber;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#getSourceStart()
- */
- public int getSourceStart() {
- return fSourceStart;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#isError()
- */
- public boolean isError() {
- return fIsError;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#isWarning()
- */
- public boolean isWarning() {
- return !fIsError;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#setSourceStart(int)
- */
- public void setSourceStart(int sourceStart) {
- fSourceStart= sourceStart;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#setSourceEnd(int)
- */
- public void setSourceEnd(int sourceEnd) {
- fSourceEnd= sourceEnd;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.IProblem#setSourceLineNumber(int)
- */
- public void setSourceLineNumber(int lineNumber) {
- fLineNumber= lineNumber;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.CategorizedProblem#getCategoryID()
- */
- @Override
- public int getCategoryID() {
- return CAT_SYNTAX;
- }
-
- /*
- * @see org.eclipse.jdt.core.compiler.CategorizedProblem#getMarkerType()
- */
- @Override
- public String getMarkerType() {
- return MARKER_TYPE;
- }
-
- @SuppressWarnings("rawtypes")
- public Map getAttributes(){
- return vMessage.getAttributes();
- }
- }
-
public JavaDirtyRegionProcessor(ITextEditor editor) {
this.fEditor = editor;
fHelper = createValidationContext();
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblem.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblem.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblem.java 2012-07-06 23:56:29 UTC (rev 42452)
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.validation.java;
+
+import java.util.Map;
+
+import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.jboss.tools.common.validation.ValidationMessage;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class TempJavaProblem extends CategorizedProblem {
+ // TODO for dazarov. Why are you using EL marker type for all the java problems?
+ // AsYouType EL Validation 'marker type' name.
+ // marker type is used in the quickFixProcessor extension point
+// public static final String MARKER_TYPE = "org.jboss.tools.common.validation.el"; //$NON-NLS-1$
+ public static final String MARKER_TYPE = "TODO";
+
+ /** The end offset of the problem */
+ private int fSourceEnd= 0;
+
+ /** The line number of the problem */
+ private int fLineNumber= 1;
+
+ /** The start offset of the problem */
+ private int fSourceStart= 0;
+
+ /** The description of the problem */
+ private String fMessage;
+
+ private boolean fIsError;
+
+ /** The originating file name */
+ private String fOrigin;
+
+ private ValidationMessage vMessage;
+
+ public static final int EL_PROBLEM_ID= 0x88000000;
+
+ /**
+ * Initialize with the given parameters.
+ *
+ * @param message ValidationMessage
+ * @param document the document
+ * @param origin the originating file name
+ */
+ public TempJavaProblem(ValidationMessage message, String origin) {
+ super();
+ fSourceStart= message.getOffset();
+ fSourceEnd= message.getOffset() + message.getLength() - 1;
+ fLineNumber= message.getLineNumber();
+ fMessage= message.getText();
+ fOrigin= origin;
+ fIsError = (IMessage.NORMAL_SEVERITY != message.getSeverity());
+ vMessage = message;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#getArguments()
+ */
+ public String[] getArguments() {
+ return new String[0];
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#getID()
+ */
+ public int getID() {
+ return EL_PROBLEM_ID;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#getMessage()
+ */
+ public String getMessage() {
+ return fMessage;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#getOriginatingFileName()
+ */
+ public char[] getOriginatingFileName() {
+ return fOrigin.toCharArray();
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#getSourceEnd()
+ */
+ public int getSourceEnd() {
+ return fSourceEnd;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#getSourceLineNumber()
+ */
+ public int getSourceLineNumber() {
+ return fLineNumber;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#getSourceStart()
+ */
+ public int getSourceStart() {
+ return fSourceStart;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#isError()
+ */
+ public boolean isError() {
+ return fIsError;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#isWarning()
+ */
+ public boolean isWarning() {
+ return !fIsError;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#setSourceStart(int)
+ */
+ public void setSourceStart(int sourceStart) {
+ fSourceStart= sourceStart;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#setSourceEnd(int)
+ */
+ public void setSourceEnd(int sourceEnd) {
+ fSourceEnd= sourceEnd;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.IProblem#setSourceLineNumber(int)
+ */
+ public void setSourceLineNumber(int lineNumber) {
+ fLineNumber= lineNumber;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.CategorizedProblem#getCategoryID()
+ */
+ @Override
+ public int getCategoryID() {
+ return CAT_SYNTAX;
+ }
+
+ /*
+ * @see org.eclipse.jdt.core.compiler.CategorizedProblem#getMarkerType()
+ */
+ @Override
+ public String getMarkerType() {
+ return MARKER_TYPE;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Map getAttributes(){
+ return vMessage.getAttributes();
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblem.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblemAnnotation.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblemAnnotation.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblemAnnotation.java 2012-07-06 23:56:29 UTC (rev 42452)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.validation.java;
+
+import java.util.Map;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.ProblemAnnotation;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class TempJavaProblemAnnotation extends ProblemAnnotation {
+ private TempJavaProblem problem;
+
+ public TempJavaProblemAnnotation(TempJavaProblem problem, ICompilationUnit cu) {
+ super(problem, cu);
+ this.problem = problem;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Map getAttributes() {
+ return problem.getAttributes();
+ }
+}
\ No newline at end of file
Property changes on: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/TempJavaProblemAnnotation.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
More information about the jbosstools-commits
mailing list