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