|
|
Re: Palette should initially be expanded [message #947668 is a reply to message #479514] |
Wed, 17 October 2012 09:54 |
pankaj sharma Messages: 2 Registered: October 2012 |
Junior Member |
|
|
Matthew Dickie wrote on Tue, 11 August 2009 07:22Hi all,
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:
FlyoutPreferences prefs =
FlyoutPaletteComposite.createFlyoutPreferences(
GFEUIPlugin.getDefault().getPluginPreferences());
prefs.setPaletteState(1);
return prefs;
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.
Can anyone help?
use following in your editor
@Override
protected FlyoutPreferences getPalettePreferences() {
FlyoutPreferences preferences = super.getPalettePreferences();
// here we are setting palette state as always opened i.e STATE_PINNED_OPEN
preferences.setPaletteState(FlyoutPaletteComposite.STATE_PINNED_OPEN);
return preferences;
}
|
|
|
Powered by
FUDForum. Page generated in 0.02283 seconds