private void getMetadata() { PlvsLogger.log("FieldEditor.getMetadata()"); object rawIssueObject = facade.getRawIssueObject(issue); List <JiraField> filledFields = JiraActionFieldType.fillFieldValues(issue, rawIssueObject, new List <JiraField> { field }); field = filledFields[0]; field.setRawIssueObject(rawIssueObject); SortedDictionary <string, JiraProject> projects = JiraServerCache.Instance.getProjects(issue.Server); if (!projects.ContainsKey(issue.ProjectKey)) { return; } JiraProject project = projects[issue.ProjectKey]; // todo: these are not always necessary. refactor to make it more efficient and smart List <JiraNamedEntity> versions = facade.getVersions(issue.Server, project); versions.Reverse(); List <JiraNamedEntity> comps = facade.getComponents(issue.Server, project); this.safeInvoke(new MethodInvoker(() => createEditorWidget(versions, comps, rawIssueObject))); }
private void runActivateIssueActionsWorker(Action onFinish) { JiraServer server = JiraServerModel.Instance.getServer(new Guid(CurrentActiveIssue.ServerGuid)); if (server != null) { try { int mods = 0; JiraIssue issue = SmartJiraServerFacade.Instance.getIssue(server, CurrentActiveIssue.Key); if (issue != null) { string me = CredentialUtils.getUserNameWithoutDomain(server.UserName); if (issue.Assignee == null || issue.Assignee.Equals("Unknown") || !issue.Assignee.Equals(me)) { jiraStatus.setInfo("Assigning issue to me..."); JiraField assignee = new JiraField("assignee", null) { Values = new List <string> { me }, SettablePropertyName = "name" }; var rawIssueObject = SmartJiraServerFacade.Instance.getRawIssueObject(issue); assignee.setRawIssueObject(rawIssueObject); SmartJiraServerFacade.Instance.updateIssue(issue, new List <JiraField> { assignee }); ++mods; } List <JiraNamedEntity> actions = SmartJiraServerFacade.Instance.getActionsForIssue(issue); JiraNamedEntity action = actions.Find(a => a.Id.Equals(START_PROGRESS_ACTION_ID)); if (action == null) { container.safeInvoke(new MethodInvoker(delegate { ActionSelector sel = new ActionSelector(actions); if (sel.ShowDialog() == DialogResult.OK) { action = sel.SelectedAction; } })); } // foreach (JiraNamedEntity action in actions.Where(action => action.Id.Equals(START_PROGRESS_ACTION_ID))) { if (action != null) { jiraStatus.setInfo("Setting issue in progress..."); SmartJiraServerFacade.Instance.runIssueActionWithoutParams(issue, action); ++mods; } if (mods > 0) { issue = SmartJiraServerFacade.Instance.getIssue(server, CurrentActiveIssue.Key); } } jiraStatus.setInfo("Work on issue " + CurrentActiveIssue.Key + " started"); container.safeInvoke(new MethodInvoker(() => { JiraIssueListModelImpl.Instance.updateIssue(issue); onFinish(); })); } catch (Exception e) { CurrentActiveIssue = null; jiraStatus.setError(FAILED_TO_START_WORK, e); container.safeInvoke(new MethodInvoker(() => PlvsUtils.showError(FAILED_TO_START_WORK, e))); } } else { container.safeInvoke(new MethodInvoker( () => PlvsUtils.showError(FAILED_TO_START_WORK, new Exception("Unknown JIRA server")))); } }