Skip to main content


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 14:39 Go to next message
Hao Missing name is currently offline Hao Missing nameFriend
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 15:35 Go to previous messageGo to next message
Hao Missing name is currently offline Hao Missing nameFriend
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 16:30 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
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 14:29 Go to previous message
Laura V is currently offline Laura VFriend
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 Apr 19 18:12:08 GMT 2024

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

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

Back to the top