Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Extend CEditor via a plugin (How to ?)
Extend CEditor via a plugin [message #904774] Wed, 29 August 2012 02:17 Go to next message
Kitesurfer () is currently offline Kitesurfer ()
Messages: 84
Registered: December 2009
Member
Hello,

I have a plugin which is used for extensions as txt (and some more). The plugin extends the AbstractDecoratedTextEditor ("public class MyEditor extends AbstractDecoratedTextEditor").
This works oke.

Now I need to extend the extension C. I've installed the CDT-addon; why do things from scratch if the community already did that great job for C/C++ !.
I see in debug that the editor is named CEditor. So my (simple :-)thought was: extend the CEditor !
So I did: "public class MyCEditor extends CEditor" ... but that doesn't work .
"CEditor cannot be resolved to a type".
So I imported: import org.eclipse.*; ... the error remains

Does anybody know how to solve this ? ... or has anybody a clue how to extend CEditor in the same way as I extended the AbstractDecoratedTextEditor ?

Thanks in advance.

Greetz !
Re: Extend CEditor via a plugin [message #913399 is a reply to message #904774] Sat, 15 September 2012 10:17 Go to previous messageGo to next message
Kitesurfer () is currently offline Kitesurfer ()
Messages: 84
Registered: December 2009
Member
nobody ?
Re: Extend CEditor via a plugin [message #918471 is a reply to message #904774] Thu, 20 September 2012 23:36 Go to previous messageGo to next message
Pawel Piech is currently offline Pawel Piech
Messages: 9
Registered: July 2009
Junior Member
You should be able to reference CEditor as long as your plugin includes the org.eclipse.cdt.ui. However, unlike AbstractDecoratedTextEditor which is meant to be used as a base class for a variety of editors, CEditor is not meant to be extended. The CDT team may change it's public and protected methods in any major, minor, or maintenance release and this could cause your plugin to break.
Re: Extend CEditor via a plugin [message #921031 is a reply to message #918471] Sun, 23 September 2012 15:00 Go to previous messageGo to next message
Kitesurfer () is currently offline Kitesurfer ()
Messages: 84
Registered: December 2009
Member
Pawel, appreciate your post.

The content of the post is disappointing. My thoughts about java are that any classe could be used as a base-class for other classes.

I understand your point that when the CDT team change their code, I'd have to change my plugin code. But isn't that with all plugins ? ... the Eclipse team could also change the AbstractDecoratedTextEditor in a way that my plugin wouldn't work anymore ... at the end, that's my responsability.

Would it be an alternative be to copy the CDT plugin, and go on from there ? ... or is the CDT plugin priviliged code ?
If yes, how would I get a copy of the CDT plugin ?




Re: Extend CEditor via a plugin [message #921446 is a reply to message #921031] Mon, 24 September 2012 01:51 Go to previous message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 2012-09-23 21:00, Kitesurfer () wrote:
> The content of the post is disappointing. My thoughts about java are
> that any classe could be used as a base-class for other classes.

This has nothing to do with Java, it has to do with contract-based
software design. Within a large API it is important to clarify which
types are public API and which are not. If a type belongs to public API
an implementation has much less degrees of freedom to modify this type,
because the risk is high to break your code.

A more reasonable question to ask would be: "CEditor seems like a very
useful class for client code as well and so should be make part of the
public API" (Let me add that I have not enough insight to decide whether
this assertion is true).

Greetings from Bremen,

Daniel Krügler
Previous Topic:Run custom Job after Build before Launch
Next Topic:ScrolledComposite is not displaying scroll bars
Goto Forum:
  


Current Time: Thu Aug 28 09:18:50 EDT 2014

Powered by FUDForum. Page generated in 0.01738 seconds