Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 225270 Details for
Bug 397455
[hovering] Package Javadoc hover throws NPE if package-info.java contains references
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
JUnits Attached
eclipse.jdt.ui.20130107_tests.patch (text/plain), 48.25 KB, created by
Martin Mathew
on 2013-01-07 05:29:46 EST
(
hide
)
Description:
JUnits Attached
Filename:
MIME Type:
Creator:
Martin Mathew
Created:
2013-01-07 05:29:46 EST
Size:
48.25 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui.tests >diff --git ui/org/eclipse/jdt/ui/tests/packageHover/PackageJavadocTest.java ui/org/eclipse/jdt/ui/tests/packageHover/PackageJavadocTest.java >new file mode 100644 >index 0000000..5063fa1 >--- /dev/null >+++ ui/org/eclipse/jdt/ui/tests/packageHover/PackageJavadocTest.java >@@ -0,0 +1,715 @@ >+package org.eclipse.jdt.ui.tests.packageHover; >+ >+import java.io.File; >+ >+import junit.framework.Assert; >+import junit.framework.Test; >+import junit.framework.TestSuite; >+ >+import org.eclipse.jdt.testplugin.JavaProjectHelper; >+import org.eclipse.jdt.testplugin.JavaTestPlugin; >+ >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Path; >+ >+import org.eclipse.core.resources.ResourcesPlugin; >+ >+import org.eclipse.jface.text.Region; >+ >+import org.eclipse.jdt.core.IClasspathAttribute; >+import org.eclipse.jdt.core.IClasspathEntry; >+import org.eclipse.jdt.core.ICompilationUnit; >+import org.eclipse.jdt.core.IJavaElement; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.IPackageFragment; >+import org.eclipse.jdt.core.IPackageFragmentRoot; >+import org.eclipse.jdt.core.JavaCore; >+ >+import org.eclipse.jdt.internal.core.JavaElement; >+import org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations; >+ >+import org.eclipse.jdt.ui.JavaElementLabels; >+import org.eclipse.jdt.ui.tests.core.CoreTests; >+import org.eclipse.jdt.ui.tests.core.ProjectTestSetup; >+ >+import org.eclipse.jdt.internal.ui.JavaPlugin; >+import org.eclipse.jdt.internal.ui.text.java.hover.JavadocBrowserInformationControlInput; >+import org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover; >+import org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks; >+ >+public class PackageJavadocTest extends CoreTests { >+ >+ public PackageJavadocTest(String name) { >+ super(name); >+ } >+ >+ public static Test suite() { >+ return setUpTest(new TestSuite(PackageJavadocTest.class)); >+ } >+ >+ private IJavaProject fJProject1; >+ >+ >+ public void testGetDocFromPackageHtml_src() throws Exception { >+ >+ File junitSrcArchive= JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/JavadocHover_src.zip")); >+ >+ assertTrue("junit src not found", junitSrcArchive != null && junitSrcArchive.exists()); >+ >+ JavaProjectHelper.addSourceContainerWithImport(fJProject1, "src", junitSrcArchive, JavaProjectHelper.JUNIT_SRC_ENCODING); >+ ICompilationUnit cu= (ICompilationUnit)fJProject1.findElement(new Path("JavadocHover_src/junit/javadochoverhtml/JavaDocHoverTest.java")); >+ assertNotNull("JavaDocHoverTest.java", cu); >+ >+ IPackageFragment pack= (IPackageFragment)cu.getParent(); >+ IJavaElement[] elements= new JavaElement[1]; >+ elements[0]= pack; >+ JavadocBrowserInformationControlInput hoverInfo= JavadocHover.getHoverInfo(elements, cu, new Region(21, 16), null); >+ String actualHtmlContent= hoverInfo.getHtml(); >+ >+ String javadochoverLoc= JavaDocLocations.getBaseURL(pack, false); >+ String imageLoc= JavaPlugin.getDefault().getImagesOnFSRegistry().getImageURL(pack).toExternalForm(); >+ >+ StringBuffer expectedHtmlContent= new StringBuffer(); >+ >+ expectedHtmlContent.append("<html><head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">/* Font definitions */\n"); >+ expectedHtmlContent.append("html { font-family: 'Segoe UI',sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; }\n"); >+ expectedHtmlContent.append("body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; }\n"); >+ expectedHtmlContent.append("pre { font-family: monospace; }\n\n"); >+ expectedHtmlContent.append("/* Margins */\n"); >+ expectedHtmlContent.append("body { overflow: auto; margin-top: 0px; margin-bottom: 0.5em; margin-left: 0.3em; margin-right: 0px; }\n"); >+ expectedHtmlContent.append("h1 { margin-top: 0.3em; margin-bottom: 0.04em; } \n"); >+ expectedHtmlContent.append("h2 { margin-top: 2em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h3 { margin-top: 1.7em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h4 { margin-top: 2em; margin-bottom: 0.3em; }\n"); >+ expectedHtmlContent.append("h5 { margin-top: 0px; margin-bottom: 0px; }\n"); >+ expectedHtmlContent.append("p { margin-top: 1em; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("pre { margin-left: 0.6em; }\n"); >+ expectedHtmlContent.append("ul { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em;}\n"); >+ expectedHtmlContent.append("li { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("li p { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("ol { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em; }\n"); >+ expectedHtmlContent.append("dl { margin-top: 0px; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; }\n"); >+ expectedHtmlContent.append("dd { margin-top: 0px; margin-bottom: 0px; }\n\n"); >+ expectedHtmlContent.append("/* Styles and colors */\n"); >+ expectedHtmlContent.append("a:link { color: #0000FF; }\n"); >+ expectedHtmlContent.append("a:hover { color: #000080; }\n"); >+ expectedHtmlContent.append("a:visited { text-decoration: underline; }\n"); >+ expectedHtmlContent.append("a.header:link { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:visited { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:hover { text-decoration: underline; color: #000080; }\n"); >+ expectedHtmlContent.append("h4 { font-style: italic; }\n"); >+ expectedHtmlContent.append("strong { font-weight: bold; }\n"); >+ expectedHtmlContent.append("em { font-style: italic; }\n"); >+ expectedHtmlContent.append("var { font-style: italic; }\n"); >+ expectedHtmlContent.append("th { font-weight: bold; }\n"); >+ expectedHtmlContent.append("</style>\n"); >+ expectedHtmlContent.append("<base href='" + javadochoverLoc + "'>\n"); >+ expectedHtmlContent >+ .append("</head><body text=\"#000000\" bgcolor=\"#ffffe1\"><h5><div style='word-wrap: break-word; position: relative; margin-left: 20px; padding-top: 2px; '><a href='" >+ + JavaElementLinks.createURI(JavaElementLinks.OPEN_LINK_SCHEME, pack) + "'><!--[if lte IE 6]><![if gte IE 5.5]>\n"); >+ expectedHtmlContent >+ .append("<span alt='Open Declaration' style=\"border:none; position: absolute; width: 16px; height: 16px; left: -21px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" >+ + imageLoc + "')\"></span>\n"); >+ expectedHtmlContent.append("<![endif]><![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if !IE]>-->\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<!--<![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if gte IE 7]>\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<![endif]-->\n"); >+ >+ >+ >+ expectedHtmlContent.append("</a>" + JavaElementLinks.getElementLabel(pack, JavaElementLabels.P_COMPRESSED) + "</div></h5><br><p>"); >+ >+ expectedHtmlContent.append("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\r\n"); >+ expectedHtmlContent.append("<html>\r\n"); >+ expectedHtmlContent.append("<head>\r\n"); >+ expectedHtmlContent.append(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n"); >+ expectedHtmlContent.append(" <title>Package-level Javadoc</title>\r\n"); >+ expectedHtmlContent.append("</head>\r\n"); >+ expectedHtmlContent.append("<body>\r\n"); >+ expectedHtmlContent.append("Test package documentation in package.html\r\n"); >+ expectedHtmlContent.append("This is to test package hovering.\r\n"); >+ expectedHtmlContent.append("</body>\r\n"); >+ expectedHtmlContent.append("</html>\r\n"); >+ expectedHtmlContent.append("</body></html>"); >+ Assert.assertEquals(expectedHtmlContent.toString(), actualHtmlContent); >+ >+ >+ } >+ >+ >+ public void testGetDocFromPackageInfoJava_src() throws Exception { >+ >+ >+ File junitSrcArchive= JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/JavadocHover_src.zip")); >+ >+ assertTrue("junit src not found", junitSrcArchive != null && junitSrcArchive.exists()); >+ >+ JavaProjectHelper.addSourceContainerWithImport(fJProject1, "src", junitSrcArchive, JavaProjectHelper.JUNIT_SRC_ENCODING); >+ ICompilationUnit cu= (ICompilationUnit)fJProject1.findElement(new Path("JavadocHover_src/junit/javadochover/Activator.java")); >+ assertNotNull("Activator.java", cu); >+ >+ IPackageFragment pack= (IPackageFragment)cu.getParent(); >+ IJavaElement[] elements= new JavaElement[1]; >+ elements[0]= pack; >+ JavadocBrowserInformationControlInput hoverInfo= JavadocHover.getHoverInfo(elements, cu, new Region(21, 12), null); >+ String actualHtmlContent= hoverInfo.getHtml(); >+ >+ StringBuffer expectedHtmlContent= new StringBuffer(); >+ expectedHtmlContent.append("<html><head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">/* Font definitions */\n"); >+ expectedHtmlContent.append("html { font-family: 'Segoe UI',sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; }\n"); >+ expectedHtmlContent.append("body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; }\n"); >+ expectedHtmlContent.append("pre { font-family: monospace; }\n\n"); >+ expectedHtmlContent.append("/* Margins */\n"); >+ expectedHtmlContent.append("body { overflow: auto; margin-top: 0px; margin-bottom: 0.5em; margin-left: 0.3em; margin-right: 0px; }\n"); >+ expectedHtmlContent.append("h1 { margin-top: 0.3em; margin-bottom: 0.04em; } \n"); >+ expectedHtmlContent.append("h2 { margin-top: 2em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h3 { margin-top: 1.7em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h4 { margin-top: 2em; margin-bottom: 0.3em; }\n"); >+ expectedHtmlContent.append("h5 { margin-top: 0px; margin-bottom: 0px; }\n"); >+ expectedHtmlContent.append("p { margin-top: 1em; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("pre { margin-left: 0.6em; }\n"); >+ expectedHtmlContent.append("ul { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em;}\n"); >+ expectedHtmlContent.append("li { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("li p { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("ol { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em; }\n"); >+ expectedHtmlContent.append("dl { margin-top: 0px; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; }\n"); >+ expectedHtmlContent.append("dd { margin-top: 0px; margin-bottom: 0px; }\n\n"); >+ expectedHtmlContent.append("/* Styles and colors */\n"); >+ expectedHtmlContent.append("a:link { color: #0000FF; }\n"); >+ expectedHtmlContent.append("a:hover { color: #000080; }\n"); >+ expectedHtmlContent.append("a:visited { text-decoration: underline; }\n"); >+ expectedHtmlContent.append("a.header:link { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:visited { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:hover { text-decoration: underline; color: #000080; }\n"); >+ expectedHtmlContent.append("h4 { font-style: italic; }\n"); >+ expectedHtmlContent.append("strong { font-weight: bold; }\n"); >+ expectedHtmlContent.append("em { font-style: italic; }\n"); >+ expectedHtmlContent.append("var { font-style: italic; }\n"); >+ expectedHtmlContent.append("th { font-weight: bold; }\n"); >+ expectedHtmlContent.append("</style>\n"); >+ String javadochoverLoc= JavaDocLocations.getBaseURL(pack, false); >+ expectedHtmlContent.append("<base href='" + javadochoverLoc + "'>\n"); >+ expectedHtmlContent >+ .append("</head><body text=\"#000000\" bgcolor=\"#ffffe1\"><h5><div style='word-wrap: break-word; position: relative; margin-left: 20px; padding-top: 2px; '><a href='" >+ + JavaElementLinks.createURI(JavaElementLinks.OPEN_LINK_SCHEME, pack) + "'><!--[if lte IE 6]><![if gte IE 5.5]>\n"); >+ String imageLoc= JavaPlugin.getDefault().getImagesOnFSRegistry().getImageURL(pack).toExternalForm(); >+ expectedHtmlContent >+ .append("<span alt='Open Declaration' style=\"border:none; position: absolute; width: 16px; height: 16px; left: -21px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" >+ + imageLoc + "')\"></span>\n"); >+ expectedHtmlContent.append("<![endif]><![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if !IE]>-->\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<!--<![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if gte IE 7]>\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<![endif]-->\n"); >+ expectedHtmlContent.append("</a>" >+ + JavaElementLinks.getElementLabel(pack, JavaElementLabels.P_COMPRESSED) + "</div></h5><br><p>Test package documentation from package-info.java\n"); >+ expectedHtmlContent.append(" This is the test content.</body></html>"); >+ >+ Assert.assertEquals(expectedHtmlContent.toString(), actualHtmlContent); >+ >+ >+ >+ } >+ >+ public void testGetDocFromPackageHtml_archive() throws Exception { >+ >+ File junitSrcArchive= JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/JavadocHover_src.zip")); >+ >+ assertTrue("junit src not found", junitSrcArchive != null && junitSrcArchive.exists()); >+ >+ JavaProjectHelper.addSourceContainerWithImport(fJProject1, "src", junitSrcArchive, JavaProjectHelper.JUNIT_SRC_ENCODING); >+ ICompilationUnit cu= (ICompilationUnit)fJProject1.findElement(new Path("JavadocHover_src/junit/javadochoverhtml/JavaDocHoverTest.java")); >+ assertNotNull("JavaDocHoverTest.java", cu); >+ >+ IPackageFragment pack= (IPackageFragment)cu.getParent(); >+ IJavaElement[] elements= new JavaElement[1]; >+ elements[0]= pack; >+ JavadocBrowserInformationControlInput hoverInfo= JavadocHover.getHoverInfo(elements, cu, new Region(67, 10), null); >+ String actualHtmlContent= hoverInfo.getHtml(); >+ >+ String javadochoverLoc= JavaDocLocations.getBaseURL(pack, false); >+ String imageLoc= JavaPlugin.getDefault().getImagesOnFSRegistry().getImageURL(pack).toExternalForm(); >+ >+ StringBuffer expectedHtmlContent= new StringBuffer(); >+ >+ expectedHtmlContent.append("<html><head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">/* Font definitions */\n"); >+ expectedHtmlContent.append("html { font-family: 'Segoe UI',sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; }\n"); >+ expectedHtmlContent.append("body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; }\n"); >+ expectedHtmlContent.append("pre { font-family: monospace; }\n"); >+ expectedHtmlContent.append("\n"); >+ expectedHtmlContent.append("/* Margins */\n"); >+ expectedHtmlContent.append("body { overflow: auto; margin-top: 0px; margin-bottom: 0.5em; margin-left: 0.3em; margin-right: 0px; }\n"); >+ expectedHtmlContent.append("h1 { margin-top: 0.3em; margin-bottom: 0.04em; } \n"); >+ expectedHtmlContent.append("h2 { margin-top: 2em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h3 { margin-top: 1.7em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h4 { margin-top: 2em; margin-bottom: 0.3em; }\n"); >+ expectedHtmlContent.append("h5 { margin-top: 0px; margin-bottom: 0px; }\n"); >+ expectedHtmlContent.append("p { margin-top: 1em; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("pre { margin-left: 0.6em; }\n"); >+ expectedHtmlContent.append("ul { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em;}\n"); >+ expectedHtmlContent.append("li { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("li p { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("ol { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em; }\n"); >+ expectedHtmlContent.append("dl { margin-top: 0px; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; }\n"); >+ expectedHtmlContent.append("dd { margin-top: 0px; margin-bottom: 0px; }\n"); >+ expectedHtmlContent.append("\n"); >+ expectedHtmlContent.append("/* Styles and colors */\n"); >+ expectedHtmlContent.append("a:link { color: #0000FF; }\n"); >+ expectedHtmlContent.append("a:hover { color: #000080; }\n"); >+ expectedHtmlContent.append("a:visited { text-decoration: underline; }\n"); >+ expectedHtmlContent.append("a.header:link { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:visited { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:hover { text-decoration: underline; color: #000080; }\n"); >+ expectedHtmlContent.append("h4 { font-style: italic; }\n"); >+ expectedHtmlContent.append("strong { font-weight: bold; }\n"); >+ expectedHtmlContent.append("em { font-style: italic; }\n"); >+ expectedHtmlContent.append("var { font-style: italic; }\n"); >+ expectedHtmlContent.append("th { font-weight: bold; }\n"); >+ expectedHtmlContent.append("</style>\n"); >+ expectedHtmlContent >+ .append("<base href='" + javadochoverLoc + "'>\n"); >+ expectedHtmlContent >+ .append("</head><body text=\"#000000\" bgcolor=\"#ffffe1\"><h5><div style='word-wrap: break-word; position: relative; margin-left: 20px; padding-top: 2px; '><a href='" >+ + JavaElementLinks.createURI(JavaElementLinks.OPEN_LINK_SCHEME, pack) + "'><!--[if lte IE 6]><![if gte IE 5.5]>\n"); >+ expectedHtmlContent >+ .append("<span alt='Open Declaration' style=\"border:none; position: absolute; width: 16px; height: 16px; left: -21px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" >+ + imageLoc + "')\"></span>\n"); >+ expectedHtmlContent.append("<![endif]><![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if !IE]>-->\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<!--<![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if gte IE 7]>\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<![endif]-->\n"); >+ expectedHtmlContent.append("</a>" + JavaElementLinks.getElementLabel(pack, JavaElementLabels.P_COMPRESSED) >+ + "</div></h5><br><p><!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\r\n"); >+ expectedHtmlContent.append("<html>\r\n"); >+ expectedHtmlContent.append("<head>\r\n"); >+ expectedHtmlContent.append(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n"); >+ expectedHtmlContent.append(" <title>Package-level Javadoc</title>\r\n"); >+ expectedHtmlContent.append("</head>\r\n"); >+ expectedHtmlContent.append("<body>\r\n"); >+ expectedHtmlContent.append("Test package documentation in package.html\r\n"); >+ expectedHtmlContent.append("This is to test package hovering.\r\n"); >+ expectedHtmlContent.append("</body>\r\n"); >+ expectedHtmlContent.append("</html>\r\n"); >+ expectedHtmlContent.append("</body></html>"); >+ >+ Assert.assertEquals(expectedHtmlContent.toString(), actualHtmlContent); >+ >+ } >+ >+ public void testGetDocFromPackageInfoJava_archive() throws Exception { >+ File junitSrcArchive= JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/JavadocHover_src.zip")); >+ assertTrue("junit src not found", junitSrcArchive != null && junitSrcArchive.exists()); >+ JavaProjectHelper.addSourceContainerWithImport(fJProject1, "src", junitSrcArchive, JavaProjectHelper.JUNIT_SRC_ENCODING); >+ ICompilationUnit cu= (ICompilationUnit)fJProject1.findElement(new Path("JavadocHover_src/junit/javadochoverhtml/JavaDocHoverTest.java")); >+ assertNotNull("JavaDocHoverTest.java", cu); >+ >+ File clsJarPath= JavaTestPlugin.getDefault().getFileInPlugin(new Path("/testresources/133534.zip")); >+ File srcJarPath= JavaTestPlugin.getDefault().getFileInPlugin(new Path("/testresources/133534_src.zip")); >+ >+ >+ JavaProjectHelper.addLibraryWithImport(fJProject1, new Path(clsJarPath.getAbsolutePath()), new Path(srcJarPath.getAbsolutePath()), null); >+ fJProject1.open(null); >+ IPackageFragmentRoot jarRoot= this.fJProject1.getPackageFragmentRoot(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/TestSetupProject/133534.zip"))); >+ IPackageFragment packageFragment= jarRoot.getPackageFragment("in.ibm.test"); >+ assertNotNull(packageFragment); >+ IPath sourceAttachmentPath= jarRoot.getSourceAttachmentPath(); >+ Assert.assertNotNull(sourceAttachmentPath); >+ >+ int offset= cu.getSource().indexOf("in.ibm.test"); >+ int length= "in.ibm.test".length(); >+ IJavaElement[] codeSelect= cu.codeSelect(offset, length); >+ Assert.assertNotNull(codeSelect); >+ Assert.assertTrue("No package found !", codeSelect.length > 0); >+ packageFragment= (IPackageFragment)codeSelect[0]; >+ JavadocBrowserInformationControlInput hoverInfo= JavadocHover.getHoverInfo(new IJavaElement[] { packageFragment }, cu, new Region(offset, length), null); >+ String actualHtmlContent= hoverInfo.getHtml(); >+ String imageLoc= JavaPlugin.getDefault().getImagesOnFSRegistry().getImageURL(packageFragment).toExternalForm(); >+ >+ StringBuffer expectedHtmlContent= new StringBuffer(); >+ expectedHtmlContent.append("<html><head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">/* Font definitions */\n"); >+ expectedHtmlContent.append("html { font-family: 'Segoe UI',sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; }\n"); >+ expectedHtmlContent.append("body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; }\n"); >+ expectedHtmlContent.append("pre { font-family: monospace; }\n\n"); >+ expectedHtmlContent.append("/* Margins */\n"); >+ expectedHtmlContent.append("body { overflow: auto; margin-top: 0px; margin-bottom: 0.5em; margin-left: 0.3em; margin-right: 0px; }\n"); >+ expectedHtmlContent.append("h1 { margin-top: 0.3em; margin-bottom: 0.04em; } \n"); >+ expectedHtmlContent.append("h2 { margin-top: 2em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h3 { margin-top: 1.7em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h4 { margin-top: 2em; margin-bottom: 0.3em; }\n"); >+ expectedHtmlContent.append("h5 { margin-top: 0px; margin-bottom: 0px; }\n"); >+ expectedHtmlContent.append("p { margin-top: 1em; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("pre { margin-left: 0.6em; }\n"); >+ expectedHtmlContent.append("ul { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em;}\n"); >+ expectedHtmlContent.append("li { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("li p { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("ol { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em; }\n"); >+ expectedHtmlContent.append("dl { margin-top: 0px; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; }\n"); >+ expectedHtmlContent.append("dd { margin-top: 0px; margin-bottom: 0px; }\n\n"); >+ expectedHtmlContent.append("/* Styles and colors */\n"); >+ expectedHtmlContent.append("a:link { color: #0000FF; }\n"); >+ expectedHtmlContent.append("a:hover { color: #000080; }\n"); >+ expectedHtmlContent.append("a:visited { text-decoration: underline; }\n"); >+ expectedHtmlContent.append("a.header:link { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:visited { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:hover { text-decoration: underline; color: #000080; }\n"); >+ expectedHtmlContent.append("h4 { font-style: italic; }\n"); >+ expectedHtmlContent.append("strong { font-weight: bold; }\n"); >+ expectedHtmlContent.append("em { font-style: italic; }\n"); >+ expectedHtmlContent.append("var { font-style: italic; }\n"); >+ expectedHtmlContent.append("th { font-weight: bold; }\n"); >+ expectedHtmlContent >+ .append("</style></head><body text=\"#000000\" bgcolor=\"#ffffe1\"><h5><div style='word-wrap: break-word; position: relative; margin-left: 20px; padding-top: 2px; '><a href='" >+ + JavaElementLinks.createURI(JavaElementLinks.OPEN_LINK_SCHEME, packageFragment) + "'><!--[if lte IE 6]><![if gte IE 5.5]>\n"); >+ expectedHtmlContent >+ .append("<span alt='Open Declaration' style=\"border:none; position: absolute; width: 16px; height: 16px; left: -21px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" >+ + imageLoc + "')\"></span>\n"); >+ expectedHtmlContent.append("<![endif]><![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if !IE]>-->\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<!--<![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if gte IE 7]>\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<![endif]-->\n"); >+ expectedHtmlContent >+ .append("</a>in.ibm.test</div></h5><br><p>This is the package documentation for in.ibm.test. The documentation is done in package-info.java file.<dl><dt>Author:</dt><dd> manju</dd></dl></body></html>"); >+ >+ Assert.assertEquals(expectedHtmlContent.toString(), actualHtmlContent); >+ >+ } >+ >+ public void testGetDocFromSourceAttachmentRootPath() throws Exception { >+ File junitSrcArchive= JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/JavadocHover_src.zip")); >+ assertTrue("junit src not found", junitSrcArchive != null && junitSrcArchive.exists()); >+ JavaProjectHelper.addSourceContainerWithImport(fJProject1, "src", junitSrcArchive, JavaProjectHelper.JUNIT_SRC_ENCODING); >+ ICompilationUnit cu= (ICompilationUnit)fJProject1.findElement(new Path("JavadocHover_src/junit/javadochoverhtml/JavaDocHoverTest.java")); >+ assertNotNull("JavaDocHoverTest.java", cu); >+ >+ File clsJarPath= JavaTestPlugin.getDefault().getFileInPlugin(new Path("/testresources/133534.zip")); >+ File srcJarPath= JavaTestPlugin.getDefault().getFileInPlugin(new Path("/testresources/133534_src.zip")); >+ >+ >+ JavaProjectHelper.addLibraryWithImport(fJProject1, new Path(clsJarPath.getAbsolutePath()), new Path(srcJarPath.getAbsolutePath()), new Path("src")); >+ fJProject1.open(null); >+ IPackageFragmentRoot jarRoot= this.fJProject1.getPackageFragmentRoot(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/TestSetupProject/133534.zip"))); >+ Assert.assertTrue(jarRoot != null && jarRoot.exists()); >+ IPackageFragment packageFragment= jarRoot.getPackageFragment("in.ibm.test.html"); >+ Assert.assertTrue(packageFragment != null && packageFragment.exists()); >+ IPath sourceAttachmentPath= jarRoot.getSourceAttachmentPath(); >+ Assert.assertNotNull(sourceAttachmentPath); >+ >+ int offset= cu.getSource().indexOf("in.ibm.test.html"); >+ int length= "in.ibm.test.html".length(); >+ IJavaElement[] codeSelect= cu.codeSelect(offset, length); >+ Assert.assertNotNull(codeSelect); >+ Assert.assertTrue("No package found !", codeSelect.length > 0); >+ packageFragment= (IPackageFragment)codeSelect[0]; >+ JavadocBrowserInformationControlInput hoverInfo= JavadocHover.getHoverInfo(new IJavaElement[] { packageFragment }, cu, new Region(offset, length), null); >+ String actualHtmlContent= hoverInfo.getHtml(); >+ String imageLoc= JavaPlugin.getDefault().getImagesOnFSRegistry().getImageURL(packageFragment).toExternalForm(); >+ >+ StringBuffer expectedHtmlContent= new StringBuffer(); >+ expectedHtmlContent.append("<html><head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">/* Font definitions */\n"); >+ expectedHtmlContent.append("html { font-family: 'Segoe UI',sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; }\n"); >+ expectedHtmlContent.append("body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; }\n"); >+ expectedHtmlContent.append("pre { font-family: monospace; }\n\n"); >+ expectedHtmlContent.append("/* Margins */\n"); >+ expectedHtmlContent.append("body { overflow: auto; margin-top: 0px; margin-bottom: 0.5em; margin-left: 0.3em; margin-right: 0px; }\n"); >+ expectedHtmlContent.append("h1 { margin-top: 0.3em; margin-bottom: 0.04em; } \n"); >+ expectedHtmlContent.append("h2 { margin-top: 2em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h3 { margin-top: 1.7em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h4 { margin-top: 2em; margin-bottom: 0.3em; }\n"); >+ expectedHtmlContent.append("h5 { margin-top: 0px; margin-bottom: 0px; }\n"); >+ expectedHtmlContent.append("p { margin-top: 1em; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("pre { margin-left: 0.6em; }\n"); >+ expectedHtmlContent.append("ul { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em;}\n"); >+ expectedHtmlContent.append("li { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("li p { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("ol { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em; }\n"); >+ expectedHtmlContent.append("dl { margin-top: 0px; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; }\n"); >+ expectedHtmlContent.append("dd { margin-top: 0px; margin-bottom: 0px; }\n\n"); >+ expectedHtmlContent.append("/* Styles and colors */\n"); >+ expectedHtmlContent.append("a:link { color: #0000FF; }\n"); >+ expectedHtmlContent.append("a:hover { color: #000080; }\n"); >+ expectedHtmlContent.append("a:visited { text-decoration: underline; }\n"); >+ expectedHtmlContent.append("a.header:link { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:visited { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:hover { text-decoration: underline; color: #000080; }\n"); >+ expectedHtmlContent.append("h4 { font-style: italic; }\n"); >+ expectedHtmlContent.append("strong { font-weight: bold; }\n"); >+ expectedHtmlContent.append("em { font-style: italic; }\n"); >+ expectedHtmlContent.append("var { font-style: italic; }\n"); >+ expectedHtmlContent.append("th { font-weight: bold; }\n"); >+ expectedHtmlContent >+ .append("</style></head><body text=\"#000000\" bgcolor=\"#ffffe1\"><h5><div style='word-wrap: break-word; position: relative; margin-left: 20px; padding-top: 2px; '><a href='" >+ + JavaElementLinks.createURI(JavaElementLinks.OPEN_LINK_SCHEME, packageFragment) + "'><!--[if lte IE 6]><![if gte IE 5.5]>\n"); >+ expectedHtmlContent >+ .append("<span alt='Open Declaration' style=\"border:none; position: absolute; width: 16px; height: 16px; left: -21px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" >+ + imageLoc + "')\"></span>\n"); >+ expectedHtmlContent.append("<![endif]><![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if !IE]>-->\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<!--<![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if gte IE 7]>\n"); >+ expectedHtmlContent.append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<![endif]-->\n"); >+ >+ expectedHtmlContent.append("</a>in.ibm.test.html</div></h5><br><p><!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\r\n"); >+ expectedHtmlContent.append("<html>\r\n"); >+ expectedHtmlContent.append("<head>\r\n"); >+ expectedHtmlContent.append(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n"); >+ expectedHtmlContent.append(" <title>Package-level Javadoc</title>\r\n"); >+ expectedHtmlContent.append("</head>\r\n"); >+ expectedHtmlContent.append("<body>\r\n"); >+ expectedHtmlContent.append("This is the package documentation for in.ibm.test.html. The content is present in package.html file.The source attachment root path is set.\r\n"); >+ expectedHtmlContent.append("</body>\r\n"); >+ expectedHtmlContent.append("</html></body></html>"); >+ >+ Assert.assertEquals(expectedHtmlContent.toString(), actualHtmlContent); >+ >+ } >+ >+ >+ public void testGetPackageattacheddoc() throws Exception { >+ // http://download.oracle.com/javase/6/docs/api/ >+ File junitSrcArchive= JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/JavadocHover_src.zip")); >+ >+ assertTrue("junit src not found", junitSrcArchive != null && junitSrcArchive.exists()); >+ >+ JavaProjectHelper.addSourceContainerWithImport(fJProject1, "src", junitSrcArchive, JavaProjectHelper.JUNIT_SRC_ENCODING); >+ ICompilationUnit cu= (ICompilationUnit)fJProject1.findElement(new Path("JavadocHover_src/junit/javadochoverhtml/JavaDocHoverTest.java")); >+ assertNotNull("JavaDocHoverTest.java", cu); >+ >+ >+ IClasspathAttribute attribute= >+ JavaCore.newClasspathAttribute( >+ IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, >+ "url:http://download.oracle.com/javase/6/docs/api/"); >+ IClasspathEntry[] rawClasspath= fJProject1.getRawClasspath(); >+ IClasspathEntry newEntry= JavaCore.newLibraryEntry(new Path(JavaTestPlugin.getDefault().getFileInPlugin(new Path("/testresources/rtstubs15.jar")).getAbsolutePath()), null, null, null, >+ new IClasspathAttribute[] { attribute }, false); >+ rawClasspath[0]= newEntry; >+ IClasspathEntry[] newPathEntry= new IClasspathEntry[] { rawClasspath[0], rawClasspath[1] }; >+ this.fJProject1.setRawClasspath(newPathEntry, null); >+ this.fJProject1.getResolvedClasspath(false); >+ >+ int offset= cu.getSource().indexOf("java.math"); >+ int length= "java.math".length(); >+ IJavaElement[] codeSelect= cu.codeSelect(offset, length); >+ Assert.assertNotNull(codeSelect); >+ Assert.assertTrue("No package found !", codeSelect.length > 0); >+ >+ JavadocBrowserInformationControlInput hoverInfo= JavadocHover.getHoverInfo(codeSelect, cu, new Region(offset, length), null); >+ String actualHtmlContent= hoverInfo.getHtml(); >+ Assert.assertNotNull(actualHtmlContent); >+ >+ String imageLoc= JavaPlugin.getDefault().getImagesOnFSRegistry().getImageURL(codeSelect[0]).toExternalForm(); >+ >+ StringBuffer expectedHtmlContent= new StringBuffer(); >+ expectedHtmlContent.append("<html><head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">/* Font definitions */\n"); >+ expectedHtmlContent.append("html { font-family: 'Segoe UI',sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; }\n"); >+ expectedHtmlContent.append("body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; }\n"); >+ expectedHtmlContent.append("pre { font-family: monospace; }\n\n"); >+ >+ expectedHtmlContent.append("/* Margins */\n"); >+ expectedHtmlContent.append("body { overflow: auto; margin-top: 0px; margin-bottom: 0.5em; margin-left: 0.3em; margin-right: 0px; }\n"); >+ expectedHtmlContent.append("h1 { margin-top: 0.3em; margin-bottom: 0.04em; } \n"); >+ expectedHtmlContent.append("h2 { margin-top: 2em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h3 { margin-top: 1.7em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h4 { margin-top: 2em; margin-bottom: 0.3em; }\n"); >+ expectedHtmlContent.append("h5 { margin-top: 0px; margin-bottom: 0px; }\n"); >+ expectedHtmlContent.append("p { margin-top: 1em; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("pre { margin-left: 0.6em; }\n"); >+ expectedHtmlContent.append("ul { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em;}\n"); >+ expectedHtmlContent.append("li { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("li p { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("ol { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em; }\n"); >+ expectedHtmlContent.append("dl { margin-top: 0px; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; }\n"); >+ expectedHtmlContent.append("dd { margin-top: 0px; margin-bottom: 0px; }\n\n"); >+ >+ expectedHtmlContent.append("/* Styles and colors */\n"); >+ expectedHtmlContent.append("a:link { color: #0000FF; }\n"); >+ expectedHtmlContent.append("a:hover { color: #000080; }\n"); >+ expectedHtmlContent.append("a:visited { text-decoration: underline; }\n"); >+ expectedHtmlContent.append("a.header:link { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:visited { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:hover { text-decoration: underline; color: #000080; }\n"); >+ expectedHtmlContent.append("h4 { font-style: italic; }\n"); >+ expectedHtmlContent.append("strong { font-weight: bold; }\n"); >+ expectedHtmlContent.append("em { font-style: italic; }\n"); >+ expectedHtmlContent.append("var { font-style: italic; }\n"); >+ expectedHtmlContent.append("th { font-weight: bold; }\n"); >+ expectedHtmlContent.append("</style>\n"); >+ expectedHtmlContent.append("<base href='http://download.oracle.com/javase/6/docs/api/java/math/package-summary.html'>\n"); >+ expectedHtmlContent >+ .append("</head><body text=\"#000000\" bgcolor=\"#ffffe1\"><h5><div style='word-wrap: break-word; position: relative; margin-left: 20px; padding-top: 2px; '><a href='" >+ + JavaElementLinks.createURI(JavaElementLinks.OPEN_LINK_SCHEME, codeSelect[0]) + "'><!--[if lte IE 6]><![if gte IE 5.5]>\n"); >+ expectedHtmlContent >+ .append("<span alt='Open Declaration' style=\"border:none; position: absolute; width: 16px; height: 16px; left: -21px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" >+ + imageLoc + "')\"></span>\n"); >+ expectedHtmlContent.append("<![endif]><![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if !IE]>-->\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<!--<![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if gte IE 7]>\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<![endif]-->\n"); >+ expectedHtmlContent.append("</a>java.math</div></h5><br><p>\n\n"); >+ >+ expectedHtmlContent.append("<P>\n"); >+ expectedHtmlContent.append("Provides classes for performing arbitrary-precision integer arithmetic\n"); >+ expectedHtmlContent.append("(BigInteger) and arbitrary-precision decimal arithmetic (BigDecimal).\n"); >+ expectedHtmlContent.append("BigInteger is analogous to Java's primitive integer types except that it\n"); >+ expectedHtmlContent.append("provides arbitrary precision, hence operations on BigIntegers do not overflow\n"); >+ expectedHtmlContent.append("or lose precision. In addition to standard arithmetic operations, BigInteger\n"); >+ expectedHtmlContent.append("provides modular arithmetic, GCD calculation, primality testing, prime\n"); >+ expectedHtmlContent.append("generation, bit manipulation, and a few other miscellaneous operations.\n\n"); >+ >+ expectedHtmlContent.append("BigDecimal provides arbitrary-precision signed decimal numbers suitable for\n"); >+ expectedHtmlContent.append("currency calculations and the like. BigDecimal gives the user complete\n"); >+ expectedHtmlContent.append("control over rounding behavior, allowing the user to choose from a\n"); >+ expectedHtmlContent.append("comprehensive set of eight rounding modes.\n\n"); >+ >+ expectedHtmlContent.append("<!--\n"); >+ expectedHtmlContent.append("<h2>Related Documentation</h2>\n\n"); >+ >+ expectedHtmlContent.append("For overviews, tutorials, examples, guides, and tool documentation, please see:\n"); >+ expectedHtmlContent.append("<ul>\n"); >+ expectedHtmlContent.append(" <li><a href=\"\">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>\n"); >+ expectedHtmlContent.append("</ul>\n"); >+ expectedHtmlContent.append("-->\n"); >+ expectedHtmlContent.append("<P>\n\n"); >+ >+ expectedHtmlContent.append("<P>\n"); >+ expectedHtmlContent.append("<DL>\n"); >+ expectedHtmlContent.append("<DT><B>Since:</B></DT>\n"); >+ expectedHtmlContent.append(" <DD>JDK1.1</DD>\n"); >+ expectedHtmlContent.append("</DL>\n"); >+ expectedHtmlContent.append("<HR>\n\n\n"); >+ >+ >+ expectedHtmlContent.append("</body></html>"); >+ >+ Assert.assertEquals(expectedHtmlContent.toString(), actualHtmlContent); >+ >+ } >+ >+ public void testBug397455() throws Exception { >+ >+ File junitSrcArchive= JavaTestPlugin.getDefault().getFileInPlugin(new Path("testresources/JavadocHover_src.zip")); >+ >+ assertTrue("junit src not found", junitSrcArchive != null && junitSrcArchive.exists()); >+ >+ JavaProjectHelper.addSourceContainerWithImport(fJProject1, "src", junitSrcArchive, JavaProjectHelper.JUNIT_SRC_ENCODING); >+ ICompilationUnit cu= (ICompilationUnit)fJProject1.findElement(new Path("JavadocHover_src/junit/checkPackageInfo/TestNPEHover.java")); >+ assertNotNull("TestNPEHover.java", cu); >+ >+ IPackageFragment pack= (IPackageFragment)cu.getParent(); >+ IJavaElement[] elements= new JavaElement[1]; >+ elements[0]= pack; >+ JavadocBrowserInformationControlInput hoverInfo= JavadocHover.getHoverInfo(elements, cu, new Region(21, 12), null); >+ String actualHtmlContent= hoverInfo.getHtml(); >+ >+ StringBuffer expectedHtmlContent= new StringBuffer(); >+ expectedHtmlContent.append("<html><head><style CHARSET=\"ISO-8859-1\" TYPE=\"text/css\">/* Font definitions */\n"); >+ expectedHtmlContent.append("html { font-family: 'Segoe UI',sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; }\n"); >+ expectedHtmlContent.append("body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; }\n"); >+ expectedHtmlContent.append("pre { font-family: monospace; }\n\n"); >+ expectedHtmlContent.append("/* Margins */\n"); >+ expectedHtmlContent.append("body { overflow: auto; margin-top: 0px; margin-bottom: 0.5em; margin-left: 0.3em; margin-right: 0px; }\n"); >+ expectedHtmlContent.append("h1 { margin-top: 0.3em; margin-bottom: 0.04em; } \n"); >+ expectedHtmlContent.append("h2 { margin-top: 2em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h3 { margin-top: 1.7em; margin-bottom: 0.25em; }\n"); >+ expectedHtmlContent.append("h4 { margin-top: 2em; margin-bottom: 0.3em; }\n"); >+ expectedHtmlContent.append("h5 { margin-top: 0px; margin-bottom: 0px; }\n"); >+ expectedHtmlContent.append("p { margin-top: 1em; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("pre { margin-left: 0.6em; }\n"); >+ expectedHtmlContent.append("ul { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em;}\n"); >+ expectedHtmlContent.append("li { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("li p { margin-top: 0px; margin-bottom: 0px; } \n"); >+ expectedHtmlContent.append("ol { margin-top: 0px; margin-bottom: 1em; margin-left: 1em; padding-left: 1em; }\n"); >+ expectedHtmlContent.append("dl { margin-top: 0px; margin-bottom: 1em; }\n"); >+ expectedHtmlContent.append("dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; }\n"); >+ expectedHtmlContent.append("dd { margin-top: 0px; margin-bottom: 0px; }\n\n"); >+ expectedHtmlContent.append("/* Styles and colors */\n"); >+ expectedHtmlContent.append("a:link { color: #0000FF; }\n"); >+ expectedHtmlContent.append("a:hover { color: #000080; }\n"); >+ expectedHtmlContent.append("a:visited { text-decoration: underline; }\n"); >+ expectedHtmlContent.append("a.header:link { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:visited { text-decoration: none; color: #000000 }\n"); >+ expectedHtmlContent.append("a.header:hover { text-decoration: underline; color: #000080; }\n"); >+ expectedHtmlContent.append("h4 { font-style: italic; }\n"); >+ expectedHtmlContent.append("strong { font-weight: bold; }\n"); >+ expectedHtmlContent.append("em { font-style: italic; }\n"); >+ expectedHtmlContent.append("var { font-style: italic; }\n"); >+ expectedHtmlContent.append("th { font-weight: bold; }\n"); >+ expectedHtmlContent.append("</style>\n"); >+ String javadochoverLoc= JavaDocLocations.getBaseURL(pack, false); >+ expectedHtmlContent.append("<base href='" + javadochoverLoc + "'>\n"); >+ expectedHtmlContent >+ .append("</head><body text=\"#000000\" bgcolor=\"#ffffe1\"><h5><div style='word-wrap: break-word; position: relative; margin-left: 20px; padding-top: 2px; '><a href='" >+ + JavaElementLinks.createURI(JavaElementLinks.OPEN_LINK_SCHEME, pack) + "'><!--[if lte IE 6]><![if gte IE 5.5]>\n"); >+ String imageLoc= JavaPlugin.getDefault().getImagesOnFSRegistry().getImageURL(pack).toExternalForm(); >+ expectedHtmlContent >+ .append("<span alt='Open Declaration' style=\"border:none; position: absolute; width: 16px; height: 16px; left: -21px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" >+ + imageLoc + "')\"></span>\n"); >+ expectedHtmlContent.append("<![endif]><![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if !IE]>-->\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<!--<![endif]-->\n"); >+ expectedHtmlContent.append("<!--[if gte IE 7]>\n"); >+ expectedHtmlContent >+ .append("<img alt='Open Declaration' style='border:none; position: absolute; width: 16px; height: 16px; left: -21px; ' src='" + imageLoc + "'/>\n"); >+ expectedHtmlContent.append("<![endif]-->\n"); >+ expectedHtmlContent.append("</a>" >+ + JavaElementLinks.getElementLabel(pack, JavaElementLabels.P_COMPRESSED) >+ + "</div></h5><br><p><p><b>Deprecated.</b> <i> use a pick</i><p>The pack is a test package. This doc contains references like <code><a href='eclipse-javadoc:%E2%98%82=TestSetupProject/src%3CJavadocHover_src.junit.checkPackageInfo%7Bpackage-info.java%E2%98%83package-info.java%E2%98%82Object'>Object</a></code> and <code><a href='eclipse-javadoc:%E2%98%82=TestSetupProject/src%3CJavadocHover_src.junit.checkPackageInfo%7Bpackage-info.java%E2%98%83package-info.java%E2%98%82Defaults%E2%98%82foo%E2%98%82String'>Defaults.foo(String)</a></code> and tags<dl><dt>Author:</dt><dd> me</dd></dl></body></html>"); >+ >+ Assert.assertEquals(expectedHtmlContent.toString(), actualHtmlContent); >+ >+ >+ >+ } >+ >+ public static Test setUpTest(Test test) { >+ return new ProjectTestSetup(test); >+ } >+ >+ @Override >+ protected void setUp() throws Exception { >+ fJProject1= ProjectTestSetup.getProject(); >+ >+ } >+ >+ >+ @Override >+ protected void tearDown() throws Exception { >+ JavaProjectHelper.clear(fJProject1, ProjectTestSetup.getDefaultClasspath()); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 397455
:
225268
| 225270 |
225271