Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Palette should initially be expanded
Palette should initially be expanded [message #479514] Tue, 11 August 2009 11:22 Go to next message
Matthew Dickie is currently offline Matthew DickieFriend
Messages: 56
Registered: July 2009
Member
Hi 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?
Re: Palette should initially be expanded [message #947667 is a reply to message #479514] Wed, 17 October 2012 09:52 Go to previous messageGo to next message
pankaj sharma is currently offline pankaj sharmaFriend
Messages: 2
Registered: October 2012
Junior Member
override this method 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;
}
Re: Palette should initially be expanded [message #947668 is a reply to message #479514] Wed, 17 October 2012 09:54 Go to previous message
pankaj sharma is currently offline pankaj sharmaFriend
Messages: 2
Registered: October 2012
Junior Member
Matthew Dickie wrote on Tue, 11 August 2009 07:22
Hi 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;
}

Previous Topic:Tree Structure
Next Topic:GEF with Eclipse RCP 4x
Goto Forum:
  


Current Time: Thu Apr 18 14:02:58 GMT 2024

Powered by FUDForum. Page generated in 0.02283 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top