我已经定义了标准的 TextEditor 来打开.git文件。(代码在 GitHub 上)
<!-- git -->
<extension
point="org.eclipse.ui.editors">
<editor
class="org.eclipse.ui.editors.text.TextEditor"
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
default="true"
extensions="gitignore,gitmodules,gitattributes"
icon="icons/git.ico"
id="org.eclipse.ui.DefaultTextEditor"
name="Text Editor">
</editor>
</extension>
但是,无论我打开什么文件,此代码都会更改 TextEditor 的图标。
自定义文本编辑器是唯一的方法吗?是否仅针对文件类型有特定的扩展点?
更新:定义自己的编辑器如下
import org.eclipse.ui.editors.text.TextEditor;
public class GitFilesEditor extends TextEditor{
让事情变得更加复杂(我不喜欢指定所有这些项目)
Multiple markers at this line
- The type org.eclipse.jface.text.source.Annotation cannot be resolved. It is indirectly referenced from required .class files
- The type org.eclipse.jface.text.revisions.RevisionInformation cannot be resolved. It is indirectly referenced from required .class files
- The type org.eclipse.jface.text.source.ISourceViewer cannot be resolved. It is indirectly referenced from required .class files
- The type org.eclipse.jface.text.IRegion cannot be resolved. It is indirectly referenced from required .class files
- The type org.eclipse.jface.text.source.IVerticalRuler cannot be resolved. It is indirectly referenced from required .class files