打开一个默认编辑器,在treeviewer选择eclipse rcp(例如:因为eclipse知道j.java文件必须在文本编辑器中打开) [英] Opening a default editor, on a treeviewer selection eclipse rcp(eg: as eclipse knows that j.java files must be opened in text editor)
问题描述
如果你有自己的浏览器实现,你需要定义完整的该查看器中的行为,甚至打开文件。由于您已经注册了一个针对该扩展名的编辑器,所以每当在Eclipse中打开该文件时,由查看器或其他查看器(Project Explorer,Navigator)将Eclipse自动在指定的编辑器中打开该文件。
在您的双击监听器中,您可以使用 org.eclipse.ui.actions.OpenFileAction
或类似的东西来确保文件被打开Eclipse根据Workbench规则。 Btw为什么要避免添加双击监听器?
I have a file with extension .xyz .i want to open an editor when it is double clicked How to go about doing it.I have a treeviewer that lists only my files that i need ,in those i have a .xyz file.I have added an editor in the extension point and in the extensions textfield i hav e added .xyz also.I dont want to add a doubleclicklistener to the viewer.Is there a way to add or tell eclipse that if this is the extension of the file then by default it should open.
Well if you have your own viewer implementation you will need to define the complete behavior in that viewer, even the opening of files. Since you have registered an editor against that extension so whenever that file is opened in Eclipse, either by your viewer or some other viewer (Project Explorer, Navigator) Eclipse will automatically open the file in the assigned editor.
In your double click listener you can use org.eclipse.ui.actions.OpenFileAction
or something like it to ensure that the file is opened by Eclipse according to Workbench rules. Btw why do you want to avoid adding a double click listener?
这篇关于打开一个默认编辑器,在treeviewer选择eclipse rcp(例如:因为eclipse知道j.java文件必须在文本编辑器中打开)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!