Configure PartStack to be displayed minimized [message #990895] |
Fri, 14 December 2012 12:25  |
Eclipse User |
|
|
|
I'd like to display a PartStack component minimized at startup.
Consulting the lifeeditor I noticed that a minimized PartStack is tagged "Minimized" and has it's visibility set to false.
However, if I configure my PartStack control this way, instead of displayed minimized it isn't visible at all.
I tried to produce the desired state programmatically. I first tried it in my lifecycle classe's @ProcessAdditions method using the EModelService:
===
MUIElement partStack = modelService.find("my.part.stack", application);
partStack.getTags().add(IPresentationEngine.MINIMIZED);
partStack.setVisible(false);
===
However, this has in exactly the same outcome as the model configuration.
As workaround, I succeeded to produce the desired state using a child element's @PostConstruct method.
I think this behavior far from intuitive. In addition, I see the following error in my console:
===
java.lang.IllegalStateException: Application does not have an active window
at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.getActiveWindowService(ApplicationPartServiceImpl.java:36)
at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.requestActivation(ApplicationPartServiceImpl.java:71)
at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.minimize(MinMaxAddon.java:540)
...
===
Is there a clean way to display a PartStack minimized a startup?
(I guess, this my post addresses the same issue as http://www.eclipse.org/forums/index.php/m/784379/?srch=partstack+minimized#msg_784379)
Regards,
Benno
|
|
|
|
|
|
Re: Configure PartStack to be displayed minimized [message #1722049 is a reply to message #1066285] |
Tue, 02 February 2016 08:41  |
Eclipse User |
|
|
|
Thanks a zillion for these instructions!
Beware that whenever you use the MinMax Addon, it assumes that the ID of the tool control where a stack should be minimized is "<stack.id>(<perspective.id>)".
@see org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon#createTrim(MUIElement element)
[...]
// Is there already a TrimControl there ?
String trimId = element.getElementId() + getMinimizedElementSuffix(element);
MToolControl trimStack = (MToolControl) modelService.find(trimId, window);
@see org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon#getMinimizedElementSuffix(MUIElement element)
private String getMinimizedElementSuffix(MUIElement element) {
String id = ID_SUFFIX;
MPerspective persp = modelService.getPerspectiveFor(element);
if (persp != null) {
id = '(' + persp.getElementId() + ')'
}
return id;
}
Additionally, one can also programmatically maximize and minimize a stack by programmatically adding the tag:
myPartStack.getTags().add(<TAG>);
where TAG = { IPresentationEngine.MINIMIZED, IPresentationEngine.MAXIMIZED }.
[Updated on: Wed, 03 February 2016 05:51] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04405 seconds