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();
}
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();
}
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();
}
});
}
};
}
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();
}
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());
}
Aggregations