Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Context Activation doesn't work
Context Activation doesn't work [message #488589] Tue, 29 September 2009 11:17 Go to next message
Ralf Heydenreich is currently offline Ralf Heydenreich
Messages: 126
Registered: July 2009
Senior Member
Hi all,
I want to activate a defined context programmatically. What I've done is
the following:

plugin.xml:
<!-- define a new context -->
<extension
point="org.eclipse.ui.contexts">
<context
description="Context for editing Sources"
id="my.own.EditorScope"
name="PrivateEditing"
parentId="org.eclipse.xtext.ui.core.XtextEditorScope">
</context>
</extension>

Now, in the Activator class of my plugin I've overwritten the start()
method:

private static final String MYEDITORCONTEXT = "my.own.EditorScope";

@Override
public void start(BundleContext context) throws Exception {
super.start(context);
IContextService contextService =
(IContextService)getWorkbench().getService(IContextService.c lass);
IContextActivation activation =
contextService.activateContext(MYEDITORCONTEXT);
System.out.println("*** NEW CONTEXT: "+activation.getContextId());
}

If I start a new Eclipse Application based on my new plugin (there are
some more plugins, yet), the console tells me that the context was
changed. But if I look in Window -> Preferences -> General -> Keys the
Scheme is always set to Default. I thought that changing the context
changes this, too. Any hints are welcome.

TIA,
Ralf.
Re: Context Activation doesn't work [message #488650 is a reply to message #488589] Tue, 29 September 2009 15:32 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The context is active. But schemes are something else entirely (groups of keybindings).

Activating a context simply activates it. If you have a keybinding in that context, it will be considered to see if can be an active keybinding.

PW


Previous Topic:TextCellEditor+ICellModifier+ContentProposalAdapter+IControlContentAdapter
Next Topic:Application could not be found in the registry.
Goto Forum:
  


Current Time: Thu Oct 23 01:48:12 GMT 2014

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

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