use of org.eclipse.swt.widgets.MessageBox in project eclipse.platform.swt by eclipse.
the class Bug483791_setBackgroundGC method main.
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
final Label l = new Label(shell, SWT.None);
l.setText("ASDQWE");
l.addPaintListener(arg0 -> arg0.gc.drawLine(0, 0, arg0.width, arg0.height));
final Button b = new Button(shell, SWT.PUSH);
b.setText("CLICK");
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
l.setBackground(display.getSystemColor(SWT.COLOR_CYAN));
// these don't help
/*
l.redraw();
l.update();
*/
MessageBox mb = new MessageBox(shell);
mb.setMessage("Background should not override GC drawing, but it does");
mb.open();
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
use of org.eclipse.swt.widgets.MessageBox in project eclipse.platform.swt by eclipse.
the class TextEditor method showError.
void showError(String title, String message) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.CLOSE);
messageBox.setText(title);
messageBox.setMessage(message);
messageBox.open();
}
use of org.eclipse.swt.widgets.MessageBox in project linuxtools by eclipse.
the class TapsetParser method askIfEditCredentials.
private void askIfEditCredentials() {
if (displayingCredentialDialog.compareAndSet(false, true)) {
PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageBox dialog = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
dialog.setText(Messages.TapsetParser_RemoteCredentialErrorTitle);
dialog.setMessage(Messages.TapsetParser_RemoteCredentialErrorMessage);
if (dialog.open() == SWT.YES) {
// $NON-NLS-1$
String pageID = "org.eclipse.linuxtools.systemtap.prefs.consoleLog";
PreferencesUtil.createPreferenceDialogOn(shell, pageID, new String[] { pageID }, null).open();
}
displayingCredentialDialog.set(false);
});
}
}
use of org.eclipse.swt.widgets.MessageBox in project knime-core by knime.
the class WorkflowEditor method showInfoMessage.
/**
* Shows a simple information message.
*
* @param message the info message to display
*/
private void showInfoMessage(final String header, final String message) {
// inform the user
MessageBox mb = new MessageBox(this.getSite().getShell(), SWT.ICON_INFORMATION | SWT.OK);
mb.setText(header);
mb.setMessage(message);
mb.open();
}
use of org.eclipse.swt.widgets.MessageBox in project knime-core by knime.
the class ConvertMetaNodeToSubNodeAction method runOnNodes.
/**
* Expand metanode!
*
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
if (nodeParts.length < 1) {
return;
}
try {
WorkflowManager manager = getManager();
WorkflowManager metaNode = Wrapper.unwrapWFM(nodeParts[0].getNodeContainer());
if (!metaNode.unlock(new GUIWorkflowCipherPrompt())) {
return;
}
// before we do anything, let's see if the convert will reset the metanode
if (manager.canResetNode(metaNode.getID())) {
// yes: ask if we can reset, otherwise bail
MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell(), SWT.OK | SWT.CANCEL);
mb.setMessage("Executed Nodes inside Metanode will be reset - are you sure?");
mb.setText("Reset Executed Nodes");
int dialogreturn = mb.open();
if (dialogreturn == SWT.CANCEL) {
return;
}
// perform reset
if (manager.canResetNode(metaNode.getID())) {
manager.resetAndConfigureNode(metaNode.getID());
}
}
ConvertMetaNodeToSubNodeCommand cmnc = new ConvertMetaNodeToSubNodeCommand(manager, metaNode.getID());
execute(cmnc);
} catch (IllegalArgumentException e) {
MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ERROR);
mb.setMessage("Sorry, converting Metanode failed: " + e.getMessage());
mb.setText("Convert failed");
mb.open();
}
try {
// Give focus to the editor again. Otherwise the actions (selection)
// is not updated correctly.
getWorkbenchPart().getSite().getPage().activate(getWorkbenchPart());
} catch (Exception e) {
// ignore
}
}
Aggregations