Exemple #1
0
  protected ArtifactImportPage(File defaultSourceFile, Artifact defaultDestinationArtifact) {
    super(PAGE_NAME);
    selectedArtifactTypes = new ArrayList<>();
    selectionLatch = new SelectionLatch();
    collector = new RoughArtifactCollector(new RoughArtifact(RoughArtifactKind.PRIMARY));
    artifactSelectPanel = new ArtifactSelectPanel();
    artifactSelectPanel.setDialogTitle("Select Destination Artifact");
    artifactSelectPanel.setDialogMessage(
        "Select a destination artifact. Imported items will be added as children of the selected artifact.");

    artifactSelectPanel.setDefaultItem(defaultDestinationArtifact);

    artifactTypeSelectPanel = new ArtifactTypeSelectPanel();
    artifactTypeSelectPanel.setDialogTitle("Import as Artifact Type");
    artifactTypeSelectPanel.setDialogMessage(
        "Select what artifact type data should be imported as.");

    attributeTypeSelectPanel = new AttributeTypeSelectPanel();
    attributeTypeSelectPanel.setDialogTitle("Select Attribute Types");
    attributeTypeSelectPanel.setDialogMessage(
        "Select which attribute types should be used to match imported and existing artifacts.");

    importContributionManager = new ArtifactExtractorContributionManager();
    parserSelectPanel = new ArtifactExtractorSelectPanel(importContributionManager);

    setTitle("Import artifacts into OSEE");
    setDescription("Import artifacts into Define");
    setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.ARTIFACT_IMPORT_WIZARD));

    operationReportMessages = new StringBuilder();

    this.defaultSourceFile = defaultSourceFile;
  }
Exemple #2
0
  private void createArtifactTypeSelectArea(Composite parent) {
    Label selectArtifactTypeInstructions = new Label(parent, SWT.NONE);
    selectArtifactTypeInstructions.setText("Select artifact type for imported data:");

    artifactTypeSelectPanel.createControl(parent);
    artifactTypeSelectPanel.addListener(this);
  }
Exemple #3
0
  private synchronized void updateExtractedElements() {
    selectionLatch.setCurrentValues(getDestinationArtifact(), getSourceFile(), getArtifactParser());
    if (selectionLatch.areSelectionsValid()) {
      selectionLatch.latch();

      collector.reset();

      final Artifact destinationArtifact = selectionLatch.currentSelected.destinationArtifact;
      final File sourceFile = selectionLatch.currentSelected.sourceFile;
      final IArtifactExtractor extractor = selectionLatch.currentSelected.extractor;

      operationReportMessages.setLength(0);

      IOperation op =
          ArtifactImportOperationFactory.createArtifactsCompOperation(
              "Extracting data from source",
              sourceFile,
              destinationArtifact,
              new OperationLogger() {
                @Override
                public void log(String... row) {
                  for (String warningMessage : row) {
                    operationReportMessages.append(warningMessage);
                  }
                };
              },
              extractor,
              collector,
              selectedArtifactTypes,
              true);

      selectedArtifactTypes.clear();

      if (executeOperation(op)) {
        artifactTypeSelectPanel.setAllowedArtifactTypes(selectedArtifactTypes);
        try {
          if (getArtifactType() != null) {
            ArtifactType specificArtifactType = ArtifactTypeManager.getType(getArtifactType());
            attributeTypeSelectPanel.setAllowedAttributeTypes(
                specificArtifactType.getAttributeTypes(getDestinationArtifact().getFullBranch()));
          }
        } catch (Exception ex) {
          OseeLog.log(Activator.class, Level.SEVERE, ex);
        }
      }
    }
  }
Exemple #4
0
 public IArtifactType getArtifactType() {
   return artifactTypeSelectPanel.getSelected();
 }