Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321594

Summary: Variables within application context of ExecutionEvent are erased after opening dialog
Product: [Eclipse Project] Platform Reporter: Gunnar Schulze <gunnar.schulze>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: prakash
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Gunnar Schulze CLA 2010-08-03 09:48:53 EDT
Build Identifier: 20100617-1415

In the execute() method of a handler, you can normally retrieve the active editor via HandlerUtil.getActiveEditor(event). However, after displaying e.g. an error dialog, getActiveEditor() returns null. It seems that the activeActionSets variable within the application context gets changed. However, under MacOS X and in versions prior to 3.6 this works.



Reproducible: Always

Steps to Reproduce:
Put the following code into the execute() method of a handler:

public Object execute(ExecutionEvent event) throws ExecutionException
{
    System.out.println("Active editor: " + HandlerUtil.getActiveEditor(event));
    MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "foo", "bar");
    System.out.println("Active editor: " + HandlerUtil.getActiveEditor(event));
    return null;
}

The active editor can be retrieved before, but not after the execution event.
Comment 1 Prakash Rangaraj CLA 2010-08-03 10:40:51 EDT
Sounds like Bug# 242246
Comment 2 Paul Webster CLA 2010-08-11 12:58:09 EDT

*** This bug has been marked as a duplicate of bug 242246 ***