use of org.eclipse.swt.widgets.MessageBox in project knime-core by knime.
the class CreateMetaNodeCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
// Add node to workflow and get the container
try {
WorkflowManager wfm = getHostWFM();
m_copyContent = wfm.paste(m_persistor);
NodeID[] nodeIDs = m_copyContent.getNodeIDs();
if (nodeIDs.length > 0) {
NodeID first = nodeIDs[0];
m_container = wfm.getNodeContainer(first);
// create extra info and set it
NodeUIInformation info = NodeUIInformation.builder().setNodeLocation(m_location.x, m_location.y, -1, -1).setHasAbsoluteCoordinates(false).setSnapToGrid(m_snapToGrid).setIsDropLocation(true).build();
m_container.setUIInformation(info);
}
} catch (Throwable t) {
// if fails notify the user
String error = "Metanode cannot be created";
LOGGER.debug(error + ": " + t.getMessage(), t);
MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_WARNING | SWT.OK);
mb.setText(error);
mb.setMessage("The metanode could not be created " + "due to the following reason:\n" + t.getMessage());
mb.open();
return;
}
}
use of org.eclipse.swt.widgets.MessageBox in project knime-core by knime.
the class CreateNodeCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
WorkflowManager hostWFM = getHostWFM();
// Add node to workflow and get the container
try {
NodeID id = hostWFM.createAndAddNode(m_factory);
m_container = hostWFM.getNodeContainer(id);
NodeTimer.GLOBAL_TIMER.addNodeCreation(m_container);
} catch (Throwable t) {
// if fails notify the user
LOGGER.debug("Node cannot be created.", t);
MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_WARNING | SWT.OK);
mb.setText("Node cannot be created.");
mb.setMessage("The selected node could not be created " + "due to the following reason:\n" + t.getMessage());
mb.open();
return;
}
// create extra info and set it
NodeUIInformation info = NodeUIInformation.builder().setNodeLocation(m_location.x, m_location.y, -1, -1).setHasAbsoluteCoordinates(false).setSnapToGrid(m_snapToGrid).setIsDropLocation(true).build();
m_container.setUIInformation(info);
}
use of org.eclipse.swt.widgets.MessageBox in project knime-core by knime.
the class AbstractWrappedDialog method showErrorMessage.
/**
* Shows the latest error message of the dialog in a MessageBox.
*
* @param message The error string.
*/
protected void showErrorMessage(final String message) {
MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR);
mb.setText("Error");
mb.setMessage(message != null ? message : "(no message)");
mb.open();
}
use of org.eclipse.swt.widgets.MessageBox in project knime-core by knime.
the class MasterKeyPreferencePage method checkMasterKeys.
private String checkMasterKeys(final String masterKey, final String confirmMasterKey) {
setErrorMessage(null);
if (masterKey == null || masterKey.isEmpty()) {
MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText("Empty master key...");
mb.setMessage("Master Key must not be empty.");
setErrorMessage(mb.getMessage());
mb.open();
return null;
}
if (!masterKey.equals(confirmMasterKey)) {
MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
mb.setMessage("Make sure both master keys are the same.");
setErrorMessage(mb.getMessage());
mb.open();
return null;
}
try {
SecretKey secretKey = KnimeEncryption.createSecretKey(HeadlessPreferencesConstants.P_MASTER_KEY);
return KnimeEncryption.encrypt(secretKey, masterKey.toCharArray());
} catch (Exception e) {
MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText("Master Key Encryption...");
mb.setMessage("Master Key Encryption failed:\n" + e.getMessage());
setErrorMessage(mb.getMessage());
mb.open();
return null;
}
}
use of org.eclipse.swt.widgets.MessageBox in project knime-core by knime.
the class DeleteAction method showCantDeleteMessage.
private void showCantDeleteMessage() {
MessageBox mb = new MessageBox(m_shell, SWT.ICON_ERROR | SWT.OK);
mb.setText("Can't Lock for Deletion");
mb.setMessage("At least one of the workflows " + "can't be deleted.\n" + " It is probably in use by another user/instance.\n" + "Cancel deletion.");
mb.open();
}
Aggregations