@Override public String toString() { String pattern = I18N.instance().getAnnotationDescription(roleDescription); FindBugsMessageFormat format = new FindBugsMessageFormat(pattern); return format.format(new BugAnnotation[] { this }, null); }
/** * Get a string describing the bug priority and type. e.g. * "High Priority Correctness" * * @return a string describing the bug priority and type */ public String getPriorityTypeString() { String priorityString = getPriorityString(); BugPattern bugPattern = this.getBugPattern(); // then get the category and put everything together String categoryString = I18N.instance().getBugCategoryDescription(bugPattern.getCategory()); return priorityString + " Confidence " + categoryString; // TODO: internationalize the word "Confidence" }
/** * Add BugCode elements. * * @param bugCodeSet * all bug codes (abbrevs) referenced in the BugCollection */ private void addBugCodes(Set<String> bugCodeSet) { Element root = document.getRootElement(); for (String bugCode : bugCodeSet) { Element element = root.addElement("BugCode"); element.addAttribute("abbrev", bugCode); Element description = element.addElement("Description"); description.setText(I18N.instance().getBugTypeDescription(bugCode)); } }
/** * Convert to String. This method returns the "short" message describing the * bug, as opposed to the longer format returned by getMessage(). The short * format is appropriate for the tree view in a GUI, where the annotations * are listed separately as part of the overall bug instance. */ @Override public String toString() { return I18N.instance().getShortMessage(type); }
private void addDesignationKey(String argument) { I18N i18n = I18N.instance(); for (String x : argument.split("[,|]")) { for (String designationKey : i18n.getUserDesignationKeys()) { if (designationKey.equals(x) || i18n.getUserDesignation(designationKey).equals(x)) { this.designationKey.add(designationKey); break; } } } }
@Override public String[] getAllSorted() {// FIXME I think we always want user to // see all possible designations, not // just the ones he has set in his // project, Agreement? -Dan List<String> sortedDesignations = I18N.instance().getUserDesignationKeys(true); return sortedDesignations.toArray(new String[sortedDesignations.size()]); } },
/** * value is the key of the designations. * * @param value * @return */ @Override public String formatValue(String value) { return I18N.instance().getUserDesignation(value); }
@Override public String formatValue(String value) { return I18N.instance().getShortMessageWithoutCode(value); } },
public void setUserDesignationKeyIndex(int index, @CheckForNull BugCollection bugCollection) { setUserDesignationKey(I18N.instance().getUserDesignationKey(index), bugCollection); }
public String getUserDesignationKey(int index) { List<String> keys = getUserDesignationKeys(true); return keys.get(index); }
int keyEvents[] = { KeyEvent.VK_1, KeyEvent.VK_2, KeyEvent.VK_3, KeyEvent.VK_4, KeyEvent.VK_5, KeyEvent.VK_6, KeyEvent.VK_7, KeyEvent.VK_8, KeyEvent.VK_9 }; for (String key : I18N.instance().getUserDesignationKeys(true)) { String name = I18N.instance().getUserDesignation(key); mainFrame.addDesignationItem(changeDesignationMenu, key, name, keyEvents[i++]);
public int getUserDesignationKeyIndex() { return I18N.instance().getUserDesignationKeys(true).indexOf(getUserDesignationKey()); }
@Override public String formatValue(String value) { return I18N.instance().getUserDesignation(value); }
/** * Convert to String. This method returns the "short" message describing the * bug, as opposed to the longer format returned by getMessage(). The short * format is appropriate for the tree view in a GUI, where the annotations * are listed separately as part of the overall bug instance. */ @Override public String toString() { return I18N.instance().getShortMessage(type); }
/** * Get a List containing all known user designation keys keys. E.g., * "MOSTLY_HARMLESS", "MUST_FIX", "NOT_A_BUG", etc. * * If <code>sort == true</code> then it will attempt to sort the List as * appropriate to show the user. * * @return List of user designation keys */ public List<String> getUserDesignationKeys(boolean sort) { List<String> result = getUserDesignationKeys(); if (sort) { Collections.sort(result, designationKeyComparator); } return result; }
@Override public String toString() { String pattern = I18N.instance().getAnnotationDescription(description); FindBugsMessageFormat format = new FindBugsMessageFormat(pattern); return format.format(new BugAnnotation[] { this }, null); }
private void writeBugCategories(XMLOutput xmlOutput) throws IOException { // Find bug categories reported Set<String> bugCatSet = new HashSet<>(); for (Iterator<BugInstance> i = iterator(); i.hasNext();) { BugInstance bugInstance = i.next(); BugPattern bugPattern = bugInstance.getBugPattern(); bugCatSet.add(bugPattern.getCategory()); } // Emit element describing each reported bug code for (String bugCat : bugCatSet) { String bugCatDescription = I18N.instance().getBugCategoryDescription(bugCat); if (bugCatDescription == null) { continue; } XMLAttributeList attributeList = new XMLAttributeList(); attributeList.addAttribute("category", bugCat); xmlOutput.openTag("BugCategory", attributeList); xmlOutput.openTag("Description"); xmlOutput.writeText(bugCatDescription); xmlOutput.closeTag("Description"); xmlOutput.closeTag("BugCategory"); } }
int keyEvents[] = { KeyEvent.VK_1, KeyEvent.VK_2, KeyEvent.VK_3, KeyEvent.VK_4, KeyEvent.VK_5, KeyEvent.VK_6, KeyEvent.VK_7, KeyEvent.VK_8, KeyEvent.VK_9 }; for (String key : I18N.instance().getUserDesignationKeys(true)) { String name = I18N.instance().getUserDesignation(key); mainFrame.addDesignationItem(changeDesignationMenu, key, name, keyEvents[i++]);
@Override public String formatValue(String value) { return I18N.instance().getBugTypeDescription(value); }
choice = UserDesignation.UNCLASSIFIED.name(); } else { choice = I18N.instance().getUserDesignationKeys(true).get(index);