use of org.fife.ui.autocomplete.ParameterizedCompletion.Parameter in project omegaide by omegaui.
the class ParameterizedCompletionContext method possiblyUpdateParamCopies.
private void possiblyUpdateParamCopies(Document doc) {
int index = getCurrentParameterIndex();
// FunctionCompletions add an extra param at end of inserted text
if (index > -1 && index < pc.getParamCount()) {
// Typing in an "end parameter" => stop parameter assistance.
Parameter param = pc.getParam(index);
if (param.isEndParam()) {
deactivate();
return;
}
// Get the current value of the current parameter.
List<Highlight> paramHighlights = getParameterHighlights();
Highlight h = paramHighlights.get(index);
// param offsets are offset (!) by 1
int start = h.getStartOffset() + 1;
int len = h.getEndOffset() - start;
String replacement = null;
try {
replacement = doc.getText(start, len);
} catch (BadLocationException ble) {
// Never happens
ble.printStackTrace();
}
// value of this parameter.
for (ParamCopyInfo pci : paramCopyInfos) {
if (pci.paramName.equals(param.getName())) {
pci.h = replaceHighlightedText(doc, pci.h, replacement);
}
}
} else {
// Probably the "end parameter" for FunctionCompletions.
deactivate();
}
}
use of org.fife.ui.autocomplete.ParameterizedCompletion.Parameter in project omegaide by omegaui.
the class MarkupTagCompletion method addAttributes.
/**
* Adds HTML describing the attributes of this tag to a buffer.
*
* @param sb The buffer to append to.
*/
protected void addAttributes(StringBuilder sb) {
// TODO: Localize me.
int attrCount = getAttributeCount();
if (attrCount > 0) {
sb.append("<b>Attributes:</b><br>");
sb.append("<center><table width='90%'><tr><td>");
for (int i = 0; i < attrCount; i++) {
Parameter attr = getAttribute(i);
sb.append(" <b>");
sb.append(attr.getName() != null ? attr.getName() : attr.getType());
sb.append("</b> ");
String desc = attr.getDescription();
if (desc != null) {
sb.append(desc);
}
sb.append("<br>");
}
sb.append("</td></tr></table></center><br><br>");
}
}
use of org.fife.ui.autocomplete.ParameterizedCompletion.Parameter in project lara-framework by specs-feup.
the class EditorConfigurer method addPrintlnCompletion.
static void addPrintlnCompletion(DefaultCompletionProvider provider) {
FunctionCompletion printlnCompletion = new FunctionCompletion(provider, "println", "void");
List<Parameter> params = new ArrayList<>();
Parameter messageParam = new Parameter(null, "message", true);
messageParam.setDescription("The message to print");
params.add(messageParam);
printlnCompletion.setParams(params);
printlnCompletion.setShortDescription("Print a message");
printlnCompletion.setSummary("Print a message");
provider.addCompletion(printlnCompletion);
}
Aggregations