Problem with DockSituationIgnore

Hello,
I tried to implement DockSituationIgnore, but I’m getting NullPointerException during save.
I’m not sure whether it is a bug or maybe I didn’t implement it correctly. It can be reproduced if you add the following code to your PersistentLayoutExample.

...
frontend.setIgnoreForEntry(new DockablesFilter());
frontend.setIgnoreForFinal(new DockablesFilter());
...

private static class DockablesFilter implements DockSituationIgnore {

        public boolean ignoreElement(DockElement element) {
            if (element instanceof ColorDockable) {
                ColorDockable colorDockable = (ColorDockable) element;
                //Filter out red dockable
                boolean result = (colorDockable.getColor().getRGB() == -26215);
                return result;
            }
            return false;
        }

        public boolean ignoreElement(PerspectiveElement element) {
            return false;
        }

        public boolean ignoreChildren(DockStation station) {
            return false;
        }

        public boolean ignoreChildren(PerspectiveStation station) {
            return false;
        }
}

Also, I’m not completely understand the usage of setIgnoreForEntry and setIgnoreForFinal. What I should do if I don’t want some dockable to appear in the settings xml? Should I use both of them as in example above?

Ok, I’ll have a closer look at this in the evening. It is almost certainly a bug in the framework as your code seems to be correct.

As for final vs. entry: the “final” layout is the position/size of Dockables when starting or stopping the application. In the example this is simulated by the “WriteAction” and the “ReadAction”. The “entry” layouts are the layouts that can be selected during runtime, in the example with the Save/SaveAs/Load/Delete-Action. If you want to completely hide the location of a dockable, then you need to use both “setIgnoreForEntry” and “setIgnoreForFinal”.

I’ve uploaded a new version which should fix the bug.

Thanks.
One small thing: while checking what was changed I noticed that in this version you made a typo in DockFrontend’s JavaDoc of HIDE_ACCELERATOR - KeyStore instead of KeyStroke.

ups, thanks :slight_smile: