# Editors: Context Menu Options for Resources Opened In Editors and Selected Text Regions in Editors

In editors (Java editor, XML editor, text editor, ...) you also can execute StartExplorer actions, either on an empty text selection (that is, just right click anywhere in the editor window without selecting text first) or for a selected text region. StartExplorer offers the following options here:

• Start File Manager in this Path
• Start Shell in this Path
• Open in Default Application
• Copy Resource Path to Clipboard
• Custom Commands

These are the same options as for resource views like Navigator, Package Explorer or Project Explorer, just named a bit different.

The difference to the commands for resource is that these commands work based either on the file that is currently opened in the editor or based on the selected text region in the editor.

• If no text is selected, the operation is executed on the file currently opened in the editor. This basically works the same way as if the file in the editor would have been selected in a resource view like Package Explorer.
• If some text is selected, the plug-in behaves quite differently and it is important to understand how StartExplorer works with selected text regions, otherwise you might get unexpected results: When text is selected, the plug-in interprets the selected text region as a file system path, denoting either a folder or a file. If this path is a folder, the plug-in can open a file manager or a shell for this folder. If the aforementioned path refers to a file rather than a directory, the plug-in can start the default system application for it. If the selected text is a relative path, it is interpreted relative to the file currently opened in the editor.
• If the text is not a file but instead a valid URL (like http://www.whatever.com or mailto:bobby.tables@foobar.com) you can use the option "Open in Default Application" to fire up your default browser or mail client etc. On some platforms the file manager supports URLs (for example Windows Explorer does that) and on this platforms you can also use "Start File Manager in this Path" to open the URL via the file manager.

Actually, StartExplorer is a bit smarter when handling selected text regions than the last paragraph may give the impression. If you try to open a file manager for your selection it doesn't matter whether you selected a path denoting a folder or a file. If the selected text region points to a file, the parent directory of that file is shown in the file manager and the file is selected, just as you would expect. Furthermore, if the path ends with an incomplete path segment, the last segment is discarded. Example: In your text file (or XML file or whatever) you have the path C:\path\to\some\directory\file.xyz. Now you select just C:\path\to\some\dire and start a file manager for that path. The plug-in recognizes that C:\path\to\some\dire is not a valid path and tries the parent directory C:\path\to\some. If this is a valid, existing directory, a file manager window pops up showing C:\path\to\some. If you select "Start shell in this path" for C:\path\to\some\directory\file.xyz then the directory C:\path\to\some\directory will be shown.

The option "Copy resource path to clipboard" is always executed on the file currently opened in the editor, no matter if text is selected or not. That is, it always copies the path of the file you are working on to the clipboard.

The custom commands are completely configurable through the preference page, just as for the resource-based commands.