Esempio n. 1
0
    private void findText(String text, Shell activeShell) {
      ScanningResultList results = resultTable.getScanningResults();

      int startIndex = resultTable.getSelectionIndex() + 1;

      int foundIndex = results.findText(text, startIndex);

      if (foundIndex >= 0) {
        // if found, then select and finish
        resultTable.setSelection(foundIndex);
        resultTable.setFocus();
        return;
      }

      if (startIndex > 0) {
        // if started not from the beginning, offer to restart
        MessageBox messageBox = new MessageBox(activeShell, SWT.YES | SWT.NO | SWT.ICON_QUESTION);
        messageBox.setText(Labels.getLabel("title.find"));
        messageBox.setMessage(
            Labels.getLabel("text.find.notFound") + " " + Labels.getLabel("text.find.restart"));
        if (messageBox.open() == SWT.YES) {
          resultTable.deselectAll();
          findText(text, activeShell);
        }
      } else {
        // searching is finished, nothing was found
        MessageBox messageBox = new MessageBox(activeShell, SWT.OK | SWT.ICON_INFORMATION);
        messageBox.setText(Labels.getLabel("title.find"));
        messageBox.setMessage(Labels.getLabel("text.find.notFound"));
        messageBox.open();
      }
    }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.dialogs.Dialog#okPressed()
   */
  protected void okPressed() {
    String result = getNameCheckResult();
    if (result != null) {
      MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_WARNING);
      mb.setText(
          Messages.getString("HyperlinkEditorDialog.HyperlinkName.Title.Warning")); // $NON-NLS-1$
      mb.setMessage(result);
      mb.open();
      fTxtHyperlinkLabel.setFocus();
      return;
    }

    if (fsBaseURL == null) {
      MessageBox mb = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_WARNING);
      mb.setText(
          Messages.getString("HyperlinkEditorDialog.HyperlinkName.Title.Warning")); // $NON-NLS-1$
      mb.setMessage(Messages.getString("HyperlinkEditorDialog.BaseURL.Message")); // $NON-NLS-1$
      mb.open();
      fTxtHyperlinkLabel.setFocus();
      return;
    }
    fURLValue.getLabel().getCaption().setValue(fTxtHyperlinkLabel.getText().trim());
    fURLValue.setBaseUrl(fsBaseURL);
    fURLValue.setBaseParameterName(fTxtBaseParm.getText());
    fURLValue.setSeriesParameterName(fTxtSeriesParm.getText());
    fURLValue.setValueParameterName(fTxtValueParm.getText());
    super.okPressed();
  }
  private void sql() {
    try {
      IngresVectorwiseLoaderMeta info = new IngresVectorwiseLoaderMeta();
      getInfo(info);
      RowMetaInterface prev = transMeta.getPrevStepFields(stepname);
      StepMeta stepMeta = transMeta.findStep(stepname);

      // Only use the fields that were specified.
      //
      RowMetaInterface prevNew = new RowMeta();

      for (int i = 0; i < info.getFieldDatabase().length; i++) {
        ValueMetaInterface insValue = prev.searchValueMeta(info.getFieldStream()[i]);
        if (insValue != null) {
          ValueMetaInterface insertValue = insValue.clone();
          insertValue.setName(info.getFieldDatabase()[i]);
          prevNew.addValueMeta(insertValue);
        } else {
          throw new KettleStepException(
              BaseMessages.getString(
                  PKG,
                  "IngresVectorWiseLoaderDialog.FailedToFindField.Message",
                  info.getFieldStream()[i]));
        }
      }
      prev = prevNew;

      SQLStatement sql = info.getSQLStatements(transMeta, stepMeta, prev, repository, metaStore);
      if (!sql.hasError()) {
        if (sql.hasSQL()) {
          SQLEditor sqledit =
              new SQLEditor(
                  transMeta,
                  shell,
                  SWT.NONE,
                  info.getDatabaseMeta(),
                  transMeta.getDbCache(),
                  sql.getSQL());
          sqledit.open();
        } else {
          MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
          mb.setMessage(
              BaseMessages.getString(PKG, "IngresVectorWiseLoaderDialog.NoSQL.DialogMessage"));
          mb.setText(BaseMessages.getString(PKG, "IngresVectorWiseLoaderDialog.NoSQL.DialogTitle"));
          mb.open();
        }
      } else {
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
        mb.setMessage(sql.getError());
        mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
        mb.open();
      }
    } catch (KettleException ke) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "IngresVectorWiseLoaderDialog.BuildSQLError.DialogTitle"),
          BaseMessages.getString(PKG, "IngresVectorWiseLoaderDialog.BuildSQLError.DialogMessage"),
          ke);
    }
  }
 private void getlookup() {
   try {
     String stepFrom = wStep.getText();
     if (!Utils.isEmpty(stepFrom)) {
       RowMetaInterface r = transMeta.getStepFields(stepFrom);
       if (r != null && !r.isEmpty()) {
         BaseStepDialog.getFieldsFromPrevious(
             r, wReturn, 1, new int[] {1}, new int[] {4}, -1, -1, null);
       } else {
         MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
         mb.setMessage(
             BaseMessages.getString(PKG, "FuzzyMatchDialog.CouldNotFindFields.DialogMessage"));
         mb.setText(
             BaseMessages.getString(PKG, "FuzzyMatchDialog.CouldNotFindFields.DialogTitle"));
         mb.open();
       }
     } else {
       MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
       mb.setMessage(
           BaseMessages.getString(PKG, "FuzzyMatchDialog.StepNameRequired.DialogMessage"));
       mb.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.StepNameRequired.DialogTitle"));
       mb.open();
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "FuzzyMatchDialog.FailedToGetFields.DialogTitle"),
         BaseMessages.getString(PKG, "FuzzyMatchDialog.FailedToGetFields.DialogMessage"),
         ke);
   }
 }
  // Generate code for create table...
  // Conversions done by Database
  private void create() {
    try {
      LucidDBBulkLoaderMeta info = new LucidDBBulkLoaderMeta();
      getInfo(info);

      String name = stepname; // new name might not yet be linked to other steps!
      StepMeta stepMeta =
          new StepMeta(
              BaseMessages.getString(PKG, "LucidDBBulkLoaderDialog.StepMeta.Title"),
              name,
              info); //$NON-NLS-1$
      RowMetaInterface prev = transMeta.getPrevStepFields(stepname);

      SQLStatement sql = info.getSQLStatements(transMeta, stepMeta, prev);
      if (!sql.hasError()) {
        if (sql.hasSQL()) {
          SQLEditor sqledit =
              new SQLEditor(
                  transMeta,
                  shell,
                  SWT.NONE,
                  info.getDatabaseMeta(),
                  transMeta.getDbCache(),
                  sql.getSQL());
          sqledit.open();
        } else {
          MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
          mb.setMessage(
              BaseMessages.getString(
                  PKG, "LucidDBBulkLoaderDialog.NoSQLNeeds.DialogMessage")); // $NON-NLS-1$
          mb.setText(
              BaseMessages.getString(
                  PKG, "LucidDBBulkLoaderDialog.NoSQLNeeds.DialogTitle")); // $NON-NLS-1$
          mb.open();
        }
      } else {
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
        mb.setMessage(sql.getError());
        mb.setText(
            BaseMessages.getString(
                PKG, "LucidDBBulkLoaderDialog.SQLError.DialogTitle")); // $NON-NLS-1$
        mb.open();
      }
    } catch (KettleException ke) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(
              PKG, "LucidDBBulkLoaderDialog.CouldNotBuildSQL.DialogTitle"), // $NON-NLS-1$
          BaseMessages.getString(PKG, "LucidDBBulkLoaderDialog.CouldNotBuildSQL.DialogMessage"),
          ke); //$NON-NLS-1$
    }
  }
  public void removeConnection() {
    try {
      Collection<UIDatabaseConnection> connections = connectionsTable.getSelectedItems();

      if (connections != null && !connections.isEmpty()) {
        for (Object obj : connections) {
          if (obj != null && obj instanceof UIDatabaseConnection) {
            UIDatabaseConnection connection = (UIDatabaseConnection) obj;

            DatabaseMeta databaseMeta = connection.getDatabaseMeta();

            // Make sure this connection already exists and store its id for updating
            ObjectId idDatabase = repository.getDatabaseID(databaseMeta.getName());
            if (idDatabase == null) {
              MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
              mb.setMessage(
                  BaseMessages.getString(
                      PKG,
                      "RepositoryExplorerDialog.Connection.Delete.DoesNotExists.Message",
                      databaseMeta.getName()));
              mb.setText(
                  BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Delete.Title"));
              mb.open();
            } else {
              repository.deleteDatabaseMeta(databaseMeta.getName());
            }
          }
        }
      } else {
        MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
        mb.setMessage(
            BaseMessages.getString(
                PKG, "RepositoryExplorerDialog.Connection.Edit.NoItemSelected.Message"));
        mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Delete.Title"));
        mb.open();
      }
    } catch (KettleException e) {
      if (mainController == null || !mainController.handleLostRepository(e)) {
        new ErrorDialog(
            shell,
            BaseMessages.getString(
                PKG, "RepositoryExplorerDialog.Connection.Create.UnexpectedError.Title"),
            BaseMessages.getString(
                PKG, "RepositoryExplorerDialog.Connection.Remove.UnexpectedError.Message"),
            e);
      }
    } finally {
      refreshConnectionList();
    }
  }
  public void removePartition() {
    String partitionSchemaName = "";
    try {
      Collection<UIPartition> partitions = partitionsTable.getSelectedItems();

      if (partitions != null && !partitions.isEmpty()) {
        for (Object obj : partitions) {
          if (obj != null && obj instanceof UIPartition) {
            UIPartition partition = (UIPartition) obj;
            PartitionSchema partitionSchema = partition.getPartitionSchema();
            partitionSchemaName = partitionSchema.getName();
            // Make sure the partition to delete exists in the repository
            ObjectId partitionId = repository.getPartitionSchemaID(partitionSchema.getName());
            if (partitionId == null) {
              MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
              mb.setMessage(
                  BaseMessages.getString(
                      PKG,
                      "RepositoryExplorerDialog.Partition.DoesNotExists.Message",
                      partitionSchemaName));
              mb.setText(
                  BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Delete.Title"));
              mb.open();
            } else {
              repository.deletePartitionSchema(partitionId);
            }
          }
        }
      } else {
        MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
        mb.setMessage(
            BaseMessages.getString(
                PKG, "RepositoryExplorerDialog.Partition.NoItemSelected.Message"));
        mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Delete.Title"));
        mb.open();
      }
    } catch (KettleException e) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Delete.Title"),
          BaseMessages.getString(
                  PKG, "RepositoryExplorerDialog.Partition.Delete.UnexpectedError.Message")
              + partitionSchemaName
              + "]",
          e); //$NON-NLS-3$
    } finally {
      refreshPartitions();
    }
  }
 public void createPartition() {
   try {
     PartitionSchema partition = new PartitionSchema();
     PartitionSchemaDialog partitionDialog =
         new PartitionSchemaDialog(shell, partition, repository.readDatabases(), variableSpace);
     if (partitionDialog.open()) {
       // See if this partition already exists...
       ObjectId idPartition = repository.getPartitionSchemaID(partition.getName());
       if (idPartition == null) {
         if (partition.getName() != null && !partition.getName().equals("")) {
           repository.insertLogEntry(
               BaseMessages.getString(
                   RepositoryExplorer.class,
                   "PartitionsController.Message.CreatingPartition",
                   partition.getName()));
           repository.save(partition, Const.VERSION_COMMENT_INITIAL_VERSION, null);
         } else {
           MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
           mb.setMessage(
               BaseMessages.getString(
                   PKG, "RepositoryExplorerDialog.Partition.Edit.InvalidName.Message"));
           mb.setText(
               BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Create.Title"));
           mb.open();
         }
       } else {
         MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
         mb.setMessage(
             BaseMessages.getString(
                 PKG, "RepositoryExplorerDialog.Partition.Create.AlreadyExists.Message"));
         mb.setText(
             BaseMessages.getString(
                 PKG, "RepositoryExplorerDialog.Partition.Create.AlreadyExists.Title"));
         mb.open();
       }
     }
   } catch (KettleException e) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(
             PKG, "RepositoryExplorerDialog.Partition.Create.UnexpectedError.Title"),
         BaseMessages.getString(
             PKG, "RepositoryExplorerDialog.Partition.Create.UnexpectedError.Message"),
         e);
   } finally {
     refreshPartitions();
   }
 }
  public void okPressed() {
    if (fileDialogMode == VFS_DIALOG_SAVEAS && "".equals(fileNameText.getText())) { // $NON-NLS-1$
      // do nothing, user did not enter a file name for saving
      MessageBox messageDialog = new MessageBox(dialog, SWT.OK);
      messageDialog.setText(Messages.getString("VfsFileChooserDialog.error")); // $NON-NLS-1$
      messageDialog.setMessage(
          Messages.getString("VfsFileChooserDialog.noFilenameEntered")); // $NON-NLS-1$
      messageDialog.open();
      return;
    }

    if (fileDialogMode == VFS_DIALOG_SAVEAS) {
      try {
        FileObject toBeSavedFile =
            vfsBrowser.getSelectedFileObject().resolveFile(fileNameText.getText());
        if (toBeSavedFile.exists()) {
          MessageBox messageDialog = new MessageBox(dialog, SWT.YES | SWT.NO);
          messageDialog.setText(
              Messages.getString("VfsFileChooserDialog.fileExists")); // $NON-NLS-1$
          messageDialog.setMessage(
              Messages.getString("VfsFileChooserDialog.fileExistsOverwrite")); // $NON-NLS-1$
          int flag = messageDialog.open();
          if (flag == SWT.NO) {
            return;
          }
        }
      } catch (FileSystemException e) {
        e.printStackTrace();
      }
    }
    if (fileDialogMode == VFS_DIALOG_SAVEAS) {
      enteredFileName = fileNameText.getText();
    }

    try {
      if (fileDialogMode == VFS_DIALOG_OPEN_FILE
          && vfsBrowser.getSelectedFileObject().getType().equals(FileType.FOLDER)) {
        // try to open this node, it is a directory
        vfsBrowser.selectTreeItemByFileObject(vfsBrowser.getSelectedFileObject(), true);
        return;
      }
    } catch (FileSystemException e) {
    }

    okPressed = true;
    hideCustomPanelChildren();
    dialog.dispose();
  }
  private void ok() {
    if (Const.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());

    int nritems = wFields.nrNonEmpty();

    jobEntry.connections = new DatabaseMeta[nritems];
    jobEntry.waitfors = new String[nritems];
    jobEntry.waittimes = new int[nritems];

    for (int i = 0; i < nritems; i++) {
      String arg = wFields.getNonEmpty(i).getText(1);
      DatabaseMeta dbMeta = jobMeta.findDatabase(arg);
      if (dbMeta != null) {
        jobEntry.connections[i] = dbMeta;
        jobEntry.waitfors[i] = "" + Const.toInt(wFields.getNonEmpty(i).getText(2), 0);
        jobEntry.waittimes[i] =
            JobEntryCheckDbConnections.getWaitTimeByDesc(wFields.getNonEmpty(i).getText(3));
      }
    }
    dispose();
  }
