/**
   * Ensures that fields are set. Update checkEnable / use to checkConnection().
   *
   * @return
   */
  @Override
  protected boolean checkFieldsValue() {

    if (metadataNameText.getCharCount() == 0) {
      metadataNameText.forceFocus();
      updateStatus(IStatus.ERROR, Messages.getString("FileStep1.nameAlert")); // $NON-NLS-1$
      return false;
    } else if (!MetadataToolHelper.isValidSchemaName(metadataNameText.getText())) {
      metadataNameText.forceFocus();
      updateStatus(
          IStatus.ERROR, Messages.getString("FileStep1.nameAlertIllegalChar")); // $NON-NLS-1$
      return false;
    } else if (nameExist(metadataNameText.getText())) {
      updateStatus(
          IStatus.ERROR, Messages.getString("CommonWizard.nameAlreadyExist")); // $NON-NLS-1$
      return false;
    }

    if (tableEditorView.getMetadataEditor().getBeanCount() > 0) {
      updateStatus(IStatus.OK, null);
      return true;
    }
    updateStatus(IStatus.ERROR, Messages.getString("FileStep3.itemAlert")); // $NON-NLS-1$

    return false;
  }
  /**
   * DOC zli Comment method "guessSchema".
   *
   * @param processDescription
   */
  public void guessSchema(ProcessDescription processDescription) {
    informationLabel.setText(
        "   " + Messages.getString("FileStep3.guessIsDone")); // $NON-NLS-1$ //$NON-NLS-2$
    // clear all items
    tableEditorView.getMetadataEditor().removeAll();
    List<MetadataColumn> columns = new ArrayList<MetadataColumn>();

    List<IMetadataColumn> listColumns = processDescription.getSchema().get(0).getListColumns();
    int size = listColumns.size();
    if (size > 0) {
      for (int i = 0; i < size; i++) {
        MetadataColumn metadataColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
        metadataColumn.setNullable(listColumns.get(i).isNullable());
        metadataColumn.setLength(listColumns.get(i).getLength());
        metadataColumn.setPattern(listColumns.get(i).getPattern());
        metadataColumn.setTalendType(listColumns.get(i).getTalendType());
        metadataColumn.setPrecision(listColumns.get(i).getPrecision());
        metadataColumn.setLabel(listColumns.get(i).getLabel());
        columns.add(i, metadataColumn);
      }
    }
    tableEditorView.getMetadataEditor().addAll(columns);
    tableEditorView.getTableViewerCreator().layout();
    informationLabel.setText(Messages.getString("FileStep3.guessTip")); // $NON-NLS-1$
  }
  /**
   * DOC ocarbone Comment method "addTreeNavigator".
   *
   * @param parent
   * @param width
   * @param height
   */
  private void addTreeNavigator(Composite parent, int width, int height) {
    // Group
    Group group =
        Form.createGroup(
            parent,
            1,
            Messages.getString("DatabaseTableForm.navigatorTree"),
            height); //$NON-NLS-1$

    // ScrolledComposite
    ScrolledComposite scrolledCompositeFileViewer =
        new ScrolledComposite(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE);
    scrolledCompositeFileViewer.setExpandHorizontal(true);
    scrolledCompositeFileViewer.setExpandVertical(true);
    GridData gridData1 = new GridData(GridData.FILL_BOTH);
    gridData1.widthHint = width + 12;
    gridData1.heightHint = height;
    gridData1.horizontalSpan = 2;
    scrolledCompositeFileViewer.setLayoutData(gridData1);

    tableViewerCreator = new TableViewerCreator(scrolledCompositeFileViewer);
    tableViewerCreator.setHeaderVisible(false);
    tableViewerCreator.setColumnsResizableByDefault(false);
    tableViewerCreator.setBorderVisible(false);
    tableViewerCreator.setLinesVisible(false);
    tableViewerCreator.setLayoutMode(LAYOUT_MODE.NONE);
    tableViewerCreator.setCheckboxInFirstColumn(false);
    tableViewerCreator.setFirstColumnMasked(false);

    tableNavigator = tableViewerCreator.createTable();
    tableNavigator.setLayoutData(new GridData(GridData.FILL_BOTH));

    TableColumn tableColumn = new TableColumn(tableNavigator, SWT.NONE);
    tableColumn.setText(
        Messages.getString("DatabaseTableForm.tableColumnText.talbe")); // $NON-NLS-1$
    tableColumn.setWidth(width + 120);

    scrolledCompositeFileViewer.setContent(tableNavigator);
    scrolledCompositeFileViewer.setSize(width + 12, height);

    // // Button Add metadata Table
    Composite button =
        Form.startNewGridLayout(group, HEIGHT_BUTTON_PIXEL, false, SWT.CENTER, SWT.CENTER);
    addTableButton =
        new UtilsButton(
            button,
            Messages.getString("DatabaseTableForm.AddTable"),
            width - 30,
            HEIGHT_BUTTON_PIXEL); //$NON-NLS-1$

    Composite rmButton =
        Form.startNewGridLayout(group, HEIGHT_BUTTON_PIXEL, false, SWT.CENTER, SWT.CENTER);
    removeTableButton =
        new UtilsButton(rmButton, "Remove Schema", width - 30, HEIGHT_BUTTON_PIXEL); // $NON-NLS-1$
  }
  @Override
  protected void addFields() {

    // Header Fields
    Composite mainComposite =
        Form.startNewDimensionnedGridLayout(this, 2, WIDTH_GRIDDATA_PIXEL, 60);
    metadataNameText =
        new LabelledText(
            mainComposite, Messages.getString("FileStep3.metadataName")); // $NON-NLS-1$
    metadataCommentText =
        new LabelledText(
            mainComposite, Messages.getString("FileStep3.metadataComment")); // $NON-NLS-1$

    // Group MetaData
    Group groupMetaData =
        Form.createGroup(
            this, 1, Messages.getString("FileStep3.groupMetadata"), 280); // $NON-NLS-1$
    Composite compositeMetaData = Form.startNewGridLayout(groupMetaData, 1);

    // Composite Guess
    Composite compositeGuessButton =
        Form.startNewDimensionnedGridLayout(compositeMetaData, 2, WIDTH_GRIDDATA_PIXEL, 40);
    informationLabel = new Label(compositeGuessButton, SWT.NONE);
    informationLabel.setText(
        Messages.getString("FileStep3.informationLabel")
            + "                                                  "); //$NON-NLS-1$ //$NON-NLS-2$
    informationLabel.setSize(500, HEIGHT_BUTTON_PIXEL);

    guessButton =
        new UtilsButton(
            compositeGuessButton,
            Messages.getString("FileStep3.guess"),
            WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
            HEIGHT_BUTTON_PIXEL);
    guessButton.setToolTipText(Messages.getString("FileStep3.guessTip")); // $NON-NLS-1$

    // Composite MetadataTableEditorView
    Composite compositeTable =
        Form.startNewDimensionnedGridLayout(compositeMetaData, 1, WIDTH_GRIDDATA_PIXEL, 200);
    compositeTable.setLayout(new FillLayout());
    metadataEditor =
        new MetadataEmfTableEditor(
            Messages.getString("FileStep3.metadataDescription")); // $NON-NLS-1$
    tableEditorView = new MetadataEmfTableEditorView(compositeTable, SWT.NONE);

    if (!isInWizard()) {
      // Bottom Button
      Composite compositeBottomButton =
          Form.startNewGridLayout(this, 2, false, SWT.CENTER, SWT.CENTER);
      // Button Cancel
      cancelButton =
          new UtilsButton(
              compositeBottomButton,
              Messages.getString("CommonWizard.cancel"),
              WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
              HEIGHT_BUTTON_PIXEL);
    }
    // addUtilsButtonListeners(); changed by hqzhang, need not call here, has been called in
    // setupForm()
  }
