| Hiding and restoring a view in RCP [message #1005350] |
Thu, 24 January 2013 20:36  |
Prasanth Jonna Vamsi Messages: 8 Registered: January 2013 |
Junior Member |
|
|
I have 4 views in my perspective. I need to hide a view and restore it on.
But what i inferred is eclipse is closing the view on the call of hideView() and showView is creating a new view. But i need to just hide and show the view as it works for "View - > Console / View -> error log " in eclipse.
My sample code
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
String viewIdToToggle = HBinningView.ID;
IViewReference viewToToggle = activePage.findViewReference(viewIdToToggle);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
if (!isChecked()) {
activePage.hideView(viewToToggle);
} else {
try {
activePage.showView(viewIdToToggle);
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
|
|
|
| Re: Hiding and restoring a view in RCP [message #1005457 is a reply to message #1005350] |
Fri, 25 January 2013 09:18   |
John Steele Messages: 42 Registered: January 2010 |
Member |
|
|
Hmmm... Sounds fishy. I just tested your code by placing a break point at the beginning of the createPartControl(Composite parent) method of the View, and it's only called once when it's initially created.
From that point forward createPartControl(Composite parent) is never called again; indicating it's not re-creating the view per activePage.showView(viewIdToToggle) call.
I put another break point in the dispose() method of the View, and sure enough, it's only called once when the platform is shutdown. Again, indicating the view is only disposed once.
Is this a trick question? Or am I misinterpreting the question?
[Updated on: Fri, 25 January 2013 09:20] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
| Re: Hiding and restoring a view in RCP [message #1005701 is a reply to message #1005656] |
Mon, 28 January 2013 05:34  |
John Steele Messages: 42 Registered: January 2010 |
Member |
|
|
I see, if I'm understanding this correctly, if you toggle the view when the two views are within the same Folder the entire Folder is being minimized. I didn't have this problem because I put the view that I was minimizing in its own Folder within the perspective, so the view performing the minimizing action doesn't also get minimized.
j
Prasanth Jonna Vamsi wrote on Mon, 28 January 2013 00:17I even tried this one too . But problem in my case is I have two views separated by tabs. [If i click on one tab it shows 1 view and another tab, it shows other view ] Now if you minimize , it minimizes the whole view rather than that particular tab.
|
|
|
Powered by
FUDForum. Page generated in 0.01870 seconds