Esempio n. 11
0
  /**
   * Starts the report thread and shows a progress bar dialog. Only to be used by reports with SQL
   * and HQL data sources at the moment
   */
  public void viewBatchReport() {
    JasperPrint jp_0 = reportList.get(0);
    List<Integer> reportSizes = new ArrayList();
    for (int i = 0; i < reportList.size(); i++) {
      reportSizes.add(Integer.valueOf(reportList.get(i).getPages().size()));
    }

    for (int i = 1; i < reportList.size(); i++) {
      List<JRPrintPage> pageList = reportList.get(i).getPages();
      for (int j = 0; j < reportSizes.get(i).intValue(); j++) {
        jp_0.addPage(pageList.get(j));
      }
    }

    if (jp_0 != null) {
      if (jp_0.getPages().size() > 0) {
        ViewerApp viewer = new ViewerApp();
        viewer.getReportViewer().setDocument(jp_0);
        viewer.open();
      } else if (!reportGenerationCancelled) {
        MessageBox mNoPages = new MessageBox(parent, SWT.ICON_ERROR | SWT.OK);
        mNoPages.setText("Report Has No Pages");
        mNoPages.setMessage(
            "The report you are trying to generate does not contain any data. \n\nPlease check the input values you have entered (such as dates) for this report, and try again.");
        mNoPages.open();
      }
    }
  }
