use of org.knime.base.node.rules.engine.manipulator.PrefixUnaryManipulator in project knime-core by knime.
the class RuleMainPanel method onSelectionInManipulatorList.
/**
* {@inheritDoc}
*/
@Override
protected void onSelectionInManipulatorList(final Object selected) {
if (selected instanceof InfixManipulator) {
InfixManipulator infix = (InfixManipulator) selected;
String textToInsert = infix.getName() + " ";
try {
if (m_textEditor.getCaretPosition() == 0 || m_textEditor.getText().isEmpty() || m_textEditor.getText(m_textEditor.getCaretPosition(), 1).charAt(0) != ' ') {
textToInsert = " " + textToInsert;
}
} catch (BadLocationException e) {
LOGGER.coding("Not fatal error, but should not happen, requires no action.", e);
}
m_textEditor.insert(textToInsert, m_textEditor.getCaretPosition());
m_textEditor.requestFocus();
} else if (selected instanceof PrefixUnaryManipulator || selected instanceof ConstantManipulator) {
Manipulator prefix = (Manipulator) selected;
m_textEditor.replaceSelection(prefix.getName() + " ");
m_textEditor.requestFocus();
} else {
super.onSelectionInManipulatorList(selected);
}
}
Aggregations