/** * Method getParticipant. * * @param aId - String * @return R4EParticipant */ protected R4EParticipant getParticipant(String aId) { // First check if the participant already exist in the participant list for (R4EParticipant tmpPart : fParticipants) { if (aId.equalsIgnoreCase(tmpPart.getId())) { return null; } } final R4EParticipant participant = RModelFactory.eINSTANCE.createR4EParticipant(); if (R4EUIModelController.isUserQueryAvailable()) { final IQueryUser query = new QueryUserFactory().getInstance(); try { final List<IUserInfo> users = query.searchByUserId(aId); // Fill info with first user returned for (IUserInfo user : users) { if (user.getUserId().toLowerCase().equals(aId)) { participant.setId(user.getUserId().toLowerCase()); participant.setEmail(user.getEmail()); fParticipantsDetailsValues.add(UIUtils.buildUserDetailsString(user)); return participant; } } } catch (NamingException e) { R4EUIPlugin.Ftracer.traceError("Exception: " + e.toString() + " (" + e.getMessage() + ")"); R4EUIPlugin.getDefault().logError("Exception: " + e.toString(), e); } catch (IOException e) { R4EUIPlugin.getDefault().logWarning("Exception: " + e.toString(), e); } } participant.setId(aId); fParticipantsDetailsValues.add(""); return participant; }
/** * Method decorateImage. * * @param aBaseImage Image * @param aElement Object * @return Image * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(Image, Object) */ public Image decorateImage(Image aBaseImage, Object aElement) { // $codepro.audit.disable // If the image is not already loaded, do it here Image currentOverlayImage; if (null != aBaseImage) { currentOverlayImage = aBaseImage; } else { currentOverlayImage = ((IR4EUIModelElement) aElement) .getImage(((IR4EUIModelElement) aElement).getImageLocation()); } ImageDescriptor topLeftOverlay = null; String topLeftOverlayId = ""; // $NON-NLS-1$ ImageDescriptor topRightOverlay = null; String topRightOverlayId = ""; // $NON-NLS-1$ ImageDescriptor bottomLeftOverlay = null; String bottomLeftOverlayId = ""; // $NON-NLS-1$ ImageDescriptor bottomRightOverlay = null; String bottomRightOverlayId = ""; // $NON-NLS-1$ ImageRegistry registry = R4EUIPlugin.getDefault().getImageRegistry(); // Disabled element decorator if (!((IR4EUIModelElement) aElement).isEnabled()) { bottomRightOverlay = ImageDescriptor.createFromImage(((IR4EUIModelElement) aElement).getDisabledImage()); bottomRightOverlayId = DECORATOR_DISABLED_ID; } else { if (((IR4EUIModelElement) aElement).isUserReviewed() || (aElement instanceof R4EUIAnomalyExtended && ((R4EUIAnomalyExtended) aElement).isTerminalState())) { // Completed element decorator bottomRightOverlay = ImageDescriptor.createFromImage(((IR4EUIModelElement) aElement).getUserReviewedImage()); bottomRightOverlayId = DECORATOR_REVIEWED_ID; } // Added, Removed or Modified file if (aElement instanceof R4EUIFileContext) { if (null == ((R4EUIFileContext) aElement).getBaseFileVersion() && null != ((R4EUIFileContext) aElement).getTargetFileVersion()) { // Only target present, file was added bottomLeftOverlay = ImageDescriptor.createFromImage(((R4EUIFileContext) aElement).getAddedImage()); bottomLeftOverlayId = DECORATOR_ADDED_ID; } else if (null != ((R4EUIFileContext) aElement).getBaseFileVersion() && null == ((R4EUIFileContext) aElement).getTargetFileVersion()) { // Only base present, file was removed bottomLeftOverlay = ImageDescriptor.createFromImage(((R4EUIFileContext) aElement).getRemovedImage()); bottomLeftOverlayId = DECORATOR_REMOVED_ID; } // else modified file } // Read-Only if (((IR4EUIModelElement) aElement).isReadOnly()) { topRightOverlay = ImageDescriptor.createFromImage(((IR4EUIModelElement) aElement).getReadOnlyImage()); topRightOverlayId = DECORATOR_READONLY_ID; } // Due date passed if (((IR4EUIModelElement) aElement).isDueDatePassed()) { topLeftOverlay = ImageDescriptor.createFromImage( ((IR4EUIModelElement) aElement).getDueDatePassedImage()); topLeftOverlayId = DECORATOR_OVERDUE_ID; } } // Construct a new image identifier String baseImageId = ((IR4EUIModelElement) aElement).getImageLocation(); String decoratedImageId = baseImageId + topLeftOverlayId + topRightOverlayId + bottomLeftOverlayId + bottomRightOverlayId; // Return the stored image if we have one if (registry.get(decoratedImageId) == null) { DecorationOverlayIcon decoratedImage = new DecorationOverlayIcon( currentOverlayImage, new ImageDescriptor[] { topLeftOverlay, topRightOverlay, bottomLeftOverlay, bottomRightOverlay, null }) {}; registry.put(decoratedImageId, decoratedImage); } return registry.get(decoratedImageId); }