Exemple #5
0
  @Override
  public boolean performFinish() {
    boolean formIsPerformed = false;
    formIsPerformed = page1.isPageComplete();
    if (formIsPerformed) {
      IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
      try {
        if (creation) {
          String nextId = factory.getNextId();
          connectionProperty.setId(nextId);
          factory.create(connectionItem, salesforceSchemaWizardPage0.getDestinationPath());
        } else {
          // update
          RepositoryUpdateManager.updateFileConnection(connectionItem);
          refreshInFinish(salesforceSchemaWizardPage0.isNameModifiedByUser());
          updateConnectionItem();
        }
        ProxyRepositoryFactory.getInstance()
            .saveProject(ProjectManager.getInstance().getCurrentProject());

      } catch (Exception e) {
        String detailError = e.toString();
        new ErrorDialogWidthDetailArea(
            getShell(),
            PID,
            Messages.getString("CommonWizard.persistenceException"), // $NON-NLS-1$
            detailError);
        log.error(
            Messages.getString("CommonWizard.persistenceException")
                + "\n"
                + detailError); //$NON-NLS-1$ //$NON-NLS-2$
        return false;
      }
      return true;
    } else {
      return false;
    }
  }
Exemple #6
0
  @Override
  public void addPages() {
    if (isToolbar) {
      pathToSave = null;
    }
    salesforceSchemaWizardPage0 =
        new Step0WizardPage(
            connectionProperty,
            pathToSave,
            ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA,
            !isRepositoryObjectEditable(),
            creation);

    salesforceSchemaWizardPage0.setTitle(
        Messages.getString("SalesforceWizardPage.titleCreate.Step")
            + " 1 " //$NON-NLS-1$ //$NON-NLS-2$
            + Messages.getString("FileWizardPage.of")
            + ALL_STEPS); //$NON-NLS-1$
    salesforceSchemaWizardPage0.setDescription(
        Messages.getString("SalesforceWizardPage.descriptionCreate.Step1")); // $NON-NLS-1$
    addPage(salesforceSchemaWizardPage0);
    if (creation) {
      setWindowTitle(Messages.getString("SalesforceSchemaWizard.windowTitleCreate")); // $NON-NLS-1$
    } else {
      setWindowTitle(Messages.getString("SalesforceSchemaWizard.windowTitleUpdate")); // $NON-NLS-1$
    }
    page1 =
        new SalesforceWizardPage(
            1,
            connectionItem,
            isRepositoryObjectEditable(),
            existingNames,
            salesforceAPI,
            contextModeManager);
    page1.setTitle(
        Messages.getString("SalesforceWizardPage.titleCreate.Step")
            + " 2 " //$NON-NLS-1$ //$NON-NLS-2$
            + Messages.getString("FileWizardPage.of")
            + ALL_STEPS); //$NON-NLS-1$
    page1.setDescription(
        Messages.getString("SalesforceWizardPage.descriptionCreate.Step2")); // $NON-NLS-1$
    addPage(page1);
    page1.setPageComplete(false);
  }
  /** run a ShadowProcess to determined the Metadata. */
  protected void runShadowProcess() {
    initGuessSchema();
    LdifFileConnection originalValueConnection = getOriginalValueConnection();
    try {
      informationLabel.setText(
          "   " + Messages.getString("FileStep3.guessProgress")); // $NON-NLS-1$ //$NON-NLS-2$

      // get the XmlArray width an adapt ProcessDescription
      ProcessDescription processDescription = getProcessDescription(originalValueConnection);
      CsvArray csvArray =
          ShadowProcessHelper.getCsvArray(processDescription, "FILE_LDIF"); // $NON-NLS-1$
      if (csvArray == null) {
        informationLabel.setText(
            "   " + Messages.getString("FileStep3.guessFailure")); // $NON-NLS-1$ //$NON-NLS-2$

      } else {
        refreshMetaDataTable(csvArray, processDescription);
      }

    } catch (CoreException e) {
      if (getParent().getChildren().length == 1) {
        new ErrorDialogWidthDetailArea(
            getShell(),
            PID,
            Messages.getString("FileStep3.guessFailureTip")
                + "\n" //$NON-NLS-1$ //$NON-NLS-2$
                + Messages.getString("FileStep3.guessFailureTip2"),
            e.getMessage()); // $NON-NLS-1$
      } else {
        new ErrorDialogWidthDetailArea(
            getShell(),
            PID,
            Messages.getString("FileStep3.guessFailureTip"),
            e.getMessage()); // $NON-NLS-1$
      }
      log.error(
          Messages.getString("FileStep3.guessFailure")
              + " "
              + e.getMessage()); // $NON-NLS-1$ //$NON-NLS-2$
    }
    checkFieldsValue();
  }
  /**
   * DOC ocarbone Comment method "refreshMetaData".
   *
   * @param csvArray
   */
  public void refreshMetaDataTable(final CsvArray csvArray, ProcessDescription processDescription) {
    informationLabel.setText(
        "   " + Messages.getString("FileStep3.guessIsDone")); // $NON-NLS-1$ //$NON-NLS-2$

    // clear all items
    tableEditorView.getMetadataEditor().removeAll();

    List<MetadataColumn> columns = new ArrayList<MetadataColumn>();

    if (csvArray == null || csvArray.getRows().isEmpty()) {
      return;
    } else {

      List<String[]> csvRows = csvArray.getRows();
      String[] fields = csvRows.get(0);
      // int numberOfCol = fields.size();

      Integer numberOfCol = getRightFirstRow(csvRows);

      // define the label to the metadata width the content of the first row
      int firstRowToExtractMetadata = 0;

      // the first rows is used to define the label of any metadata
      String[] label = new String[numberOfCol.intValue()];
      for (int i = 0; i < numberOfCol; i++) {
        label[i] = DEFAULT_LABEL + i;
        if (firstRowToExtractMetadata == 0) {
          label[i] =
              "" + processDescription.getSchema().get(0).getListColumns().get(i); // $NON-NLS-1$
        }
      }

      for (int i = 0; i < numberOfCol.intValue(); i++) {
        // define the first currentType and assimile it to globalType
        String globalType = null;
        int lengthValue = 0;
        int precisionValue = 0;

        int current = firstRowToExtractMetadata;
        while (globalType == null) {
          if (LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA) {
            if (i >= csvRows.get(current).length) {
              globalType = "id_String"; // $NON-NLS-1$
            } else {
              globalType = JavaDataTypeHelper.getTalendTypeOfValue(csvRows.get(current)[i]);
              current++;
              // if (current == csvRows.size()) {
              // globalType = "id_String"; //$NON-NLS-1$
              // }
            }
          } else {
            if (i >= csvRows.get(current).length) {
              globalType = "String"; // $NON-NLS-1$
            } else {
              globalType = PerlDataTypeHelper.getTalendTypeOfValue(csvRows.get(current)[i]);
              current++;
              // if (current == csvRows.size()) {
              // globalType = "String"; //$NON-NLS-1$
              // }
            }
          }
        }

        // for another lines
        for (int f = firstRowToExtractMetadata; f < csvRows.size(); f++) {
          fields = csvRows.get(f);
          if (fields.length > i) {
            String value = fields[i];
            if (!value.equals("")) { // $NON-NLS-1$
              if (LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA) {
                if (!JavaDataTypeHelper.getTalendTypeOfValue(value).equals(globalType)) {
                  globalType =
                      JavaDataTypeHelper.getCommonType(
                          globalType, JavaDataTypeHelper.getTalendTypeOfValue(value));
                }
              } else {
                if (!PerlDataTypeHelper.getTalendTypeOfValue(value).equals(globalType)) {
                  globalType =
                      PerlDataTypeHelper.getCommonType(
                          globalType, PerlDataTypeHelper.getTalendTypeOfValue(value));
                }
              }
              if (lengthValue < value.length()) {
                lengthValue = value.length();
              }
              int positionDecimal = 0;
              if (value.indexOf(',') > -1) {
                positionDecimal = value.lastIndexOf(',');
                precisionValue = lengthValue - positionDecimal;
              } else if (value.indexOf('.') > -1) {
                positionDecimal = value.lastIndexOf('.');
                precisionValue = lengthValue - positionDecimal;
              }
            } else {
              IPreferenceStore preferenceStore = null;
              if (GlobalServiceRegister.getDefault()
                  .isServiceRegistered(IDesignerCoreUIService.class)) {
                IDesignerCoreUIService designerCoreUiService =
                    (IDesignerCoreUIService)
                        GlobalServiceRegister.getDefault().getService(IDesignerCoreUIService.class);
                preferenceStore = designerCoreUiService.getPreferenceStore();
              }
              if (preferenceStore != null
                  && preferenceStore.getString(MetadataTypeLengthConstants.VALUE_DEFAULT_TYPE)
                      != null
                  && !preferenceStore
                      .getString(MetadataTypeLengthConstants.VALUE_DEFAULT_TYPE)
                      .equals("")) { // $NON-NLS-1$
                globalType =
                    preferenceStore.getString(MetadataTypeLengthConstants.VALUE_DEFAULT_TYPE);
                if (preferenceStore.getString(MetadataTypeLengthConstants.VALUE_DEFAULT_LENGTH)
                        != null
                    && !preferenceStore
                        .getString(MetadataTypeLengthConstants.VALUE_DEFAULT_LENGTH)
                        .equals("")) { // $NON-NLS-1$
                  lengthValue =
                      Integer.parseInt(
                          preferenceStore.getString(
                              MetadataTypeLengthConstants.VALUE_DEFAULT_LENGTH));
                }
              }
            }
          }
        }

        // define the metadataColumn to field i
        MetadataColumn metadataColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
        // metadataColumn.setPattern("\"dd-MM-yyyy\"");
        // Convert javaType to TalendType
        String talendType = null;
        talendType = globalType;
        if (globalType.equals(JavaTypesManager.FLOAT.getId())
            || globalType.equals(JavaTypesManager.DOUBLE.getId())) {
          metadataColumn.setPrecision(precisionValue);
        } else {
          metadataColumn.setPrecision(0);
        }
        metadataColumn.setTalendType(talendType);
        metadataColumn.setLength(lengthValue);

        // Check the label and add it to the table
        metadataColumn.setLabel(
            tableEditorView.getMetadataEditor().getNextGeneratedColumnName(label[i]));
        columns.add(i, metadataColumn);
      }
    }
    tableEditorView.getMetadataEditor().addAll(columns);
    checkFieldsValue();
    tableEditorView.getTableViewerCreator().layout();
    tableEditorView.getTableViewerCreator().getTable().deselectAll();
    informationLabel.setText(Messages.getString("FileStep3.guessTip")); // $NON-NLS-1$
  }
  public void refreshMetaDataTable(final CsvArray csvArray, ProcessDescription processDescription) {
    informationLabel.setText(
        "   " + Messages.getString("FileStep3.guessIsDone")); // $NON-NLS-1$ //$NON-NLS-2$
    // clear all items
    tableEditorView.getMetadataEditor().removeAll();

    List<MetadataColumn> columns = new ArrayList<MetadataColumn>();
    if (csvArray == null || csvArray.getRows().isEmpty()) {
      return;
    } else {

      List<String[]> csvRows = csvArray.getRows();
      Integer numberOfCol = getRightFirstRow(csvRows);

      // define the label to the metadata width the content of the first row
      int firstRowToExtractMetadata = 0;
      List<IMetadataColumn> listColumns = processDescription.getSchema().get(0).getListColumns();
      // the first rows is used to define the label of any metadata
      String[] label = new String[numberOfCol.intValue()];
      for (int i = 0; i < numberOfCol; i++) {
        label[i] = DEFAULT_LABEL + i;
        if (firstRowToExtractMetadata == 0) {

          label[i] = "" + listColumns.get(i); // $NON-NLS-1$
        }
      }

      for (int i = 0; i < numberOfCol.intValue(); i++) {
        // define the first currentType and assimile it to globalType
        String globalType = null;
        int lengthValue = 0;
        int precisionValue = 0;
        boolean nullAble = true;

        int current = firstRowToExtractMetadata;
        while (globalType == null) {
          String value = csvRows.get(current)[i];
          if (LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA) {
            if (i >= csvRows.get(current).length) {
              globalType = "id_String"; // $NON-NLS-1$
            } else {
              if (value != null && !"".equals(value)) { // $NON-NLS-1$
                globalType = JavaDataTypeHelper.getTalendTypeOfValue(value);
              } else {
                globalType = listColumns.get(i).getTalendType();
              }
              current++;
            }
          } else {
            if (i >= csvRows.get(current).length) {
              globalType = "String"; // $NON-NLS-1$
            } else {
              globalType = PerlDataTypeHelper.getTalendTypeOfValue(value);
              current++;
            }
          }
        }
        nullAble = listColumns.get(i).isNullable();
        lengthValue = listColumns.get(i).getLength();
        precisionValue = listColumns.get(i).getPrecision();

        // define the metadataColumn to field i
        MetadataColumn metadataColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
        // Convert javaType to TalendType
        String talendType = null;
        if (LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA) {
          talendType = globalType;
          if (globalType.equals(JavaTypesManager.FLOAT.getId())
              || globalType.equals(JavaTypesManager.DOUBLE.getId())) {
            metadataColumn.setPrecision(precisionValue);
          } else {
            metadataColumn.setPrecision(0);
          }
        } else {
          talendType =
              PerlTypesManager.getNewTypeName(
                  MetadataTalendType.loadTalendType(
                      globalType, "TALENDDEFAULT", false)); // $NON-NLS-1$
          if (globalType.equals("FLOAT")
              || globalType.equals("DOUBLE")) { // $NON-NLS-1$ //$NON-NLS-2$
            metadataColumn.setPrecision(precisionValue);
          } else {
            metadataColumn.setPrecision(0);
          }
        }

        metadataColumn.setNullable(nullAble);
        metadataColumn.setTalendType(talendType);
        metadataColumn.setLength(lengthValue);
        // bug 6758
        if (talendType.equals("id_Date")) { // $NON-NLS-1$
          String pattern = listColumns.get(i).getPattern();
          metadataColumn.setPattern(pattern);
        }
        // Check the label and add it to the table
        metadataColumn.setLabel(
            tableEditorView.getMetadataEditor().getNextGeneratedColumnName(label[i]));
        columns.add(i, metadataColumn);
      }
    }
    // tableEditorView.getMetadataEditor().registerDataList(columns);
    tableEditorView.getMetadataEditor().addAll(columns);

    checkFieldsValue();
    tableEditorView.getTableViewerCreator().layout();
    informationLabel.setText(Messages.getString("FileStep3.guessTip")); // $NON-NLS-1$
  }
  /** run a ShadowProcess to determined the Metadata. */
  protected void runShadowProcess() {
    initGuessSchema();
    SalesforceSchemaConnection originalValueConnection = getOriginalValueConnection();
    // if no file, the process don't be executed
    if (originalValueConnection.getWebServiceUrl() == null
        || originalValueConnection.getWebServiceUrl().equals("")) { // $NON-NLS-1$
      informationLabel.setText(
          "Salesforce endpoint lost" //$NON-NLS-1$
              + "                                                                              "); //$NON-NLS-1$
      return;
    }

    // try {
    informationLabel.setText(
        "   " + Messages.getString("FileStep3.guessProgress")); // $NON-NLS-1$ //$NON-NLS-2$

    // get the XmlArray width an adapt ProcessDescription
    ProcessDescription processDescription = getProcessDescription(originalValueConnection);

    IMetadataTable metadataTableOrder = readMetadataDetail();
    if (metadataTableOrder != null) {
      metadataTableClone = metadataTableOrder.clone();
      metadataTableOrder = modifyMetadataTable();
    }
    List<IMetadataTable> schema = processDescription.getSchema();
    if (schema != null && schema.size() > 0) {
      if (useAlphbet) {
        if (metadataTableOrder != null) {
          schema.get(0).setListColumns(metadataTableOrder.getListColumns());
        }
      } else {
        if (metadataTableClone != null) {
          schema.get(0).setListColumns(metadataTableClone.getListColumns());
        }
      }
    }
    // the web service url is used by tSalesforceInput, see 0004027: Studio crashes when clicking
    // Next on
    // Step 3 of SF wizard
    // processDescription.getSalesforceSchemaBean().setWebServerUrl(TSALESFORCE_INPUT_URL);
    //            CsvArray csvArray = ShadowProcessHelper.getCsvArray(processDescription,
    // "SALESFORCE_SCHEMA", true); //$NON-NLS-1$
    //
    // if (csvArray == null) {
    //                informationLabel.setText("   " +
    // Messages.getString("FileStep3.guessFailure")); //$NON-NLS-1$ //$NON-NLS-2$
    // } else {
    // refreshMetaDataTable(csvArray, processDescription);
    // }

    // } catch (CoreException e) {
    // if (getParent().getChildren().length == 1) {
    //                new ErrorDialogWidthDetailArea(getShell(), PID,
    // Messages.getString("FileStep3.guessFailureTip") + "\n" //$NON-NLS-1$ //$NON-NLS-2$
    //                        + Messages.getString("FileStep3.guessFailureTip2"), e.getMessage());
    // //$NON-NLS-1$
    // } else {
    //                new ErrorDialogWidthDetailArea(getShell(), PID,
    // Messages.getString("FileStep3.guessFailureTip"), e.getMessage()); //$NON-NLS-1$
    // }
    //            log.error(Messages.getString("FileStep3.guessFailure") + " " + e.getMessage());
    // //$NON-NLS-1$ //$NON-NLS-2$
    // }
    guessSchema(processDescription);
    checkFieldsValue();
  }
  @Override
  protected void addFields() {

    int leftCompositeWidth = 125;
    int rightCompositeWidth = WIDTH_GRIDDATA_PIXEL - leftCompositeWidth;
    int headerCompositeHeight = 80;
    int tableSettingsCompositeHeight = 15;
    int tableCompositeHeight = 200;

    int height = headerCompositeHeight + tableSettingsCompositeHeight + tableCompositeHeight;

    // Header Fields
    Composite mainComposite =
        Form.startNewDimensionnedGridLayout(this, 2, WIDTH_GRIDDATA_PIXEL, 60);

    SashForm sash = new SashForm(mainComposite, SWT.HORIZONTAL);
    GridData sashData = new GridData(GridData.FILL_BOTH);
    sash.setLayoutData(sashData);
    Composite leftComposite =
        Form.startNewDimensionnedGridLayout(sash, 1, leftCompositeWidth, height);
    Composite rightComposite =
        Form.startNewDimensionnedGridLayout(sash, 1, rightCompositeWidth, height);
    sash.setWeights(new int[] {1, 5});
    addTreeNavigator(leftComposite, leftCompositeWidth, height);
    metadataNameText =
        new LabelledText(
            rightComposite, Messages.getString("FileStep3.metadataName")); // $NON-NLS-1$
    metadataCommentText =
        new LabelledText(
            rightComposite, Messages.getString("FileStep3.metadataComment")); // $NON-NLS-1$

    // Group MetaData
    Group groupMetaData =
        Form.createGroup(
            rightComposite, 1, Messages.getString("FileStep3.groupMetadata"), 280); // $NON-NLS-1$
    Composite compositeMetaData = Form.startNewGridLayout(groupMetaData, 1);

    // Composite Guess
    Composite compositeGuessButton =
        Form.startNewDimensionnedGridLayout(compositeMetaData, 2, WIDTH_GRIDDATA_PIXEL, 40);
    informationLabel = new Label(compositeGuessButton, SWT.NONE);
    informationLabel.setText(
        Messages.getString("FileStep3.informationLabel")
            + "                                                  "); //$NON-NLS-1$ //$NON-NLS-2$
    informationLabel.setSize(500, HEIGHT_BUTTON_PIXEL);

    guessButton =
        new UtilsButton(
            compositeGuessButton,
            Messages.getString("FileStep3.guess"),
            WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
            HEIGHT_BUTTON_PIXEL);
    guessButton.setToolTipText(Messages.getString("FileStep3.guessTip")); // $NON-NLS-1$

    // Composite MetadataTableEditorView
    Composite compositeTable =
        Form.startNewDimensionnedGridLayout(compositeMetaData, 1, WIDTH_GRIDDATA_PIXEL, 200);
    compositeTable.setLayout(new FillLayout());
    metadataEditor =
        new MetadataEmfTableEditor(
            Messages.getString("FileStep3.metadataDescription")); // $NON-NLS-1$
    tableEditorView = new MetadataEmfTableEditorView(compositeTable, SWT.NONE);

    if (!isInWizard()) {
      // Bottom Button
      Composite compositeBottomButton =
          Form.startNewGridLayout(this, 2, false, SWT.CENTER, SWT.CENTER);
      // Button Cancel
      cancelButton =
          new UtilsButton(
              compositeBottomButton,
              Messages.getString("CommonWizard.cancel"),
              WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
              HEIGHT_BUTTON_PIXEL);
    }
    addUtilsButtonListeners();
  }