[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: MultipageEditorPart.getActiveEditor problem

Dan,

> There is a method on MultipageEditorPart .getActiveEditor() which will
> return the currently active nested editor Part. The problem is that this
> method is not public, it is protected, thus my code cannot access it.  
> I am wondering how I can get the active NestedEditorPart given the
> MultiPageEditorPart ? Or is there an easier way that other people out
> there are using to get the current nested editor?

If you are writing the editor yourself you must be subclassing
MultiPageEditorPart.  The getActiveEditor method is protected, so it will
be visible only to your subclass.  You can make it public simply by
overriding the method in your subclass as follows ..

	public IEditorPart getActiveEditor() {
		return super.getActiveEditor();
	}

Note: I notice that it says "subclasses should not override this method". 
I would ignore that comment and do whatever you have to within your
subclass.  However, if you prefer not to do that then just use a different
method name.	
If you need to get data from an MPE class which was defined by someone
else you must rely upon them to expose this method (or add some other
visible method to get the active page). If there is no API for it blame
java for its tight security and give up.

I hope this answers your question.

Dave