Search in sources :

Example 1 with BasicCompletion

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));
    }
}
Also used : BasicCompletion(org.fife.ui.autocomplete.BasicCompletion)

Example 2 with BasicCompletion

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();
}
Also used : BasicCompletion(org.fife.ui.autocomplete.BasicCompletion)

Example 3 with BasicCompletion

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);
    }
}
Also used : Completion(org.fife.ui.autocomplete.Completion) BasicCompletion(org.fife.ui.autocomplete.BasicCompletion) AutoCompletion(org.fife.ui.autocomplete.AutoCompletion) BasicCompletion(org.fife.ui.autocomplete.BasicCompletion) Manipulator(org.knime.base.node.preproc.stringmanipulation.manipulator.Manipulator)

Example 4 with BasicCompletion

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);
}
Also used : Completion(org.fife.ui.autocomplete.Completion) BasicCompletion(org.fife.ui.autocomplete.BasicCompletion) BasicCompletion(org.fife.ui.autocomplete.BasicCompletion) FlowVariable(org.knime.core.node.workflow.FlowVariable)

Example 5 with BasicCompletion

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);
}
Also used : Completion(org.fife.ui.autocomplete.Completion) BasicCompletion(org.fife.ui.autocomplete.BasicCompletion) DataColumnSpec(org.knime.core.data.DataColumnSpec) BasicCompletion(org.fife.ui.autocomplete.BasicCompletion)

Aggregations

BasicCompletion (org.fife.ui.autocomplete.BasicCompletion)6 Completion (org.fife.ui.autocomplete.Completion)3 Manipulator (org.knime.base.node.preproc.stringmanipulation.manipulator.Manipulator)2 AutoCompletion (org.fife.ui.autocomplete.AutoCompletion)1 JavaScriptingCompletionProvider (org.knime.base.node.util.JavaScriptingCompletionProvider)1 DataColumnSpec (org.knime.core.data.DataColumnSpec)1 FlowVariable (org.knime.core.node.workflow.FlowVariable)1