use of org.knime.core.node.util.StringHistory in project knime-core by knime.
the class ListFilesSettings method saveSettingsTo.
/**
* Save settings in model & dialog.
*
* @param settings To save to.
*/
protected void saveSettingsTo(final NodeSettingsWO settings) {
settings.addString(EXTENSIONS_SETTINGS, m_extensionsString);
settings.addString(LOCATION_SETTINGS, m_locationString);
settings.addBoolean(RECURSIVE_SETTINGS, m_recursive);
settings.addString(FILTER_SETTINGS, m_filter.name());
settings.addBoolean(CASE_SENSITIVE_STRING, m_caseSensitive);
if (m_locationString != null) {
StringHistory h = StringHistory.getInstance(LIST_FILES_HISTORY_ID);
h.add(m_locationString);
}
if (m_extensionsString != null) {
StringHistory h = StringHistory.getInstance(LIST_FILES_EXT_HISTORY_ID);
h.add(m_extensionsString);
}
}
use of org.knime.core.node.util.StringHistory in project knime-core by knime.
the class SQLTypeCellEditor method saveSettings.
/**
* Save all SQL data types to StringHistory
*/
void saveSettings() {
String historyId = createHistoryId(m_dbIdentifier);
StringHistory sh = StringHistory.getInstance(historyId, STRING_HISTORY_MAX_ENTRY);
for (Entry<String, SQLTypeComboBoxModel> entry : m_models.entrySet()) {
String history = entry.getKey() + STRING_HISTORY_DELIMITER;
final SQLTypeComboBoxModel model = entry.getValue();
for (int i = 0; i < model.getSize(); i++) {
sh.add(history + model.getElementAt(i));
}
}
}
use of org.knime.core.node.util.StringHistory in project knime-core by knime.
the class ListFilesSettings method saveSettingsTo.
/**
* Save settings in model & dialog.
*
* @param settings To save to.
*/
protected void saveSettingsTo(final NodeSettingsWO settings) {
settings.addString(EXTENSIONS_SETTINGS, m_extensionsString);
settings.addString(LOCATION_SETTINGS, m_locationString);
settings.addBoolean(RECURSIVE_SETTINGS, m_recursive);
settings.addString(FILTER_SETTINGS, m_filter.name());
settings.addBoolean(CASE_SENSITIVE_STRING, m_caseSensitive);
if (m_locationString != null) {
StringHistory h = StringHistory.getInstance(LIST_FILES_HISTORY_ID);
h.add(m_locationString);
}
if (m_extensionsString != null) {
StringHistory h = StringHistory.getInstance(LIST_FILES_EXT_HISTORY_ID);
h.add(m_extensionsString);
}
}
use of org.knime.core.node.util.StringHistory in project knime-core by knime.
the class JavaScriptingJarListPanel method onJarAdd.
private void onJarAdd() {
DefaultListModel model = (DefaultListModel) m_addJarList.getModel();
Set<Object> hash = new HashSet<Object>();
for (Enumeration<?> e = model.elements(); e.hasMoreElements(); ) {
hash.add(e.nextElement());
}
StringHistory history = StringHistory.getInstance("java_snippet_jar_dirs");
if (m_jarFileChooser == null) {
File dir = null;
for (String h : history.getHistory()) {
File temp = new File(h);
if (temp.isDirectory()) {
dir = temp;
break;
}
}
m_jarFileChooser = new JFileChooser(dir);
m_jarFileChooser.setFileFilter(new SimpleFileFilter(".zip", ".jar"));
m_jarFileChooser.setMultiSelectionEnabled(true);
}
int result = m_jarFileChooser.showDialog(m_addJarList, "Select");
if (result == JFileChooser.APPROVE_OPTION) {
for (File f : m_jarFileChooser.getSelectedFiles()) {
String s = f.getAbsolutePath();
if (hash.add(s)) {
model.addElement(s);
}
}
history.add(m_jarFileChooser.getCurrentDirectory().getAbsolutePath());
}
}
use of org.knime.core.node.util.StringHistory in project knime-core by knime.
the class JarListPanel method onJarFileAdd.
private void onJarFileAdd() {
final Set<String> hash = new HashSet<>(Collections.list(m_listModel.elements()));
final StringHistory history = StringHistory.getInstance("java_snippet_jar_dirs");
if (m_jarFileChooser == null) {
File dir = null;
for (final String h : history.getHistory()) {
final File temp = new File(h);
if (temp.isDirectory()) {
dir = temp;
break;
}
}
m_jarFileChooser = new JFileChooser(dir);
m_jarFileChooser.setFileFilter(new SimpleFileFilter(".zip", ".jar"));
m_jarFileChooser.setMultiSelectionEnabled(true);
}
final int result = m_jarFileChooser.showDialog(m_addJarList, "Select");
if (result == JFileChooser.APPROVE_OPTION) {
for (final File f : m_jarFileChooser.getSelectedFiles()) {
final String s = f.getAbsolutePath();
if (hash.add(s)) {
m_listModel.addElement(s);
}
}
history.add(m_jarFileChooser.getCurrentDirectory().getAbsolutePath());
}
}
Aggregations