Exemplo n.º 1
0
 public String getRecordName() {
   if (initOK) {
     return Tools.removeTrailingUnderscore(record.getName());
   } else {
     throw new IllegalStateException("init() was NOT invoked");
   }
 }
Exemplo n.º 2
0
 @Override
 public void addPages() {
   String dsl = Tools.generateRecordElementsDSL(record);
   importToolSelectionPage = new ImportToolSelectionPage(importToolExtensionElements, record, dsl);
   addPage(importToolSelectionPage);
   previewPage = new PreviewPage(record);
   addPage(previewPage);
 }
Exemplo n.º 3
0
  @Override
  public IWizardPage getNextPage(IWizardPage page) {
    if (page == importToolSelectionPage) {

      // The user has chosen an import tool and cannot change his/her selection; go get the
      // data entry pages from the import tool extension element and add all import wizard
      // pages.  Make sure we build and add the wizard pages only once.

      addDataEntryPages(importToolSelectionPage.getExtensionElement());

      // get a hold of the import tool and the parameters configured for it in the defining
      // extension and create the import tool proxy
      IRecordElementsImportTool importTool =
          activeRecordElementsImportToolExtensionElement.getRecordElementsImportTool();
      Properties importToolParms = activeRecordElementsImportToolExtensionElement.getParameters();
      proxy = new RecordElementsImportToolProxy(importTool, importToolParms);

      // return the first import tool data entry page or null if no data entry pages are
      // defined
      if (!dataEntryWizardPages.isEmpty()) {
        dataEntryWizardPages.get(0).aboutToShow();
        return dataEntryWizardPages.get(0);
      } else {
        return null;
      }
    } else if (dataEntryWizardPages != null && dataEntryWizardPages.contains(page)) {
      // we need the next data entry page
      int i = dataEntryWizardPages.indexOf(page);
      if (i < 0) {
        throw new RuntimeException("logic error");
      } else {
        // get the next relevant data entry page, if any
        ImportWizardPage nextPage = getNextRelevantPageIndex(i);
        if (nextPage != null) {
          // there is a next relevant data entry page, so return it
          nextPage.aboutToShow();
          return nextPage;
        } else {
          // no next data entry page, prepare the preview page and return it
          SchemaRecord record = new RecordModelBuilder().build("DUMMY");
          record.getRootElements().clear();
          record.getRootElements().addAll(proxy.invokeImportTool(context));
          String recordElementsDSL = Tools.generateRecordElementsDSL(record);
          previewPage.setRecordElementsDSL(recordElementsDSL);
          return previewPage;
        }
      }
    }
    return null;
  }