Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » can't deactivate context on workbench window(can't deactivate context on workbench window)
can't deactivate context on workbench window [message #861391] Sat, 28 April 2012 10:39 Go to next message
Hao Missing name is currently offline Hao Missing name
Messages: 115
Registered: July 2009
Senior Member
I define a com.dfs.test.ui.app1.contexts.window on top of context org.eclipse.ui.contexts.window
<extension
point="org.eclipse.ui.contexts">
<context
description="DFA App1 Window Context"
id="com.dfs.test.ui.app1.contexts.window"
name="DFA App1 Window Context"
parentId="org.eclipse.ui.contexts.window">
</context>
</extension>

I bind key M1+S on context com.dfs.test.ui.app1.contexts.window
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.dfs.test.command1"
contextId="com.dfs.test.ui.app1.contexts.window"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+S">
</key>
</extension>

I activate the context when our perspective is activated and deactive the context when out perspective is deactivated as following:
final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (workbenchWindow != null) {
workbenchWindow.addPerspectiveListener(new PerspectiveAdapter() {
IContextActivation ctxAct = null;
public void perspectiveActivated(IWorkbenchPage page,
IPerspectiveDescriptor perspective) {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
IContextService ctxService = (IContextService) window.getService(IContextService.class);
ctxAct = ctxService.activateContext("com.dfs.test.ui.app1.contexts.window");
super.perspectiveActivated(page, perspective);
}

public void perspectiveDeactivated(IWorkbenchPage page,
IPerspectiveDescriptor perspective) {
super.perspectiveDeactivated(page, perspective);
}

public void perspectivePreDeactivate(
IWorkbenchPage page,
IPerspectiveDescriptor perspective) {
if( ctxAct != null ){
ctxAct.getContextService().deactivateContext(ctxAct);
}
super.perspectivePreDeactivate(page, perspective);
}

});
}

all of above the code runs fine without any error. But after our perspective is deactivated, the context is still active. I see the ctxAct.getContextService().deactivateContext(ctxAct); is called without any error in perspectivePreDeactivate(). Why is the context not deactivated?
Re: can't deactivate context on workbench window [message #867992 is a reply to message #861391] Tue, 01 May 2012 11:35 Go to previous messageGo to next message
Hao Missing name is currently offline Hao Missing name
Messages: 115
Registered: July 2009
Senior Member
Hi,

Would someone please help me to resolve the issue? Or I post the topic in wrong group?
Re: can't deactivate context on workbench window [message #870331 is a reply to message #867992] Mon, 07 May 2012 12:30 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can open a bug at https://bugs.eclipse.org/bugs against Eclipse Platform UI

If you attach a little plugin with your code in it, they can debug it.

PW


Re: can't deactivate context on workbench window [message #915561 is a reply to message #870331] Mon, 17 September 2012 10:29 Go to previous message
Laura V is currently offline Laura V
Messages: 32
Registered: March 2012
Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=389579
Previous Topic:Can I use ISchedulingRule as a explicit lock?
Next Topic:Installing Manually Eclipse
Goto Forum:
  


Current Time: Fri Aug 29 14:29:25 EDT 2014

Powered by FUDForum. Page generated in 0.02949 seconds