@Override public boolean applicable(final ServiceContext context) { ISapphirePart part = context.find(ISapphirePart.class); if (part instanceof SapphireDiagramEditorPagePart) { SapphireDiagramEditorPagePart diagramPagePart = (SapphireDiagramEditorPagePart) part; DiagramEditorPageDef pageDef = diagramPagePart.getPageDef(); if (pageDef.getLayoutPersistence().content() == LayoutPersistence.SIDE_BY_SIDE) { return true; } } return false; }
@Override protected void compute(Set<String> values) { DiagramEditorPageDef diagramPageDef = context(DiagramEditorPageDef.class); ElementList<IDiagramPaletteCompartmentDef> compartments = diagramPageDef.getPaletteCompartments(); if (compartments.size() == 0) { values.add(DiagramPaletteCompartmentConstants.NODES_COMPARTMENT_ID); values.add(DiagramPaletteCompartmentConstants.CONNECTIONS_COMPARTMENT_ID); } else { for (IDiagramPaletteCompartmentDef compartment : compartments) { values.add(compartment.getId().content()); } } }