|
From: François R. <jed...@fr...> - 2010-01-24 04:20:12
|
I've finally imported the new Launcher plugin into SVN! It's quite functional and ready to use so I recommend you try it. If you do, please make sure you apply the following patch to jEdit in order to add dynamic menu to FSB: https://sourceforge.net/tracker/?func=detail&aid=2938170&group_id=588&atid=300588 It took more time to develop than expected but the end the result should be of interest: it provides the plumbing needed to define common actions to display on contextual menu in various places: FSB, PV, plugin menu, and text area context menu. This plugin could be considered as a replacement for: - HelperLauncher - ProjectViewer's external application feature - browser actions that depend on the selected files Its home is under plugins/Launcher. I also updated the NativeBrowser plugin so it uses the Launcher plugin to integrate with the rest of jEdit. This makes it a nice and simple usage example for the Launcher plugin. I've specified version 0.1 for both of these plugins. I encourage you to try them and provide feedback. Once we agree on their stability, we can release them as 1.0. There are plenty of additional features that could be developped. Feel free to contribute if you're itching for: - console integration for shell output - InfoViewer integration by having it define its own Launchers like NativeBrowser - LaunchConfigurations: sort of like Commando in console, so I guess Commando could be integrated into Launcher because in the end it's about providing a GUI to specify parameters for launching files. - better integration with FSB menu - clean up PV by removing functionality also found in Launcher - having browser-actions work in PV - define launchers with beanshell scripts - having SVNPlugin use Launcher to provide its options (that would be a great use case) There is practically no doc and javadoc so I'll provide more of these in the coming days rather than develop new features. Don't let this prevent you from trying it and looking at the code. I tend to code in a slightly verbose but easier to understand way. For now you can read the following intro. Cheers, Fr. Launcher plugin introduction: The Launcher plugin provides a way to add the same context specific menu to the File System Browser, ProjectViewer, Plugin Menu, and text area contextual menu. The contents of this menu is dynamic and depends on the current selection or buffer. This menu offers various ways of launching the selected resource. For example: launch with associated application as defined by the desktop, launch in browser, execute file, launch with associated application as defined in the Launcher options, etc. More precisely the Launcher plugin proposes a framework for defining Launchers and managing them via LauncherTypes. Both of these classes are services whereby other plugins can contribute new Launchers and LauncherTypes. Launchers are an extension of the EditAction type. They are typically stateless therefore the same instance is reused in different places. LauncherTypes manage a set of Launchers that: - launch the same type of resource (files, url, etc.) - share the same configuration information and intented action Note that the same Launcher can be used by many LauncherTypes. For example on most systems one can find a command line tool that is able to open a file with its associated application and also open a url with the default browser (desktop settings). On x11 system this application is 'xdg- open', on Mac OS X 'open', and on Windows 'start'. At startup the Launcher plugin determines which OS is being used and defines the corresponding SystemApplicationOrBrowserLauncher. The latter will then be used by BrowserLauncherType and SystemApplicationLauncherType. |