public static void openMessageDialog(Shell parent, String title, String message, int messageType) { SwtMessageDialog dialog = new SwtMessageDialog(parent, title, message, messageType, new String[] {"OK"}, 0); dialog.open(); }
protected void buttonPressed(int buttonId) { setReturnCode(buttonId); close(); }
public void showMessage(int level, String title, String text, Throwable throwable) { // TODO Add option to show throwable int messageType; switch (level) { case Message.ERROR: messageType = SwtMessageDialog.ERROR; break; case Message.WARN: messageType = SwtMessageDialog.WARNING; break; default: messageType = SwtMessageDialog.INFORMATION; } SwtMessageDialog.openMessageDialog(shell, title, text, messageType); }
public void widgetSelected(SelectionEvent event) { buttonPressed(((Integer) event.widget.getData()).intValue()); } });
public void handleEvent(Event e) { if (selectDeviceDialog.open() == SwtDialog.OK) { if (selectDeviceDialog.getSelectedDeviceEntry().equals(getDevice())) { return; } if (MIDletBridge.getCurrentMIDlet() != getLauncher()) { if (!SwtMessageDialog.openQuestion(shell, "Question?", "Changing device needs MIDlet to be restarted. All MIDlet data will be lost. Are you sure?")) { return; } } setDevice(selectDeviceDialog.getSelectedDeviceEntry()); if (MIDletBridge.getCurrentMIDlet() != getLauncher()) { try { startMidlet(MIDletBridge.getCurrentMIDlet().getClass(), MIDletBridge.getMIDletAccess()); } catch (Exception ex) { System.err.println(ex); } } else { startLauncher(MIDletBridge.getMIDletContext()); } } } };
public static boolean openQuestion(Shell parent, String title, String message) { SwtMessageDialog dialog = new SwtMessageDialog(parent, title, message, QUESTION, new String[] {"Yes", "No"}, 0); return dialog.open() == 0; }