[jbosstools-commits] JBoss Tools SVN: r42416 - in trunk/common/plugins: org.jboss.tools.common/META-INF and 15 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Jul 5 15:53:29 EDT 2012


Author: dazarov
Date: 2012-07-05 15:53:28 -0400 (Thu, 05 Jul 2012)
New Revision: 42416

Added:
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/quickfix/
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/quickfix/BaseJavaHover.java
   trunk/common/plugins/org.jboss.tools.common/schema/
   trunk/common/plugins/org.jboss.tools.common/schema/quickFix.exsd
   trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/
   trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IBaseMarkerResolution.java
   trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFixGenerator.java
   trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/MarkerAnnotationInfo.java
   trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixExtension.java
   trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixManager.java
   trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixProposal.java
Removed:
   trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd
   trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/
Modified:
   trunk/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF
   trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml
   trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/BaseQuickAssistProcessor.java
   trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java
   trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
   trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml
   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/META-INF/MANIFEST.MF
   trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
   trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
   trunk/common/plugins/org.jboss.tools.common/plugin.xml
Log:
Make Quick Fix "Configure Problem Severity" work on Temporary annotations https://issues.jboss.org/browse/JBIDE-12232

Modified: trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF	2012-07-05 19:53:28 UTC (rev 42416)
@@ -12,6 +12,7 @@
  org.jboss.tools.common.jobs,
  org.jboss.tools.common.log,
  org.jboss.tools.common.preferences,
+ org.jboss.tools.common.quickfix,
  org.jboss.tools.common.refactoring,
  org.jboss.tools.common.reporting,
  org.jboss.tools.common.text,
@@ -40,7 +41,8 @@
  org.apache.commons.httpclient;bundle-version="3.1.0",
  org.eclipse.ui.editors;bundle-version="3.7.0",
  org.eclipse.jpt.common.core;bundle-version="1.0.0",
- org.eclipse.ltk.core.refactoring;bundle-version="3.5.200"
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.200",
+ org.eclipse.wst.sse.ui;bundle-version="1.3.100"
 Bundle-Version: 3.4.0.qualifier
 Bundle-ActivationPolicy: lazy
 Bundle-ManifestVersion: 2

Modified: trunk/common/plugins/org.jboss.tools.common/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/plugin.xml	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common/plugin.xml	2012-07-05 19:53:28 UTC (rev 42416)
@@ -2,6 +2,8 @@
 <?eclipse version="3.0"?>
 <plugin>
 
+<extension-point id="quickFix" name="Quick Fix Generator" schema="schema/quickFix.exsd"/>
+
  <extension point="org.eclipse.wst.xml.core.catalogContributions">
       <catalogContribution id="default">
         

