|
|
|
Re: How to add Editor in Perspective [message #453412 is a reply to message #453409] |
Fri, 28 July 2006 16:46 |
|
Joy wrote:
> Hi,
>
> I have used the function getSite().getPage().getEditorReferences() to
> get editor references and then I retrieved editorinputs from editor
> references. Then I used those editorinputs in openEditor() function. Is
> it okay?
Editor references are (references to) existing editors that already have
input ... why would you be calling open on the input a second time?
Your stated problem is how to add an editor ... except if you have
IEditorReferences, you already have editors.
>
> getSite().getPage()
>
> and
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage()
within a view or an editor, getSite().getPage() returns the view (or
editor) IWorkbenchPage. Since you can have multiple workbench windows
open,
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage() can
return a different IWorkbenchPage than the one that contains your views
and editors.
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
|
Re: How to add Editor in Perspective [message #453434 is a reply to message #453430] |
Mon, 31 July 2006 13:15 |
|
Joy wrote:
> Hello,
>
> I got little confused. I have implemented one MulitpageEditorPart and
> added some controls in it. Now I want to open it through calling
> openEditor(). But it requires one parameter as IEditorInput. But I have
> not implemented any EditorInput. What I understand by calling
> getEditorReferences(), it provides references of all editors that are
> specified in plugin.xml. Is not it?
No, getEditorReferences() will return all of the editors that are
currently open in your IWorkbenchPage. You need an editor input to open
an editor. You can pass in a FileEditorInput if you have an
IResource/IFile selected, or if your editor isn't tied to the filesystem
you can create your own version of IEditorInput.
In theory, an IEditorInput is the "abstract name" of the input for your
editor ... your editor will use that to get whatever it is editing.
ex: the TextEditor uses the IEditorInput (usually a FileEditorInput) to
get the contents of the IFile that it is working on.
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Powered by
FUDForum. Page generated in 0.03680 seconds