@Override
  protected void okPressed() {
    Iterator settingsIterator = selectedSettings.iterator();
    MultiStatus result =
        new MultiStatus(
            PlatformUI.PLUGIN_ID,
            IStatus.OK,
            IDEWorkbenchMessages.ChooseWorkspaceWithSettingsDialog_ProblemsTransferTitle,
            null);

    IPath path = new Path(getWorkspaceLocation());
    String[] selectionIDs = new String[selectedSettings.size()];
    int index = 0;

    while (settingsIterator.hasNext()) {
      IConfigurationElement elem = (IConfigurationElement) settingsIterator.next();
      result.add(transferSettings(elem, path));
      selectionIDs[index] = elem.getAttribute(ATT_ID);
    }
    if (result.getSeverity() != IStatus.OK) {
      ErrorDialog.openError(
          getShell(),
          IDEWorkbenchMessages.ChooseWorkspaceWithSettingsDialog_TransferFailedMessage,
          IDEWorkbenchMessages.ChooseWorkspaceWithSettingsDialog_SaveSettingsFailed,
          result);
      return;
    }

    saveSettings(selectionIDs);
    super.okPressed();
  }
Пример #2
0
  /* (non-Javadoc)
   * @see com.metamatrix.metamodels.builder.processor.Processor#getRecordCount(org.eclipse.core.runtime.IStatus)
   */
  public int getRecordCount() {
    int totalRows = 0;

    // ----------------------------------------------
    // Get the available Tables for this schema
    // ----------------------------------------------
    List tableNames = null;
    try {
      tableNames = getSchemaTables();
    } catch (SQLException e) {
      // Log the exception
      final String msg =
          "Error retrieving the tables for " + this.modelAndSchemaName; // $NON-NLS-1$
      MetamodelBuilderUtil.addStatus(status, IStatus.ERROR, msg, e);
      return totalRows;
    }

    // ----------------------------------------------
    // Count the table rows
    // ----------------------------------------------
    if (tableNames != null) {
      for (int i = 0; i < processingOrder.length; i++) {
        if (tableNames.contains(processingOrder[i])) {
          int tableRows = countTableRows(processingOrder[i]);
          if (tableRows > 0) {
            totalRows += tableRows;
          }
          if (status.getSeverity() == IStatus.ERROR) {
            return totalRows;
          }
        }
      }
    }
    return totalRows;
  }
  @Override
  public boolean performFinish() {
    final MultiStatus status =
        new MultiStatus(
            Plugin.PLUGIN_ID, 0, "Problems occurred while resolving or importing bundles.", null);

    Collection<Resource> adding = new ArrayList<Resource>();
    adding.addAll(dependenciesPage.getSelected());
    adding.addAll(dependenciesPage.getRequired());

    if (adding.isEmpty()) return true;

    AddOBRResourcesToWorkspaceTask installTask = new AddOBRResourcesToWorkspaceTask(adding, status);

    try {
      getContainer().run(true, true, installTask);

      switch (status.getSeverity()) {
        case IStatus.CANCEL:
          return false;
        case IStatus.ERROR:
          ErrorDialog.openError(getShell(), "Error", null, status);
          return false;
        case IStatus.WARNING:
          if (ErrorDialog.openError(getShell(), "Error", null, status) == Window.OK) {
            return true;
          } else {
            return false;
          }
        default:
          return true;
      }
    } catch (InvocationTargetException e) {
      ErrorDialog.openError(
          getShell(),
          "Error",
          null,
          new Status(
              IStatus.ERROR,
              Plugin.PLUGIN_ID,
              0,
              "Error creating workspace configuration project.",
              e.getCause()));
    } catch (InterruptedException e) {
      // Can't happen?
    }
    return false;
  }
Пример #4
0
  /* (non-Javadoc)
   * @see com.metamatrix.metamodels.builder.processor.Processor#process(org.eclipse.core.runtime.IProgressMonitor)
   */
  public IStatus process(IProgressMonitor monitor) {
    if (monitor != null) {
      monitor.subTask("Processing Entities for " + this.modelAndSchemaName); // $NON-NLS-1$
    }

    // ----------------------------------------------
    // Get the available Tables for this schema
    // ----------------------------------------------
    List tableNames = null;
    try {
      tableNames = getSchemaTables();
    } catch (SQLException e) {
      // Log the exception
      final String msg =
          "Error retrieving the tables for " + this.modelAndSchemaName; // $NON-NLS-1$
      MetamodelBuilderUtil.addStatus(status, IStatus.ERROR, msg, e);
      return status;
    }

    // ----------------------------------------------
    // Process Tables in the specified order
    // ----------------------------------------------
    if (tableNames != null) {
      for (int i = 0; i < processingOrder.length; i++) {
        if (tableNames.contains(processingOrder[i])) {
          processTable(processingOrder[i], monitor);
          if (status.getSeverity() == IStatus.ERROR) {
            return status;
          }
        }
      }
    }

    if (monitor != null && monitor.isCanceled()) {
      final String msg = "Entity Processing Cancelled"; // $NON-NLS-1$
      MetamodelBuilderUtil.addStatus(status, IStatus.CANCEL, msg);
      return status;
    }
    return status;
  }