it is possible to intercept the Open File menu in eclipse?
My project require to open a file with specified extension in eclipse, but not in a editor. the file should be open in a embedded QT application in a view of eclipse.
my thinking is trying to intercept the open file action in eclipse, and if the file extension is the one i am interesting, then I get the view embedded, and ask it to open the file.
the question is I does NOT find any extensio开发者_StackOverflow社区n to allow me to hook the Open File ... menu. I debug the eclipse editor, I find there is a IOpenListener which seems to be responsible for open file, I didnot try it.
is there a good way to do this.
I don't think you can associate a view with a file type. You'll have to use an editor, as editors are associated with a file; views are not.
In your plugin.xml, add the org.eclipse.ui.editors extension, and then add an editor to it. Specify the file extension(s) it should handle in the 'extensions' element, along with the name, id, class, etc. of the editor you want to open it with.
If you absolutely must use a view, you could provide a way to open a file from within the view itself. Depending on what you're doing, this will probably be deviating from Eclipse UI guidelines.
精彩评论