Esempio n. 12
0
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    stepname = wStepname.getText(); // return value
    // copy info to TextFileInputMeta class (input)
    input.setSql(wSQL.getText());
    input.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
    input.setExecutedEachInputRow(wEachRow.getSelection());
    input.setSingleStatement(wSingleStatement.getSelection());
    input.setVariableReplacementActive(wVariables.getSelection());
    input.setQuoteString(wQuoteString.getSelection());
    input.setParams(wSetParams.getSelection());
    input.setInsertField(wInsertField.getText());
    input.setUpdateField(wUpdateField.getText());
    input.setDeleteField(wDeleteField.getText());
    input.setReadField(wReadField.getText());

    int nrargs = wFields.nrNonEmpty();
    input.allocate(nrargs);
    if (log.isDebug())
      logDebug(BaseMessages.getString(PKG, "ExecSQLDialog.Log.FoundArguments", +nrargs + ""));
    for (int i = 0; i < nrargs; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getArguments()[i] = item.getText(1);
    }

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

    dispose();
  }
Esempio n. 13
0
  /**
   * The action has been activated. The argument of the method represents the 'real' action sitting
   * in the workbench UI.
   *
   * @see IWorkbenchWindowActionDelegate#run
   */
  public void run(IAction action) {
    AlisaEditor editor;
    Requirement requirement;

    requirement = null;
    editor = null;
    IEditorPart editorPart = window.getActivePage().getActiveEditor();

    if (editorPart instanceof AlisaEditor) {
      editor = (AlisaEditor) editorPart;
    }

    if (editor != null) {
      Object o =
          ((IStructuredSelection)
                  (editor.getTableViewer(AlisaEditor.INDEX_TABLE_REQUIREMENTS).getSelection()))
              .getFirstElement();
      if (o instanceof Requirement) {
        requirement = (Requirement) o;
      }
    }

    if (requirement == null) {
      MessageBox dialog = new MessageBox(window.getShell(), SWT.OK);
      dialog.setText("Alisa CAE Generator");
      dialog.setMessage("You must select a requirement");
      dialog.open();
    } else {
      //			GeneratorCAE.init();
      //			GeneratorCAE.generate (null, requirement);
      //			GeneratorCAE.save(edu.cmu.sei.alisa.analysis.utils.Utils.getSelectedProject());
      //			AlisaDebug.debug("[GenerateCAE] selected requirement=" + requirement);
    }
  }
