Fixes and updates

This commit is contained in:
Nico committed 2021-03-07 15:22:55 +01:00
1 parent d1710ea6a5
commit fb4da77359
211 files changed
+45363 -45571

No files matched your search

@@ -13,16 +13,16 @@ import javax.swing.text.JTextComponent;
* <p>
*
* This completion type uses its <tt>shortDescription</tt> property as part of
* its summary returned by {@link #getSummary()}; for this reason, it may be
* a little longer (even much longer), if desired, than what is recommended
* for <tt>BasicCompletion</tt>s (where the <tt>shortDescription</tt> is used
* in {@link #toString()} for <tt>ListCellRenderers</tt>).
* its summary returned by {@link #getSummary()}; for this reason, it may be a
* little longer (even much longer), if desired, than what is recommended for
* <tt>BasicCompletion</tt>s (where the <tt>shortDescription</tt> is used in
* {@link #toString()} for <tt>ListCellRenderers</tt>).
*
* @author Robert Futrell
* @version 1.0
*/
public class VariableCompletion extends BasicCompletion {
/**
* The variable's type.
*/
@@ -31,27 +31,24 @@ public class VariableCompletion extends BasicCompletion {
* What library (for example) this variable is defined in.
*/
private String definedIn;
/**
* Constructor.
*
* @param provider
* The parent provider.
* @param name
* The name of this variable.
* @param type
* The type of this variable (e.g. "<code>int</code>",
* "<code>String</code>", etc.).
* @param provider The parent provider.
* @param name The name of this variable.
* @param type The type of this variable (e.g. "<code>int</code>",
* "<code>String</code>", etc.).
*/
public VariableCompletion(CompletionProvider provider, String name, String type) {
super(provider, name);
this.type = type;
}
protected void addDefinitionString(StringBuilder sb) {
sb.append("<html><b>").append(getDefinitionString()).append("</b>");
}
public String getDefinitionString() {
StringBuilder sb = new StringBuilder();
// Add the return type if applicable (C macros like NULL have no type).
@@ -62,7 +59,7 @@ public class VariableCompletion extends BasicCompletion {
sb.append(getName());
return sb.toString();
}
/**
* Returns where this variable is defined.
*
@@ -72,7 +69,7 @@ public class VariableCompletion extends BasicCompletion {
public String getDefinedIn() {
return definedIn;
}
/**
* Returns the name of this variable.
*
@@ -81,7 +78,7 @@ public class VariableCompletion extends BasicCompletion {
public String getName() {
return getReplacementText();
}
/**
* {@inheritDoc}
*/
@@ -93,29 +90,25 @@ public class VariableCompletion extends BasicCompletion {
possiblyAddDefinedIn(sb);
return sb.toString();
}
/**
* Returns the tool tip text to display for mouse hovers over this
* completion.
* 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
* 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.
* @return The tool tip text for this completion, or <code>null</code> if none.
*/
@Override
public String getToolTipText() {
return getDefinitionString();
}
/**
* Returns the type of this variable.
*
@@ -124,13 +117,12 @@ public class VariableCompletion extends BasicCompletion {
public String getType() {
return type;
}
/**
* Adds some HTML describing where this variable is defined, if this
* information is known.
* Adds some HTML describing where this variable is defined, if this information
* is known.
*
* @param sb
* The buffer to append to.
* @param sb The buffer to append to.
*/
protected void possiblyAddDefinedIn(StringBuilder sb) {
if (definedIn != null) {
@@ -138,13 +130,11 @@ public class VariableCompletion extends BasicCompletion {
sb.append(" <em>").append(definedIn).append("</em>");
}
}
/**
* Adds the description text as HTML to a buffer, if a description is
* defined.
* Adds the description text as HTML to a buffer, if a description is defined.
*
* @param sb
* The buffer to append to.
* @param sb The buffer to append to.
* @return Whether there was a description to add.
*/
protected boolean possiblyAddDescription(StringBuilder sb) {
@@ -156,18 +146,17 @@ public class VariableCompletion extends BasicCompletion {
}
return false;
}
/**
* Sets where this variable is defined.
*
* @param definedIn
* Where this variable is defined.
* @param definedIn Where this variable is defined.
* @see #getDefinedIn()
*/
public void setDefinedIn(String definedIn) {
this.definedIn = definedIn;
}
/**
* Overridden to return the name of the variable being completed.
*