Skip to main content



      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 18:22 Go to next message
Eclipse UserFriend
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 18:53 Go to previous message
Eclipse UserFriend
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: Sat Mar 15 04:45:41 EDT 2025

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

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

Back to the top