Use Java6 Desktop class to open URL

Description

If I'm correct PCGen is now compiled with Java6. In this case, using the java.awt.Desktop class to handle URL should be used.

The system actually need to manually indicate the browser, which was needed before and can be conserved in case the isDesktopAvailable returns false.

Environment

None

Activity

Show:
Vincent Hatakeyama
September 5, 2012, 8:03 PM

The proposed patch does the following:
– uses Utility.viewInBrowser as the entry point for all call to browser (was only use some times),
– has a new class DesktopBrowserLauncher that tries to use the Desktop class (introduced in Java 6) to browse for an URI. If it fails, it uses the old BrowserLauncher that was used before.

What is not done is:
– i18n of many messages seen in the code.
– Indicate in the Preferences dialog that it is not needed to set the browser in case Desktop and browse action are supported.
– fix the www.e-junkie.com affiliate link (the domain redirect to another, no idea if the affiliate code is working). The URL should probably go into the software properties.

James Dempsey
September 6, 2012, 7:39 AM

I've applied the patch with a small modification to the docs call including localisation of the error message.

Thanks for the patch!

Vincent Hatakeyama
September 8, 2012, 10:31 AM

This is not entirely fixed. I found that there is a preview field in the Spells Known tab and it uses the old pcgen.gui.utils.Utility. I thought I needn’t fix the pcgen.gui.* classes because there were not used anymore.

I tried to remove pcgen.gui from compilation, and it provokes a good chunk of errors because some classes are still uses. Is there a plan to remove all those classes? Or is it needed to update them on top of pcgen.gui2?

James Dempsey
September 8, 2012, 4:09 PM

Good catch.The intention is to remove the pcgen.gui.* classes after the 6.0 release. There are still some lingering uses of it which will need to be resolved at that time.

I'll raise a separate issue for fixing up the preview code.

James Dempsey
September 8, 2012, 9:22 PM

Old code excised.

Fixed

Assignee

James Dempsey

Reporter

Vincent Hatakeyama

Labels

None

Theme

None

Epic/Theme

None

Pending User Input

None

Fix versions

Affects versions

Priority

Minor
Configure