[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/eclipse-cdt/devel eclipse-cdt-libhover-jar.patch, NONE, 1.1 eclipse-cdt.spec, 1.50, 1.51



Author: jjohnstn

Update of /cvs/dist/rpms/eclipse-cdt/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv31643

Modified Files:
	eclipse-cdt.spec 
Added Files:
	eclipse-cdt-libhover-jar.patch 
Log Message:

* Mon Jul 31 2006 Jeff Johnston  <jjohnstn redhat com> 3.1.0-1jpp_10fc
- Fix bug with library hover help.




eclipse-cdt-libhover-jar.patch:
 LibHover.java |  168 ++++++++++++++--------------------------------------------
 1 files changed, 41 insertions(+), 127 deletions(-)

--- NEW FILE eclipse-cdt-libhover-jar.patch ---
--- com.redhat.eclipse.cdt.autotools/src/com/redhat/eclipse/cdt/autotools/ui/LibHover.java.fix	2006-07-31 15:56:12.000000000 -0400
+++ com.redhat.eclipse.cdt.autotools/src/com/redhat/eclipse/cdt/autotools/ui/LibHover.java	2006-07-31 15:56:31.000000000 -0400
@@ -15,43 +15,45 @@
 
 package com.redhat.eclipse.cdt.autotools.ui;
 
-import java.util.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import org.w3c.dom.*;
-
-import org.eclipse.core.runtime.*;
-import com.redhat.eclipse.cdt.autotools.AutotoolsPlugin;
-import org.eclipse.cdt.ui.ICHelpProvider;
-import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
 import org.eclipse.cdt.ui.CUIPlugin;
 import org.eclipse.cdt.ui.ICHelpBook;
+import org.eclipse.cdt.ui.ICHelpProvider;
 import org.eclipse.cdt.ui.ICHelpResourceDescriptor;
 import org.eclipse.cdt.ui.IFunctionSummary;
 import org.eclipse.cdt.ui.IRequiredInclude;
+import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Plugin;
 import org.eclipse.help.IHelpResource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import com.redhat.eclipse.cdt.autotools.AutotoolsPlugin;
 
 public class LibHover implements ICHelpProvider {
 	
     private static Plugin plugin;
-    private static String docsRootPath = null;
 
     // see comment in initialize()
     // private static String defaultSearchPath = null;
     
     private static Document document;
-    private static String oldpath = null;static final String  constructTypes[] ={
+    static final String  constructTypes[] ={
             "dtype",
 	        "enum",
 	        "function",
@@ -66,108 +68,39 @@ public class LibHover implements ICHelpP
 	    static final int typeIndex          = 4;
 	    static final int unionIndex         = 5;
 
-    private Document getDocument(String path, String name) {
-        Document doc = null;
-
-        String userHome = System.getProperty("user.home");
-        String userDir  = System.getProperty("user.dir");
-
-        if ((null == oldpath) || !oldpath.equals(path)) {
-            StringTokenizer dirs = new StringTokenizer(path, ":", false);
-
-            while((null == doc) && dirs.hasMoreTokens()) {
-                String dir =  dirs.nextToken();
-                if ((null != userHome) && dir.startsWith("~")) {
-                    dir = dir.replaceFirst("~", userHome);
-                }
-                else if ((null != userDir) && dir.startsWith(".")) {
-                    dir = dir.replaceFirst(".", userDir);
-                }
-                else if ((null != docsRootPath) && dir.startsWith("!")) {
-                    dir = dir.replaceFirst("!", docsRootPath);
-                }
-
-                if (!dir.endsWith("/")) dir = dir.concat("/");
-
-                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-                factory.setValidating(true);
-                try {
-                    DocumentBuilder builder = factory.newDocumentBuilder();
-//                    builder.setErrorHandler(new TextHoverErrorHandler());
-                    doc = builder.parse( new File(dir + name) );
-                }
-                catch (SAXParseException saxException) {
-                    doc = null;
-                }
-                catch (SAXException saxEx) {
-                    doc = null;
-                }
-                catch (ParserConfigurationException pce) {
-                    doc = null;
-                }
-                catch (IOException ioe) {
-                    doc = null;
-                }
-            }
-            oldpath = path;
-        }
-
-        return doc;
-    }
-    
-	public void buildDocPath(String root, String path) {
+     
+	public void getLibHoverDocs() {
 		if (null != plugin) {
-//			URL hoverdocsURL;
-//			URL homeURL = plugin.find(new Path("."));
 			Document doc = null;
 			try {
-//				homeURL = Platform.asLocalURL(homeURL);
-//				IPath topPath = (new Path(homeURL.getPath())).removeLastSegments(1);
-//				IPath homePath = topPath;
-//				if (null != root) homePath = homePath.append(root);
-//				if (null != path) homePath = homePath.append(path);
-//				homePath = homePath.addTrailingSeparator();
-//				docsRootPath = homePath.toOSString();
-
 				// see comment in initialize()
-				// document = getDocument(((null == defaultSearchPath) ? "!" : defaultSearchPath), "glibc.xml");
 				try {
-					Path p = new Path("libhoverdocs/glibc.xml");
+					// Use the FileLocator class to open the magic hover doc file
+					// in the plugin's jar.
+					Path p = new Path("libhoverdocs/glibc.xml"); //$NON-NLS-1$
 					InputStream docStream = FileLocator.openStream(AutotoolsPlugin.getDefault().getBundle(), p, false);
-					System.out.println("docStream created");
-//					Path x = new Path(hoverdocsURL.getPath());
-//					x.append("glibc.xml");
-//					System.out.println(x.toString());
-		               DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-		                factory.setValidating(true);
-		                try {
-		                    DocumentBuilder builder = factory.newDocumentBuilder();
-//		                    builder.setErrorHandler(new TextHoverErrorHandler());
-		                    doc = builder.parse(docStream);
-		                    System.out.println("doc parsed successfully");
-		                }
-		                catch (SAXParseException saxException) {
-		                    doc = null;
-		                    System.out.println("SAXParseException");
-		                }
-		                catch (SAXException saxEx) {
-		                    doc = null;
-		                    System.out.println("SAXException");
-		                }
-		                catch (ParserConfigurationException pce) {
-		                    doc = null;
-		                    System.out.println("ParserConfigurationException");
-		                }
-		                catch (IOException ioe) {
-		                    doc = null;
-		                    System.out.println("IOException");
-		                }
+					DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+					factory.setValidating(true);
+					try {
+						DocumentBuilder builder = factory.newDocumentBuilder();
+						doc = builder.parse(docStream);
+					}
+					catch (SAXParseException saxException) {
+						doc = null;
+					}
+					catch (SAXException saxEx) {
+						doc = null;
+					}
+					catch (ParserConfigurationException pce) {
+						doc = null;
+					}
+					catch (IOException ioe) {
+						doc = null;
+					}
 				} catch (MalformedURLException e) {
 					CUIPlugin.getDefault().log(e);
 				}
-
 				document = doc;
-//				document = getDocument("./libhoverdocs:~/libhoverdocs:/usr/share/eclipse/libhoverdocs:!", "glibc.xml");
 			}
 			catch (IOException ioe) {
 			}
@@ -176,26 +109,7 @@ public class LibHover implements ICHelpP
 	
 	public void initialize() {
 		plugin = (Plugin)AutotoolsPlugin.getDefault();
-
-		// the getAttribute() isn't working right -- it gets ghost attrs from somwhere rather than from the current fragment.xml --
-		// so to hell with it for the moment.
-		//
-		// String libhoverdocsroot = null;
-		// String libhoverdocspath = null;
-		// IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID,
-		//										   "CCompletionContributor"); //$NON-NLS-1$
-		// if (extensionPoint != null) {
-		// 	IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
-		// 	for (int i = 0; i < elements.length; i++) {
-		// 		libhoverdocsroot  = elements[i].getAttribute("libhoverdocsroot");
-		// 		libhoverdocspath  = elements[i].getAttribute("libhoverdocspath");
-		//		defaultSearchPath = elements[i].getAttribute("defaultsearchpath");
-		//	}
-		// }
-		// buildDocPath(libhoverdocsroot,libhoverdocspath);
-		//
-		// use the following, pro-tem, instead
-		buildDocPath("com.redhat.eclipse.cdt.autotools", "libhoverdocs");
+		getLibHoverDocs();
 	}
 	
 	private class HelpBook implements ICHelpBook {


Index: eclipse-cdt.spec
===================================================================
RCS file: /cvs/dist/rpms/eclipse-cdt/devel/eclipse-cdt.spec,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- eclipse-cdt.spec	25 Jul 2006 16:31:02 -0000	1.50
+++ eclipse-cdt.spec	31 Jul 2006 20:50:37 -0000	1.51
@@ -21,7 +21,7 @@
 Summary: 	%{pkg_summary}
 Name: 		%{eclipse_name}-cdt
 Version: 	%{majmin}.%{micro}
-Release: 	1jpp_9fc
+Release: 	1jpp_10fc
 License:	Eclipse Public License - v 1.0 (EPL) <http://www.eclipse.org/legal/epl-v10.html>
 Group: 		Text Editors/Integrated Development Environments (IDE)
 URL:		http://www.eclipse.org/cdt
@@ -50,6 +50,7 @@
 Patch3: %{name}-sdk-build-linux.patch
 Patch4: %{name}-no-tests.patch
 Patch5: %{name}-dynamic-scannerinfo-ext.patch
+Patch6: %{name}-libhover-jar.patch
 
 BuildRequires: eclipse-pde
 %if %{gcj_support}
@@ -98,6 +99,7 @@
 mkdir autotools
 pushd autotools
 tar -xzf %{SOURCE1}
+%patch6 -p0
 popd
 
 # Upstream CVS includes random .so files.  Let's remove them now.
@@ -266,6 +268,9 @@
 %endif
 
 %changelog
+* Mon Jul 31 2006 Jeff Johnston  <jjohnstn redhat com> 3.1.0-1jpp_10fc
+- Fix bug with library hover help.
+
 * Tue Jul 25 2006 Jeff Johnston  <jjohnstn redhat com> 3.1.0-1jpp_9fc
 - Remove redundant runtime packages from sdk.
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]