Search in sources :

Example 21 with MessageBox

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

the class WebCrawlImportDialog method messageBox.

public boolean messageBox(String message, int style) {
    if (style == SWT.ICON_ERROR) {
        message += "Do you want to try again?";
        style = style | SWT.YES | SWT.NO;
    }
    messageBox = new MessageBox(dialog, style);
    messageBox.setMessage(message);
    if (messageBox.open() == SWT.NO) {
        userResponse = CANCEL;
        dialog.close();
        return false;
    }
    return true;
}
Also used : MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 22 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 23 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 24 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 25 with MessageBox

use of org.eclipse.swt.widgets.MessageBox in project cubrid-manager by CUBRID.

the class QueryPlanCompositeWithHistory method deleteHistory.

/**
	 * delete history
	 * only delete from tableItem in planHistoryTable and Preference
	 * don't delete it from planHistoryList 
	 * because planHistoryList keep the uid and index relationship
	 */
private void deleteHistory() {
    MessageBox messageBox = new MessageBox(getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
    messageBox.setText(Messages.tooltip_qedit_explain_history_delete);
    messageBox.setMessage(Messages.explain_history_delete_message);
    // remove data, both view and model
    int buttonID = messageBox.open();
    if (buttonID == SWT.YES) {
        List<Integer> deleteIndex = new ArrayList<Integer>();
        for (int i = 0; i < planHistoryTable.getSelectionIndices().length; i++) {
            deleteIndex.add(planHistoryTable.getSelectionIndices()[i]);
        }
        List<StructQueryPlan> deleteList = new ArrayList<StructQueryPlan>();
        for (int i = 0; i < deleteIndex.size(); i++) {
            int seletectIndex = deleteIndex.get(i);
            int newIndex = seletectIndex - i;
            TableItem tableItem = planHistoryTable.getItem(newIndex);
            if (tableItem == null) {
                return;
            }
            int uid = Integer.valueOf(tableItem.getText(0));
            PlanTabItem tabItem = findPlanTab(uid);
            if (tabItem != null) {
                if (!tabItem.isDisposed()) {
                    tabItem.dispose();
                }
            }
            if (!tableItem.isDisposed()) {
                tableItem.dispose();
            }
            StructQueryPlan sq = planHistoryList.get(uid - 1);
            deleteList.add(sq);
        }
        PlanHistoryManager.deleteStructQuerysFromPreference(editor.getSelectedDatabase(), deleteList);
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) StructQueryPlan(com.cubrid.common.core.queryplan.StructQueryPlan) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

MessageBox (org.eclipse.swt.widgets.MessageBox)37 ArrayList (java.util.ArrayList)8 Shell (org.eclipse.swt.widgets.Shell)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 IOException (java.io.IOException)4 List (java.util.List)4 IElementParameter (org.talend.core.model.process.IElementParameter)4 Node (org.talend.designer.core.ui.editor.nodes.Node)4 File (java.io.File)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Label (org.eclipse.swt.widgets.Label)3 Text (org.eclipse.swt.widgets.Text)3 IConnection (org.talend.core.model.process.IConnection)3 Message (ca.uhn.hl7v2.model.Message)2 IllegalOperationException (cl.utfsm.acs.acg.core.IllegalOperationException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2