protected void openDialog( final String title, final String message, final int dialogType ) { final Dialog dialog = new SimpleMessageDialog( shell, title, message, dialogType ); dialog.open(); }
protected void confirmDialog( String title, String msg, String ok ) throws Exception { MessageDialog confirmDialog = new MessageDialog( getShell(), title, null, msg, MessageDialog.NONE, new String[] { ok }, 0 ) { @Override protected Point getInitialSize() { return new Point( DIALOG_WIDTH, DIALOG_HEIGHT ); } @Override protected void configureShell( Shell shell ) { super.configureShell( shell ); shell.setBackground( shell.getDisplay().getSystemColor( DIALOG_COLOR ) ); shell.setBackgroundMode( SWT.INHERIT_FORCE ); } }; confirmDialog.open(); }
public boolean open() { boolean retval = true; IRunnableWithProgress op = new IRunnableWithProgress() { public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException { try { rep.save( jobMeta, versionComment, new ProgressMonitorAdapter( monitor ) ); } catch ( KettleException e ) { throw new InvocationTargetException( e, "Error saving job" ); } } }; try { ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell ); pmd.run( true, true, op ); } catch ( InvocationTargetException e ) { new ErrorDialog( shell, "Error saving job", "An error occured saving the job!", e ); retval = false; } catch ( InterruptedException e ) { new ErrorDialog( shell, "Error saving job", "An error occured saving the job!", e ); retval = false; } return retval; } }
ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell ); pmd.run( true, true, op ); } catch ( InvocationTargetException e ) { MessageDialog errorDialog = new MessageDialog( shell, BaseMessages.getString( PKG, "TransSaveProgressDialog.UnableToSave.DialogTitle" ), null, BaseMessages.getString( PKG, "TransSaveProgressDialog.UnableToSave.DialogMessage" ), MessageDialog.ERROR, new String[] { BaseMessages.getString( PKG, "TransSaveProgressDialog.UnableToSave.Close" ) }, 0 ); errorDialog.open(); retval = false; } catch ( InterruptedException e ) {
@Override public void widgetSelected(SelectionEvent e) { InputDialog inputDialog = new InputDialog(shell.getParent().getShell(), RedisClient.i18nFile.getText(I18nFile.INPUTVALUES), RedisClient.i18nFile.getText(I18nFile.LISTINPUTFORMAT), "", null); if (inputDialog.open() == InputDialog.OK) { String values = inputDialog.getValue(); String[] setValues = values.split(";"); long size = service.addValues(id, db, key, setValues); if(size == 0) MessageDialog.openInformation(shell.getParent().getShell(), RedisClient.i18nFile.getText(I18nFile.INPUTVALUES), RedisClient.i18nFile.getText(I18nFile.ADDSETVALUES)); refresh(); } } });
public static void showDatabaseExistsDialog( Shell parent, DatabaseMeta databaseMeta ) { String title = BaseMessages.getString( PKG, "DatabaseDialog.DatabaseNameExists.Title" ); String message = BaseMessages.getString( PKG, "DatabaseDialog.DatabaseNameExists", databaseMeta.getName() ); String okButton = BaseMessages.getString( PKG, "System.Button.OK" ); MessageDialog dialog = new MessageDialog( parent, title, null, message, MessageDialog.ERROR, new String[] { okButton }, 0 ); dialog.open(); }
@Override public void widgetSelected(SelectionEvent e) { InputDialog dialog = new InputDialog(shell.getParent().getShell(), RedisClient.i18nFile.getText(I18nFile.INSERTHEAD), RedisClient.i18nFile.getText(I18nFile.INPUTVALUES), "", null); if(dialog.open() == InputDialog.OK){ String value = dialog.getValue(); service.addHead(id, db, key, value); refresh(); } } });
@Override public void mouseUp(MouseEvent e) { String name = text_2.getText(); if( name.length() == 0 ){ MessageDialog.openError(shell, RedisClient.i18nFile.getText(I18nFile.ERROR),RedisClient.i18nFile.getText(I18nFile.INPUTFAVORITE)); } else { result = name; shell.dispose(); } } });
static MessageDialog getFieldsChoiceDialog( Shell shell, int existingFields, int newFields ) { MessageDialog messageDialog = new MessageDialog( shell, BaseMessages.getString( PKG, "BaseStepDialog.GetFieldsChoice.Title" ), // "Warning!" null, BaseMessages.getString( PKG, "BaseStepDialog.GetFieldsChoice.Message", "" + existingFields, "" + newFields ), MessageDialog.WARNING, new String[] { BaseMessages.getString( PKG, "BaseStepDialog.AddNew" ), BaseMessages.getString( PKG, "BaseStepDialog.Add" ), BaseMessages.getString( PKG, "BaseStepDialog.ClearAndAdd" ), BaseMessages.getString( PKG, "BaseStepDialog.Cancel" ), }, 0 ); MessageDialog.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); return messageDialog; }
private void deleteOneKey() { boolean ok = MessageDialog.openConfirm(shell, i18nFile.getText(I18nFile.DELETEKEY), i18nFile.getText(I18nFile.CONFIRMDELETEKEY)); if (ok) deleteKey(itemsSelected[0]); }
public boolean transOverwritePrompt( TransMeta transMeta ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteTrans.Title" ), null, BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteTrans.Message", transMeta.getName() ), MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ), BaseMessages.getString( PKG, "System.Button.No" ) }, 1, BaseMessages.getString( PKG, "RepositoryImportDialog.DontAskAgain.Label" ), !askOverwrite ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); int answer = md.open(); askOverwrite = !md.getToggleState(); return ( answer & 0xFF ) == 0; }
@Override protected void buttonPressed( int buttonId ) { super.buttonPressed( buttonId ); if ( buttonId == detailsIndex ) { DetailsDialog detailsDialog = new DetailsDialog( getParentShell(), BaseMessages.getString( PKG, "ErrorDialog.ShowDetail.Title" ), null, BaseMessages.getString( PKG, "ErrorDialog.ShowDetail.Message" ), 0, new String[] { BaseMessages.getString( PKG, "ErrorDialog.ShowDetail.Close" ) }, 0, details ); detailsDialog.open(); } } }
/** * Overridden to give the button the desired width. */ @Override public void create() { super.create(); final Button button = getButton( 0 ); final int newX = button.getBounds().x + button.getBounds().width - buttonWidth; button.setBounds( newX, button.getBounds().y, buttonWidth, button.getBounds().height ); } }
@Override protected void configureShell( Shell shell ) { super.configureShell( shell ); shell.setBackground( shell.getDisplay().getSystemColor( DIALOG_COLOR ) ); shell.setBackgroundMode( SWT.INHERIT_FORCE ); } };
/** * Overridden to auto-size the shell according to the selected width. */ @Override protected void constrainShellSize() { super.constrainShellSize(); try { // the shell property within the Windows class is private - need to access it via reflection final Field shellField = Window.class.getDeclaredField( "shell" ); shellField.setAccessible( true ); final Shell thisShell = (Shell) shellField.get( this ); thisShell.pack(); final int height = thisShell.computeSize( width, SWT.DEFAULT ).y; thisShell.setBounds( thisShell.getBounds().x, thisShell.getBounds().y, width + 4, height + 2 ); } catch ( final Exception e ) { // nothing to do } }
protected void showUnsupportedConnectionMessageBox( DatabaseInterface dbi ) { String title = BaseMessages.getString( PKG, "TableOutput.UnsupportedConnection.DialogTitle" ); String message = dbi.getUnsupportedTableOutputMessage(); String close = BaseMessages.getString( PKG, "System.Button.Close" ); MessageDialog dialog = new MessageDialog( shell, title, GUIResource.getInstance().getImageSpoon(), message, MessageDialog.WARNING, new String[] { close }, 0 ); dialog.open(); }
public void handleEvent(Event event) { String key = openDataContent.canClose(); if(key != null){ boolean ok = MessageDialog.openConfirm(shell, i18nFile.getText(I18nFile.CLOSEAPP), key + ": " + i18nFile.getText(I18nFile.CLOSEAPPERROR)); event.doit = ok; }else event.doit = true; } });
public boolean jobOverwritePrompt( JobMeta jobMeta ) { MessageDialogWithToggle md = new MessageDialogWithToggle( shell, BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteJob.Title" ), null, BaseMessages .getString( PKG, "RepositoryImportDialog.OverwriteJob.Message", jobMeta.getName() ), MessageDialog.QUESTION, new String[] { BaseMessages.getString( PKG, "System.Button.Yes" ), BaseMessages.getString( PKG, "System.Button.No" ) }, 1, BaseMessages.getString( PKG, "RepositoryImportDialog.DontAskAgain.Label" ), !askOverwrite ); MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() ); int answer = md.open(); askOverwrite = !md.getToggleState(); return ( answer & 0xFF ) == 0; }
/** * Overridden to make the shell background white. * * @param shell */ @Override protected void configureShell( Shell shell ) { super.configureShell( shell ); shell.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WHITE ) ); shell.setBackgroundMode( SWT.INHERIT_FORCE ); }
@Override protected void configureShell( Shell shell ) { super.configureShell( shell ); shell.setBackground( shell.getDisplay().getSystemColor( DIALOG_COLOR ) ); shell.setBackgroundMode( SWT.INHERIT_FORCE ); } };