Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » why is MultiPageEditorPart.getActiveEditor() not public ?
why is MultiPageEditorPart.getActiveEditor() not public ? [message #460646] Tue, 26 December 2006 23:22 Go to next message
Diego Tognola is currently offline Diego TognolaFriend
Messages: 3
Registered: July 2009
Junior Member
merry X-mas,

I'd like to code a 'copy image' action that grabs the image off the
current EditorPart of the current MultiPageEditorPart. Finding the
current MultiPageEditorPart is easy
(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getAct ivePage().getActivePart()),
but the only way to determine its current EditorPart seems to be by
overriding MultiPageEditorPart.getActiveEditor() in my implementation of
the MultiPageEditorPart and making it public (so the action - which
lives in a different package - can access it).

Here's my question: why was MultiPageEditorPart.getActiveEditor()
declared protected ? Am I doing something I am not supposed to do here ?

cheers,
Diego
Re: why is MultiPageEditorPart.getActiveEditor() not public ? [message #461175 is a reply to message #460646] Fri, 05 January 2007 23:53 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Diego Tognola wrote:
>
> Here's my question: why was MultiPageEditorPart.getActiveEditor()
> declared protected ? Am I doing something I am not supposed to do here ?

you are doing something you're not supposed to ... from the javadoc:
* Returns the active nested editor if there is one.
* <p>
* Subclasses should not override this method
* </p>

That's not to say you can't create public IEditorPart getCurrentEditor()
and return getActiveEditor().

As to why ... that's partly lost in the mists of time, but basically as
public API it states you can't override or extend (the framework expects
certain return values and a certain behaviour).


One plugin ignored the warning, overrode the method, and changed the
behaviour that if there was no active editor (just a Composite page) it
return the MPEP ... then suddenly they got an infinite loop.

It's not that you can't ignore those kinds of warnings ... but perhaps
you shouldn't.

Later,
PW


Previous Topic:several plugins locations in one product configuration?
Next Topic:KeyBindings, ActionSets and more
Goto Forum:
  


Current Time: Tue Apr 16 17:58:24 GMT 2024

Powered by FUDForum. Page generated in 1.43135 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top