Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Closing editor from a job
Closing editor from a job [message #490162] Wed, 07 October 2009 15:32 Go to next message
chris snow is currently offline chris snowFriend
Messages: 16
Registered: July 2009
Junior Member
I'm trying to close an editor from a job,

IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage pg = win.getActivePage();
pg.closeEditor(editor, false);

The problem is that from within the job I don't appear to have an ActiveWorkbenchWindow as it is null.

How can I close an editor from within a job?

Many thanks in advance,

Chris
Re: Closing editor from a job [message #490248 is a reply to message #490162] Thu, 08 October 2009 05:14 Go to previous message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
chris snow wrote:
> IWorkbench wb = PlatformUI.getWorkbench();
> IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
> IWorkbenchPage pg = win.getActivePage();
> pg.closeEditor(editor, false);
>
> The problem is that from within the job I don't appear to have an
> ActiveWorkbenchWindow as it is null.

Are you calling it from the UI thread? If not you have to use
Display.syncExec()


- Prakash

Platform UI Team, IBM
http://blog.eclipse-tips.com
Previous Topic:Export feature without jnlp files generated
Next Topic:How do I restrict or limit the size of a MasterDetailsBlock
Goto Forum:
  


Current Time: Thu Apr 25 10:28:29 GMT 2024

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

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

Back to the top