Author: dazarov
Date: 2010-02-28 04:28:32 -0500 (Sun, 28 Feb 2010)
New Revision: 20535
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4876
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2010-02-27
20:40:00 UTC (rev 20534)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2010-02-28
09:28:32 UTC (rev 20535)
@@ -11,6 +11,7 @@
package org.jboss.tools.jst.web.ui.action;
import java.util.HashMap;
+import java.util.Properties;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@@ -20,6 +21,8 @@
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.text.IStructuredDocument;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
/**
@@ -29,6 +32,9 @@
*
*/
public class AddTLDMarkerResolution implements IMarkerResolution{
+ private IFile file;
+ private IDocument document;
+ private Properties properties;
public static HashMap<String, String> libs = new HashMap<String, String>();
static{
@@ -42,6 +48,12 @@
libs.put("c", "http://java.sun.com/jstl/core"); //$NON-NLS-1$
//$NON-NLS-2$
libs.put("jsp", "http://java.sun.com/JSP/Page"); //$NON-NLS-1$
//$NON-NLS-2$
}
+
+ public AddTLDMarkerResolution(IFile file, IDocument document, Properties properties){
+ this.file = file;
+ this.document = document;
+ this.properties = properties;
+ }
public String getLabel() {
return "Insert tag library defenition";
@@ -75,6 +87,7 @@
}
public void run(IMarker marker) {
-
+ PaletteTaglibInserter inserter = new PaletteTaglibInserter();
+ inserter.inserTaglib(document, properties);
}
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2010-02-27
20:40:00 UTC (rev 20534)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2010-02-28
09:28:32 UTC (rev 20535)
@@ -34,11 +34,15 @@
*
*/
public class JSPProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
+ private IFile file;
+ private IDocument document;
+ private Properties properties;
+
public IMarkerResolution[] getResolutions(IMarker marker) {
try{
if(isOurCase(marker)){
return new IMarkerResolution[] {
- new AddTLDMarkerResolution()
+ new AddTLDMarkerResolution(file, document, properties)
};
}
@@ -59,18 +63,14 @@
if(prefix == null)
return false;
- //System.out.println("Prefix - "+prefix);
-
if(!AddTLDMarkerResolution.libs.containsKey(prefix))
return false;
- IFile file = (IFile)marker.getResource();
+ file = (IFile)marker.getResource();
- //System.out.println("File - "+file.getFullPath());
+ document = AddTLDMarkerResolution.getDocument(file);
- IDocument document = AddTLDMarkerResolution.getDocument(file);
-
- Properties properties = new Properties();
+ properties = new Properties();
properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI,
AddTLDMarkerResolution.libs.get(prefix));
properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new
ISelectionProvider() {
@@ -96,18 +96,6 @@
if(p.containsValue(prefix))
return false;
-
-// ArrayList<TaglibData> includeTaglibs = new ArrayList<TaglibData>();
-
-// List<TaglibData> taglibs = XmlUtil.getTaglibsForJSPDocument(document,
includeTaglibs);
-//
-// for(TaglibData data : taglibs){
-// System.out.println("Taglib prefix - "+data.getPrefix()+" URI -
"+data.getUri());
-// }
-
-// if(XmlUtil.getTaglibForPrefix(prefix, taglibs) != null)
-// return false;
-
return true;
}
}
\ No newline at end of file