private void updateStatus() { CPElement entryError = null; int nErrorEntries = 0; IStatus status = Status.OK_STATUS; List<CPElement> elements = getCPaths(); for (int i = elements.size() - 1; i >= 0; i--) { CPElement currElement = elements.get(i); if (currElement.getStatus().getSeverity() != IStatus.OK) { nErrorEntries++; if (entryError == null) { entryError = currElement; } } } if (nErrorEntries > 0) { if (nErrorEntries == 1 && entryError != null) { status = entryError.getStatus(); } else { status = new Status( IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, NLS.bind( CPathEntryMessages.CPElement_status_multiplePathErrors, String.valueOf(nErrorEntries)), null); } } fContext.statusChanged(status); }
private void updateStatus(List<?> selected) { if (selected.size() != 1) { updateStatus(); return; } CPElement element = null; if (selected.get(0) instanceof CPElement) { element = (CPElement) selected.get(0); } else if (selected.get(0) instanceof CPElementAttribute) { element = ((CPElementAttribute) selected.get(0)).getParent(); } if (element != null && element.getStatus().getSeverity() != IStatus.OK) { fContext.statusChanged(element.getStatus()); } else { updateStatus(); return; } }