Esempio n. 14
0
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;
    input.setCommitSize(Const.toInt(wCommit.getText(), 0));
    stepname = wStepname.getText(); // return value
    input.setSqlFieldName(wSQLFieldName.getText());
    // copy info to TextFileInputMeta class (input)
    input.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));

    input.setInsertField(wInsertField.getText());
    input.setUpdateField(wUpdateField.getText());
    input.setDeleteField(wDeleteField.getText());
    input.setReadField(wReadField.getText());
    input.setSqlFromfile(wSQLFromFile.getSelection());
    input.SetSendOneStatement(wSendOneStatement.getSelection());
    if (input.getDatabaseMeta() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          BaseMessages.getString(
              PKG, "ExecSQLRowDialog.InvalidConnection.DialogMessage")); // $NON-NLS-1$
      mb.setText(
          BaseMessages.getString(
              PKG, "ExecSQLRowDialog.InvalidConnection.DialogTitle")); // $NON-NLS-1$
      mb.open();
      return;
    }

    dispose();
  }
 private void displayMessageBox(int widgetArguments, String title, String message) {
   MessageBox errorDialog =
       new MessageBox(vfsBrowser.getDisplay().getActiveShell(), widgetArguments);
   errorDialog.setText(title); // $NON-NLS-1$
   errorDialog.setMessage(message);
   errorDialog.open();
 }
