use of org.knime.workbench.editor2.actions.CheckUpdateMetaNodeLinkAllAction in project knime-core by knime.
the class LoadWorkflowRunnable method postLoadCheckForMetaNodeUpdates.
static void postLoadCheckForMetaNodeUpdates(final WorkflowEditor editor, final WorkflowManager parent, final List<NodeID> links) {
StringBuilder m = new StringBuilder("The workflow contains ");
if (links.size() == 1) {
m.append("one metanode link (\"");
m.append(parent.findNodeContainer(links.get(0)).getNameWithID());
m.append("\").");
} else {
m.append(links.size()).append(" metanode links.");
}
m.append("\n\n").append("Do you want to check for updates now?");
final String message = m.toString();
final AtomicBoolean result = new AtomicBoolean(false);
final IPreferenceStore corePrefStore = KNIMEUIPlugin.getDefault().getPreferenceStore();
final String pKey = PreferenceConstants.P_META_NODE_LINK_UPDATE_ON_LOAD;
String pref = corePrefStore.getString(pKey);
boolean showInfoMsg = true;
if (MessageDialogWithToggle.ALWAYS.equals(pref)) {
result.set(true);
showInfoMsg = false;
} else if (MessageDialogWithToggle.NEVER.equals(pref)) {
result.set(false);
} else {
final Display display = Display.getDefault();
display.syncExec(new Runnable() {
@Override
public void run() {
Shell activeShell = display.getActiveShell();
MessageDialogWithToggle dlg = MessageDialogWithToggle.openYesNoCancelQuestion(activeShell, "Metanode Link Update", message, "Remember my decision", false, corePrefStore, pKey);
switch(dlg.getReturnCode()) {
case IDialogConstants.YES_ID:
result.set(true);
break;
default:
result.set(false);
}
}
});
}
if (result.get()) {
new CheckUpdateMetaNodeLinkAllAction(editor, showInfoMsg).run();
}
}
Aggregations