/** * Removes the IPresentationEngine.HIDDEN_EXPLICITLY from the trimbar * entries. Having a separate logic for toolbars and toolcontrols would be * confusing for the user, hence we remove this tag for both these types * * @param toolbarModel */ private void removeHiddenTags(MToolControl toolControl) { MWindow mWindow = modelService.getTopLevelWindowFor(toolControl); List<MTrimElement> trimElements = modelService.findElements(mWindow, null, MTrimElement.class, null); for (MTrimElement trimElement : trimElements) { trimElement.getTags().remove(IPresentationEngine.HIDDEN_EXPLICITLY); } }
/** * This is a HACK ! Due to compatibility restrictions we have the case where * we <b>must</b> leave 'empty' toolbars in the trim. This code detects this * particular scenario and hides any TB's of this type... * * @param te * The proposed trim element * @return <code>true</code> iff this element represents an empty managed * TB. */ private boolean hideManagedTB(MTrimElement te) { if (!(te instanceof MToolBar) || !(te.getRenderer() instanceof ToolBarManagerRenderer)) return false; if (!(te.getWidget() instanceof Composite)) return false; Composite teComp = (Composite) te.getWidget(); Control[] kids = teComp.getChildren(); if (kids.length != 1 || !(kids[0] instanceof ToolBar)) return false; boolean barVisible = ((ToolBar) kids[0]).getItemCount() > 0; // HACK! The trim dragging code uses the visible attribute as well // this is a local 'lock' to prevent the layout from messing with it if (!te.getTags().contains("LockVisibility")) { //$NON-NLS-1$ te.setVisible(barVisible); } return !barVisible; }
/** * This is a HACK ! Due to compatibility restrictions we have the case where * we <b>must</b> leave 'empty' toolbars in the trim. This code detects this * particular scenario and hides any TB's of this type... * * @param te * The proposed trim element * @return <code>true</code> iff this element represents an empty managed * TB. */ private boolean hideManagedTB(MTrimElement te) { if (!(te instanceof MToolBar) || !(te.getRenderer() instanceof ToolBarManagerRenderer)) return false; if (!(te.getWidget() instanceof Composite)) return false; Composite teComp = (Composite) te.getWidget(); Control[] kids = teComp.getChildren(); if (kids.length != 1 || !(kids[0] instanceof ToolBar)) return false; boolean barVisible = ((ToolBar) kids[0]).getItemCount() > 0; // HACK! The trim dragging code uses the visible attribute as well // this is a local 'lock' to prevent the layout from messing with it if (!te.getTags().contains("LockVisibility")) { //$NON-NLS-1$ te.setVisible(barVisible); } return !barVisible; }
&& toolBar.getTags().contains(TOOLBAR_SEPARATOR)) {
MTrimElement.class, null); for (MTrimElement mTrimElement : trimElements) { mTrimElement.getTags().remove(IPresentationEngine.HIDDEN_EXPLICITLY);