continue; Object[] array = item.getChildren().toArray(); for (int c = 0; c < array.length; c++) { MToolBarElement me = (MToolBarElement) array[c]; if (!containsMatching(toContribute.getChildren(), me)) { toContribute.getChildren().add(me);
public boolean anyVisibleWhen() { if (toolbarContribution.getVisibleWhen() != null) { return true; } for (MToolBarElement child : toolbarContribution.getChildren()) { if (child.getVisibleWhen() != null || child.getPersistedState().get( MenuManagerRenderer.VISIBILITY_IDENTIFIER) != null) { return true; } } return false; }
public boolean anyVisibleWhen() { if (toolbarContribution.getVisibleWhen() != null) { return true; } List<MToolBarElement> childrenToInspect; if (toolbarContribution.getTransientData().get(FACTORY) != null) { // See mergeIntoModel childrenToInspect = this.generatedElements; } else { childrenToInspect = toolbarContribution.getChildren(); } for (MToolBarElement child : childrenToInspect) { if (requiresVisibilityCheck(child)) { return true; } } return false; }
private void contributeToolBarGroup(ArrayList<MToolBarContribution> contributions, String parentId, String group) { if (toolbarContributionGroupIds.contains(parentId + group)) { return; } toolbarContributionGroupIds.add(parentId + group); MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE .createToolBarContribution(); toolBarContribution.getTags().add(ContributionsAnalyzer.MC_MENU); toolBarContribution.getTags().add("scheme:toolbar"); //$NON-NLS-1$ toolBarContribution.setParentId(parentId); toolBarContribution.setPositionInParent("after=additions"); //$NON-NLS-1$ MToolBarSeparator sep = MenuFactoryImpl.eINSTANCE.createToolBarSeparator(); sep.setElementId(group); sep.setVisible(false); toolBarContribution.getChildren().add(sep); contributions.add(toolBarContribution); }
toolBarContribution.getChildren().add(element); } else if (IWorkbenchRegistryConstants.TAG_SEPARATOR.equals(itemType)) { MToolBarElement element = createToolBarSeparatorAddition(child); toolBarContribution.getChildren().add(element); } else if (IWorkbenchRegistryConstants.TAG_CONTROL.equals(itemType)) { MToolBarElement element = createToolControlAddition(child); toolBarContribution.getChildren().add(element); } else if (IWorkbenchRegistryConstants.TAG_DYNAMIC.equals(itemType)) { ContextFunction generator = new ContextFunction() { toolBarContribution.getChildren().add(element);
public static boolean processAddition(final MToolBar toolBarModel, MToolBarContribution toolBarContribution, List<MToolBarElement> contributions, HashSet<String> existingSeparatorNames) { int idx = getIndex(toolBarModel, toolBarContribution.getPositionInParent()); if (idx == -1) { return false; } for (MToolBarElement item : toolBarContribution.getChildren()) { if (item instanceof MToolBarSeparator && existingSeparatorNames.contains(item.getElementId())) { // skip this, it's already there continue; } MToolBarElement copy = (MToolBarElement) EcoreUtil.copy((EObject) item); if (DEBUG) { trace("addToolBarContribution " + copy, toolBarModel.getWidget(), toolBarModel); //$NON-NLS-1$ } toolBarModel.getChildren().add(idx++, copy); contributions.add(copy); if (copy instanceof MToolBarSeparator && copy.getElementId() != null) { existingSeparatorNames.add(copy.getElementId()); } } return true; }
toolBarContribution.getChildren().add(action);
} else { copyElements = new ArrayList<>(); for (MToolBarElement item : toolbarContribution.getChildren()) { MToolBarElement copy = (MToolBarElement) EcoreUtil .copy((EObject) item);
} else { copyElements = new ArrayList<MToolBarElement>(); for (MToolBarElement item : toolbarContribution.getChildren()) { MToolBarElement copy = (MToolBarElement) EcoreUtil .copy((EObject) item);