Esempio n. 16
0
  private boolean saveAs() {

    FileDialog saveDialog = new FileDialog(shell, SWT.SAVE);
    saveDialog.setFilterExtensions(new String[] {"*.adr;", "*.*"});
    saveDialog.setFilterNames(new String[] {"Address Books (*.adr)", "All Files "});

    saveDialog.open();
    String name = saveDialog.getFileName();

    if (name.equals("")) return false;

    if (name.indexOf(".adr") != name.length() - 4) {
      name += ".adr";
    }

    File file = new File(saveDialog.getFilterPath(), name);
    if (file.exists()) {
      MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
      box.setText(resAddressBook.getString("Save_as_title"));
      box.setMessage(
          resAddressBook.getString("File")
              + file.getName()
              + " "
              + resAddressBook.getString("Query_overwrite"));
      if (box.open() != SWT.YES) {
        return false;
      }
    }
    this.file = file;
    return save();
  }
  protected void createNewMessageBox() {
    Shell shell = getParentObject();

    dialog = new MessageBox(shell, acceptBtn | cancelBtn);
    dialog.setText(getTitle());
    dialog.setMessage(this.getMessage());
  }
Esempio n. 18
0
  private StackFileInfo postSTackFile(
      StackFileInfo stackFileInfo, ParserConfig config, String filter, boolean isRecent) {
    if (stackFileInfo.getTotalWorkingCount() <= 0) {
      MessageBox messageBox =
          new MessageBox(
              m_parentComposite.getShell(), SWT.ICON_ERROR | SWT.YES | SWT.APPLICATION_MODAL);
      messageBox.setText("File open error");
      messageBox.setMessage(
          new StringBuilder(200)
              .append("A working thread is not exists in ")
              .append(stackFileInfo.getFilename())
              .append(". configure a ")
              .append(config.getConfigFilename())
              .append(". ")
              .toString());
      messageBox.open();
      return null;
    }

    if (!isRecent) {
      PreferenceManager prefManager = PreferenceManager.get();
      if (filter == null) {
        prefManager.addToStackFiles(stackFileInfo.getFilename());
      }
      prefManager.addToAnalyzedStackFiles(stackFileInfo.getFilename());
    }
    return stackFileInfo;
  }
