自定义编辑器文法打开XML模型文件,查看源码IEditorRegistry,通过设置
workbench.getEditorRegistry().setDefaultEditor(".xml","ModelEdit");
实现为XML模型文件指定了自定义编辑器,但是,再次打开文件会出现错误org.eclipse.ui.part.FileEditorInput cannot be cast to nwpu.edu.gnc.edit.parts.EditorInput
无法将FileEditorInput 转换为自定义的EditorInput
继续排查发现,ModelEdit类中的init方法EditorInput eInput = (EditorInput) input;
//// System.out.println(input.getClass());
// document = eInput.getDocument();
// modelRoot = eInput.getModelRoot();
// id = eInput.getId();
// setPartName(eInput.getEditorName());
导致转化失败,注释掉后双击文件可以成功打开自定义编辑器,但是不能进行编辑操作,这里交给师弟修改了
workbench.getEditorRegistry().setDefaultEditor(".xml","ModelEdit");
实现为XML模型文件指定了自定义编辑器,但是,再次打开文件会出现错误org.eclipse.ui.part.FileEditorInput cannot be cast to nwpu.edu.gnc.edit.parts.EditorInput
无法将FileEditorInput 转换为自定义的EditorInput
继续排查发现,ModelEdit类中的init方法EditorInput eInput = (EditorInput) input;
//// System.out.println(input.getClass());
// document = eInput.getDocument();
// modelRoot = eInput.getModelRoot();
// id = eInput.getId();
// setPartName(eInput.getEditorName());
导致转化失败,注释掉后双击文件可以成功打开自定义编辑器,但是不能进行编辑操作,这里交给师弟修改了