@Override public Object executeWithException(ExecutionEvent event, IStructuredSelection selection) throws OseeCoreException { Branch selectedBranch = Handlers.getBranchesFromStructuredSelection(selection).iterator().next(); EntryDialog ed = new EntryDialog( "Set Associated Artifact", "Set Associated Artifact for Branch\n\n\"" + selectedBranch.getName() + "\"" + (selectedBranch.getAssociatedArtifactId() != null ? "\n\nCurrently: " + selectedBranch.getAssociatedArtifactId() : "") + "\n\nEnter new Artifact Id to associate:"); ed.setEntry(String.valueOf(selectedBranch.getAssociatedArtifactId())); if (ed.open() == 0) { String artId = ed.getEntry(); Artifact associatedArtifact = ArtifactQuery.getArtifactFromId(Integer.parseInt(artId), BranchManager.getCommonBranch()); if (MessageDialog.openConfirm( Displays.getActiveShell(), "Set Associated Artifact", "Set Associated Artifact for Branch\n\n\"" + selectedBranch.getName() + "\"\nto\nArtifact: " + associatedArtifact)) { selectedBranch.setAssociatedArtifactId(Integer.parseInt(artId)); BranchManager.persist(selectedBranch); } } return null; }
public static void loadFromCache(AbstractBranchCacheMessage message, Collection<Branch> types) throws OseeCoreException { for (Branch br : types) { Integer branchId = br.getId(); message .getBranchRows() .add( new BranchRow( br.getId(), br.getGuid(), br.getName(), br.getBranchType(), br.getBranchState(), br.getArchiveState(), br.getStorageState())); if (br.hasParentBranch()) { message.getChildToParent().put(branchId, br.getParentBranch().getId()); } addTxRecord(message.getBranchToBaseTx(), branchId, br.getBaseTransaction()); addTxRecord(message.getBranchToSourceTx(), branchId, br.getSourceTransaction()); addAssocArtifact(message.getBranchToAssocArt(), branchId, br.getAssociatedArtifactId()); if (br.getBranchType().isMergeBranch()) { addMergeBranches(message.getMergeBranches(), (MergeBranch) br); } } }