Skip to content

Commit 08d60b2

Browse files
committed
scala: removed unused imports. Added registration of code changes
1 parent 219fe96 commit 08d60b2

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

RubyScript/src/org/knime/ext/jruby/RubyScriptNodeDialog.scala

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ package org.knime.ext.jruby
22

33
import java.awt.BorderLayout
44
import java.awt.Color
5-
import java.awt.event._
65

7-
import javax.swing.Box
86
import javax.swing.BoxLayout
97
import javax.swing.DefaultCellEditor
108
import javax.swing.JComboBox
11-
import javax.swing.table.TableColumn
12-
import javax.swing.table.TableCellEditor
139
import javax.swing.text.BadLocationException
10+
import javax.swing.event.DocumentListener
11+
import javax.swing.event.DocumentEvent
12+
import javax.swing.Icon
1413

1514
import org.knime.core.data.DataColumnSpec
1615
import org.knime.core.data.DataTableSpec
@@ -30,9 +29,6 @@ import scala.collection.convert.WrapAsScala.enumerationAsScalaIterator
3029

3130
import scala.swing._
3231
import scala.swing.event._
33-
import scala.swing.Table
34-
import scala.swing.Container
35-
import scala.swing.FileChooser
3632

3733
/**
3834
* <code>NodeDialog</code> for the "JRuby Script" Node.
@@ -71,6 +67,8 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
7167

7268
private val fileChooser = new FileChooser()
7369

70+
private var changed = false
71+
7472
createColumnSelectionTab()
7573

7674
createScriptTab()
@@ -168,6 +166,11 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
168166
setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_RUBY)
169167
setCodeFoldingEnabled(true)
170168
setAntiAliasingEnabled(true)
169+
getDocument().addDocumentListener(new DocumentListener() {
170+
def insertUpdate(e: DocumentEvent) { changed = true }
171+
def removeUpdate(e: DocumentEvent) { changed = true }
172+
def changedUpdate(e: DocumentEvent) { changed = true }
173+
});
171174
}
172175

173176
val spScript = new RTextScrollPane(scriptTextArea) {
@@ -358,6 +361,7 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
358361
table.addRow(dataTableColumnNames(i), dataTableColumnTypes(i))
359362
}
360363
updateColumnTable(specs)
364+
changed = false;
361365
}
362366

363367
/* (non-Javadoc)
@@ -380,6 +384,7 @@ class RubyScriptNodeDialog(private var factory: RubyScriptNodeFactory)
380384
settings.addStringArray(RubyScriptNodeModel.COLUMN_NAMES, columnNames: _*)
381385
val columnTypes = table.getDataTableColumnTypes
382386
settings.addStringArray(RubyScriptNodeModel.COLUMN_TYPES, columnTypes: _*)
387+
changed = false;
383388
}
384389

385390
/**

0 commit comments

Comments
 (0)