Java Code Examples for org.eclipse.swt.SWT#OK
The following examples show how to use
org.eclipse.swt.SWT#OK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobGraph.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public void enableDisableHopsDownstream( boolean enabled ) { if ( currentHop == null ) { return; } JobHopMeta before = (JobHopMeta) currentHop.clone(); currentHop.setEnabled( enabled ); JobHopMeta after = (JobHopMeta) currentHop.clone(); spoon.addUndoChange( jobMeta, new JobHopMeta[] { before }, new JobHopMeta[] { after }, new int[] { jobMeta .indexOfJobHop( currentHop ) } ); Set<JobEntryCopy> checkedEntries = enableDisableNextHops( currentHop.getToEntry(), enabled, new HashSet<>() ); if ( checkedEntries.stream().anyMatch( entry -> jobMeta.hasLoop( entry ) ) ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_WARNING ); mb.setMessage( BaseMessages.getString( PKG, "JobGraph.Dialog.LoopAfterHopEnabled.Message" ) ); mb.setText( BaseMessages.getString( PKG, "JobGraph.Dialog.LoopAfterHopEnabled.Title" ) ); mb.open(); } spoon.refreshGraph(); }
Example 2
Source File: AggregateRowsDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void get() { try { RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null && r.size() > 0 ) { BaseStepDialog.getFieldsFromPrevious( r, wFields, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, null ); } else { MessageBox mb; mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION ); mb.setMessage( BaseMessages.getString( PKG, "AggregateRowsDialog.CouldNotRetrieveFields.DialogMessage", Const.CR ) ); mb.setText( BaseMessages.getString( PKG, "AggregateRowsDialog.CouldNotRetrieveFields.DialogTitle" ) ); mb.open(); } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "AggregateRowsDialog.GetFieldsFailed.DialogTitle" ), BaseMessages .getString( PKG, "AggregateRowsDialog.GetFieldsFailed.DialogMessage" ), ke ); } }
Example 3
Source File: ERDiagramEditPart.java From ermaster-b with Apache License 2.0 | 6 votes |
private void changeDatabase(PropertyChangeEvent event) { MessageBox messageBox = new MessageBox(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(), SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL); messageBox.setText(ResourceString .getResourceString("dialog.title.change.database")); messageBox.setMessage(ResourceString .getResourceString("dialog.message.change.database")); if (messageBox.open() == SWT.OK) { event.setPropagationId("consumed"); } else { ERDiagram diagram = (ERDiagram) this.getModel(); diagram.restoreDatabase(String.valueOf(event.getOldValue())); } }
Example 4
Source File: XBaseInputDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void ok() { if ( Utils.isEmpty( wStepname.getText() ) ) { return; } try { stepname = wStepname.getText(); // return value getInfo( input ); } catch ( KettleStepException e ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( e.toString() ); mb.setText( BaseMessages.getString( PKG, "System.Warning" ) ); mb.open(); } dispose(); }
Example 5
Source File: DimensionLookupDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void ok() { if ( Utils.isEmpty( wStepname.getText() ) ) { return; } getInfo( input ); stepname = wStepname.getText(); // return value if ( input.getDatabaseMeta() == null ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "DimensionLookupDialog.InvalidConnection.DialogMessage" ) ); mb.setText( BaseMessages.getString( PKG, "DimensionLookupDialog.InvalidConnection.DialogTitle" ) ); mb.open(); return; } dispose(); }
Example 6
Source File: DatabaseLookupDialog.java From hop with Apache License 2.0 | 5 votes |
private void getSchemaNames() { DatabaseMeta databaseMeta = pipelineMeta.findDatabase( wConnection.getText() ); if ( databaseMeta != null ) { Database database = new Database( loggingObject, databaseMeta ); try { database.connect(); String[] schemas = database.getSchemas(); if ( null != schemas && schemas.length > 0 ) { schemas = Const.sortStrings( schemas ); EnterSelectionDialog dialog = new EnterSelectionDialog( shell, schemas, BaseMessages.getString( PKG, "DatabaseLookupDialog.AvailableSchemas.Title", wConnection.getText() ), BaseMessages .getString( PKG, "DatabaseLookupDialog.AvailableSchemas.Message", wConnection.getText() ) ); String d = dialog.open(); if ( d != null ) { wSchema.setText( Const.NVL( d, "" ) ); setTableFieldCombo(); } } else { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "DatabaseLookupDialog.NoSchema.Error" ) ); mb.setText( BaseMessages.getString( PKG, "DatabaseLookupDialog.GetSchemas.Error" ) ); mb.open(); } } catch ( Exception e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ), BaseMessages .getString( PKG, "DatabaseLookupDialog.ErrorGettingSchemas" ), e ); } finally { database.disconnect(); } } }
Example 7
Source File: AxisConfigPage.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void applyChanges() { axis.setTitle(titleText.getText()); axis.setFont(scaleFont); axis.setTitleFont(titleFont); axis.setForegroundColor(XYGraphMediaFactory.getInstance().getColor(axisColorSelector.getColorValue())); axis.setPrimarySide(primaryButton.getSelection()); axis.setLogScale(logButton.getSelection()); // must be set before autoScale as we update the maxOrAutoScaleThrText // button as well setInverted(invertAxisButton.getSelection()); axis.setAutoScale(autoScaleButton.getSelection()); if (autoScaleButton.getSelection()) axis.setAutoScaleThreshold(maxOrAutoScaleThrText.getDoubleValue()); else axis.setRange(minText.getDoubleValue(), maxOrAutoScaleThrText.getDoubleValue()); axis.setDateEnabled(dateEnabledButton.getSelection()); axis.setAutoFormat(autoFormat.getSelection()); if (!autoFormat.getSelection()) { String saveFormat = axis.getFormatPattern(); try { axis.setFormatPattern(formatText.getText()); axis.format(0); } catch (Exception e) { axis.setFormatPattern(saveFormat); MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR | SWT.OK); mb.setMessage("Failed to set format due to incorrect format pattern: " + e.getMessage()); mb.setText("Format pattern error!"); mb.open(); } } axis.setShowMajorGrid(showGridButton.getSelection()); axis.setDashGridLine(dashGridLineButton.getSelection()); axis.setMajorGridColor(XYGraphMediaFactory.getInstance().getColor(gridColorSelector.getColorValue())); axis.setVisible(showAxisButton.getSelection()); }
Example 8
Source File: JobEntryMysqlBulkFileDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void ok() { if ( Utils.isEmpty( wName.getText() ) ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setText( BaseMessages.getString( PKG, "System.StepJobEntryNameMissing.Title" ) ); mb.setMessage( BaseMessages.getString( PKG, "System.JobEntryNameMissing.Msg" ) ); mb.open(); return; } jobEntry.setName( wName.getText() ); jobEntry.setDatabase( jobMeta.findDatabase( wConnection.getText() ) ); jobEntry.setSchemaname( wSchemaname.getText() ); jobEntry.setTablename( wTablename.getText() ); jobEntry.setFilename( wFilename.getText() ); jobEntry.setSeparator( wSeparator.getText() ); jobEntry.setEnclosed( wEnclosed.getText() ); jobEntry.setOptionEnclosed( wOptionEnclosed.getSelection() ); jobEntry.setLineterminated( wLineterminated.getText() ); jobEntry.setLimitlines( wLimitlines.getText() ); jobEntry.setListColumn( wListColumn.getText() ); jobEntry.outdumpvalue = wOutDumpValue.getSelectionIndex(); jobEntry.setHighPriority( wHighPriority.getSelection() ); jobEntry.iffileexists = wIfFileExists.getSelectionIndex(); jobEntry.setAddFileToResult( wAddFileToResult.getSelection() ); dispose(); }
Example 9
Source File: JobEntrySFTPDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void checkRemoteFolder() { String changeFTPFolder = jobMeta.environmentSubstitute( wScpDirectory.getText() ); if ( !Utils.isEmpty( changeFTPFolder ) ) { if ( connectToSFTP( true, changeFTPFolder ) ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION ); mb.setMessage( BaseMessages.getString( PKG, "JobSFTP.FolderExists.OK", changeFTPFolder ) + Const.CR ); mb.setText( BaseMessages.getString( PKG, "JobSFTP.FolderExists.Title.Ok" ) ); mb.open(); } } }
Example 10
Source File: JobEntryFTPDeleteDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void test() { if ( connect() ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION ); mb.setMessage( BaseMessages.getString( PKG, "JobFTPDelete.Connected.OK", wServerName.getText() ) + Const.CR ); mb.setText( BaseMessages.getString( PKG, "JobFTPDelete.Connected.Title.Ok" ) ); mb.open(); } }
Example 11
Source File: DiskWindow.java From AppleCommander with GNU General Public License v2.0 | 5 votes |
/** * Warns user about a Generic Disk Error problem * * @param e */ protected void handle(final DiskException e) { if (e instanceof DiskCorruptException) { this.handle((DiskCorruptException) e); return; } final MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK | SWT.MODELESS); box.setText(textBundle.get("SwtAppleCommander.DiskException.Title")); //$NON-NLS-1$ box.setMessage( textBundle.format("SwtAppleCommander.DiskException.Message", //$NON-NLS-1$ e.imagepath, e.toString())); box.open(); }
Example 12
Source File: HopGuiWorkflowHopDelegate.java From hop with Apache License 2.0 | 5 votes |
/** * @param workflowMeta workflow metadata * @param newHop hop to be checked * @return true when the hop was added, false if there was an error */ public boolean checkIfHopAlreadyExists( WorkflowMeta workflowMeta, WorkflowHopMeta newHop ) { boolean ok = true; if ( workflowMeta.findWorkflowHop( newHop.getFromAction(), newHop.getToAction() ) != null ) { MessageBox mb = new MessageBox( hopGui.getShell(), SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "HopGui.Dialog.HopExists.Message" ) ); // "This hop already exists!" mb.setText( BaseMessages.getString( PKG, "HopGui.Dialog.HopExists.Title" ) ); // Error! mb.open(); ok = false; } return ok; }
Example 13
Source File: LocationMouseDoubleClickExtensionPoint.java From hop with Apache License 2.0 | 5 votes |
private void openDataSet( String dataSetName ) { HopGui hopGui = HopGui.getInstance(); IHopMetadataProvider metadataProvider = hopGui.getMetadataProvider(); try { IHopMetadataSerializer<DataSet> setSerializer = hopGui.getMetadataProvider().getSerializer( DataSet.class ); DataSet dataSet = setSerializer.load( dataSetName ); dataSet.initializeVariablesFrom( hopGui.getVariables() ); DataSetDialog dataSetDialog = new DataSetDialog( hopGui.getShell(), metadataProvider, dataSet ); while ( dataSetDialog.open() != null ) { String message = TestingGuiPlugin.validateDataSet( dataSet, dataSetName, setSerializer.listObjectNames() ); // Save the data set... // if ( message == null ) { setSerializer.save( dataSet ); break; } else { MessageBox box = new MessageBox( hopGui.getShell(), SWT.OK ); box.setText( "Error" ); box.setMessage( message ); box.open(); } } } catch ( Exception e ) { new ErrorDialog( hopGui.getShell(), "Error", "Error editing data set '" + dataSetName + "'", e ); } }
Example 14
Source File: JobEntryDelayDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void ok() { if ( Utils.isEmpty( wName.getText() ) ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setText( BaseMessages.getString( PKG, "System.StepJobEntryNameMissing.Title" ) ); mb.setMessage( BaseMessages.getString( PKG, "System.JobEntryNameMissing.Msg" ) ); mb.open(); return; } jobEntry.setName( wName.getText() ); jobEntry.setMaximumTimeout( wMaximumTimeout.getText() ); jobEntry.scaleTime = wScaleTime.getSelectionIndex(); dispose(); }
Example 15
Source File: DataOverrideHandler.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override protected void showMessage( String message, boolean scroll ) { Shell parent = getShell(); ShowMessageDialog msgDialog = new ShowMessageDialog( parent, SWT.ICON_INFORMATION | SWT.OK, BaseMessages.getString( PKG, "DatabaseDialog.DatabaseConnectionTest.title" ), message, scroll ); msgDialog.open(); }
Example 16
Source File: AccessInputDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private boolean checkInputTableName( AccessInputMeta meta ) { if ( meta.getTableName() == null || meta.getTableName().length() < 1 ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "AccessInputDialog.TableMissing.DialogMessage" ) ); mb.setText( BaseMessages.getString( PKG, "System.Dialog.Error.Title" ) ); mb.open(); return false; } else { return true; } }
Example 17
Source File: JobEntryHTTPDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void ok() { if ( Utils.isEmpty( wName.getText() ) ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setText( BaseMessages.getString( PKG, "System.StepJobEntryNameMissing.Title" ) ); mb.setMessage( BaseMessages.getString( PKG, "System.JobEntryNameMissing.Msg" ) ); mb.open(); return; } jobEntry.setName( wName.getText() ); jobEntry.setUrl( wURL.getText() ); jobEntry.setRunForEveryRow( wRunEveryRow.getSelection() ); jobEntry.setUrlFieldname( wFieldURL.getText() ); jobEntry.setUploadFieldname( wFieldUpload.getText() ); jobEntry.setDestinationFieldname( wFieldTarget.getText() ); jobEntry.setUsername( wUserName.getText() ); jobEntry.setPassword( wPassword.getText() ); jobEntry.setProxyHostname( wProxyServer.getText() ); jobEntry.setProxyPort( wProxyPort.getText() ); jobEntry.setNonProxyHosts( wNonProxyHosts.getText() ); jobEntry.setUploadFilename( wUploadFile.getText() ); jobEntry.setTargetFilename( wRunEveryRow.getSelection() ? "" : wTargetFile.getText() ); jobEntry.setFileAppended( wRunEveryRow.getSelection() ? false : wAppend.getSelection() ); jobEntry.setDateTimeAdded( wRunEveryRow.getSelection() ? false : wDateTimeAdded.getSelection() ); jobEntry.setTargetFilenameExtension( wRunEveryRow.getSelection() ? "" : wTargetExt.getText() ); jobEntry.setAddFilenameToResult( wAddFilenameToResult.getSelection() ); int nritems = wHeaders.nrNonEmpty(); int nr = 0; for ( int i = 0; i < nritems; i++ ) { String arg = wHeaders.getNonEmpty( i ).getText( 1 ); if ( arg != null && arg.length() != 0 ) { nr++; } } String[] headerNames = new String[nr]; String[] headerValues = new String[nr]; nr = 0; for ( int i = 0; i < nritems; i++ ) { String varname = wHeaders.getNonEmpty( i ).getText( 1 ); String varvalue = wHeaders.getNonEmpty( i ).getText( 2 ); if ( varname != null && varname.length() != 0 ) { headerNames[nr] = varname; headerValues[nr] = varvalue; nr++; } } jobEntry.setHeaderName( headerNames ); jobEntry.setHeaderValue( headerValues ); dispose(); }
Example 18
Source File: HopGuiWorkflowRunDelegate.java From hop with Apache License 2.0 | 4 votes |
private static void showSaveJobBeforeRunningDialog( Shell shell ) { MessageBox m = new MessageBox( shell, SWT.OK | SWT.ICON_WARNING ); m.setText( BaseMessages.getString( PKG, "WorkflowLog.Dialog.SaveJobBeforeRunning.Title" ) ); m.setMessage( BaseMessages.getString( PKG, "WorkflowLog.Dialog.SaveJobBeforeRunning.Message" ) ); m.open(); }
Example 19
Source File: TSVExtendedHandler.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 4 votes |
@Override public void run() { Shell shell = new Shell(); shell.setText("Extended TSV Analysis"); shell.setSize(300, 400); Monitor primary = shell.getDisplay().getPrimaryMonitor(); Rectangle bounds = primary.getBounds(); Rectangle rect = shell.getBounds(); int x = bounds.x + (bounds.width - rect.width) / 2; int y = bounds.y + (bounds.height - rect.height) / 2; shell.setLocation(x, y); // Set layout for shell GridLayout layout = new GridLayout(); shell.setLayout(layout); // Create a composite to hold the children Composite composite = new Composite(shell, SWT.NONE); final ModuleTableViewer moduleTableViewer = new ModuleTableViewer(composite); if (moduleTableViewer.isPlatformFound()) { moduleTableViewer.getControl().addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { moduleTableViewer.dispose(); } }); // Ask the shell to display its content shell.open(); moduleTableViewer.run(shell); } else { MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); dialog.setText("Platform extension not found"); dialog.setMessage("The platform extension was not found in the workspace. Please import it and try again."); dialog.open(); } }
Example 20
Source File: ActionFtpDeleteDialog.java From hop with Apache License 2.0 | 4 votes |
private boolean connectToFtps() { boolean retval = false; try { if ( ftpsclient == null ) { String realServername = workflowMeta.environmentSubstitute( wServerName.getText() ); String realUsername = workflowMeta.environmentSubstitute( wUserName.getText() ); String realPassword = Utils.resolvePassword( workflowMeta, wPassword.getText() ); int port = Const.toInt( workflowMeta.environmentSubstitute( wPort.getText() ), 0 ); // Create ftp client to host:port ... ftpsclient = new FtpsConnection( FtpsConnection.getConnectionTypeByDesc( wConnectionType.getText() ), realServername, port, realUsername, realPassword ); if ( !Utils.isEmpty( wProxyHost.getText() ) ) { // Set proxy String realProxy_host = workflowMeta.environmentSubstitute( wProxyHost.getText() ); String realProxy_user = workflowMeta.environmentSubstitute( wProxyUsername.getText() ); String realProxy_pass = Utils.resolvePassword( workflowMeta, wProxyPassword.getText() ); ftpsclient.setProxyHost( realProxy_host ); int proxyport = Const.toInt( workflowMeta.environmentSubstitute( wProxyPort.getText() ), 990 ); if ( proxyport != 0 ) { ftpsclient.setProxyPort( proxyport ); } if ( !Utils.isEmpty( realProxy_user ) ) { ftpsclient.setProxyUser( realProxy_user ); } if ( !Utils.isEmpty( realProxy_pass ) ) { ftpsclient.setProxyPassword( realProxy_pass ); } } // login to FTPS host ... ftpsclient.connect(); pwdFolder = ftpsclient.getWorkingDirectory(); } retval = true; } catch ( Exception e ) { if ( ftpsclient != null ) { try { ftpsclient.disconnect(); } catch ( Exception ignored ) { // We've tried quitting the FTPS Client exception // nothing else to be done if the FTPS Client was already disconnected } ftpsclient = null; } MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "JobFTPDelete.ErrorConnect.NOK", e.getMessage() ) + Const.CR ); mb.setText( BaseMessages.getString( PKG, "JobFTPDelete.ErrorConnect.Title.Bad" ) ); mb.open(); } return retval; }