Search in sources :

Example 1 with Completion

use of org.fife.ui.autocomplete.Completion 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 2 with Completion

use of org.fife.ui.autocomplete.Completion 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 3 with Completion

use of org.fife.ui.autocomplete.Completion 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 4 with Completion

use of org.fife.ui.autocomplete.Completion 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)

Example 5 with Completion

use of org.fife.ui.autocomplete.Completion 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)5 Completion (org.fife.ui.autocomplete.Completion)5 DataColumnSpec (org.knime.core.data.DataColumnSpec)2 FlowVariable (org.knime.core.node.workflow.FlowVariable)2 AutoCompletion (org.fife.ui.autocomplete.AutoCompletion)1 Manipulator (org.knime.base.node.preproc.stringmanipulation.manipulator.Manipulator)1