Close perspective views [message #464410] |
Fri, 02 March 2007 08:56 |
Eclipse User |
|
|
|
When I change a perspective, I need to close all opened views before open
the other perspective to free memory.
I use this code to close views:
Vector<String> perspectiveView = getPerspectiveView();
for (Iterator iter = perspectiveView .iterator(); iter.hasNext();) {
String idView = (String) iter.next();
try {
IViewPart view = page.findView(idView);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().
getActivePage().hideView(view);
} catch (Throwable t) {
System.out.println("view not closed");
}
}
To detect the change of perspective, I add a listener in perspectiveBar.
To close a view, I have to instantiate it. To instantiate a view the
perspective that holds the view has to be activated, so I have to
reactivate the before perspective, hide its views and finally activate the
other perspective to can get my objetive.
Can I add a listener in actual perspective o similar that notify me when a
perspective is going to be hiden?, so I could close all its views and
later activate the other perspective. I have implement
IPerspectiveListener4 but I didn't obtain anything.
Can someone help me? please
Thanks.
Ángel
|
|
|
Powered by
FUDForum. Page generated in 0.03155 seconds