Search code examples
javaeclipsegraphiti

How do I disable/remove the Palette of an Eclipse Graphiti editor?


Trying to remove the palette of a Eclipse Graphiti editor.

org.eclipse.graphiti.ui.editor.DiagramBehavior has a createPaletteBehaviour() to override but if I return null, the editor crashes.

I also tried this in the diagram behavior, but I actually don't want it collapsed but removed:

@Override
protected DefaultPaletteBehavior createPaletteBehaviour() {
    return new DefaultPaletteBehavior(this) {
        @Override
        public FlyoutPreferences getPalettePreferences() {
            FlyoutPreferences palettePreferences = super.getPalettePreferences();
            palettePreferences.setPaletteState(FlyoutPaletteComposite.STATE_COLLAPSED);
            return palettePreferences;
        }
    };
}

I would also prefer to use some API instead of manipulating the preferences.


Solution

  • I just got a reply in the eclipse forum: https://www.eclipse.org/forums/index.php/m/1698886/

    "you can override isShowFlyoutPalette() in your tool behavior provider and return false there to hide the palette."

    This is what I was looking for.