dzsessona / QuickOpener-NetBeans

Sometimes while programming in NetBeans you want to explore a particular file that you are editing on the file system browser, or maybe launch a command in a terminal to do something with it.
52 stars 41 forks source link

Fix IOException thrown by sun.awt.X11.XDesktopPeer.launch #2

Closed tychobrailleur closed 12 years ago

tychobrailleur commented 12 years ago

Despite being on a Gnome3 system where Desktop.isSupported(Action.OPEN) claims to be supported, the following error is thrown:

java.io.IOException: Failed to show URI:file:/home/sebastien/dev/jruby-launcher/ at sun.awt.X11.XDesktopPeer.launch(XDesktopPeer.java:114) at sun.awt.X11.XDesktopPeer.open(XDesktopPeer.java:77) at java.awt.Desktop.open(Desktop.java:272) at com.sessonad.quickopener.commands.LinuxGnomeCommands.browseInFileSystem(LinuxGnomeCommands.java:16) at com.sessonad.quickopener.actions.FileSystem.actionPerformed(FileSystem.java:40) at org.openide.awt.InjectorExactlyOne.actionPerformed(InjectorExactlyOne.java:78) at org.openide.awt.ContextAction$Performer.actionPerformed(ContextAction.java:226)

This pull request calls the process that is normally called when the Desktop.isSupported(Action.OPEN) call returns false as a fallback when the IOException is thrown. It also includes a bit of refactoring to address the code repetition.

dzsessona commented 12 years ago

Nice one Seb, I'll merge and port those changes into quickopener-eclipse too, which btw share the same code (https://github.com/kinkadzs/QuickOpener-NetBeans/tree/master/QuickOpener/src/com/sessonad/quickopener/commands) code apart from Commands.java. Do you know if i can I make a (open) library to be shared by the two projects in github? Or does it have to be a new project? Anyway, going to the center now... it's saturday after all ! :-)

tychobrailleur commented 12 years ago

It'll probably have to be a new project all right.