Search in sources :

Example 1 with LanguageSupport

use of org.fife.rsta.ac.LanguageSupport in project knime-core by knime.

the class JavaSnippetNodeDialog method updateAutocompletion.

private void updateAutocompletion() {
    final LanguageSupportFactory lsf = LanguageSupportFactory.get();
    final LanguageSupport support = lsf.getSupportFor(org.fife.ui.rsyntaxtextarea.SyntaxConstants.SYNTAX_STYLE_JAVA);
    final JavaLanguageSupport jls = (JavaLanguageSupport) support;
    final JarManager jarManager = jls.getJarManager();
    try {
        if (m_autoCompletionJars == null || !Arrays.stream(m_autoCompletionJars).allMatch(file -> file.exists()) || !Arrays.equals(m_autoCompletionJars, m_snippet.getCompiletimeClassPath())) {
            m_autoCompletionJars = m_snippet.getCompiletimeClassPath();
            jarManager.clearClassFileSources();
            jarManager.addCurrentJreClassFileSource();
            for (final File jarFile : m_autoCompletionJars) {
                if (!jarFile.getName().endsWith(".jar")) {
                    continue;
                }
                jarManager.addClassFileSource(jarFile);
            }
        }
    } catch (IOException ioe) {
        LOGGER.error(ioe.getMessage(), ioe);
    }
}
Also used : JavaLanguageSupport(org.fife.rsta.ac.java.JavaLanguageSupport) LanguageSupport(org.fife.rsta.ac.LanguageSupport) Arrays(java.util.Arrays) NodeSettingsRO(org.knime.core.node.NodeSettingsRO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) JavaSnippetSettings(org.knime.base.node.jsnippet.util.JavaSnippetSettings) FieldsTableModel(org.knime.base.node.jsnippet.ui.FieldsTableModel) JavaSnippetDocument(org.knime.base.node.jsnippet.guarded.JavaSnippetDocument) Border(javax.swing.border.Border) NodeDialogPane(org.knime.core.node.NodeDialogPane) ErrorStrip(org.fife.ui.rsyntaxtextarea.ErrorStrip) JarListPanel(org.knime.base.node.jsnippet.ui.JarListPanel) ByteArrayInputStream(java.io.ByteArrayInputStream) JSnippetTextArea(org.knime.base.node.jsnippet.ui.JSnippetTextArea) Map(java.util.Map) ListDataEvent(javax.swing.event.ListDataEvent) TitledBorder(javax.swing.border.TitledBorder) BorderLayout(java.awt.BorderLayout) DefaultTemplateController(org.knime.base.node.jsnippet.template.DefaultTemplateController) TableModelEvent(javax.swing.event.TableModelEvent) Frame(java.awt.Frame) TemplateNodeDialog(org.knime.base.node.jsnippet.template.TemplateNodeDialog) BorderFactory(javax.swing.BorderFactory) FlowVariableList(org.knime.base.node.jsnippet.ui.FlowVariableList) UUID(java.util.UUID) BadLocationException(javax.swing.text.BadLocationException) TemplatesPanel(org.knime.base.node.jsnippet.template.TemplatesPanel) InFieldsTable(org.knime.base.node.jsnippet.ui.InFieldsTable) TemplateProvider(org.knime.base.node.jsnippet.template.TemplateProvider) Dimension(java.awt.Dimension) LanguageSupportFactory(org.fife.rsta.ac.LanguageSupportFactory) JPanel(javax.swing.JPanel) JavaLanguageSupport(org.fife.rsta.ac.java.JavaLanguageSupport) JavaSnippetTemplateProvider(org.knime.base.node.jsnippet.template.JavaSnippetTemplateProvider) LanguageSupport(org.fife.rsta.ac.LanguageSupport) JSplitPane(javax.swing.JSplitPane) ByteArrayOutputStream(java.io.ByteArrayOutputStream) TableColumnModel(javax.swing.table.TableColumnModel) JarManager(org.fife.rsta.ac.java.JarManager) DataTableSpec(org.knime.core.data.DataTableSpec) SyntaxConstants(org.fife.ui.rsyntaxtextarea.SyntaxConstants) FlowVariable(org.knime.core.node.workflow.FlowVariable) NodeSettings(org.knime.core.node.NodeSettings) TableModelListener(javax.swing.event.TableModelListener) JSnippetFieldsController(org.knime.base.node.jsnippet.ui.JSnippetFieldsController) GridLayout(java.awt.GridLayout) NotConfigurableException(org.knime.core.node.NotConfigurableException) SwingUtilities(javax.swing.SwingUtilities) OutFieldsTableModel(org.knime.base.node.jsnippet.ui.OutFieldsTableModel) NodeLogger(org.knime.core.node.NodeLogger) BundleListPanel(org.knime.base.node.jsnippet.ui.BundleListPanel) ViewUtils(org.knime.core.node.util.ViewUtils) AddTemplateDialog(org.knime.base.node.jsnippet.template.AddTemplateDialog) JComponent(javax.swing.JComponent) Column(org.knime.base.node.jsnippet.ui.FieldsTableModel.Column) JavaSnippetTemplate(org.knime.base.node.jsnippet.template.JavaSnippetTemplate) JButton(javax.swing.JButton) Fold(org.fife.ui.rsyntaxtextarea.folding.Fold) ColumnList(org.knime.base.node.jsnippet.ui.ColumnList) IOException(java.io.IOException) File(java.io.File) FoldManager(org.fife.ui.rsyntaxtextarea.folding.FoldManager) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) JScrollPane(javax.swing.JScrollPane) ListDataListener(javax.swing.event.ListDataListener) RTextScrollPane(org.fife.ui.rtextarea.RTextScrollPane) OutFieldsTable(org.knime.base.node.jsnippet.ui.OutFieldsTable) JLabel(javax.swing.JLabel) GuardedDocument(org.knime.base.node.jsnippet.guarded.GuardedDocument) Collections(java.util.Collections) JarManager(org.fife.rsta.ac.java.JarManager) LanguageSupportFactory(org.fife.rsta.ac.LanguageSupportFactory) JavaLanguageSupport(org.fife.rsta.ac.java.JavaLanguageSupport) IOException(java.io.IOException) File(java.io.File)

Aggregations

BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 Frame (java.awt.Frame)1 GridLayout (java.awt.GridLayout)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Map (java.util.Map)1 UUID (java.util.UUID)1 BorderFactory (javax.swing.BorderFactory)1 JButton (javax.swing.JButton)1 JComponent (javax.swing.JComponent)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JSplitPane (javax.swing.JSplitPane)1 SwingUtilities (javax.swing.SwingUtilities)1