use of org.fife.ui.autocomplete.BasicCompletion in project drmips by brunonova.
the class CodeEditor method addDirectives.
/**
* Adds the directives to the auto-complete options.
*/
private void addDirectives() {
String desc = Lang.t("directive"), summ;
summ = "<b><u><tt>.text </tt> (" + Lang.t("directive") + ")</u></b><br /><br /><dl>";
summ += "<dt><b>" + Lang.t("usage") + ":</b></dt><dd><pre>.text</pre></dd>";
summ += "<dt><br /><b>" + Lang.t("description") + ":</b></dt><dd>" + Lang.t("text_directive_description") + "</dd></dl>";
completeProvider.addCompletion(new BasicCompletion(completeProvider, ".text", desc, summ));
if (cpu.hasDataMemory()) {
summ = "<b><u><tt>.data </tt> (" + Lang.t("directive") + ")</u></b><br /><br /><dl>";
summ += "<dt><b>" + Lang.t("usage") + ":</b></dt><dd><pre>.data</pre></dd>";
summ += "<dt><br /><b>" + Lang.t("description") + ":</b></dt><dd>" + Lang.t("data_directive_description") + "</dd></dl>";
completeProvider.addCompletion(new BasicCompletion(completeProvider, ".data", desc, summ));
summ = "<b><u><tt>.word </tt> (" + Lang.t("directive") + ")</u></b><br /><br /><dl>";
summ += "<dt><b>" + Lang.t("usage") + ":</b></dt><dd><pre>.word 20, -13, 56, ...</pre></dd>";
summ += "<dt><br /><b>" + Lang.t("description") + ":</b></dt><dd>" + Lang.t("word_directive_description") + "</dd></dl>";
completeProvider.addCompletion(new BasicCompletion(completeProvider, ".word", desc, summ));
summ = "<b><u><tt>.space </tt> (" + Lang.t("directive") + ")</u></b><br /><br /><dl>";
summ += "<dt><b>" + Lang.t("usage") + ":</b></dt><dd><pre>.space 16</pre></dd>";
summ += "<dt><br /><b>" + Lang.t("description") + ":</b></dt><dd>" + Lang.t("space_directive_description") + "</dd></dl>";
completeProvider.addCompletion(new BasicCompletion(completeProvider, ".space", desc, summ));
}
}
use of org.fife.ui.autocomplete.BasicCompletion in project drmips by brunonova.
the class CodeEditor method setAutoComplete.
/**
* Sets the auto-complete options for the given CPU.
*/
private void setAutoComplete() {
completeProvider.clear();
String desc;
for (Instruction instruction : cpu.getInstructionSet().getInstructions()) {
// add instructions
completeProvider.addCompletion(new BasicCompletion(completeProvider, instruction.getMnemonic(), instruction.getUsage(), getInstructionSummary(instruction)));
}
for (PseudoInstruction pseudo : cpu.getInstructionSet().getPseudoInstructions()) {
// add pseudo-instructions
completeProvider.addCompletion(new BasicCompletion(completeProvider, pseudo.getMnemonic(), pseudo.getUsage(), getInstructionSummary(pseudo)));
}
addDirectives();
}
use of org.fife.ui.autocomplete.BasicCompletion in project knime-core by knime.
the class JSnippetPanel method initCompletionProvider.
private void initCompletionProvider() {
Collection<? extends Manipulator> manipulators = m_manipProvider.getManipulators(ManipulatorProvider.ALL_CATEGORY);
for (Manipulator m : manipulators) {
Completion completion = new BasicCompletion(m_completionProvider, m.getName(), m.getDisplayName(), m.getDescription());
m_completionProvider.addCompletion(completion);
}
}
use of org.fife.ui.autocomplete.BasicCompletion in project knime-core by knime.
the class KnimeCompletionProvider method setFlowVariables.
/**
* Set flow variables that should be shown in the code completion box.
*
* @param variables flow variables
*/
public void setFlowVariables(final Iterable<FlowVariable> variables) {
if (m_flowVariableCompletions.size() > 0) {
for (Completion c : m_flowVariableCompletions) {
removeCompletion(c);
}
}
m_flowVariableCompletions.clear();
for (FlowVariable var : variables) {
String typeChar;
switch(var.getType()) {
case DOUBLE:
typeChar = "D";
break;
case INTEGER:
typeChar = "I";
break;
case STRING:
typeChar = "S";
break;
default:
return;
}
m_flowVariableCompletions.add(new BasicCompletion(this, "$${" + typeChar + var.getName() + /*.replace("\\", "\\\\").replace("}", "\\}")*/
"}$$", var.getType().toString(), "The flow variable " + var.getName() + "."));
}
addCompletions(m_flowVariableCompletions);
}
use of org.fife.ui.autocomplete.BasicCompletion in project knime-core by knime.
the class KnimeCompletionProvider method setColumns.
/**
* Set columns that should be shown in the code completion box.
*
* @param columns the columns
*/
public void setColumns(final Iterable<DataColumnSpec> columns) {
if (m_columnCompletions.size() > 0) {
for (Completion c : m_columnCompletions) {
removeCompletion(c);
}
}
m_columnCompletions.clear();
for (DataColumnSpec column : columns) {
m_columnCompletions.add(new BasicCompletion(this, escapeColumnName(column.getName()), column.getType().toString(), "The column " + column.getName() + "."));
}
addCompletions(m_columnCompletions);
}
Aggregations