Esempio n. 19
0
  private ParserConfig selectAdoptiveParserConfig() {
    PreferenceManager prefManager = PreferenceManager.get();
    String configFile = prefManager.getCurrentParserConfig();
    if (m_isDefaultConfiguration) {
      configFile = XMLReader.DEFAULT_XMLCONFIG;
    }

    if (configFile == null) {
      MessageBox messageBox =
          new MessageBox(
              m_parentComposite.getShell(),
              SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.APPLICATION_MODAL);
      messageBox.setText("Check Setting selection");
      messageBox.setMessage(
          "The configuration file is not selected.\r\nDo you want to use the default configuration?");
      int result = messageBox.open();
      if (result == SWT.YES) {
        configFile = XMLReader.DEFAULT_XMLCONFIG;
      } else {
        configFile = selectCurrentParserConfig();
        if (configFile == null) {
          throw new RuntimeException("Parser config file is not selected!");
        }
      }
    }

    ParserConfigReader reader = new ParserConfigReader(configFile);
    return reader.read();
  }
  private void ok() {
    if (Const.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.setEscaped(wEscaped.getText());
    jobEntry.setLineterminated(wLineterminated.getText());
    jobEntry.setLinestarted(wLinestarted.getText());
    jobEntry.setReplacedata(wReplacedata.getSelection());
    jobEntry.setIgnorelines(wIgnorelines.getText());
    jobEntry.setListattribut(wListattribut.getText());
    jobEntry.prorityvalue = wProrityValue.getSelectionIndex();
    jobEntry.setLocalInfile(wLocalInfile.getSelection());

    jobEntry.setAddFileToResult(wAddFileToResult.getSelection());

    dispose();
  }
Esempio n. 21
0
 private int showMultipleOutputTablesWarning(boolean includeCancel) {
   MessageBox mb =
       new MessageBox(shell, SWT.OK | (includeCancel ? SWT.CANCEL : SWT.NONE) | SWT.ICON_ERROR);
   mb.setMessage(BaseMessages.getString(PKG, "SapInputDialog.MultipleOutputTables.DialogMessage"));
   mb.setText(BaseMessages.getString(PKG, "SapInputDialog.MultipleOutputTables.DialogTitle"));
   return mb.open();
 }
Esempio n. 22
0
 private int showDatabaseWarning(boolean includeCancel) {
   MessageBox mb =
       new MessageBox(shell, SWT.OK | (includeCancel ? SWT.CANCEL : SWT.NONE) | SWT.ICON_ERROR);
   mb.setMessage(BaseMessages.getString(PKG, "SapInputDialog.InvalidConnection.DialogMessage"));
   mb.setText(BaseMessages.getString(PKG, "SapInputDialog.InvalidConnection.DialogTitle"));
   return mb.open();
 }
 public void promptForNewFolder() {
   boolean done = false;
   String defaultText = "New Folder";
   String text = defaultText;
   while (!done) {
     if (text == null) {
       text = defaultText;
     }
     TextInputDialog textDialog =
         new TextInputDialog(
             Messages.getString("VfsBrowser.enterNewFolderName"), text, 500, 160); // $NON-NLS-1$
     text = textDialog.open();
     if (text != null && !"".equals(text)) { // $NON-NLS-1$
       try {
         vfsBrowser.createFolder(text); // $NON-NLS-1$
         done = true;
       } catch (FileSystemException e) {
         MessageBox errorDialog = new MessageBox(newFolderButton.getShell(), SWT.OK);
         errorDialog.setText(Messages.getString("VfsBrowser.error")); // $NON-NLS-1$
         if (e.getCause() != null) {
           errorDialog.setMessage(e.getCause().getMessage());
         } else {
           errorDialog.setMessage(e.getMessage());
         }
         errorDialog.open();
       }
     } else {
       done = true;
     }
   }
 }
Esempio n. 24
0
  private void prepare() {
    try {
      this.container = new FrequencyContainer(this.chiffre, this.plength);

      boolean a = container.isBlocked();
      String b = container.cutText(chiffre);
      String c = container.formatPreview(a, plength, b);

      this.tsample.setText(c);

      container.initGraph(cgraph);
      container.activateComparator(
          container.getReferenceText(),
          DataProvider.getInstance().getAlphabet(container.getAlphabetIdent()));
      container.enableButtons(cphrase);
      container.show();
    } catch (NoContentException ncEx) {
      // not my fault. just in case.
      String message = Messages.FrequencyGui_mbox_missing;
      MessageBox box = new MessageBox(null, SWT.ICON_WARNING);
      box.setText(Messages.VigenereGlobal_mbox_info);
      box.setMessage(message);
      box.open();
    }
  }
 private int ask(String message, String title) {
   Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
   MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
   messageBox.setMessage(message);
   messageBox.setText(title);
   return messageBox.open();
 }
 public boolean performOk() {
   if (super.performOk() && shouldRevalidateOnSettingsChange()) {
     MessageBox mb =
         new MessageBox(
             this.getShell(),
             SWT.APPLICATION_MODAL
                 | SWT.YES
                 | SWT.NO
                 | SWT.CANCEL
                 | SWT.ICON_INFORMATION
                 | SWT.RIGHT);
     mb.setText(SSEUIMessages.Validation_Title);
     /* Choose which message to use based on if its project or workspace settings */
     String msg =
         (getProject() == null)
             ? SSEUIMessages.Validation_Workspace
             : SSEUIMessages.Validation_Project;
     mb.setMessage(msg);
     switch (mb.open()) {
       case SWT.CANCEL:
         return false;
       case SWT.YES:
         storeValues();
         ValidateJob job = new ValidateJob(SSEUIMessages.Validation_jobName);
         job.schedule();
       case SWT.NO:
         storeValues();
       default:
         return true;
     }
   }
   return true;
 }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    input.setDatabase(transMeta.findDatabase(wConnection.getText()));
    input.setSchemaname(wSchemaname.getText());
    input.setTablename(wTablenameText.getText());
    input.setTablenameInField(wTablenameInField.getSelection());
    input.setDynamicTablenameField(wTableName.getText());
    input.setDynamicColumnnameField(wColumnName.getText());
    input.setResultFieldName(wResult.getText());

    stepname = wStepname.getText(); // return value

    if (input.getDatabase() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          BaseMessages.getString(
              PKG, "ColumnExistsDialog.InvalidConnection.DialogMessage")); // $NON-NLS-1$
      mb.setText(
          BaseMessages.getString(
              PKG, "ColumnExistsDialog.InvalidConnection.DialogTitle")); // $NON-NLS-1$
      mb.open();
    }

    dispose();
  }
