Skip to main content


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 22:54 Go to next message
Bahar Sateli is currently offline Bahar SateliFriend
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 22: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 09:32 Go to previous messageGo to next message
Vijay RajFriend
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 19:20 Go to previous message
Bahar Sateli is currently offline Bahar SateliFriend
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:string filter for TreeViewer
Next Topic:Getting TableViewerColumns from TableViewer reference?
Goto Forum:
  


Current Time: Tue Apr 23 15:27:19 GMT 2024

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

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

Back to the top