Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to add Editor in Perspective
How to add Editor in Perspective [message #453362] Thu, 27 July 2006 13:19 Go to next message
Faisal is currently offline FaisalFriend
Messages: 19
Registered: July 2009
Junior Member
Hi,

Inside the code of Perspective (in createInitialLayout() function) we use
addView() function to add view. But how to add Editor? I am trying to use
MultipageEditorPart.

-Faisal
Re: How to add Editor in Perspective [message #453376 is a reply to message #453362] Thu, 27 July 2006 19:00 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Faisal wrote:
> Hi,
>
> Inside the code of Perspective (in createInitialLayout() function) we
> use addView() function to add view. But how to add Editor? I am trying
> to use MultipageEditorPart.

editors are opened (usually) by user interaction with some editor input.

Programmatically, you are looking at IWorkbenchPage#openEditor(*) ...
but editors aren't tied to a perspective. You'll have to open the
editor outside the perspective layout code.

Later,
PW


Re: How to add Editor in Perspective [message #453409 is a reply to message #453376] Fri, 28 July 2006 15:33 Go to previous messageGo to next message
Joy is currently offline JoyFriend
Messages: 3
Registered: July 2009
Junior Member
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?

getSite().getPage()

and

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage()

what are the differences? Can you please explain.
Re: How to add Editor in Perspective [message #453412 is a reply to message #453409] Fri, 28 July 2006 16:46 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Re: How to add Editor in Perspective [message #453430 is a reply to message #453412] Mon, 31 July 2006 10:04 Go to previous messageGo to next message
Joy is currently offline JoyFriend
Messages: 3
Registered: July 2009
Junior Member
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? As I understand, I dont need to
implement IEditorInput, RCP provides default implementation. So one way to
get corresponding editorinput is through IEditorReference.

Please let me know if I am wrong.
Re: How to add Editor in Perspective [message #453434 is a reply to message #453430] Mon, 31 July 2006 13:15 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


Previous Topic:RCP as the enterprise application framework
Next Topic:PLUGIN XML
Goto Forum:
  


Current Time: Sun Dec 22 06:27:12 GMT 2024

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

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

Back to the top