use of org.fife.ui.rtextarea.RTextScrollPane in project knime-core by knime.
the class RuleMainPanel method createEditorComponent.
/**
* {@inheritDoc}
*/
@Override
protected JComponent createEditorComponent() {
m_textEditor = new KnimeSyntaxTextArea(20, 60);
final RSyntaxTextArea textArea = m_textEditor;
// An AutoCompletion acts as a "middle-man" between a text component
// and a CompletionProvider. It manages any options associated with
// the auto-completion (the popup trigger key, whether to display a
// documentation window along with completion choices, etc.). Unlike
// CompletionProviders, instances of AutoCompletion cannot be shared
// among multiple text components.
AutoCompletion ac = new AutoCompletion(getCompletionProvider());
ac.setShowDescWindow(true);
ac.install(textArea);
setExpEdit(textArea);
textArea.setSyntaxEditingStyle(m_syntaxStyle);
textArea.getPopupMenu().add(new ToggleRuleAction("Toggle comment", textArea));
RTextScrollPane textScrollPane = new RTextScrollPane(textArea);
textScrollPane.setLineNumbersEnabled(true);
textScrollPane.setIconRowHeaderEnabled(true);
m_gutter = textScrollPane.getGutter();
addRowHeaderMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void mouseClicked(final MouseEvent e) {
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
try {
new ToggleRuleAction(textArea).actionPerformed(new ToggleRuleAction.LinePosition(textArea, (int) (new Date().getTime() & 0x7fffffff), "toggle comment", e.getModifiers(), textArea.getLineOfOffset(textArea.viewToModel(e.getPoint()))));
} catch (BadLocationException e1) {
LOGGER.debug(e1.getMessage(), e1);
}
}
}
});
return textScrollPane;
}
use of org.fife.ui.rtextarea.RTextScrollPane in project knime-core by knime.
the class JavaSnippetNodeDialog method createSnippetPanel.
/**
* Create the panel with the snippet.
*/
private JComponent createSnippetPanel() {
m_snippetTextArea = new JSnippetTextArea(m_snippet);
// reset style which causes a recreation of the folds
// this code is also executed in "onOpen" but that is not called for the template viewer tab
m_snippetTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
m_snippetTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
collapseAllFolds();
final JScrollPane snippetScroller = new RTextScrollPane(m_snippetTextArea);
final JPanel snippet = new JPanel(new BorderLayout());
snippet.add(snippetScroller, BorderLayout.CENTER);
final ErrorStrip es = new ErrorStrip(m_snippetTextArea);
snippet.add(es, BorderLayout.LINE_END);
return snippet;
}
use of org.fife.ui.rtextarea.RTextScrollPane in project knime-core by knime.
the class ParameterizedDBQueryPanel method createEditorPanel.
private JPanel createEditorPanel() {
final JPanel panel = new JPanel(new BorderLayout());
final JLabel editorLabel = new JLabel("SQL Statement");
editorLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
final RTextScrollPane editorScrollPane = new RTextScrollPane(m_editor);
editorScrollPane.setPreferredSize(new Dimension(850, 400));
editorScrollPane.setFoldIndicatorEnabled(true);
panel.add(editorLabel, BorderLayout.NORTH);
panel.add(editorScrollPane, BorderLayout.CENTER);
return panel;
}
use of org.fife.ui.rtextarea.RTextScrollPane in project cuba by cuba-platform.
the class DesktopSourceCodeEditor method createTextComponentImpl.
@Override
protected RSyntaxTextArea createTextComponentImpl() {
RSyntaxTextArea impl = new RSyntaxTextArea();
int height = (int) impl.getPreferredSize().getHeight();
impl.setMinimumSize(new Dimension(0, height));
RTextScrollPane scrollPane = new RTextScrollPane(impl);
scrollPane.setLineNumbersEnabled(showGutter);
composition = scrollPane;
composition.setPreferredSize(new Dimension(150, height));
composition.setMinimumSize(new Dimension(0, height));
doc.putProperty("filterNewlines", false);
return impl;
}
Aggregations