Search code examples
eclipsee4

Eclipse e4 disable close in shared element


I created a part as shared element. and it is used as placeholder with no closeable on the part stack.

But at launching the e4 application I saw that close button on placeholder is enabled (like 'X').

Why doesn't the placeholder apply the closeable option?


Solution

  • The code in the stack renderer for determining the close flag is:

    protected boolean isClosable(MPart part) {
        // if it's a shared part check its current ref
        if (part.getCurSharedRef() != null) {
            return !(part.getCurSharedRef().getTags().contains(IPresentationEngine.NO_CLOSE));
        }
    
        return part.isCloseable();
    }
    

    And the JavaDoc for IPresentationEngine.NO_CLOSE (value `"NoClose") says:

    When applied as a tag to an MPlaceholder inhibits the display of the close affordance. This allows a part to be closeable in one perspective but not in a different one