[jbosstools-commits] JBoss Tools SVN: r42769 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Jul 27 18:03:45 EDT 2012


Author: akazakov
Date: 2012-07-27 18:03:45 -0400 (Fri, 27 Jul 2012)
New Revision: 42769

Modified:
   trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java
Log:
https://issues.jboss.org/browse/JBIDE-12304 Make Quick Fix "Add tag library definition" work with KB Model instead of using plain tag library list

Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java	2012-07-27 20:34:46 UTC (rev 42768)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java	2012-07-27 22:03:45 UTC (rev 42769)
@@ -19,7 +19,11 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry;
+import org.eclipse.wst.xml.core.internal.catalog.Catalog;
+import org.eclipse.wst.xml.core.internal.catalog.CatalogEntry;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogElement;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
 import org.jboss.tools.jst.web.kb.IKbProject;
 import org.jboss.tools.jst.web.kb.KbProjectFactory;
 import org.jboss.tools.jst.web.kb.WebKbPlugin;
@@ -106,14 +110,23 @@
 	public static List<File> getStaticTagLibs() {
 		List<File> files = new ArrayList<File>();
 		try {
-			ICatalogEntry[] entries = XMLCorePlugin.getDefault().getDefaultXMLCatalog().getCatalogEntries();
-			for (ICatalogEntry entry : entries) {
-				String uri = entry.getURI();
-				if(uri!=null && uri.endsWith(".tld") && uri.endsWith(".xml")) {
-	        		File file = new File(new URL(uri).getFile());
-	        		if(file.exists()) {
-	        			files.add(file);
-	        		}
+			INextCatalog[] catalogs = XMLCorePlugin.getDefault().getDefaultXMLCatalog().getNextCatalogs();
+			for (INextCatalog catalog : catalogs) {
+				ICatalog c = catalog.getReferencedCatalog();
+				if(c instanceof Catalog) {
+					ICatalogElement[] elements = ((Catalog)c).getCatalogElements();
+					for (ICatalogElement element : elements) {
+						if(element instanceof CatalogEntry) {
+							CatalogEntry entry = (CatalogEntry)element;
+							String uri = entry.getURI();
+							if(uri!=null && (uri.endsWith(".tld") || uri.endsWith(".xml")) && (uri.startsWith("file:") || uri.startsWith("jar:"))) {
+				        		File file = new File(new URL(uri).getFile());
+				        		if(file.exists()) {
+				        			files.add(file);
+				        		}
+							}
+						}
+					}
 				}
 			}
 		} catch (IOException e) {



More information about the jbosstools-commits mailing list