Search in sources :

Example 81 with MessageBox

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();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Display(org.eclipse.swt.widgets.Display) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 82 with MessageBox

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();
}
Also used : MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 83 with MessageBox

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);
        });
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 84 with MessageBox

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();
}
Also used : MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 85 with MessageBox

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
    }
}
Also used : ConvertMetaNodeToSubNodeCommand(org.knime.workbench.editor2.commands.ConvertMetaNodeToSubNodeCommand) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) GUIWorkflowCipherPrompt(org.knime.workbench.editor2.editparts.GUIWorkflowCipherPrompt) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

MessageBox (org.eclipse.swt.widgets.MessageBox)99 Shell (org.eclipse.swt.widgets.Shell)17 ArrayList (java.util.ArrayList)13 File (java.io.File)11 IOException (java.io.IOException)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 GridData (org.eclipse.swt.layout.GridData)9 GridLayout (org.eclipse.swt.layout.GridLayout)9 WorkflowManager (org.knime.core.node.workflow.WorkflowManager)9 Point (org.eclipse.swt.graphics.Point)8 Button (org.eclipse.swt.widgets.Button)8 Display (org.eclipse.swt.widgets.Display)8 Composite (org.eclipse.swt.widgets.Composite)7 FileDialog (org.eclipse.swt.widgets.FileDialog)7 Label (org.eclipse.swt.widgets.Label)7 List (java.util.List)6 SWTError (org.eclipse.swt.SWTError)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)6 SelectionListener (org.eclipse.swt.events.SelectionListener)6 SWT (org.eclipse.swt.SWT)5