@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; }
@Override public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException { List<Artifact> activeTeams = new LinkedList<>(); for (Artifact agTeam : ArtifactQuery.getArtifactListFromType( AtsArtifactTypes.AgileTeam, AtsUtilCore.getAtsBranch())) { if (agTeam.getSoleAttributeValue(AtsAttributeTypes.Active, true)) { activeTeams.add(agTeam); } } FilteredTreeArtifactDialog dialog = new FilteredTreeArtifactDialog( getName(), "Select Agile Team", activeTeams, new ArtifactTreeContentProvider(), new ArtifactLabelProvider()); if (dialog.open() == 0) { EntryDialog ed = new EntryDialog(getName(), "Enter new Agile Sprint name(s) (comma delimited)"); if (ed.open() == 0) { if (Strings.isValid(ed.getEntry())) { try { AgileEndpointApi ageilEp = AtsClientService.getAgileEndpoint(); JaxNewAgileSprint newSprint = new JaxNewAgileSprint(); int teamUuid = ((Artifact) dialog.getSelectedFirst()).getArtId(); for (String name : ed.getEntry().split(",")) { newSprint.setName(name); newSprint.setTeamUuid(teamUuid); Response response = ageilEp.createSprint(new Long(teamUuid), newSprint); JaxAgileSprint sprint = response.readEntity(JaxAgileSprint.class); if (sprint != null) { long uuid = sprint.getUuid(); Artifact sprintArt = ArtifactQuery.getArtifactFromId( new Long(uuid).intValue(), AtsUtilCore.getAtsBranch()); sprintArt.getParent().reloadAttributesAndRelations(); AtsUtil.openArtifact(sprintArt.getGuid(), OseeCmEditor.CmPcrEditor); } else { AWorkbench.popup("Error creating Agile Team [%s]", response.toString()); return; } } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } } } }
@Override public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException { if (AtsUtil.isProductionDb()) { AWorkbench.popup("ERROR", "This should not to be run on production DB"); return; } MessageDialog dialog = new MessageDialog( Displays.getActiveShell(), getName(), null, getName() + "\n\nSelect Source or Destination Client", MessageDialog.QUESTION, new String[] { "Source Client", "Destination Client - Start", "Destination Client - End", "Cancel" }, 2); int result = dialog.open(); resultData = new XResultData(); if (result == 0) { runClientTest(); } else if (result == 1) { EntryDialog diag = new EntryDialog(getName(), "Enter tt number of Source Client created Action"); if (diag.open() == 0) { runDestinationTestStart(diag.getEntry()); } } else if (result == 2) { EntryDialog diag = new EntryDialog(getName(), "Enter tt number of Source Client created Action"); if (diag.open() == 0) { runDestinationTestEnd(diag.getEntry()); } } }