I would like to write an editor plugin for Eclipse that extends all text editors. The problem is that if I subclass AbstractTextEditor then I will lose all the inherited classes' functionality of course. How can I do that without having to reimplement those?
Edit: Some more 开发者_JS百科details. I would like to add 1) vim-like commands, 2) modal editing, 3) modeline on the bottom.
I would like to write an editor plugin for Eclipse that extends all text editors.
You certainly can't write a plugin that contains all the functionality of multiple text editors simultaneously if the assorted text editors do different and contradictory things.
But if you're trying to make something that can modify the behavior of any other text editor, you want to look at the Decorator Pattern.
Precisely how this will interact with the Eclipse plugin architecture is unclear to me, but if your know the need, it may be clearer to you.
Make a composition of classes.
class MyTextEditor extends AbstractTextEditor {
AnotherEditor ed1;
AnotherEditor ed2;
}
精彩评论