Esempio n. 28
0
  private void getTableName() {
    DatabaseMeta inf = null;
    // New class: SelectTableDialog
    int connr = wConnection.getSelectionIndex();
    if (connr >= 0) inf = transMeta.getDatabase(connr);

    if (inf != null) {
      log.logDebug(
          toString(),
          Messages.getString("UpdateDialog.Log.LookingAtConnection")
              + inf.toString()); // $NON-NLS-1$

      DatabaseExplorerDialog std =
          new DatabaseExplorerDialog(shell, SWT.NONE, inf, transMeta.getDatabases());
      std.setSelectedSchema(wSchema.getText());
      std.setSelectedTable(wTable.getText());
      std.setSplitSchemaAndTable(true);
      if (std.open() != null) {
        wSchema.setText(Const.NVL(std.getSchemaName(), ""));
        wTable.setText(Const.NVL(std.getTableName(), ""));
      }
    } else {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          Messages.getString("UpdateDialog.InvalidConnection.DialogMessage")); // $NON-NLS-1$
      mb.setText(Messages.getString("UpdateDialog.InvalidConnection.DialogTitle")); // $NON-NLS-1$
      mb.open();
    }
  }
  // Preview the data
  private void preview() {
    GetTableNamesMeta oneMeta = new GetTableNamesMeta();

    getInfo(oneMeta);
    if (oneMeta.getDatabase() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          BaseMessages.getString(PKG, "GetTableNamesDialog.InvalidConnection.DialogMessage"));
      mb.setText(BaseMessages.getString(PKG, "GetTableNamesDialog.InvalidConnection.DialogTitle"));
      mb.open();
      return;
    }
    if (!checkUserInput(oneMeta)) return;

    TransMeta previewMeta =
        TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());

    EnterNumberDialog numberDialog =
        new EnterNumberDialog(
            shell,
            props.getDefaultPreviewSize(),
            BaseMessages.getString(PKG, "GetTableNamesDialog.PreviewSize.DialogTitle"),
            BaseMessages.getString(PKG, "GetTableNamesDialog.PreviewSize.DialogMessage"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
      TransPreviewProgressDialog progressDialog =
          new TransPreviewProgressDialog(
              shell, previewMeta, new String[] {wStepname.getText()}, new int[] {previewSize});
      progressDialog.open();

      if (!progressDialog.isCancelled()) {
        Trans trans = progressDialog.getTrans();
        String loggingText = progressDialog.getLoggingText();

        if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
          EnterTextDialog etd =
              new EnterTextDialog(
                  shell,
                  BaseMessages.getString(PKG, "System.Dialog.Error.Title"),
                  BaseMessages.getString(PKG, "GetTableNamesDialog.ErrorInPreview.DialogMessage"),
                  loggingText,
                  true);
          etd.setReadOnly();
          etd.open();
        }

        PreviewRowsDialog prd =
            new PreviewRowsDialog(
                shell,
                transMeta,
                SWT.NONE,
                wStepname.getText(),
                progressDialog.getPreviewRowsMeta(wStepname.getText()),
                progressDialog.getPreviewRows(wStepname.getText()),
                loggingText);
        prd.open();
      }
    }
  }
 @Subscribe
 public void showError(ApplicationError error) {
   error.getThrowable().printStackTrace();
   MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR);
   box.setMessage(error.getMessage());
   box.setText(resourceBundle.getString("mainForm.error"));
   box.open();
 }