This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Improve detection of the preferred PDF viewer | ||
---|---|---|---|
Product: | utilities | Reporter: | Marian Petras <mpetras> |
Component: | Assignee: | tim_sa <tim_sa> | |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | anebuzelsky, jglick, jhavlin, mmirilovic, tomwheeler, tusharvjoshi |
Priority: | P3 | Keywords: | SIMPLEFIX |
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: | OpenPDF using Desktop functionality |
Description
Marian Petras
2007-10-22 11:17:20 UTC
This enhancement would be implemented in file utilities/src/org/netbeans/modules/pdf/PDFOpenSupport.java Would going the JDK6 Desktop.getDesktop() route be an acceptable solution in this case? The file open support there does very good detection on my Linux systems, presumably also on Windows. I believe that Tim Sparg is going to work on this issue for the First Patch program, with the help of Tushar Joshi. But in response to Ernest's question of 15 August, yes, I think the Desktop API is probably the best solution. I imagine that the reason it was not originally developed this way is because the Desktop API was introduced in JDK 6, but the IDE still had to support earlier versions of the JDK. However, that is no longer a concern because JDK 6 or higher is required for current versions of NetBeans: http://netbeans.org/community/releases/70/relnotes.html#system_requirements Here is a helpful article on the Desktop API: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/ I agree with TomWheeler, the Dektop API looks to be a valid replacement for the logic that looks up the PDF-Viewer I see 2 ways of accomplishing this 1) rewrite the open() method of PDFOpenSupport so that it jus wraps the call to Desktop.open() 2) doing the above and falling back on the old code if the Desktop.open() call fails I think that the first option is much cleaner, it allows you to remove alot of code that exists to support the implementation of the searching logic. I also think that the first option is the right one, as it is much simpler and cleaner. Tim, it would be great if you could provide your patch. In addition to Tom, elotter@netbeans.org and jhavlin@netbeans.org I also agree that using Desktop API from Java SE 6 is the most standard and platform independent way of making this happen. Tim, try implementing the first option in your local environment and send me the patch and I will help you test the fix on platforms like Mac OS X Lion, Windows 7 and Ubuntu 11.04 Created attachment 110940 [details]
OpenPDF using Desktop functionality
Hi all
I've created the patch as per the suggestions above (Using the built in Desktop.open() functionality).
If there are any changes required please let me know and I will amend the patch
Thank you very much, Tim. I am going to apply your patch. In response to Comment #7 I have checked this patch and verified the functionality on Max OS X Lion and WIndows 7. I found this patch working as expected on these platform. On Mac - PDF opens in Preview app On Windows 7 - PDF Opens in system PDF viewer, in my case Foxit reader I also tried simulating the error condition by making conditions of PDF file on Mac as 000 and it shows error in a dialog. with regards Tushar Joshi, Nagpur Thank you, Tim. Thank you, Tushar. Great job! We really appreciate your helpful contribution. Now the code is clean and simple - exactly as it should be. Best regards, Jarda I only slightly changed the patch to avoid using deprecated class NotifyDescriptor.Exception. Verified on Windows 7 and Ubuntu Linux 11.04. Works well. core-main/rev/eaa80748af72 Fixed. In response to Comment #11 Wow! Thanks Jarda for this quick turnaround. Tim here goes your blood into the veins of NetBeans IDE now, congrats. with regards Tushar Works on Ubuntu 10.04 / GNOME - opens evince as expected. Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/eaa80748af72 User: Jaroslav Havlin <jhavlin@netbeans.org> Log: #119629 - Improve detection of the preferred PDF viewer |