Ejemplo n.º 1
0
 /**
  * DOC chuang ErrorDetailDialog constructor comment.
  *
  * @param parentShell
  */
 public ErrorDetailDialog(Shell parentShell, List<JobErrorEntry> errors) {
   super(parentShell);
   setShellStyle(SWT.TITLE | SWT.RESIZE | SWT.APPLICATION_MODAL | getDefaultOrientation());
   setHelpAvailable(false);
   setTitle(Messages.getString("ErrorDetailDialog.findError")); // $NON-NLS-1$
   setMessage(Messages.getString("ErrorDetailDialog.errorExist")); // $NON-NLS-1$
   this.errors = errors;
 }
  public static boolean promptConfirmLauch(Shell shell, IContext context, IProcess process) {
    boolean continueLaunch = true;

    int nbValues = 0;
    if (context == null) {
      throw new IllegalArgumentException("Context is null"); // $NON-NLS-1$
    }
    // Prompt for context values ?
    for (IContextParameter parameter : context.getContextParameterList()) {
      if (parameter.isPromptNeeded()) {
        nbValues++;
      }
    }
    if (nbValues > 0) {
      IContext contextCopy = context.clone();
      PromptDialog promptDialog = new PromptDialog(shell, contextCopy);
      if (promptDialog.open() == PromptDialog.OK) {
        for (IContextParameter param : context.getContextParameterList()) {
          boolean found = false;
          IContextParameter paramCopy = null;
          for (int i = 0; i < contextCopy.getContextParameterList().size() & !found; i++) {
            paramCopy = contextCopy.getContextParameterList().get(i);
            if (param.getName().equals(paramCopy.getName())) {
              // param.setValueList(paramCopy.getValueList());
              param.setInternalValue(paramCopy.getValue());
              found = true;
            }
          }
        }
        contextComboViewer.refresh();
        contextTableViewer.refresh();
        processNeedGenCode(process);
      } else {
        continueLaunch = false;
      }
    } else {
      if (context.isConfirmationNeeded()) {
        continueLaunch =
            MessageDialog.openQuestion(
                shell,
                Messages.getString("ProcessComposite.confirmTitle"), // $NON-NLS-1$
                Messages.getString(
                    "ProcessComposite.confirmText", context.getName())); // $NON-NLS-1$
      }

      updateDefaultValueForListTypeParameter(context.getContextParameterList());
    }
    return continueLaunch;
  }
  /**
   * Constructs a new ProcessContextComposite.
   *
   * @param parent Parent composite.
   * @param style Style bits.
   */
  public ProcessContextComposite(Composite parent, int style) {
    super(parent, style);

    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    setLayout(layout);

    // Group contextGroup = new Group(this, SWT.NONE);
    // contextGroup.setText(Messages.getString("ProcessComposite.contextGroup")); //$NON-NLS-1$
    Composite contextGroup = this;

    layout = new GridLayout();
    contextGroup.setLayout(layout);
    contextGroup.setLayoutData(new GridData(GridData.FILL_BOTH));

    contextComboViewer = new ComboViewer(contextGroup, SWT.BORDER | SWT.READ_ONLY);
    contextComboViewer.setContentProvider(new ArrayContentProvider());
    contextComboViewer.setLabelProvider(new ContextNameLabelProvider());
    contextComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    contextComboViewer.getControl().setEnabled(false);

    Table contextTable = new Table(contextGroup, SWT.BORDER);
    contextTable.setLinesVisible(true);
    contextTable.setHeaderVisible(true);

    TableColumn colName = new TableColumn(contextTable, SWT.NONE);
    colName.setText(Messages.getString("ProcessComposite.nameCol")); // $NON-NLS-1$
    colName.setWidth(COLUMN_WIDTH);
    TableColumn colValue = new TableColumn(contextTable, SWT.NONE);
    colValue.setText(Messages.getString("ProcessComposite.valueCol")); // $NON-NLS-1$
    colValue.setWidth(COLUMN_WIDTH);

    contextTableViewer = new TableViewer(contextTable);
    contextTableViewer.setContentProvider(new ArrayContentProvider());
    contextTableViewer.setLabelProvider(new ContextParameterLabelProvider());
    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = HINT_HEIGHT;
    contextTableViewer.getControl().setLayoutData(data);

    // Add listeners
    rubjobManager = ProcessManager.getInstance();
  }