/** * @param identifier the identifier to check for its quality * @return an IStatus severity indicating the quality */ public static int getQualitySeverity(IComponentIdentifier identifier) { if (identifier != null) { int noOfMatchedComps = identifier.getNumberOfOtherMatchingComponents(); if (identifier.isEqualOriginalFound()) { if (noOfMatchedComps == 1) { return IStatus.OK; } return IStatus.WARNING; } return IStatus.ERROR; } return IStatus.CANCEL; }
/** * @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; }