Copied: trunk/common/plugins/org.jboss.tools.common/schema/quickFix.exsd (from rev 42411, trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/schema/quickFix.exsd	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/schema/quickFix.exsd	2012-07-05 19:53:28 UTC (rev 42416)
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.common.text.xml" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="org.jboss.tools.common.text.xml" id="quickFix" name="Quick Fix Generator"/>
+      </appInfo>
+      <documentation>
+         This extenion point is used to send information about Quick fix generators to QuickFixManager.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appInfo>
+            <meta.element />
+         </appInfo>
+      </annotation>
+      <complexType>
+         <sequence>
+            <element ref="quick-fix-generator" 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="quick-fix-generator">
+      <complexType>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="identifier"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+         <attribute name="generator-class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="java" basedOn=":org.jboss.tools.common.text.xml.quickfix.IQuickFixGenerator"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="since"/>
+      </appInfo>
+      <documentation>
+         JBoss Tools 3.4
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="examples"/>
+      </appInfo>
+      <documentation>
+         &lt;extension point=&quot;org.jboss.tools.common.text.xml.quickFix&quot;&gt;
+ &lt;quick-fix-generator id=&quot;seam.searcher&quot; generator-class=&quot;org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator&quot; /&gt;
+&lt;/extension&gt;
+      </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>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="copyright"/>
+      </appInfo>
+      <documentation>
+         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
+      </documentation>
+   </annotation>
+
+</schema>


Property changes on: trunk/common/plugins/org.jboss.tools.common/schema/quickFix.exsd
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IBaseMarkerResolution.java (from rev 42411, trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IBaseMarkerResolution.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IBaseMarkerResolution.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IBaseMarkerResolution.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -0,0 +1,17 @@
+/******************************************************************************* 
+ * 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.quickfix;
+
+import org.eclipse.ui.IMarkerResolution2;
+
+public interface IBaseMarkerResolution extends IMarkerResolution2 {
+
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IBaseMarkerResolution.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFixGenerator.java (from rev 42411, trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFixGenerator.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFixGenerator.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -0,0 +1,37 @@
+/******************************************************************************* 
+ * 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.quickfix;
+
+import java.util.List;
+
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jface.text.source.Annotation;
+
+public interface IQuickFixGenerator {
+	
+	/**
+     * Returns whether there are any proposals for the given annotation.
+     *
+     * @param annotation the annotation
+     * @return <code>true</code> if there are proposals for the given annotation,
+     *   <code>false</code> if not
+     */
+	public boolean hasProposals(Annotation annotation);
+	
+	/**
+     * Returns list of proposals for the given annotation (may
+     * be empty).
+     *
+     * @param annotation the annotation
+     * @return list of proposals for the given annotation
+     */
+	public List<IJavaCompletionProposal> getProposals(Annotation annotation);
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/IQuickFixGenerator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/MarkerAnnotationInfo.java (from rev 42411, trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/MarkerAnnotationInfo.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/MarkerAnnotationInfo.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Exadel, Inc. and 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:
+ *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/ 
+package org.jboss.tools.common.quickfix;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
+import org.eclipse.jface.text.quickassist.IQuickAssistProcessor;
+import org.eclipse.jface.text.quickassist.IQuickFixableAnnotation;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
+import org.eclipse.wst.sse.ui.StructuredTextInvocationContext;
+import org.eclipse.wst.sse.ui.internal.correction.QuickFixRegistry;
+import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
+
+public class MarkerAnnotationInfo {
+	public final List<AnnotationInfo> infos;
+	public final ISourceViewer viewer;
+
+	public MarkerAnnotationInfo(List<AnnotationInfo> infos, ISourceViewer textViewer) {
+		this.infos = infos;
+		this.viewer = textViewer;
+	}
+	
+	public List<ICompletionProposal> getCompletionProposals(AnnotationInfo info) {
+
+		if(info.isTop())
+			return getMarkerProposals(info);
+		else
+			return getProposals(info);
+		
+	}
+
+	public List<ICompletionProposal> getMarkerProposals(AnnotationInfo info) {
+		SimpleMarkerAnnotation annotation = (SimpleMarkerAnnotation)info.annotation;
+		
+		ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+		
+		IMarker marker = annotation.getMarker();
+		IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry().getResolutions(marker);
+		for (IMarkerResolution resolution : resolutions) {
+			if(!isDirty() || !(resolution instanceof IBaseMarkerResolution)){
+				proposals.add(new QuickFixProposal(resolution, marker));
+			}
+		}
+		
+		return proposals;
+	}
+	
+	public List<ICompletionProposal> getProposals(AnnotationInfo info) {
+		TemporaryAnnotation annotation = (TemporaryAnnotation)info.annotation;
+		
+		List<ICompletionProposal> allProposals = new ArrayList<ICompletionProposal>();
+		List<IQuickAssistProcessor> processors = new ArrayList<IQuickAssistProcessor>();
+		if (canFix(annotation)) {
+			Object o = annotation.getAdditionalFixInfo();
+			if (o instanceof IQuickAssistProcessor) {
+				processors.add((IQuickAssistProcessor)o);
+			}
+			
+			// get all relevant quick fixes for this annotation
+			
+			if(isDirty() && QuickFixManager.getInstance().hasProposals(annotation)){
+				annotation.setAdditionalFixInfo(viewer.getDocument());
+				List<IJavaCompletionProposal> proposals = QuickFixManager.getInstance().getProposals(annotation);
+				allProposals.addAll(proposals);
+			}
+
+			QuickFixRegistry registry = QuickFixRegistry.getInstance();
+			processors.addAll(Arrays.asList(registry.getQuickFixProcessors(annotation)));
+
+			// set up context
+			Map attributes = null;
+			attributes = annotation.getAttributes();
+			StructuredTextInvocationContext sseContext = new StructuredTextInvocationContext(viewer, info.position.getOffset(), info.position.getLength(), attributes);
+
+			// call each processor
+			for (int i = 0; i < processors.size(); ++i) {
+				List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+				collectProposals((IQuickAssistProcessor) processors.get(i), annotation, sseContext, proposals);
+
+				if (proposals.size() > 0) {
+					allProposals.addAll(proposals);
+				}
+			}
+
+		}
+
+		return allProposals;
+	}
+	
+	private static boolean isDirty(){
+		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+		if(window != null){
+			IWorkbenchPage page = window.getActivePage();
+			if(page != null){
+				IEditorPart editor = page.getActiveEditor();
+				if(editor != null){
+					return editor.isDirty();
+				}
+			}
+		}
+		return true;
+	}
+	
+	private void collectProposals(IQuickAssistProcessor processor, Annotation annotation, IQuickAssistInvocationContext invocationContext, List<ICompletionProposal> proposalsList) {
+		ICompletionProposal[] proposals = processor.computeQuickAssistProposals(invocationContext);
+		if (proposals != null && proposals.length > 0) {
+			proposalsList.addAll(Arrays.asList(proposals));
+		}
+	}
+	
+	public boolean canFix(Annotation annotation) {
+		if (annotation instanceof IQuickFixableAnnotation) {
+			if (((IQuickFixableAnnotation) annotation).isQuickFixableStateSet()) {
+				return ((IQuickFixableAnnotation) annotation).isQuickFixable();
+			}
+		}else if(annotation instanceof TemporaryAnnotation){
+			if (((TemporaryAnnotation) annotation).isQuickFixableStateSet()) {
+				return ((TemporaryAnnotation) annotation).isQuickFixable();
+			}
+		}
+		return false;
+	}
+	
+	public static class AnnotationInfo {
+		public Annotation annotation;
+		public Position position;
+		
+		public AnnotationInfo(Annotation annotation, Position position){
+			this.annotation = annotation;
+			this.position = position;
+		}
+		
+		public boolean isTop(){
+			return annotation instanceof SimpleMarkerAnnotation;
+		}
+	}
+
+	@Override
+	public String toString() {
+		return null;
+	}
+}
\ No newline at end of file


Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/MarkerAnnotationInfo.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixExtension.java (from rev 42411, trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixExtension.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixExtension.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixExtension.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -0,0 +1,57 @@
+/******************************************************************************* 
+ * 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.quickfix;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.common.CommonPlugin;
+
+public class QuickFixExtension {
+	public static String EXTENSION_POINT = "org.jboss.tools.common.quickFix"; //$NON-NLS-1$
+
+	String id;
+	IQuickFixGenerator generator;
+
+	public QuickFixExtension() {}
+
+	public String getId() {
+		return id;
+	}
+
+	public IQuickFixGenerator getQuickFixGenerator() {
+		return generator;
+	}
+
+	static QuickFixExtension[] INSTANCES;
+
+	public static QuickFixExtension[] getInstances() {
+		if(INSTANCES != null) return INSTANCES;
+		List<QuickFixExtension> list = new ArrayList<QuickFixExtension>();
+		IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
+		IConfigurationElement[] es = point.getConfigurationElements();
+		for (IConfigurationElement e: es) {
+			QuickFixExtension n = new QuickFixExtension();
+			n.id = e.getAttribute("id"); //$NON-NLS-1$
+			try{
+				n.generator = (IQuickFixGenerator)e.createExecutableExtension("generator-class"); //$NON-NLS-1$
+			}catch(CoreException ex){
+				CommonPlugin.getDefault().logError(ex);
+			}
+			list.add(n);
+		}
+		return INSTANCES = list.toArray(new QuickFixExtension[0]);
+	}
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixExtension.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixManager.java (from rev 42411, trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixManager.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixManager.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -0,0 +1,71 @@
+/******************************************************************************* 
+ * 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.quickfix;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.source.Annotation;
+
+public class QuickFixManager {
+	private static QuickFixManager instance = null;
+	
+	private HashMap<String, IQuickFixGenerator> generators = new HashMap<String, IQuickFixGenerator>();
+	
+	public static QuickFixManager getInstance(){
+		if(instance == null){
+			instance = new QuickFixManager();
+		}
+		return instance;
+	}
+	
+	public QuickFixManager(){
+		QuickFixExtension[] extensions = QuickFixExtension.getInstances();
+		for(QuickFixExtension extension : extensions){
+			IQuickFixGenerator generator = extension.getQuickFixGenerator();
+			if(generator != null){
+				addQuickFixGenerator(generator);
+			}
+		}
+	}
+	
+	public void addQuickFixGenerator(IQuickFixGenerator generator){
+		if(!generators.containsKey(generator.getClass().toString())){
+			generators.put(generator.getClass().toString(), generator);
+		}
+	}
+	
+	public void removeQuickFixGenerator(IQuickFixGenerator generator){
+		generators.remove(generator);
+	}
+	
+	public boolean hasProposals(Annotation annotation){
+		for(IQuickFixGenerator generator : generators.values()){
+			if(generator.hasProposals(annotation)){
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	public List<IJavaCompletionProposal> getProposals(Annotation annotation){
+		ArrayList<IJavaCompletionProposal> proposals = new ArrayList<IJavaCompletionProposal>();
+		for(IQuickFixGenerator generator : generators.values()){
+			List<IJavaCompletionProposal> pp = generator.getProposals(annotation);
+			proposals.addAll(pp);
+		}
+		
+		return proposals;
+	}
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixProposal.java (from rev 42411, trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixProposal.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixProposal.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixProposal.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Exadel, Inc. and 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:
+ *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/ 
+package org.jboss.tools.common.quickfix;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+
+public class QuickFixProposal implements ICompletionProposal{
+	private IMarkerResolution resolution;
+	private IMarker marker;
+	
+	public QuickFixProposal(IMarkerResolution resolution, IMarker marker){
+		this.resolution = resolution;
+		this.marker = marker;
+	}
+
+	public void apply(IDocument document) {
+		resolution.run(marker);
+	}
+
+	public Point getSelection(IDocument document) {
+		return null;
+	}
+
+	public String getAdditionalProposalInfo() {
+		if (resolution instanceof IMarkerResolution2)
+			return ((IMarkerResolution2) resolution).getDescription();
+		
+		return (String)marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
+	}
+
+	public String getDisplayString() {
+		return resolution.getLabel();
+	}
+
+	public Image getImage() {
+		if (resolution instanceof IMarkerResolution2)
+			return ((IMarkerResolution2)resolution).getImage();
+		return null;
+	}
+
+	public IContextInformation getContextInformation() {
+		return null;
+	}
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/quickfix/QuickFixProposal.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF	2012-07-05 19:53:28 UTC (rev 42416)
@@ -10,7 +10,6 @@
  org.jboss.tools.common.text.xml.contentassist,
  org.jboss.tools.common.text.xml.info,
  org.jboss.tools.common.text.xml.internal.ui.preferencies,
- org.jboss.tools.common.text.xml.quickfix,
  org.jboss.tools.common.text.xml.ui,
  org.jboss.tools.common.text.xml.ui.xpl,
  org.jboss.tools.common.text.xml.xpl,

Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml	2012-07-05 19:53:28 UTC (rev 42416)
@@ -3,7 +3,6 @@
 <plugin>
 
    <extension-point id="contentAssistProcessor" name="Content Assist Processor Extension Point Extension" schema="schema/contentAssistProcessor.exsd"/>
-   <extension-point id="quickFix" name="Quick Fix Generator" schema="schema/quickFix.exsd"/>
 
 <!--
 	<extension-point id="foldingStructureProviders" name="%foldingStructureProvidersExtensionPoint" schema="schema/foldingStructureProviders.exsd"/> 

Deleted: trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/schema/quickFix.exsd	2012-07-05 19:53:28 UTC (rev 42416)
@@ -1,129 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.jboss.tools.common.text.xml" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appInfo>
-         <meta.schema plugin="org.jboss.tools.common.text.xml" id="quickFix" name="Quick Fix Generator"/>
-      </appInfo>
-      <documentation>
-         This extenion point is used to send information about Quick fix generators to QuickFixManager.
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appInfo>
-            <meta.element />
-         </appInfo>
-      </annotation>
-      <complexType>
-         <sequence>
-            <element ref="quick-fix-generator" 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="quick-fix-generator">
-      <complexType>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appInfo>
-                  <meta.attribute kind="identifier"/>
-               </appInfo>
-            </annotation>
-         </attribute>
-         <attribute name="generator-class" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appInfo>
-                  <meta.attribute kind="java" basedOn=":org.jboss.tools.common.text.xml.quickfix.IQuickFixGenerator"/>
-               </appInfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="since"/>
-      </appInfo>
-      <documentation>
-         JBoss Tools 3.4
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="examples"/>
-      </appInfo>
-      <documentation>
-         &lt;extension point=&quot;org.jboss.tools.common.text.xml.quickFix&quot;&gt;
- &lt;quick-fix-generator id=&quot;seam.searcher&quot; generator-class=&quot;org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator&quot; /&gt;
-&lt;/extension&gt;
-      </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>
-
-   <annotation>
-      <appInfo>
-         <meta.section type="copyright"/>
-      </appInfo>
-      <documentation>
-         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
-      </documentation>
-   </annotation>
-
-</schema>

Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/BaseQuickAssistProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/BaseQuickAssistProcessor.java	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/BaseQuickAssistProcessor.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -22,8 +22,8 @@
 import org.eclipse.jface.text.source.IAnnotationModel;
 import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
 import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
-import org.jboss.tools.common.text.xml.quickfix.MarkerAnnotationInfo;
-import org.jboss.tools.common.text.xml.quickfix.MarkerAnnotationInfo.AnnotationInfo;
+import org.jboss.tools.common.quickfix.MarkerAnnotationInfo;
+import org.jboss.tools.common.quickfix.MarkerAnnotationInfo.AnnotationInfo;
 
 public class BaseQuickAssistProcessor implements IQuickAssistProcessor {
 

Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -63,8 +63,8 @@
 import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
 import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
 import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
-import org.jboss.tools.common.text.xml.quickfix.MarkerAnnotationInfo;
-import org.jboss.tools.common.text.xml.quickfix.MarkerAnnotationInfo.AnnotationInfo;
+import org.jboss.tools.common.quickfix.MarkerAnnotationInfo;
+import org.jboss.tools.common.quickfix.MarkerAnnotationInfo.AnnotationInfo;
 import org.jboss.tools.common.text.xml.TextXMLMessages;
 
 public class MarkerProblemAnnotationHoverProcessor extends ProblemAnnotationHoverProcessor implements ITextHoverExtension, ITextHoverExtension2{

Modified: trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF	2012-07-05 19:53:28 UTC (rev 42416)
@@ -39,6 +39,7 @@
  org.jboss.tools.common.ui.marker,
  org.jboss.tools.common.ui.preferences,
  org.jboss.tools.common.ui.preferencevalue,
+ org.jboss.tools.common.ui.quickfix,
  org.jboss.tools.common.ui.refactoring,
  org.jboss.tools.common.ui.ssh,
  org.jboss.tools.common.ui.widget.editor,

Modified: trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml	2012-07-05 19:53:28 UTC (rev 42416)
@@ -39,7 +39,16 @@
             <actionSet id="org.eclipse.wst.server.ui.internal.webbrowser.actionSet"/>
          </perspectiveExtension>
       </extension>
-      <extension point="org.jboss.tools.common.text.xml.quickFix">
+      <extension point="org.jboss.tools.common.quickFix">
 		<quick-fix-generator generator-class="org.jboss.tools.common.ui.marker.ConfigureProblemSeverityResolutionGenerator" id="org.jboss.tools.common.ui.marker.ConfigureProblemSeverityResolutionGenerator" />
     </extension>
+    <extension
+      point="org.eclipse.jdt.ui.javaEditorTextHovers">
+   <hover
+         activate="true"
+         class="org.jboss.tools.common.ui.quickfix.BaseJavaHover"
+         id="org.jboss.tools.common.ui.quickfix.BaseJavaHover"
+         label="Base Java Hover">
+   </hover>
+</extension>
 </plugin>

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-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -27,9 +27,10 @@
 import org.eclipse.ui.IMarkerResolutionGenerator2;
 import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
 import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.common.text.xml.quickfix.IQuickFixGenerator;
+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;
 
 /**
  * @author Daniel Azarov
@@ -114,39 +115,48 @@
 		return attribute; 
 	}
 	
-	private String getPreferenceKey(TemporaryAnnotation annotation){
-		if(annotation.getAttributes() != null){
-			String attribute = (String)annotation.getAttributes().get(ValidationErrorManager.PREFERENCE_KEY_ATTRIBUTE_NAME);
-			return attribute;
+	private String getPreferenceKey(Annotation annotation){
+		if(annotation instanceof TemporaryAnnotation){
+			if(((TemporaryAnnotation)annotation).getAttributes() != null){
+				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);
+				return attribute;
+			}
 		}
 		return null;
 	}
 
-	private String getPreferencePageId(TemporaryAnnotation annotation){
-		if(annotation.getAttributes() != null){
-			String attribute = (String)annotation.getAttributes().get(ValidationErrorManager.PREFERENCE_PAGE_ID_NAME);
-			return attribute; 
+	private String getPreferencePageId(Annotation annotation){
+		if(annotation instanceof TemporaryAnnotation){
+			if(((TemporaryAnnotation)annotation).getAttributes() != null){
+				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);
+				return attribute; 
+			}
 		}
 		return null;
 	}
 
 	@Override
 	public boolean hasProposals(Annotation annotation) {
-		if(annotation instanceof TemporaryAnnotation){
-			return getPreferenceKey((TemporaryAnnotation)annotation) != null && getPreferencePageId((TemporaryAnnotation)annotation) != null;
-		}
-		return false;
+		return getPreferenceKey(annotation) != null && getPreferencePageId(annotation) != null;
 	}
 
 	@Override
 	public List<IJavaCompletionProposal> getProposals(Annotation annotation) {
 		ArrayList<IJavaCompletionProposal> proposals = new ArrayList<IJavaCompletionProposal>();
-		if(annotation instanceof TemporaryAnnotation){
-			String preferenceKey = getPreferenceKey((TemporaryAnnotation)annotation);
-			String preferencePageId = getPreferencePageId((TemporaryAnnotation)annotation);
-			if(preferenceKey != null && preferencePageId != null){
-				proposals.add(new ConfigureProblemSeverityMarkerResolution(preferencePageId, preferenceKey));
-			}
+		String preferenceKey = getPreferenceKey(annotation);
+		String preferencePageId = getPreferencePageId(annotation);
+		if(preferenceKey != null && preferencePageId != null){
+			proposals.add(new ConfigureProblemSeverityMarkerResolution(preferencePageId, preferenceKey));
 		}
 		return proposals;
 	}

Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/quickfix/BaseJavaHover.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/quickfix/BaseJavaHover.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/quickfix/BaseJavaHover.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -0,0 +1,59 @@
+/******************************************************************************* 
+ * 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.ui.quickfix;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.source.Annotation;
+import org.jboss.tools.common.quickfix.QuickFixManager;
+
+ at SuppressWarnings("restriction")
+public class BaseJavaHover extends AbstractAnnotationHover{
+	public BaseJavaHover() {
+		super(true);
+	}
+	
+	@Override
+	protected AnnotationInfo createAnnotationInfo(Annotation annotation, Position position, ITextViewer textViewer) {
+		AnnotationInfo info = new ProblemInfo(annotation, position, textViewer);
+		if(info.getCompletionProposals().length > 0){
+			return info;
+		}
+		return null;
+	}
+	
+	protected static class ProblemInfo extends AnnotationInfo {
+
+		public ProblemInfo(Annotation annotation, Position position, ITextViewer textViewer) {
+			super(annotation, position, textViewer);
+		}
+
+		/*
+		 * @see org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover.AnnotationInfo#getCompletionProposals()
+		 */
+		@Override
+		public ICompletionProposal[] getCompletionProposals() {
+			ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>();
+			
+			if(QuickFixManager.getInstance().hasProposals(annotation)){
+				List<IJavaCompletionProposal> pp = QuickFixManager.getInstance().getProposals(annotation);
+				proposals.addAll(pp);
+			}
+			return proposals.toArray(new ICompletionProposal[proposals.size()]);
+		}
+	}
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/quickfix/BaseJavaHover.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/common/plugins/org.jboss.tools.common.validation/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/META-INF/MANIFEST.MF	2012-07-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.validation/META-INF/MANIFEST.MF	2012-07-05 19:53:28 UTC (rev 42416)
@@ -24,4 +24,5 @@
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-Vendor: %providerName
 Export-Package: org.jboss.tools.common.validation,
- org.jboss.tools.common.validation.internal
+ org.jboss.tools.common.validation.internal,
+ org.jboss.tools.common.validation.java

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-05 18:43:26 UTC (rev 42415)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java	2012-07-05 19:53:28 UTC (rev 42416)
@@ -57,7 +57,7 @@
  *
  */
 @SuppressWarnings("restriction")
-final class JavaDirtyRegionProcessor extends
+final public class JavaDirtyRegionProcessor extends
 			DirtyRegionProcessor {
 
 	/**
@@ -213,7 +213,7 @@
 					CoreELProblem problem= new CoreELProblem(valMessage, 
 							editorInput.getName());
 					if (fCompilationUnit != null) {
-						ProblemAnnotation problemAnnotation = new ProblemAnnotation(problem, fCompilationUnit);
+						JavaProblemAnnotation problemAnnotation = new JavaProblemAnnotation(problem, fCompilationUnit);
 						addAnnotation(problemAnnotation, position, cleanAllAnnotations);
 					}
 				}
@@ -226,6 +226,19 @@
 			fInRewriteSession = event != null && event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_START);
 		}
 	}
+	
+	public class JavaProblemAnnotation extends ProblemAnnotation{
+		CoreELProblem problem;
+		
+		public JavaProblemAnnotation(CoreELProblem problem, ICompilationUnit cu) {
+			super(problem, cu);
+			this.problem = problem;
+		}
+		
+		public Map getAttributes() {
+			return problem.getAttributes();
+		}
+	}
 
 	class CoreELProblem extends CategorizedProblem {
 		/** The end offset of the problem */
@@ -244,6 +257,8 @@
 
 		/** The originating file name */
 		private String fOrigin;
+		
+		private ValidationMessage vMessage;
 
 		public static final int EL_PROBLEM_ID= 0x88000000;
 
@@ -262,6 +277,7 @@
 			fMessage= message.getText();
 			fOrigin= origin;
 			fIsError = (IMessage.NORMAL_SEVERITY != message.getSeverity());
+			vMessage = message;
 		}
 
 		/*
@@ -363,6 +379,10 @@
 		public String getMarkerType() {
 			return MARKER_TYPE;
 		}
+		
+		public Map getAttributes(){
+			return vMessage.getAttributes();
+		}
 	}
 
 	public JavaDirtyRegionProcessor(ITextEditor editor) {



More information about the jbosstools-commits mailing list