@Override public int compareTo(Completion c2) { if (c2==this) { return 0; } return super.compareTo(c2); }
/** * Overridden to return the name of the variable being completed. * * @return A string representation of this completion. */ @Override public String toString() { return getName(); }
private VariableCompletion createVariableCompletion() { VariableCompletion vc = new VariableCompletion(provider, name, returnType); if (desc.length()>0) { vc.setShortDescription(desc.toString()); desc.setLength(0); } vc.setDefinedIn(definedIn); return vc; }
/** * {@inheritDoc} */ @Override public String getSummary() { StringBuilder sb = new StringBuilder(); addDefinitionString(sb); possiblyAddDescription(sb); possiblyAddDefinedIn(sb); return sb.toString(); }
/** * Prepares this renderer to display a variable completion. * * @param list The list of choices being rendered. * @param vc The completion to render. * @param index The index into <code>list</code> being rendered. * @param selected Whether the item is selected. * @param hasFocus Whether the item has focus. */ protected void prepareForVariableCompletion(JList list, VariableCompletion vc, int index, boolean selected, boolean hasFocus) { StringBuilder sb = new StringBuilder(PREFIX); sb.append(vc.getName()); if (getShowTypes() && vc.getType()!=null) { sb.append(" : "); if (!selected) { sb.append("<font color='").append(typeColor).append("'>"); } sb.append(vc.getType()); if (!selected) { sb.append("</font>"); } } setText(sb.toString()); }
/** * Returns the tool tip text to display for mouse hovers over this * completion.<p> * * Note that for this functionality to be enabled, a * <tt>JTextComponent</tt> must be registered with the * <tt>ToolTipManager</tt>, and the text component must know to search * for this value. In the case of an * <a href="http://fifesoft.com/rsyntaxtextarea">RSyntaxTextArea</a>, this * can be done with a <tt>org.fife.ui.rtextarea.ToolTipSupplier</tt> that * calls into * {@link CompletionProvider#getCompletionsAt(JTextComponent, java.awt.Point)}. * * @return The tool tip text for this completion, or <code>null</code> if * none. */ @Override public String getToolTipText() { return getDefinitionString(); }
/** * Returns the name of this variable. * * @return The name. */ public String getName() { return getReplacementText(); }
/** * Adds the description text as HTML to a buffer, if a description is * defined. * * @param sb The buffer to append to. * @return Whether there was a description to add. */ protected boolean possiblyAddDescription(StringBuilder sb) { if (getShortDescription()!=null) { sb.append("<hr><br>"); sb.append(getShortDescription()); sb.append("<br><br><br>"); return true; } return false; }
return super.getSummary();
protected void addDefinitionString(StringBuilder sb) { sb.append("<html><b>").append(getDefinitionString()).append("</b>"); }
/** * {@inheritDoc} */ @Override public int compareTo(Completion o) { if (o==this) { return 0; } else if (o instanceof JSBeanCompletion) { JSBeanCompletion c2 = (JSBeanCompletion)o; return getLookupName().compareTo(c2.getLookupName()); } return super.compareTo(o); }
public String getDefinitionString() { StringBuilder sb = new StringBuilder(); // Add the return type if applicable (C macros like NULL have no type). if (type!=null) { sb.append(type).append(' '); } // Add the item being described's name. sb.append(getName()); return sb.toString(); }
/** * {@inheritDoc} */ @Override public int compareTo(Completion o) { if (o==this) { return 0; } else if (o instanceof JSFieldCompletion) { JSFieldCompletion c2 = (JSFieldCompletion)o; return getLookupName().compareTo(c2.getLookupName()); } return super.compareTo(o); }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof VariableCompletion) { VariableCompletion comp = (VariableCompletion) obj; return getName().equals(comp.getName()); } return super.equals(obj); }
/** * Overridden to compare methods by their comparison strings. * * @param c2 A <code>Completion</code> to compare to. * @return The sort order. */ @Override public int compareTo(Completion c2) { int rc = -1; if (c2==this) { rc = 0; } else if (c2 instanceof FunctionCompletion) { rc = getCompareString().compareTo( ((FunctionCompletion)c2).getCompareString()); } else { rc = super.compareTo(c2); } return rc; }