Skip to main content



      Home
Home » Eclipse Projects » GEF » GEF and multi page editors
GEF and multi page editors [message #88145] Thu, 24 July 2003 02:21 Go to next message
Eclipse UserFriend
Originally posted by: scheglov_ke.nlmk.ru

I am still fighting with multi page editors.
Now I have editor inherited from CompilationUnitEditor that creates
CTabFolder, places one one tab CompilationUnitEditor, and on second
tab - GEF editor. In Java editor all actions work, but not in GEF
editor - DEL key does nothing (it works, if I use this GEF editor
alone, without multi page). And when I select "Delete" from menu,
it is handled in Java editor, even when GEF editor is active.
Yes, I understand, that I should switch active editor for this
action to GEF editor. But how? I don't know. :-(
Yes, I can access delete action using
getActionRegistry().getAction(GEFActionConstants.DELETE)
but what should I do after this?
Can anybody help?

--
SY, Konstantin.
Re: GEF and multi page editors [message #88160 is a reply to message #88145] Thu, 24 July 2003 08:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.planet-wagenknecht.de

Hi!

Konstantin Scheglov wrote:
> I am still fighting with multi page editors.

Yes, there are some issues but nevertheless it is possible. You should
probably take another way, which we did for our sample application for the
upcoming IBM Redbook about EMG and GEF development.

Inherit from MultiPageEditorPart. Its pages are ordinary IEditorParts. So,
you create your stand alone editor and add it to the MultiPageEditorPart.
The MultiPageEditorPart already provides a good infrastructure for
delegating work to the active editor. But you still need to do some
integration work (e.g. #getAdapter).

> Can anybody help?

What's about the Action bar contributor? You have to develop a single one
for the whole multi page editor. There is also a multi page action
contributor class available you can inherit from. Your contributor will get
informed when the editor page changed.

Cu, Gunnar
Re: GEF and multi page editors [message #88173 is a reply to message #88160] Thu, 24 July 2003 08:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: scheglov_ke.nlmk.ru

Gunnar Wagenknecht <g.wagenknecht@planet-wagenknecht.de> wrote:

>> I am still fighting with multi page editors.
> Yes, there are some issues but nevertheless it is possible. You should
> probably take another way, which we did for our sample application for the
> upcoming IBM Redbook about EMG and GEF development.

> Inherit from MultiPageEditorPart. Its pages are ordinary IEditorParts. So,
> you create your stand alone editor and add it to the MultiPageEditorPart.
> The MultiPageEditorPart already provides a good infrastructure for
> delegating work to the active editor. But you still need to do some
> integration work (e.g. #getAdapter).
Yes, I've tried this way.
But when I place CompilationUnitEditor as page, indent stops working,
some navigate actions (like F3) does not work, because they check, that
current editor is JavaEditor.

>> Can anybody help?
> What's about the Action bar contributor? You have to develop a single one
> for the whole multi page editor. There is also a multi page action
> contributor class available you can inherit from. Your contributor will get
> informed when the editor page changed.
Yes, I know, when user switches page.
But what should I do in this case?
I've tried many ways, but all of them are unsuccessfull. :-(
Currently I use following code:

IActionBars bars = getEditorSite().getActionBars();
String id = IWorkbenchActionConstants.DELETE;
IAction action = getActionRegistry().getAction(GEFActionConstants.DELETE);
System.out.println("action: " + action);
bars.setGlobalActionHandler(id, action);
bars.updateActionBars();

I see, that global action disabled, GEF's DeleteAction is disabled, and it does
not receive notification when I select EditPart in GEF editor. I think, this is
bacause selection provider is CompilationUnitEditor, but I don't know how to
make GEF editor selection provider. :-(
I've tried (unsuccessfully) this code (from hookGraphicalViewer):
getSelectionSynchronizer().addViewer(getGraphicalViewer());
getSite().setSelectionProvider(getGraphicalViewer());
Still no notification. :-(


--
SY, Konstantin.
Re: GEF and multi page editors [message #88945 is a reply to message #88145] Tue, 29 July 2003 10:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

CUEditor most likely is changing the KeyBinding Service's context to the
"text" or "java" context. The DEL key is probably a user-mappable
keybinding, which is implemented using accelerators on the shell. So, when
the graphical page is displayed, ALL keys from the Java editor will be
mysteriously stolen. Maybe the DEL key is actually deleting text on the
other page.

You need to switch keybinding contexts whenever you switch pages in your
editor. Let me know if this guess helped any.

"Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
news:6idmAvaUDHA.1564@fairy.ao.nlmk...
> I am still fighting with multi page editors.
> Now I have editor inherited from CompilationUnitEditor that creates
> CTabFolder, places one one tab CompilationUnitEditor, and on second
> tab - GEF editor. In Java editor all actions work, but not in GEF
> editor - DEL key does nothing (it works, if I use this GEF editor
> alone, without multi page). And when I select "Delete" from menu,
> it is handled in Java editor, even when GEF editor is active.
> Yes, I understand, that I should switch active editor for this
> action to GEF editor. But how? I don't know. :-(
> Yes, I can access delete action using
> getActionRegistry().getAction(GEFActionConstants.DELETE)
> but what should I do after this?
> Can anybody help?
>
> --
> SY, Konstantin.
Re: GEF and multi page editors [message #89177 is a reply to message #88945] Wed, 30 July 2003 00:31 Go to previous message
Eclipse UserFriend
Originally posted by: scheglov_ke.nlmk.ru

Randy Hudson <none@us.ibm.com> wrote:


Thanks, I've solved my problem.
I just bind GEF actions to global actions and set selection
for GEF ections directly in graphical viewer handler.

> CUEditor most likely is changing the KeyBinding Service's context to the
> "text" or "java" context. The DEL key is probably a user-mappable
> keybinding, which is implemented using accelerators on the shell. So, when
> the graphical page is displayed, ALL keys from the Java editor will be
> mysteriously stolen. Maybe the DEL key is actually deleting text on the
> other page.

> You need to switch keybinding contexts whenever you switch pages in your
> editor. Let me know if this guess helped any.

> "Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
> news:6idmAvaUDHA.1564@fairy.ao.nlmk...
>> I am still fighting with multi page editors.
>> Now I have editor inherited from CompilationUnitEditor that creates
>> CTabFolder, places one one tab CompilationUnitEditor, and on second
>> tab - GEF editor. In Java editor all actions work, but not in GEF
>> editor - DEL key does nothing (it works, if I use this GEF editor
>> alone, without multi page). And when I select "Delete" from menu,
>> it is handled in Java editor, even when GEF editor is active.
>> Yes, I understand, that I should switch active editor for this
>> action to GEF editor. But how? I don't know. :-(
>> Yes, I can access delete action using
>> getActionRegistry().getAction(GEFActionConstants.DELETE)
>> but what should I do after this?
>> Can anybody help?
>>
>> --
>> SY, Konstantin.



--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Previous Topic:scaledgraphics
Next Topic:[ANN] Reference Article "Getting Starter" Published
Goto Forum:
  


Current Time: Sat May 10 07:02:01 EDT 2025

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

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

Back to the top