public static void gatherMenuContributions( final MMenu menuModel, final List<MMenuContribution> menuContributionList, final String id, final ArrayList<MMenuContribution> toContribute, final ExpressionContext eContext, boolean includePopups) { if (id == null || id.length() == 0) { return; } boolean menuBar = (((MUIElement) ((EObject) menuModel).eContainer()) instanceof MWindow); for (MMenuContribution menuContribution : menuContributionList) { String parentID = menuContribution.getParentId(); if (parentID == null) { // it doesn't make sense for this to be null, temporary workaround for bug 320790 continue; } boolean popup = parentID.equals(POPUP_PARENT_ID) && (menuModel instanceof MPopupMenu) && includePopups; boolean filtered = isFiltered(menuModel, menuContribution, includePopups); if (filtered || (!popup && !parentID.equals(id)) || !menuContribution.isToBeRendered()) { continue; } if (menuBar || isVisible(menuContribution, eContext)) { toContribute.add(menuContribution); } } }
public static void XXXgatherMenuContributions( final MMenu menuModel, final List<MMenuContribution> menuContributionList, final String id, final ArrayList<MMenuContribution> toContribute, final ExpressionContext eContext, boolean includePopups) { if (id == null || id.length() == 0) { return; } ArrayList<String> popupIds = new ArrayList<String>(); if (includePopups) { popupIds.add(id); for (String tag : menuModel.getTags()) { if (tag.startsWith("popup:")) { // $NON-NLS-1$ String tmp = tag.substring("popup:".length()); // $NON-NLS-1$ if (!popupIds.contains(tmp)) { popupIds.add(tmp); } } } } for (MMenuContribution menuContribution : menuContributionList) { String parentID = menuContribution.getParentId(); if (parentID == null) { // it doesn't make sense for this to be null, temporary workaround for bug 320790 continue; } boolean popupTarget = includePopups && popupIds.contains(parentID); boolean popupAny = includePopups && menuModel instanceof MPopupMenu && POPUP_PARENT_ID.equals(parentID); boolean filtered = isFiltered(menuModel, menuContribution, includePopups); if (filtered || (!popupAny && !popupTarget && !parentID.equals(id)) || !menuContribution.isToBeRendered()) { continue; } toContribute.add(menuContribution); } }