Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Open multiple editors and associating the editors with every figure
Open multiple editors and associating the editors with every figure [message #195745] Tue, 13 September 2005 12:39 Go to next message
Eclipse UserFriend
Originally posted by: seshasai.aesv.softwareag.com

Hi All

I need to open a new editor everytime I click on a new Instance of an
figure I drag and drop from a pallette,I need to associate the every
editor with its instance.

Currently even when I click on diffrent instances of a figure I open the
same editor.

I have used the

IDE.openEditor(IWorkbenchPage page, IFile input,
String editorId, boolean activate)

How can I associate a figure with its editor?

Thanks in Advance

Sai
Re: Open multiple editors and associating the editors with every figure [message #195759 is a reply to message #195745] Tue, 13 September 2005 13:46 Go to previous messageGo to next message
Sapna George is currently offline Sapna GeorgeFriend
Messages: 76
Registered: July 2009
Member
I implemented a similar functionality using Multi-Page Editor. I have two
pages, which are two different types of editors. I create new
Model/EditpPart/View instances on one page (Main editor). Upon selecting a
model, i can edit this model in finer detail on the second page (a
different type of editor).

When i create a new model in the main editor, i also create it's Detail
editor and store it in a Hashmap in the main editor. The two things that i
found i have to store are: the actual editor and the parent Composite
created in createPartControl.

When the model EditPart is selected in the main editor, i have an Action
that will redirect the selected EditPart/Model to the main editor. I
search the Hashmap for the detail editor corresponding to this model. The
editor is displayed in the second page of my multipage editor using the
following methods:

setControl(pageId, parentComposite); //parentComposite is obtained from
the Hashmap

CTabItem item = ((CTabFolder)getContainer()).getItem(pageId);

item.setData(editor); // editor is the detail editor created for this model

openPage(id);

((CTabFolder)getContainer()).redraw();

I implemented this a long time ago and i don't remember why i create new
detail editors for new models rather than creating only one detail editor
and refreshing it's model each time a new model is selected!! That
approach is probably more efficient. I did not know GEF very well back
then!! I was mostly hacking it!!

Anyway, that's my 2 cents. Hope it's helpful!

Sapna
Re: Open multiple editors and associating the editors with every figure [message #195766 is a reply to message #195759] Tue, 13 September 2005 14:17 Go to previous messageGo to next message
Sapna George is currently offline Sapna GeorgeFriend
Messages: 76
Registered: July 2009
Member
Ah! Now i remember. I actually had 3 editors, not 2, and 2 pages. Upon
selecting a model, i open the detail editor on the same page as the main
editor. Sort of like a drill down functionality. The second page is the
third editor and it's fixed.

I think that's why i create a new editor per model object.

sapna
Re: Open multiple editors and associating the editors with every figure [message #195885 is a reply to message #195766] Wed, 14 September 2005 05:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: seshasai.aesv.softwareag.com

Thanks Swapna

I did it the other way around like

IWorkbenchPage page =
((DefaultEditDomain)getViewer().getEditDomain()).getEditorPa rt().getSite().getPage();

IFile newFile = createNewFile(((Shape)this.getModel()).hashCode()+".seq");

IDE.openEditor(page, newFile, true);

I will try your way some time later ,well do you see any thing wrong in
using the above workaround.

regards
SAI
Re: Open multiple editors and associating the editors with every figure [message #195906 is a reply to message #195745] Wed, 14 September 2005 09:26 Go to previous message
Eclipse UserFriend
Originally posted by: wjancz.\/\/asko.pl(change \/\/ with w)

> I need to open a new editor everytime I click on a new Instance of an
> figure I drag and drop from a pallette,I need to associate the every
> editor with its instance.
>
> Currently even when I click on diffrent instances of a figure I open the
> same editor.
>
> I have used the
> IDE.openEditor(IWorkbenchPage page, IFile input,
> String editorId, boolean activate)
>
> How can I associate a figure with its editor?
>

Maybe the problem is in editor input ?
We are doing it like this:

final IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchPage page= window.getActivePage();
IEditorInput input = OUR_EDITOR_INPUT;
page.openEditor(input, EditorId);

the hack is in OUR_EDITOR_INPUT which overrides an equals() method.
I think this method is important!

Try to prepare your own IEditorInput - put there an instance of your figure
and ovveride equals() method.
When you call openEditor like we (se above) Eclipse should open a new
editor.

Good Luck :)

...::WojT::..
Previous Topic:new Font() problem
Next Topic:Child EditPart with Sliders
Goto Forum:
  


Current Time: Fri Apr 26 21:56:53 GMT 2024

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

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

Back to the top