[jbosstools-commits] JBoss Tools SVN: r43517 - in trunk/common: plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 7 15:06:44 EDT 2012


Author: dazarov
Date: 2012-09-07 15:06:44 -0400 (Fri, 07 Sep 2012)
New Revision: 43517

Modified:
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
   trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFix.java
   trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/QuickFixTestUtil.java
Log:
Make CDI Quick Fixes work for As-You-Type validator annotations https://issues.jboss.org/browse/JBIDE-12328

Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFix.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFix.java	2012-09-07 19:03:36 UTC (rev 43516)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFix.java	2012-09-07 19:06:44 UTC (rev 43517)
@@ -11,8 +11,7 @@
 package org.jboss.tools.common.quickfix;
 
 import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.ui.IMarkerResolution2;
 
-public interface IQuickFix extends IMarkerResolution2, IJavaCompletionProposal{
+public interface IQuickFix extends IBaseMarkerResolution, IJavaCompletionProposal{
 
 }

Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java	2012-09-07 19:03:36 UTC (rev 43516)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java	2012-09-07 19:06:44 UTC (rev 43517)
@@ -26,16 +26,15 @@
 import org.eclipse.jface.preference.IPreferencePage;
 import org.eclipse.jface.preference.PreferenceManager;
 import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
 import org.eclipse.jface.text.contentassist.IContextInformation;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IMarkerResolution2;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.dialogs.PreferencesUtil;
 import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode;
 import org.eclipse.ui.progress.UIJob;
+import org.jboss.tools.common.quickfix.IBaseMarkerResolution;
 import org.jboss.tools.common.ui.CommonUIMessages;
 import org.jboss.tools.common.ui.preferences.SeverityPreferencePage;
 
@@ -43,7 +42,7 @@
  * @author Daniel Azarov
  */
 public class ConfigureProblemSeverityMarkerResolution implements
-		IMarkerResolution2, IJavaCompletionProposal {
+	IBaseMarkerResolution, IJavaCompletionProposal {
 	private static final int PREFERENCE_SIZE = 40;
 	private static final String DOTS = "...";
 	

Modified: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/QuickFixTestUtil.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/QuickFixTestUtil.java	2012-09-07 19:03:36 UTC (rev 43516)
+++ trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/QuickFixTestUtil.java	2012-09-07 19:06:44 UTC (rev 43517)
@@ -1,7 +1,9 @@
 package org.jboss.tools.common.base.test;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import junit.framework.Assert;
 
@@ -167,6 +169,7 @@
 			if(editor.isDirty()){
 				editor.doSave(new NullProgressMonitor());
 			}
+			//editor.dispose();
 			MarkerResolutionTestUtil.restoreFiles(project, new String[]{fileName});
 		}
 	}
@@ -218,7 +221,14 @@
 			
 			return annotation;
 		}else{
-			TemporaryAnnotation annotation = new TemporaryAnnotation(new Position(offset, length), "type", "message", null, quickFixId);
+			TemporaryAnnotation annotation = new TemporaryAnnotation(new Position(offset, length), TemporaryAnnotation.ANNOT_WARNING, "message", null, quickFixId);
+			Map attributes = new HashMap();
+			attributes.put(TempMarkerManager.AS_YOU_TYPE_VALIDATION_ANNOTATION_ATTRIBUTE, Boolean.TRUE);
+			attributes.put(TempMarkerManager.MESSAGE_ID_ATTRIBUTE_NAME, quickFixId);
+			attributes.put(TempMarkerManager.PREFERENCE_KEY_ATTRIBUTE_NAME, "preferenceKey");
+			attributes.put(TempMarkerManager.PREFERENCE_PAGE_ID_NAME, "pref_page_id");
+			attributes.put(TempMarkerManager.MESSAGE_TYPE_ATTRIBUTE_NAME, JavaMarkerAnnotation.WARNING_ANNOTATION_TYPE);
+			annotation.setAttributes(attributes);
 			
 			return annotation;
 		}



More information about the jbosstools-commits mailing list