[jbosstools-commits] JBoss Tools SVN: r39741 - in workspace/dazarov/branches/jbosstools-3.4.x: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Mar 21 19:57:41 EDT 2012


Author: dazarov
Date: 2012-03-21 19:57:40 -0400 (Wed, 21 Mar 2012)
New Revision: 39741

Modified:
   workspace/dazarov/branches/jbosstools-3.4.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java
   workspace/dazarov/branches/jbosstools-3.4.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
   workspace/dazarov/branches/jbosstools-3.4.x/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
Log:
Make Quick fix for problem markers "Unknown tag" work on temporary WTP annotations https://issues.jboss.org/browse/JBIDE-10958

Modified: workspace/dazarov/branches/jbosstools-3.4.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java
===================================================================
--- workspace/dazarov/branches/jbosstools-3.4.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java	2012-03-21 18:52:15 UTC (rev 39740)
+++ workspace/dazarov/branches/jbosstools-3.4.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java	2012-03-21 23:57:40 UTC (rev 39741)
@@ -67,7 +67,7 @@
 		
 		List<ICompletionProposal> allProposals = new ArrayList<ICompletionProposal>();
 		List<IQuickAssistProcessor> processors = new ArrayList<IQuickAssistProcessor>();
-		//if (canFix(annotation)) {
+		if (canFix(annotation)) {
 			Object o = annotation.getAdditionalFixInfo();
 			if (o instanceof IQuickAssistProcessor) {
 				processors.add((IQuickAssistProcessor)o);
@@ -75,6 +75,7 @@
 			
 			// get all relevant quick fixes for this annotation
 			if(QuickFixManager.getInstance().hasProposals(annotation)){
+				annotation.setAdditionalFixInfo(viewer.getDocument());
 				List<ICompletionProposal> proposals = QuickFixManager.getInstance().getProposals(annotation);
 				allProposals.addAll(proposals);
 			}
@@ -97,7 +98,7 @@
 				}
 			}
 
-		//}
+		}
 
 		return allProposals;
 	}
@@ -114,6 +115,10 @@
 			if (((IQuickFixableAnnotation) annotation).isQuickFixableStateSet()) {
 				return ((IQuickFixableAnnotation) annotation).isQuickFixable();
 			}
+		}else if(annotation instanceof TemporaryAnnotation){
+			if (((TemporaryAnnotation) annotation).isQuickFixableStateSet()) {
+				return ((TemporaryAnnotation) annotation).isQuickFixable();
+			}
 		}
 		return false;
 	}

Modified: workspace/dazarov/branches/jbosstools-3.4.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
===================================================================
--- workspace/dazarov/branches/jbosstools-3.4.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java	2012-03-21 18:52:15 UTC (rev 39740)
+++ workspace/dazarov/branches/jbosstools-3.4.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java	2012-03-21 23:57:40 UTC (rev 39741)
@@ -176,7 +176,7 @@
 			ISourceViewer sourceViewer, String partitionType) {
 		// TODO Auto-generated method stub
 //		return super.getContentAssistProcessors(sourceViewer, partitionType);
-		return new IContentAssistProcessor[0];
+		return null;
 	}
 	
 	/**

Modified: workspace/dazarov/branches/jbosstools-3.4.x/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
--- workspace/dazarov/branches/jbosstools-3.4.x/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java	2012-03-21 18:52:15 UTC (rev 39740)
+++ workspace/dazarov/branches/jbosstools-3.4.x/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java	2012-03-21 23:57:40 UTC (rev 39741)
@@ -15,6 +15,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
@@ -23,7 +24,6 @@
 import org.eclipse.jface.text.TextSelection;
 import org.eclipse.jface.text.contentassist.ICompletionProposal;
 import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
@@ -32,6 +32,12 @@
 import org.eclipse.ui.part.FileEditorInput;
 import org.eclipse.ui.texteditor.DocumentProviderRegistry;
 import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
 import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
 import org.jboss.tools.common.text.xml.quickfix.IQuickFixGenerator;
 import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
@@ -86,8 +92,8 @@
 			return null;
 		}
 		TemporaryAnnotation ta = (TemporaryAnnotation)annotation;
-		Map attrs = ta.getAttributes();
 		
+		
 		String message = annotation.getText();
 		if(ta.getPosition() == null)
 			return null;
@@ -106,8 +112,20 @@
 		if(!libs.containsKey(prefix))
 			return null;
 		
-		resolutionName = "xmlns: "+prefix+" = \""+libs.get(prefix)+"\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		Object additionalInfo = ta.getAdditionalFixInfo();
+		if(additionalInfo instanceof IDocument){
+			IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead((IStructuredDocument)additionalInfo);
+			IDOMDocument xmlDocument = (model instanceof IDOMModel) ? ((IDOMModel) model).getDocument() : null;
+			if(xmlDocument != null && xmlDocument.isXMLType()){
+				resolutionName = "xmlns: "+prefix+" = \""+libs.get(prefix)+"\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			}else{
+				resolutionName = "<%@ taglib uri = \""+libs.get(prefix)+"\" prefix=\""+prefix+"\" %>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			}
+			
+		}
 		
+		
+		
 		return new AddTLDMarkerResolution(resolutionName, start, end, libs.get(prefix), prefix);
 	}
 	



More information about the jbosstools-commits mailing list