简体   繁体   English

如何将Eclipse样本编辑器与项目资源管理器视图中的文件相关联

[英]How to associate an Eclipse sample Editor with a file in project explorer view

I have an sample editor which opens up by selecting an action from a sample Menu created in the menu bar. 我有一个示例编辑器,它是通过从菜单栏中创建的示例菜单中选择一个动作来打开的。

How do i associate this editor with a file in Project explorer view? 如何将此编辑器与Project Explorer视图中的文件相关联?

I mean if i double click on the file in project explorer view , the editor should spawn up. 我的意思是,如果我双击项目资源管理器视图中的文件,则编辑器应会出现。

Basically i want this editor to work like a regular eclipse editor. 基本上,我希望此编辑器像常规的Eclipse编辑器一样工作。

Please let me know your suggestions or any online material which explains the framework on how to achieve this. 请让我知道您的建议或解释该框架的在线材料。

Thanks, Karthik 谢谢,卡尔提克

Have a look at IWorkbenchPage.openEditor(IEditorInput input, String editorId) . 看看IWorkbenchPage.openEditor(IEditorInput input, String editorId) Here you specify the input object of the editor and the ID for the editor. 在此指定编辑器的输入对象和编辑器的ID。

In a RCP application, the IEditorInput is usually made up by you - nothing fancy is needed unless you want to persist the editors - and ID is specified via the org.eclipse.ui.editors . 在RCP应用程序中, IEditorInput通常由您组成-除非您想保留编辑器,否则无需花哨-并通过org.eclipse.ui.editors指定ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM