Java Code Examples for org.eclipse.swt.widgets.MessageBox

The following examples show how to use org.eclipse.swt.widgets.MessageBox. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: hop   Source File: ActionSendNagiosPassiveCheckDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setMessage( BaseMessages.getString( PKG, "System.Error.TransformNameMissing.Message" ) );
    mb.setText( BaseMessages.getString( PKG, "System.Error.TransformNameMissing.Title" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setPort( wPort.getText() );
  action.setServerName( wServerName.getText() );
  action.setConnectionTimeOut( wConnectionTimeOut.getText() );
  action.setResponseTimeOut( wResponseTimeOut.getText() );
  action.setSenderServerName( wSenderServerName.getText() );
  action.setSenderServiceName( wSenderServiceName.getText() );
  action.setMessage( wMessage.getText() );
  action.setEncryptionMode( ActionSendNagiosPassiveICheck.getEncryptionModeByDesc( wEncryptionMode.getText() ) );
  action.setLevel( ActionSendNagiosPassiveICheck.getLevelByDesc( wLevelMode.getText() ) );
  action.setPassword( wPassword.getText() );

  dispose();
}
 
Example 2
Source Project: hop   Source File: HopGuiWorkflowActionDelegate.java    License: Apache License 2.0 6 votes vote down vote up
public void dupeJobEntry( WorkflowMeta workflowMeta, ActionCopy action ) {
  if ( action == null ) {
    return;
  }

  if ( action.isStart() ) {
    MessageBox mb = new MessageBox( hopGui.getShell(), SWT.OK | SWT.ICON_INFORMATION );
    mb.setMessage( BaseMessages.getString( PKG, "HopGui.Dialog.OnlyUseStartOnce.Message" ) );
    mb.setText( BaseMessages.getString( PKG, "HopGui.Dialog.OnlyUseStartOnce.Title" ) );
    mb.open();
    return;
  }

  ActionCopy copyOfAction = action.clone();
  copyOfAction.setNr( workflowMeta.findUnusedNr( copyOfAction.getName() ) );

  Point p = action.getLocation();
  copyOfAction.setLocation( p.x + 10, p.y + 10 );

  workflowMeta.addAction( copyOfAction );

  workflowGraph.updateGui();
}
 
Example 3
Source Project: hop   Source File: HopGuiWorkflowGraph.java    License: Apache License 2.0 6 votes vote down vote up
public void enableDisableHopsDownstream( WorkflowHopMeta hop, boolean enabled ) {
  if ( hop == null ) {
    return;
  }
  WorkflowHopMeta before = (WorkflowHopMeta) hop.clone();
  hop.setEnabled( enabled );
  WorkflowHopMeta after = (WorkflowHopMeta) hop.clone();
  hopGui.undoDelegate.addUndoChange( workflowMeta, new WorkflowHopMeta[] { before }, new WorkflowHopMeta[] { after }, new int[] { workflowMeta
    .indexOfWorkflowHop( hop ) } );

  Set<ActionCopy> checkedEntries = enableDisableNextHops( hop.getToAction(), enabled, new HashSet<>() );

  if ( checkedEntries.stream().anyMatch( action -> workflowMeta.hasLoop( action ) ) ) {
    MessageBox mb = new MessageBox( hopShell(), SWT.OK | SWT.ICON_WARNING );
    mb.setMessage( BaseMessages.getString( PKG, "WorkflowGraph.Dialog.LoopAfterHopEnabled.Message" ) );
    mb.setText( BaseMessages.getString( PKG, "WorkflowGraph.Dialog.LoopAfterHopEnabled.Title" ) );
    mb.open();
  }

  updateGui();
}
 
Example 4
Source Project: hop   Source File: ActionSNMPTrapDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setPort( wPort.getText() );
  action.setServerName( wServerName.getText() );
  action.setOID( wOID.getText() );
  action.setTimeout( wTimeout.getText() );
  action.setRetry( wTimeout.getText() );
  action.setComString( wComString.getText() );
  action.setMessage( wMessage.getText() );
  action.setTargetType( wTargetType.getText() );
  action.setUser( wUser.getText() );
  action.setPassPhrase( wPassphrase.getText() );
  action.setEngineID( wEngineID.getText() );
  dispose();
}
 
Example 5
Source Project: hop   Source File: EnterValueDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Test the entered value
 */
public void test() {
  try {
    ValueMetaAndData v = getValue( valueMeta.getName() );
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION );

    StringBuilder result = new StringBuilder();
    result.append( Const.CR ).append( Const.CR ).append( "    " ).append( v.toString() );
    result.append( Const.CR ).append( "    " ).append( v.toStringMeta() );

    mb.setMessage( BaseMessages.getString( PKG, "EnterValueDialog.TestResult.Message", result.toString() ) );
    mb.setText( BaseMessages.getString( PKG, "EnterValueDialog.TestResult.Title" ) );
    mb.open();
  } catch ( HopValueException e ) {
    new ErrorDialog( shell, "Error", "There was an error during data type conversion: ", e );
  }
}
 
Example 6
Source Project: hop   Source File: ActionSqlDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setSql( wSql.getText() );
  action.setUseVariableSubstitution( wUseSubs.getSelection() );
  action.setSqlFromFile( wSqlFromFile.getSelection() );
  action.setSqlFilename( wFilename.getText() );
  action.setSendOneStatement( wSendOneStatement.getSelection() );
  action.setDatabase( workflowMeta.findDatabase( wConnection.getText() ) );
  dispose();
}
 
Example 7
Source Project: hop   Source File: TableView.java    License: Apache License 2.0 6 votes vote down vote up
public void clearAll( boolean ask ) {
  int id = SWT.YES;
  if ( ask ) {
    MessageBox mb = new MessageBox( parent.getShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION );
    mb.setMessage( BaseMessages.getString( PKG, "TableView.MessageBox.ClearTable.message" ) );
    mb.setText( BaseMessages.getString( PKG, "TableView.MessageBox.ClearTable.title" ) );
    id = mb.open();
  }

  if ( id == SWT.YES ) {
    table.removeAll();
    new TableItem( table, SWT.NONE );
    if ( !readonly ) {
      parent.getDisplay().asyncExec( new Runnable() {
        @Override
        public void run() {
          edit( 0, 1 );
        }
      } );
    }
    this.setModified(); // timh
  }
}
 
Example 8
Source Project: hop   Source File: SftpPutDialog.java    License: Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
boolean connectToSftp(boolean checkFolder, String Remotefoldername ) {
  boolean retval = true;
  try {
    if ( sftpclient == null || input.hasChanged() ) {
      sftpclient = createSftpClient();
    }
    if ( checkFolder ) {
      retval = sftpclient.folderExists( Remotefoldername );
    }

  } catch ( Exception e ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setMessage( BaseMessages.getString( PKG, "SFTPPUT.ErrorConnect.NOK", wServerName.getText(), e
      .getMessage() )
      + Const.CR );
    mb.setText( BaseMessages.getString( PKG, "SFTPPUT.ErrorConnect.Title.Bad" ) );
    mb.open();
    retval = false;
  }
  return retval;
}
 
Example 9
Source Project: hop   Source File: ActionPingDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setHostname( wHostname.getText() );
  action.setNbrPackets( wNbrPackets.getText() );
  action.setTimeOut( wTimeOut.getText() );
  action.ipingtype = wPingType.getSelectionIndex();
  if ( wPingType.getSelectionIndex() == action.isystemPing ) {
    action.pingtype = action.systemPing;
  } else if ( wPingType.getSelectionIndex() == action.ibothPings ) {
    action.pingtype = action.bothPings;
  } else {
    action.pingtype = action.classicPing;
  }

  dispose();
}
 
Example 10
Source Project: hop   Source File: UserDefinedJavaClassDialog.java    License: Apache License 2.0 6 votes vote down vote up
private boolean cancel() {
  if ( input.hasChanged() ) {
    MessageBox box = new MessageBox( shell, SWT.YES | SWT.NO | SWT.APPLICATION_MODAL );
    box.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.WarningDialogChanged.Title" ) );
    box.setMessage( BaseMessages.getString(
      PKG, "UserDefinedJavaClassDialog.WarningDialogChanged.Message", Const.CR ) );
    int answer = box.open();

    if ( answer == SWT.NO ) {
      return false;
    }
  }
  transformName = null;
  input.setChanged( changed );
  dispose();
  return true;
}
 
Example 11
Source Project: hop   Source File: UserDefinedJavaClassDialog.java    License: Apache License 2.0 6 votes vote down vote up
private boolean checkForTransformClass() {
  boolean hasTransformClass = true;
  // Check if Active Script has set, otherwise Ask
  if ( getCTabItemByName( strActiveScript ) == null ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.CANCEL | SWT.ICON_ERROR );
    mb.setMessage( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.NoTransformClassSet" ) );
    mb.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ERROR.Label" ) );
    switch ( mb.open() ) {
      case SWT.OK:
        strActiveScript = folder.getItem( 0 ).getText();
        refresh();
        hasTransformClass = true;
        break;
      case SWT.CANCEL:
        hasTransformClass = false;
        break;
      default:
        break;
    }
  }
  return hasTransformClass;
}
 
Example 12
Source Project: hop   Source File: XBaseInputDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wTransformName.getText() ) ) {
    return;
  }

  try {
    transformName = wTransformName.getText(); // return value
    getInfo( input );
  } catch ( HopTransformException 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 13
Source Project: hop   Source File: ActionSyslogDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setMessage( BaseMessages.getString( PKG, "ActionSyslog.PleaseGiveActionAName.Message" ) );
    mb.setText( BaseMessages.getString( PKG, "ActionSyslog.PleaseGiveActionAName.Title" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setPort( wPort.getText() );
  action.setServerName( wServerName.getText() );
  action.setFacility( wFacility.getText() );
  action.setPriority( wPriority.getText() );
  action.setMessage( wMessage.getText() );
  action.addTimestamp( wAddTimestamp.getSelection() );
  action.setDatePattern( wDatePattern.getText() );
  action.addHostName( wAddHostName.getSelection() );
  dispose();
}
 
Example 14
Source Project: hop   Source File: HopGitPerspective.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Discard changes to selected unstaged files.
 * Equivalent to <tt>git checkout -- &lt;paths&gt;</tt>
 *
 * @throws Exception
 */
@GuiToolbarElement(
  root = GUI_PLUGIN_FILES_TOOLBAR_PARENT_ID,
  id = FILES_TOOLBAR_ITEM_FILES_DISCARD,
  label = "Discard",
  toolTip = "Discard changes to the selected files"
)
public void discard() throws Exception {
  MessageBox box = new MessageBox( hopGui.getShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION );
  box.setText( "Confirm" );
  box.setMessage( "Are you sure you want to discard changes to the selected " + getSelectedChangedFiles().size() + " files?" );
  int answer = box.open();
  if ( ( answer & SWT.YES ) == 0 ) {
    return;
  }

  List<UIFile> contents = getSelectedChangedFiles();
  for ( UIFile content : contents ) {
    vcs.revertPath( content.getName() );
  }
  refresh();

}
 
Example 15
Source Project: hop   Source File: OraBulkLoaderDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getTableName() {
  String connectionName = wConnection.getText();
  if ( StringUtils.isEmpty( connectionName ) ) {
    return;
  }
  DatabaseMeta databaseMeta = pipelineMeta.findDatabase( connectionName );
  if ( databaseMeta != null ) {
    if ( log.isDebug() ) {
      logDebug( BaseMessages.getString( PKG, "OraBulkLoaderDialog.Log.LookingAtConnection" ) + databaseMeta.toString() );
    }

    DatabaseExplorerDialog std = new DatabaseExplorerDialog( shell, SWT.NONE, databaseMeta, pipelineMeta.getDatabases() );
    std.setSelectedSchemaAndTable( wSchema.getText(), wTable.getText() );
    if ( std.open() ) {
      wSchema.setText( Const.NVL( std.getSchemaName(), "" ) );
      wTable.setText( Const.NVL( std.getTableName(), "" ) );
      setTableFieldCombo();
    }
  } else {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setMessage( BaseMessages.getString( PKG, "OraBulkLoaderDialog.InvalidConnection.DialogMessage" ) );
    mb.setText( BaseMessages.getString( PKG, "OraBulkLoaderDialog.InvalidConnection.DialogTitle" ) );
    mb.open();
  }
}
 
Example 16
Source Project: hop   Source File: MySQLBulkLoaderDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wTransformName.getText() ) ) {
    return;
  }

  // Get the information for the dialog into the input structure.
  getInfo( input );

  if ( input.getDatabaseMeta() == null ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setMessage( BaseMessages.getString( PKG, "MySQLBulkLoaderDialog.InvalidConnection.DialogMessage" ) );
    mb.setText( BaseMessages.getString( PKG, "MySQLBulkLoaderDialog.InvalidConnection.DialogTitle" ) );
    mb.open();
  }

  dispose();
}
 
Example 17
Source Project: hop   Source File: ScriptValuesAddedFunctions.java    License: Apache License 2.0 6 votes vote down vote up
public static String Alert( Context actualContext, Scriptable actualObject, Object[] ArgList,
                              Function FunctionContext ) {

    HopGui hopGui = HopGui.getInstance();
    if ( ArgList.length == 1 && hopGui != null ) {
      String strMessage = Context.toString( ArgList[ 0 ] );
      MessageBox mb = new MessageBox( hopGui.getShell(), SWT.OK | SWT.ICON_INFORMATION );
      mb.setMessage( strMessage );
      mb.setText(  "alert"  );
      mb.open();
/*
      boolean ok = hopGui.messageBox( strMessage, "Alert", true, Const.INFO );
      if ( !ok ) {
        throw new RuntimeException( "Alert dialog cancelled by user." );
      }
*/
    }

    return "";
  }
 
Example 18
Source Project: hop   Source File: ActionMysqlBulkLoadDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getTableName() {
  String databaseName = wConnection.getText();
  if ( StringUtils.isNotEmpty( databaseName ) ) {
    DatabaseMeta databaseMeta = workflowMeta.findDatabase( databaseName );
    if ( databaseMeta != null ) {
      DatabaseExplorerDialog std = new DatabaseExplorerDialog( shell, SWT.NONE, databaseMeta, workflowMeta.getDatabases() );
      std.setSelectedSchemaAndTable( wSchemaname.getText(), wTablename.getText() );
      if ( std.open() ) {
        wTablename.setText( Const.NVL( std.getTableName(), "" ) );
      }
    } else {
      MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
      mb.setMessage( BaseMessages.getString( PKG, "JobMysqlBulkLoad.ConnectionError2.DialogMessage" ) );
      mb.setText( BaseMessages.getString( PKG, "System.Dialog.Error.Title" ) );
      mb.open();
    }
  }
}
 
Example 19
Source Project: hop   Source File: ActionWriteToFileDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setFilename( wFilename.getText() );
  action.setCreateParentFolder( wCreateParentFolder.getSelection() );
  action.setAppendFile( wAppendFile.getSelection() );
  action.setContent( wContent.getText() );
  action.setEncoding( wEncoding.getText() );

  dispose();
}
 
Example 20
Source Project: hop   Source File: ActionWaitForSqlDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setMessage( "Please give this action a name." );
    mb.setText( "Enter the name of the action" );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setDatabase( workflowMeta.findDatabase( wConnection.getText() ) );

  action.schemaname = wSchemaname.getText();
  action.tablename = wTablename.getText();
  action.successCondition = ActionWaitForSql.getSuccessConditionByDesc( wSuccessCondition.getText() );
  action.rowsCountValue = wRowsCountValue.getText();
  action.iscustomSql = wcustomSql.getSelection();
  action.isUseVars = wUseSubs.getSelection();
  action.isAddRowsResult = wAddRowsToResult.getSelection();
  action.isClearResultList = wClearResultList.getSelection();
  action.customSql = wSql.getText();
  action.setMaximumTimeout( wMaximumTimeout.getText() );
  action.setCheckCycleTime( wCheckCycleTime.getText() );
  action.setSuccessOnTimeout( wSuccesOnTimeout.getSelection() );

  dispose();
}
 
Example 21
Source Project: hop   Source File: ActionWaitForSqlDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getTableName() {
  String databaseName = wConnection.getText();
  if ( StringUtils.isNotEmpty( databaseName ) ) {
    DatabaseMeta databaseMeta = workflowMeta.findDatabase( databaseName );
    if ( databaseMeta != null ) {
      DatabaseExplorerDialog std = new DatabaseExplorerDialog( shell, SWT.NONE, databaseMeta, workflowMeta.getDatabases() );
      std.setSelectedSchemaAndTable( wSchemaname.getText(), wTablename.getText() );
      if ( std.open() ) {
        wTablename.setText( Const.NVL( std.getTableName(), "" ) );
      }
    } else {
      MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
      mb.setMessage( BaseMessages.getString( PKG, "ActionWaitForSQL.ConnectionError2.DialogMessage" ) );
      mb.setText( BaseMessages.getString( PKG, "System.Dialog.Error.Title" ) );
      mb.open();
    }
  }
}
 
Example 22
Source Project: hop   Source File: ActionFolderIsEmptyDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setFoldername( wFoldername.getText() );
  action.setIncludeSubFolders( wIncludeSubFolders.getSelection() );
  action.setSpecifyWildcard( wSpecifyWildcard.getSelection() );
  action.setWildcard( wWildcard.getText() );

  dispose();
}
 
Example 23
Source Project: hop   Source File: ActionTableExistsDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void getTableName() {
  String databaseName = wConnection.getText();
  if ( StringUtils.isNotEmpty( databaseName ) ) {
    DatabaseMeta databaseMeta = workflowMeta.findDatabase( databaseName );
    if ( databaseMeta != null ) {
      DatabaseExplorerDialog std = new DatabaseExplorerDialog( shell, SWT.NONE, databaseMeta, workflowMeta.getDatabases() );
      std.setSelectedSchemaAndTable( wSchemaname.getText(), wTablename.getText() );
      if ( std.open() ) {
        wSchemaname.setText( Const.NVL( std.getSchemaName(), "" ) );
        wTablename.setText( Const.NVL( std.getTableName(), "" ) );
      }
    } else {
      MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
      mb.setMessage( BaseMessages.getString( PKG, "System.Dialog.ConnectionError.DialogMessage" ) );
      mb.setText( BaseMessages.getString( PKG, "System.Dialog.Error.Title" ) );
      mb.open();
    }
  }
}
 
Example 24
Source Project: hop   Source File: XsdValidatorDialog.java    License: Apache License 2.0 5 votes vote down vote up
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.setAllowExternalEntities( wAllowExternalEntities.getSelection() );
  jobEntry.setxmlFilename( wxmlFilename.getText() );
  jobEntry.setxsdFilename( wxsdFilename.getText() );

  dispose();
}
 
Example 25
Source Project: hop   Source File: HopGuiPipelineHopDelegate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param pipelineMeta pipeline's meta
 * @param newHop    hop to be checked
 * @return true when the hop was added, false if there was an error
 */
public boolean checkIfHopAlreadyExists( PipelineMeta pipelineMeta, PipelineHopMeta newHop ) {
  boolean ok = true;
  if ( pipelineMeta.findPipelineHop( newHop.getFromTransform(), newHop.getToTransform() ) != 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 26
Source Project: hop   Source File: HopGuiPipelineTransformDelegate.java    License: Apache License 2.0 5 votes vote down vote up
public boolean isDefinedSchemaExist( String[] schemaNames ) {
  // Before we start, check if there are any partition schemas defined...
  if ( ( schemaNames == null ) || ( schemaNames.length == 0 ) ) {
    MessageBox box = new MessageBox( hopGui.getShell(), SWT.ICON_ERROR | SWT.OK );
    box.setText( "Create a partition schema" );
    box.setMessage( "You first need to create one or more partition schemas before you can select one!" );
    box.open();
    return false;
  }
  return true;
}
 
Example 27
Source Project: hop   Source File: ActionFtpDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void checkRemoteFolder( boolean FtpFolfer, boolean checkMoveFolder, String foldername ) {
  if ( !Utils.isEmpty( foldername ) ) {
    if ( connectToFtp( FtpFolfer, checkMoveFolder ) ) {
      MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION );
      mb.setMessage( BaseMessages.getString( PKG, "JobFTP.FolderExists.OK", foldername ) + Const.CR );
      mb.setText( BaseMessages.getString( PKG, "JobFTP.FolderExists.Title.Ok" ) );
      mb.open();
    }
  }
}
 
Example 28
Source Project: hop   Source File: HopGuiPipelineGraph.java    License: Apache License 2.0 5 votes vote down vote up
@GuiContextAction(
  id = "pipeline-graph-transform-12000-sniff-output",
  parentId = HopGuiPipelineTransformContext.CONTEXT_ID,
  type = GuiActionType.Info,
  name = "Sniff output",
  tooltip = "Take a look at 50 rows coming out of the selected transform",
  image = "ui/images/preview.svg"
)
public void sniff( HopGuiPipelineTransformContext context ) {
  TransformMeta transformMeta = context.getTransformMeta();

  if ( pipeline == null ) {
    MessageBox messageBox = new MessageBox( hopShell(), SWT.ICON_INFORMATION | SWT.OK );
    messageBox.setText( BaseMessages.getString( PKG, "PipelineGraph.SniffTestingAvailableWhenRunning.Title" ) );
    messageBox.setMessage( BaseMessages.getString( PKG, "PipelineGraph.SniffTestingAvailableWhenRunning.Message" ) );
    messageBox.open();
    return;
  }
  if ( pipeline.isFinished() ) {
    // Show collected sample data...
    //

  } else {
    try {
      pipeline.retrieveComponentOutput( transformMeta.getName(), 0, 50, ( ( pipelineEngine, rowBuffer ) -> {
        hopDisplay().asyncExec( () -> {
          PreviewRowsDialog dialog = new PreviewRowsDialog( hopShell(), hopGui.getVariables(), SWT.NONE, transformMeta.getName(), rowBuffer.getRowMeta(), rowBuffer.getBuffer() );
          dialog.open();
        } );
      } ) );
    } catch ( HopException e ) {
      new ErrorDialog( hopShell(), "Error", "Error sniffing rows", e );
    }
  }
}
 
Example 29
Source Project: hop   Source File: HopGuiWorkflowHopDelegate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @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 30
Source Project: hop   Source File: HopGuiWorkflowHopDelegate.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param workflowMeta workflow meta
 * @param newHop  hop to be checked
 * @return true when the hop was added, false if there was an error
 */
public boolean performNewWorkflowHopChecks( WorkflowMeta workflowMeta, WorkflowHopMeta newHop ) {
  boolean ok = true;

  if ( workflowMeta.hasLoop( newHop.getToAction() ) ) {
    MessageBox mb = new MessageBox( hopGui.getShell(), SWT.OK | SWT.ICON_ERROR );
    mb.setMessage( BaseMessages.getString( PKG, "WorkflowGraph.Dialog.HopCausesLoop.Message" ) );
    mb.setText( BaseMessages.getString( PKG, "WorkflowGraph.Dialog.HopCausesLoop.Title" ) );
    mb.open();
    ok = false;
  }

  return ok;
}
 
Example 31
Source Project: hop   Source File: VCS.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void showMessageBox( String title, String message ) {
  MessageBox messageBox = new MessageBox( shell, SWT.OK );
  messageBox.setText( title );
  messageBox.setMessage( message == null ? "" : message );
  messageBox.open();
}
 
Example 32
Source Project: hop   Source File: ActionSftpDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setServerName( wServerName.getText() );
  action.setServerPort( wServerPort.getText() );
  action.setUserName( wUserName.getText() );
  action.setPassword( wPassword.getText() );
  action.setScpDirectory( wScpDirectory.getText() );
  action.setTargetDirectory( wTargetDirectory.getText() );
  action.setWildcard( wWildcard.getText() );
  action.setRemove( wRemove.getSelection() );
  action.setAddToResult( wAddFilenameToResult.getSelection() );
  action.setcreateTargetFolder( wCreateTargetFolder.getSelection() );
  action.setCopyPrevious( wgetPrevious.getSelection() );
  action.setUseKeyFile( wusePublicKey.getSelection() );
  action.setKeyFilename( wKeyFilename.getText() );
  action.setKeyPassPhrase( wkeyfilePass.getText() );
  action.setCompression( wCompression.getText() );

  action.setProxyType( wProxyType.getText() );
  action.setProxyHost( wProxyHost.getText() );
  action.setProxyPort( wProxyPort.getText() );
  action.setProxyUsername( wProxyUsername.getText() );
  action.setProxyPassword( wProxyPassword.getText() );
  dispose();
}
 
Example 33
Source Project: hop   Source File: ActionFoldersCompareDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setIncludeSubfolders( wIncludeSubfolders.getSelection() );
  action.setCompareFileContent( wCompareFileContent.getSelection() );
  action.setCompareFileSize( wCompareFileSize.getSelection() );

  if ( wCompareOnly.getSelectionIndex() == 1 ) {
    action.setCompareOnly( "only_files" );
  } else if ( wCompareOnly.getSelectionIndex() == 2 ) {
    action.setCompareOnly( "only_folders" );
  } else if ( wCompareOnly.getSelectionIndex() == 3 ) {
    action.setCompareOnly( "specify" );
  } else {
    action.setCompareOnly( "all" );
  }

  action.setName( wName.getText() );
  action.setWildcard( wWildcard.getText() );
  action.setFilename1( wFilename1.getText() );
  action.setFilename2( wFilename2.getText() );
  dispose();
}
 
Example 34
Source Project: hop   Source File: HopGuiWorkflowGraph.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This method enables or disables all the hops between the selected Entries.
 **/
public void enableHopsBetweenSelectedEntries( boolean enabled ) {
  List<ActionCopy> list = workflowMeta.getSelectedEntries();

  boolean hasLoop = false;

  for ( int i = 0; i < workflowMeta.nrWorkflowHops(); i++ ) {
    WorkflowHopMeta hop = workflowMeta.getWorkflowHop( i );
    if ( list.contains( hop.getFromAction() ) && list.contains( hop.getToAction() ) ) {

      WorkflowHopMeta before = (WorkflowHopMeta) hop.clone();
      hop.setEnabled( enabled );
      WorkflowHopMeta after = (WorkflowHopMeta) hop.clone();
      hopGui.undoDelegate.addUndoChange( workflowMeta, new WorkflowHopMeta[] { before }, new WorkflowHopMeta[] { after }, new int[] { workflowMeta
        .indexOfWorkflowHop( hop ) } );
      if ( workflowMeta.hasLoop( hop.getToAction() ) ) {
        hasLoop = true;
      }
    }
  }

  if ( hasLoop && enabled ) {
    MessageBox mb = new MessageBox( hopShell(), SWT.OK | SWT.ICON_WARNING );
    mb.setMessage( BaseMessages.getString( PKG, "WorkflowGraph.Dialog.LoopAfterHopEnabled.Message" ) );
    mb.setText( BaseMessages.getString( PKG, "WorkflowGraph.Dialog.LoopAfterHopEnabled.Title" ) );
    mb.open();
  }

  updateGui();
}
 
Example 35
Source Project: hop   Source File: ActionZipFileDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setZipFilename( wZipFilename.getText() );

  action.compressionRate = wCompressionRate.getSelectionIndex();
  action.ifZipFileExists = wIfFileExists.getSelectionIndex();

  action.setWildcard( wWildcard.getText() );
  action.setWildcardExclude( wWildcardExclude.getText() );
  action.setSourceDirectory( wSourceDirectory.getText() );

  action.setMoveToDirectory( wMovetoDirectory.getText() );

  action.afterZip = wAfterZip.getSelectionIndex();

  action.setAddFileToResult( wAddFileToResult.getSelection() );
  action.setDatafromprevious( wgetFromPrevious.getSelection() );
  action.setcreateparentfolder( wCreateParentFolder.getSelection() );
  action.setDateInFilename( wAddDate.getSelection() );
  action.setTimeInFilename( wAddTime.getSelection() );
  action.setSpecifyFormat( wSpecifyFormat.getSelection() );
  action.setDateTimeFormat( wDateTimeFormat.getText() );
  action.setCreateMoveToDirectory( wCreateMoveToDirectory.getSelection() );
  action.setIncludingSubFolders( wIncludeSubfolders.getSelection() );

  action.setStoredSourcePathDepth( wStoredSourcePathDepth.getText() );

  dispose();
}
 
Example 36
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 37
Source Project: hop   Source File: ActionSftpPutDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wName.getText() ) ) {
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
    mb.setText( BaseMessages.getString( PKG, "System.TransformActionNameMissing.Title" ) );
    mb.setMessage( BaseMessages.getString( PKG, "System.ActionNameMissing.Msg" ) );
    mb.open();
    return;
  }
  action.setName( wName.getText() );
  action.setServerName( wServerName.getText() );
  action.setServerPort( wServerPort.getText() );
  action.setUserName( wUserName.getText() );
  action.setPassword( wPassword.getText() );
  action.setScpDirectory( wScpDirectory.getText() );
  action.setLocalDirectory( wLocalDirectory.getText() );
  action.setWildcard( wWildcard.getText() );
  action.setCopyPrevious( wgetPrevious.getSelection() );
  action.setCopyPreviousFiles( wgetPreviousFiles.getSelection() );
  action.setAddFilenameResut( wAddFilenameToResult.getSelection() );
  action.setUseKeyFile( wusePublicKey.getSelection() );
  action.setKeyFilename( wKeyFilename.getText() );
  action.setKeyPassPhrase( wkeyfilePass.getText() );
  action.setCompression( wCompression.getText() );

  action.setProxyType( wProxyType.getText() );
  action.setProxyHost( wProxyHost.getText() );
  action.setProxyPort( wProxyPort.getText() );
  action.setProxyUsername( wProxyUsername.getText() );
  action.setProxyPassword( wProxyPassword.getText() );
  action.setCreateRemoteFolder( wCreateRemoteFolder.getSelection() );
  action.setAfterFtps( ActionSftpPut.getAfterSftpPutByDesc( wAfterFtpPut.getText() ) );
  action.setCreateDestinationFolder( wCreateDestinationFolder.getSelection() );
  action.setDestinationFolder( wDestinationFolder.getText() );
  action.setSuccessWhenNoFile( wSuccessWhenNoFile.getSelection() );
  dispose();
}
 
Example 38
Source Project: hop   Source File: ActionTableExistsDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void getSchemaNames() {
  if ( wSchemaname.isDisposed() ) {
    return;
  }
  DatabaseMeta databaseMeta = workflowMeta.findDatabase( wConnection.getText() );
  if ( databaseMeta != null ) {
    Database database = new Database( loggingObject, databaseMeta );
    database.shareVariablesWith( workflowMeta );
    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, "System.Dialog.AvailableSchemas.Title", wConnection.getText() ),
          BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Message" ) );
        String d = dialog.open();
        if ( d != null ) {
          wSchemaname.setText( Const.NVL( d.toString(), "" ) );
        }

      } else {
        MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
        mb.setMessage( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Message" ) );
        mb.setText( BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.Empty.Title" ) );
        mb.open();
      }
    } catch ( Exception e ) {
      new ErrorDialog( shell, BaseMessages.getString( PKG, "System.Dialog.Error.Title" ),
        BaseMessages.getString( PKG, "System.Dialog.AvailableSchemas.ConnectionError" ), e );
    } finally {
      if ( database != null ) {
        database.disconnect();
        database = null;
      }
    }
  }
}
 
Example 39
Source Project: hop   Source File: DatabaseExplorerDialog.java    License: Apache License 2.0 5 votes vote down vote up
public void showCount( String tableName ) {
  GetTableSizeProgressDialog pd = new GetTableSizeProgressDialog( shell, dbMeta, tableName );
  Long size = pd.open();
  if ( size != null ) {
    MessageBox mb = new MessageBox( shell, SWT.ICON_INFORMATION | SWT.OK );
    mb.setMessage( BaseMessages.getString( PKG, "DatabaseExplorerDialog.TableSize.Message", tableName, size.toString() ) );
    mb.setText( BaseMessages.getString( PKG, "DatabaseExplorerDialog.TableSize.Title" ) );
    mb.open();
  }
}
 
Example 40
Source Project: hop   Source File: MetadataManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * delete an element
 *
 * @param elementName The name of the element to delete
 * @return True if anything was deleted
 */
public boolean deleteMetadata( String elementName ) {

  if ( StringUtils.isEmpty( elementName ) ) {
    return false;
  }

  MessageBox confirmBox = new MessageBox( HopGui.getInstance().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO );
  confirmBox.setText( "Delete?" );
  confirmBox.setMessage( "Are you sure you want to delete element " + elementName + "?" );
  int anwser = confirmBox.open();
  if ( ( anwser & SWT.YES ) == 0 ) {
    return false;
  }

  try {
    IHopMetadataSerializer<T> serializer = getSerializer();

    // delete the metadata object from the metadata
    //
    T object = serializer.delete( elementName );

    // Just to be precise.
    //
    initializeElementVariables( object );

    ExtensionPointHandler.callExtensionPoint( HopGui.getInstance().getLog(), HopExtensionPoint.HopGuiMetadataObjectDeleted.id, object );

    return true;

  } catch ( Exception e ) {
    new ErrorDialog( HopGui.getInstance().getShell(), "Error", "Error deleting metadata element " + elementName, e );
    return false;
  }
}