![](/img/trans.png)
[英]Java - How can I convert an object from my own class to a string in the main class?
[英]How can I connect my own class?
我正在使用RCP应用程序,并且我想在编辑器中打开文件的过程中做一些事情。 为此,我这样写:
public class MyFileEditorInput extends FileEditorInput {
public MyFileEditorInput(IFile file) {
super(file);
// TODO Auto-generated constructor stub
}
}
该类是FileEditorInput
类的扩展,但在我的应用程序的FileEditorInput
,正在打开的FileEditorInput
。 如何用自己的方法替换?
如果您的编辑器是由Eclipse使用一种常规机制(例如,双击文件或使用“打开方式...”) FileEditorInput
则将始终使用FileEditorInput
。 您无法更改。
如果使用IDE
类之一打开文件
IEditorPart openEditor(IWorkbenchPage page, IEditorInput input, String editorId)
IEditorPart openEditor(IWorkbenchPage page, IEditorInput input, String editorId, boolean activate)
方法或采用IEditorInput
的各种IWorkbenchPage
openEditor
方法,然后可以指定编辑器输入类。
@ greg-449:您是否有执行此操作的教程? 我正在尝试创建自己的编辑器。 我在eclipse.platform.custom插件中执行此操作,这是个好方法吗? 项目架构
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.