Search in sources :

Example 51 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project cogtool by cogtool.

the class DefaultInteraction method shouldReplaceFile.

protected int shouldReplaceFile(File file) {
    MessageBox replaceBox = new MessageBox(window, SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.PRIMARY_MODAL);
    replaceBox.setMessage(L10N.get("DEFINT.ReplaceFile", "File exists.  Replace file?\n") + file.getAbsolutePath());
    return replaceBox.open();
}
Also used : MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 52 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project cogtool by cogtool.

the class WindowUtil method presentMessageDialog.

/**
     * Both displays and provides nested interaction for a pop-up (modal)
     * window built using SWT's <code>MessageBox</code>.
     *
     * @param parent    the window the pop-up "adheres" to
     * @param title     the title for the pop-up window
     * @param message   the message to display to the user
     * @param buttons   which buttons to display in the pop-up
     * @param icon      the icon to display, indicating the message's nature
     * @param mode      whether the pop-up is modal relative to
     *                  the parent window, the application as a whole,
     *                  or the entire user's system/computer
     * @return          which button was pushed to dismiss the pop-up
     *                  (see the <code>SWT</code> class for code constants)
     * @author          mlh
     * @see createMessageDialog
     */
public static int presentMessageDialog(Shell parent, String title, String message, int buttons, int icon, int mode) {
    if (message.length() > MAX_BUFFER) {
        ScrollableDialog d = new ScrollableDialog(parent, title, buttons | icon | mode, message);
        Object response = d.open();
        return ((Integer) response).intValue();
    }
    MessageBox msgBox = createMessageDialog(parent, title, message, buttons, icon, mode);
    if (parent != null) {
    // TODO: it would be nice to center this on the parent window!
    //            Point parentLoc = parent.getLocation();
    //            Point parentSize = parent.getSize();
    //            Point size = msgBox.getSize();
    //            int x = parentLoc.x + parentSize.x / 2 - size.x / 2;
    //            int y = parentLoc.y + parentSize.y / 2 - size.y / 2;
    //            msgBox.setLocation(x, y);
    }
    // no need to dispose; not a Widget!
    return msgBox.open();
}
Also used : MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 53 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project translationstudio8 by heartsome.

the class MenuItemProviders method inspectLabelsMenuItemProvider.

public static IMenuItemProvider inspectLabelsMenuItemProvider() {
    return new IMenuItemProvider() {

        public void addMenuItem(NatTable natTable, Menu popupMenu) {
            MenuItem inspectLabelsMenuItem = new MenuItem(popupMenu, SWT.PUSH);
            inspectLabelsMenuItem.setText("Debug info");
            inspectLabelsMenuItem.setEnabled(true);
            inspectLabelsMenuItem.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    NatEventData natEventData = getNatEventData(e);
                    NatTable natTable = natEventData.getNatTable();
                    int columnPosition = natEventData.getColumnPosition();
                    int rowPosition = natEventData.getRowPosition();
                    String msg = "Display mode: " + natTable.getDisplayModeByPosition(columnPosition, rowPosition) + "\nConfig labels: " + natTable.getConfigLabelsByPosition(columnPosition, rowPosition) + "\nData value: " + natTable.getDataValueByPosition(columnPosition, rowPosition) + "\n\nColumn position: " + columnPosition + "\nColumn index: " + natTable.getColumnIndexByPosition(columnPosition) + "\n\nRow position: " + rowPosition + "\nRow index: " + natTable.getRowIndexByPosition(rowPosition);
                    MessageBox messageBox = new MessageBox(natTable.getShell(), SWT.ICON_INFORMATION | SWT.OK);
                    messageBox.setText("Debug Information");
                    messageBox.setMessage(msg);
                    messageBox.open();
                }
            });
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NatTable(net.sourceforge.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) NatEventData(net.sourceforge.nattable.ui.NatEventData) Menu(org.eclipse.swt.widgets.Menu) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 54 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project otertool by wuntee.

the class GuiWorkshop method messageError.

public static void messageError(Shell shell, String message) {
    MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR);
    messageBox.setText("Error");
    messageBox.setMessage(message);
    messageBox.open();
}
Also used : MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 55 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project otertool by wuntee.

the class GuiWorkshop method yesNoDialog.

public static int yesNoDialog(Shell shell, String title, String message) {
    MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO);
    messageBox.setText(title);
    messageBox.setMessage(message);
    return (messageBox.open());
}
Also used : 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