Below snippet can be used to minimize a view.
IViewPart part = page.showView("com.kk.views.showtasks");
if (part != null) {
IWorkbenchPartReference myView = page.findViewReference(viewid);
MUIElement element = ((WorkbenchPage) page).getActiveElement(myView);
WorkbenchWindow activeWorkbenchWindow = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
MWindow window = activeWorkbenchWindow.getModel();
if (window != null) {
EModelService service = window.getContext().get(EModelService.class);
if (service != null) {
element.getTags().add(IPresentationEngine.MINIMIZED);
}
}
}
}
More important thing here is,
element.getTags().add(IPresentationEngine.MINIMIZED);
When above code gets invoked, MinMaxAddon.minimize(..) will be invoked internally to minimize a view. Minimized view will be added as a toolbar item to the trimbar.
MUIElement element = ((WorkbenchPage) page).getActiveElement(myView);
Here element is PartStack element, that means all the elements(Parts) which are there in the partstack will be minimized.
IViewPart part = page.showView("com.kk.views.showtasks");
if (part != null) {
IWorkbenchPartReference myView = page.findViewReference(viewid);
MUIElement element = ((WorkbenchPage) page).getActiveElement(myView);
WorkbenchWindow activeWorkbenchWindow = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
MWindow window = activeWorkbenchWindow.getModel();
if (window != null) {
EModelService service = window.getContext().get(EModelService.class);
if (service != null) {
element.getTags().add(IPresentationEngine.MINIMIZED);
}
}
}
}
More important thing here is,
element.getTags().add(IPresentationEngine.MINIMIZED);
When above code gets invoked, MinMaxAddon.minimize(..) will be invoked internally to minimize a view. Minimized view will be added as a toolbar item to the trimbar.
MUIElement element = ((WorkbenchPage) page).getActiveElement(myView);
Here element is PartStack element, that means all the elements(Parts) which are there in the partstack will be minimized.