@Override protected void saveWidgetValues() { super.saveWidgetValues(); IDialogSettings settings = getDialogSettings(); if (settings != null) { settings.put("isDirectory", isDirectory()); File file = getSourceFile(); if (file != null) { settings.put("source.file", getSourceFile().getAbsolutePath()); } IArtifactExtractor parser = getArtifactParser(); if (parser != null) { settings.put("selected.parser", parser.getClass().getSimpleName()); } Artifact artifact = getDestinationArtifact(); if (artifact != null) { settings.put("destination.artifact.guid", artifact.getGuid()); settings.put("destination.branch.uuid", artifact.getBranch().getUuid()); } settings.put("is.update.existing.selected", isUpdateExistingSelected()); } }
@Override public InputStream getRenderInputStream( PresentationType presentationType, List<Artifact> artifacts) throws OseeCoreException { InputStream stream = null; try { if (artifacts.isEmpty()) { stream = Streams.convertStringToInputStream( WordWholeDocumentAttribute.getEmptyDocumentContent(), "UTF-8"); } else { Artifact artifact = artifacts.iterator().next(); String content = artifact.getOrInitializeSoleAttributeValue(CoreAttributeTypes.WholeWordContent); if (presentationType == PresentationType.DIFF && WordUtil.containsWordAnnotations(content)) { throw new OseeStateException( "Trying to diff the [%s] artifact on the [%s] branch, which has tracked changes turned on. All tracked changes must be removed before the artifacts can be compared.", artifact.getName(), artifact.getBranch().getName()); } LinkType linkType = LinkType.OSEE_SERVER_LINK; content = WordMlLinkHandler.link(linkType, artifact, content); String classification = WordRendererUtil.getDataRightsClassification(artifact); if (Strings.isValid(classification)) { content = addDataRights(content, classification, artifact); } stream = Streams.convertStringToInputStream(content, "UTF-8"); } } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } return stream; }
public void addValid(Artifact artifact) { if (artifact == null) { needWindow = true; } else { this.branch = artifact.getBranch(); this.validArtifacts.add(artifact); this.names.add(artifact.getName()); } }
public void copyArtifactsToGroup( DropTargetEvent event, final GroupExplorerItem dragOverExplorerItem) { // Items dropped on Group; simply add items to group final Artifact[] artsToRelate = ((ArtifactData) event.data).getArtifacts(); for (Artifact artifact : artsToRelate) { if (!artifact.getBranch().equals(branch)) { AWorkbench.popup( "ERROR", "Cross-branch grouping not supported.\n\nGroup and Artifacts must belong to same branch."); return; } } boolean alreadyRelated = true; for (Artifact artifact : artsToRelate) { if (!dragOverExplorerItem.contains(artifact)) { alreadyRelated = false; break; } } if (alreadyRelated) { AWorkbench.popup("ERROR", "Artifact(s) already related."); return; } try { for (Artifact art : artsToRelate) { if (!dragOverExplorerItem.contains(art)) { dragOverExplorerItem .getArtifact() .addRelation(CoreRelationTypes.Universal_Grouping__Members, art); } } dragOverExplorerItem.getArtifact().persist("Drag and drop: copy artifacts to group"); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }
public static DefaultBasicGuidArtifact getBasicGuidArtifact(Artifact artifact) { return new DefaultBasicGuidArtifact( artifact.getBranch().getUuid(), artifact.getArtTypeGuid(), artifact.getGuid()); }