Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Closing a view programmatically before shutdown
Closing a view programmatically before shutdown [message #541647] Mon, 21 June 2010 18:54 Go to next message
Bahar Sateli is currently offline Bahar Sateli
Messages: 19
Registered: May 2010
Location: Canada
Junior Member
Hello,

I'm writing a plug-in which opens a view programmatically to show some results. Now I want to close this view programmatically when Eclipse shuts down, because Eclipse saves the workbench everytime it exits and I don't want it to save my view.

I found the code to close a view like the following:

final IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getViewReferences();

for (int v = 0; v < viewRefs.length; v++){
final IViewReference viewRef = viewRefs[v];
if(viewRef.getView(false).getTitle().equals(MY_VIEW_TITLE)){
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().hideView(viewRef);
}
}

but I don't know where to put this. I tried putting it in plug-in activator file's stop() method, but didn't work out.

Can anybody help me with this please?

Cheers,
Bahar

[Updated on: Mon, 21 June 2010 18:55]

Report message to a moderator

Re: Closing a view programmatically before shutdown [message #542217 is a reply to message #541647] Thu, 24 June 2010 05:32 Go to previous messageGo to next message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
The question is related to RCP forum.

in plugin.xml,in view extention where u definr u r view,

there is a attribute called restorable,set it false.


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: Closing a view programmatically before shutdown [message #543247 is a reply to message #542217] Mon, 28 June 2010 15:20 Go to previous message
Bahar Sateli is currently offline Bahar Sateli
Messages: 19
Registered: May 2010
Location: Canada
Junior Member
Thank you vijay, I added restorable="false" to view exnetsion point in my plugin.xml file and it worked! Smile
Previous Topic:Databinding with CellEditor
Next Topic:Dialog is minimized when open in Display.asyncExec
Goto Forum:
  


Current Time: Thu Jul 24 02:30:34 EDT 2014

Powered by FUDForum. Page generated in 0.01579 seconds