The palette of my graphical editor is initially hidden. I would like it
to initially be expanded. I have having difficulty figuring out how to
do this. I have changed the createPalettePreferences method for my
editor so that it sets the initaly state to STATE_EXPANDED, as below:
The palette is briefly expanded, but then collapses. It seems this piece
of code is to blame (in FlyoutPaletteComposite):
public void setGraphicalControl(Control graphicalViewer) {
Assert.isTrue(graphicalViewer != null);
Assert.isTrue(graphicalViewer.getParent() == this);
Assert.isTrue(graphicalControl == null);
graphicalControl = graphicalViewer;
addListenerToCtrlHierarchy(graphicalControl, SWT.MouseEnter, new
Listener() {
public void handleEvent(Event event) {
if (!isInState(STATE_EXPANDED))
return;
Display.getCurrent().timerExec(250, new Runnable() {
public void run() {
if (isDescendantOf(graphicalControl,
Display.getCurrent().getCursorControl())
&& isInState(STATE_EXPANDED))
setState(STATE_COLLAPSED);
}
});
}
});
}
I don't understand what this code is trying to achieve besides
collapsing my palette when I don't want it collapsed. I would like to
override this method and not call addListenerToCtrlHierarchy, but
unfortunately I can't because graphicalControl is a private field so I
can't set it.