/** * Workaround method for an error that occurs when deleting multiple tiers of an Object Mapping * Category hierarchy (selecting parent *before* child seems to be important). I believe that The * fix for EclipseLink's 328040 makes this workaround superfluous, so try removing it when moving * to EclipseLink 2.3.0 or higher. * * @param category The child to check. May be <code>null</code>, in which case <code>false</code> * will be returned. * @param toDelete Objects that are marked for deletion. * @return <code>true</code> if <code>toDelete</code> contains an ancestor of <code>category * </code>. Otherwise <code>false</code>. */ public static boolean willAncestorBeDeleted( IObjectMappingCategoryPO category, Object[] toDelete) { IObjectMappingCategoryPO ancestor = category; while (ancestor != null) { ancestor = ancestor.getParent(); for (Object possibleAncestor : toDelete) { if (ObjectUtils.equals(ancestor, possibleAncestor)) { return true; } } } return false; }
/** * @param element Object * @return name String */ public String getText(Object element) { if (element instanceof IObjectMappingAssoziationPO) { IComponentIdentifier compId = ((IObjectMappingAssoziationPO) element).getTechnicalName(); if (compId != null) { return compId.getComponentNameToDisplay(); } } else if (element instanceof IComponentNamePO) { return m_compMapper.getCompNameCache().getName(((IComponentNamePO) element).getGuid()); } else if (element instanceof IObjectMappingCategoryPO) { IObjectMappingCategoryPO category = (IObjectMappingCategoryPO) element; StringBuilder nameBuilder = new StringBuilder(); String catName = category.getName(); if (getTopLevelCategoryName(catName) != null) { catName = getTopLevelCategoryName(catName); } nameBuilder.append(catName); if (Plugin.getDefault().getPreferenceStore().getBoolean(Constants.SHOWCHILDCOUNT_KEY)) { int childListSize = 0; childListSize += category.getUnmodifiableAssociationList().size(); childListSize += category.getUnmodifiableCategoryList().size(); nameBuilder .append(StringConstants.SPACE + StringConstants.LEFT_PARENTHESES) .append(childListSize) .append(StringConstants.RIGHT_PARENTHESES); } return nameBuilder.toString(); } else if (element instanceof String) { // Missing Component Name return (String) element; } Assert.notReached( org.eclipse.jubula.client.ui.i18n.Messages.UnknownTypeOfElementInTreeOfType + StringConstants.SPACE + element.getClass().getName()); return StringConstants.EMPTY; }