コード例 #1
0
  public EList getModelResourceContents(ModelResource resource) {
    EList eList = null;

    try {
      eList = resource.getEmfResource().getContents();
    } catch (ModelWorkspaceException e) {
      UiConstants.Util.log(
          IStatus.ERROR,
          e,
          UiConstants.Util.getString(
              "FlatFileRelationalModelContributor.getModelContentsError",
              resource.getItemName())); // $NON-NLS-1$
    }

    return eList;
  }
コード例 #2
0
  @Override
  public void doFinish(ModelResource modelResource, IProgressMonitor monitor) {
    String transactionName =
        UiConstants.Util.getString(
            "FlatFileRelationalModelContributor.transactionName"); //$NON-NLS-1$
    boolean started = ModelerCore.startTxn(transactionName, this);
    boolean succeeded = false;
    try {

      if (flatFilePage.doGenerateGetFiles()) {
        addGetFilesProcedure(modelResource);
      }

      if (flatFilePage.doGenerateGetTextFiles()) {
        addGetTextFilesProcedure(modelResource);
      }

      if (flatFilePage.doGenerateSaveFile()) {
        addSaveFileProcedure(modelResource);
      }

      succeeded = true;
    } catch (Exception ex) {
      String message =
          UiConstants.Util.getString(
              "FlatFileRelationalModelContributor.doFinishError", //$NON-NLS-1$
              modelResource.getItemName());
      UiConstants.Util.log(IStatus.ERROR, ex, message);
    } finally {
      if (started) {
        if (succeeded) {
          ModelerCore.commitTxn();
        } else {
          ModelerCore.rollbackTxn();
        }
      }
    }
  }