public CVSCheckedInChangeSet(ILogEntry entry) { this.entry = entry; Date date = entry.getDate(); String comment = Util.flattenText(entry.getComment()); if (date == null) { setName("[" + entry.getAuthor() + "] " + comment); // $NON-NLS-1$ //$NON-NLS-2$ } else { String dateString = DateFormat.getDateTimeInstance().format(date); setName( "[" + entry.getAuthor() + "] (" + dateString + ") " + comment); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } }
/** * Given the current selection this method returns a text label that can be shown to the user that * reflects the tags in the current selection. These can be used in the <b>Compare With</b> and * <b>Replace With</b> actions. */ protected String calculateActionTagValue() { try { IResource[] resources = getSelectedResources(); CVSTag commonTag = null; boolean sameTagType = true; boolean multipleSameNames = true; for (int i = 0; i < resources.length; i++) { ICVSResource cvsResource = getCVSResourceFor(resources[i]); CVSTag tag = null; if (cvsResource.isFolder()) { FolderSyncInfo info = ((ICVSFolder) cvsResource).getFolderSyncInfo(); if (info != null) { tag = info.getTag(); } if (tag != null && tag.getType() == CVSTag.BRANCH) { tag = Util.getAccurateFolderTag(resources[i], tag); } } else { tag = Util.getAccurateFileTag(cvsResource); } if (tag == null) { tag = new CVSTag(); } if (commonTag == null) { commonTag = tag; } else if (!commonTag.equals(tag)) { if (commonTag.getType() != tag.getType()) { sameTagType = false; } if (!commonTag.getName().equals(tag.getName())) { multipleSameNames = false; } } } // set text to default String actionText = CVSUIMessages.ReplaceWithLatestAction_multipleTags; if (commonTag != null) { int tagType = commonTag.getType(); String tagName = commonTag.getName(); // multiple tag names but of the same type if (sameTagType && !multipleSameNames) { if (tagType == CVSTag.BRANCH) { actionText = CVSUIMessages.ReplaceWithLatestAction_multipleBranches; // } else { actionText = CVSUIMessages.ReplaceWithLatestAction_multipleVersions; } // same tag names and types } else if (sameTagType && multipleSameNames) { if (tagType == CVSTag.BRANCH) { actionText = NLS.bind( CVSUIMessages.ReplaceWithLatestAction_singleBranch, new String[] {tagName}); // } else if (tagType == CVSTag.VERSION) { actionText = NLS.bind( CVSUIMessages.ReplaceWithLatestAction_singleVersion, new String[] {tagName}); } else if (tagType == CVSTag.HEAD) { actionText = NLS.bind(CVSUIMessages.ReplaceWithLatestAction_singleHEAD, new String[] {tagName}); } } } return actionText; } catch (CVSException e) { // silently ignore return CVSUIMessages.ReplaceWithLatestAction_multipleTags; // } }