Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » IContextService in dialogs
IContextService in dialogs [message #317674] Wed, 11 July 2007 13:24 Go to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

I want to enable some keybindings in a dialog. Is there a IContextService for a Dialog?

Regards,
Teddy
Re: IContextService in dialogs [message #317701 is a reply to message #317674] Thu, 12 July 2007 03:12 Go to previous messageGo to next message
Eclipse UserFriend
Teddy W. wrote:

>I want to enable some keybindings in a dialog. Is there a IContextService for a Dialog?
>
>
You mean just JFace and no workbench or do you mean a dialog on top of
the workbench? If the latter then simply get the service via
PlatformUI.getWorkbench().getService(...).

Dani

>Regards,
>Teddy
>
>
Re: IContextService in dialogs [message #317724 is a reply to message #317701] Thu, 12 July 2007 07:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

Thanks. Yes, I mean a dialog on top of the workbench.

But it doesn't work.
I get the services and can set activateContext(..) and activateHandler(...), but the keys/contexts doesn't work in the dialog.
The keyboard shortcuts work only, if the are added to the "dialog context". So the activation of the command handlers works.

I tried it directly with the workbench services and nested services, but it seems my contexts are not activated :-(

Any idea?
Re: IContextService in dialogs [message #317741 is a reply to message #317724] Thu, 12 July 2007 09:00 Go to previous messageGo to next message
Eclipse UserFriend
Teddy W. wrote:
> Thanks. Yes, I mean a dialog on top of the workbench.
>
> But it doesn't work.
> I get the services and can set activateContext(..) and activateHandler(...), but the keys/contexts doesn't work in the dialog.
> The keyboard shortcuts work only, if the are added to the "dialog context". So the activation of the command handlers works.

What specifically are you trying to do?

If you open a dialog, you would get all keybindings that are in the
org.eclipse.ui.contexts.dialogAndWindow and
org.eclipse.ui.contexts.dialog contexts. If you want to have other
keybindings available, you can create another context off of
org.eclipse.ui.contexts.dialog and activate that with the
ActiveShellExpression or contribute your keybindings into the
org.eclipse.ui.contexts.dialog context.

If you have dialog specific handlers for a command that you want to
activate, you can do that with the IHandlerService and the
ActiveShellExpression. ex:

handlerActivation = handlerService.activateHandler(commandId, handler,
new ActiveShellExpression(getShell()));


When you close the dialog, don't forget to deactivate the context and
any handlers. For example:

if (handlerActivation!=null) {
handlerService.deactivateHandler(handlerActivation);
handlerActivation.getHandler().dispose();
handlerActivation = null;
}

Later,
PW
Re: IContextService in dialogs [message #317771 is a reply to message #317741] Thu, 12 July 2007 11:30 Go to previous message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

I wanted to enable the "org.eclipse.ui.textEditorScope" context. Perhaps, this was a stupid idea:
a) it is a child of windows context and have so a lot of command at the wrong place.
b) if I understand you correctly, the context for the dialog have to me a child of the dialog context.

I wanted to provide some more text editing actions in a dialog (not only cut and paste), but it seems too complicated, to bind them to keys. I think,
- Adding all keybindings another time for a dialog context would confuse the user.
- Copying the required keybindings from textEditorScope to a dummy context is impossible or complicated. (?)

If this is right, I will discard my idea.
Previous Topic:Ant builders. Difference between Eclipse 3.2 and 3.3
Next Topic:Bundle not found when using a plugin from a product extension in the osgi.bundles list of config.ini
Goto Forum:
  


Current Time: Sat Jul 19 07:04:45 EDT 2025

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

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

Back to the top