Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-07-20 21:10:04 +0000
committerrescobar2010-07-20 21:10:04 +0000
commit10ebb880d6e9b4d7e6c89ec91aa284897f440894 (patch)
tree822dcd580caca897cc9647f8f9201d5d176555ea /plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util
parentcd8503bd2a67b2fbcb5daceb02b7ad1089eb525e (diff)
downloadorg.eclipse.osee-10ebb880d6e9b4d7e6c89ec91aa284897f440894.tar.gz
org.eclipse.osee-10ebb880d6e9b4d7e6c89ec91aa284897f440894.tar.xz
org.eclipse.osee-10ebb880d6e9b4d7e6c89ec91aa284897f440894.zip
Displays cleanup
Diffstat (limited to 'plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util')
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitJob.java244
1 files changed, 122 insertions, 122 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitJob.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitJob.java
index 864af2a8081..f68ca1fdcc3 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitJob.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchCommitJob.java
@@ -8,128 +8,128 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.util;
-
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
-import org.eclipse.osee.ats.artifact.ReviewSMArtifact.ReviewBlockType;
+package org.eclipse.osee.ats.util;
+
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact;
+import org.eclipse.osee.ats.artifact.ReviewSMArtifact.ReviewBlockType;
import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.editor.stateItem.IAtsStateItem;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.widgets.ReviewManager;
-import org.eclipse.osee.ats.workflow.item.StateEventType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit.CommitHandler;
+import org.eclipse.osee.ats.editor.stateItem.IAtsStateItem;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.widgets.ReviewManager;
+import org.eclipse.osee.ats.workflow.item.StateEventType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.conflict.ConflictManagerExternal;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.branch.commit.CommitHandler;
import org.eclipse.osee.framework.ui.swt.Displays;
-import org.eclipse.swt.widgets.Display;
-
-public class AtsBranchCommitJob extends Job {
- private final boolean commitPopup;
- private final boolean overrideStateValidation;
- private final Branch destinationBranch;
- private final boolean archiveWorkingBranch;
- private final TeamWorkFlowArtifact teamArt;
-
- public AtsBranchCommitJob(TeamWorkFlowArtifact teamArt, boolean commitPopup, boolean overrideStateValidation, Branch destinationBranch, boolean archiveWorkingBranch) {
- super("Commit Branch");
- this.teamArt = teamArt;
- this.commitPopup = commitPopup;
- this.overrideStateValidation = overrideStateValidation;
- this.destinationBranch = destinationBranch;
- this.archiveWorkingBranch = archiveWorkingBranch;
- }
-
- private boolean adminOverride;
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- Branch workflowWorkingBranch = null;
- try {
- workflowWorkingBranch = teamArt.getWorkingBranch();
- AtsBranchManager.branchesInCommit.add(workflowWorkingBranch);
- if (workflowWorkingBranch == null) {
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID,
- "Commit Branch Failed: Can not locate branch for workflow " + teamArt.getHumanReadableId());
- }
-
- // Confirm that all blocking reviews are completed
- // Loop through this state's blocking reviews to confirm complete
- if (teamArt.isTeamWorkflow()) {
- for (ReviewSMArtifact reviewArt : ReviewManager.getReviewsFromCurrentState(teamArt)) {
- if (reviewArt.getReviewBlockType() == ReviewBlockType.Commit && !reviewArt.isCancelledOrCompleted()) {
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID,
- "Blocking Review must be completed before commit.");
- }
- }
- }
-
- if (!overrideStateValidation) {
- adminOverride = false;
- // Check extension points for valid commit
- for (IAtsStateItem item : teamArt.getStateItems().getStateItems(teamArt.getWorkPageDefinition().getId())) {
- final Result tempResult = item.committing(teamArt);
- if (tempResult.isFalse()) {
- // Allow Admin to override state validation
- if (AtsUtil.isAtsAdmin()) {
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(),
- "Override State Validation",
- tempResult.getText() + "\n\nYou are set as Admin, OVERRIDE this?")) {
- adminOverride = true;
- } else {
- adminOverride = false;
- }
- }
- }, true);
- }
- if (!adminOverride) {
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, tempResult.getText());
- }
- }
- }
- }
-
- commit(commitPopup, workflowWorkingBranch, destinationBranch, archiveWorkingBranch);
- } catch (OseeCoreException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, ex.getLocalizedMessage(), ex);
- } finally {
- if (workflowWorkingBranch != null) {
- AtsBranchManager.branchesInCommit.remove(workflowWorkingBranch);
- }
- }
- return Status.OK_STATUS;
- }
-
- private void commit(boolean commitPopup, Branch sourceBranch, Branch destinationBranch, boolean archiveWorkingBranch) throws OseeCoreException {
- boolean branchCommitted = false;
- ConflictManagerExternal conflictManager = new ConflictManagerExternal(destinationBranch, sourceBranch);
-
- if (commitPopup) {
- branchCommitted = CommitHandler.commitBranch(conflictManager, archiveWorkingBranch);
- } else {
- BranchManager.commitBranch(null, conflictManager, archiveWorkingBranch, true);
- branchCommitted = true;
- }
- if (branchCommitted) {
- // Create reviews as necessary
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Create Reviews upon Commit");
- AtsBranchManager.createNecessaryBranchEventReviews(StateEventType.CommitBranch, teamArt, transaction);
- transaction.execute();
- }
- }
-
+import org.eclipse.swt.widgets.Display;
+
+public class AtsBranchCommitJob extends Job {
+ private final boolean commitPopup;
+ private final boolean overrideStateValidation;
+ private final Branch destinationBranch;
+ private final boolean archiveWorkingBranch;
+ private final TeamWorkFlowArtifact teamArt;
+
+ public AtsBranchCommitJob(TeamWorkFlowArtifact teamArt, boolean commitPopup, boolean overrideStateValidation, Branch destinationBranch, boolean archiveWorkingBranch) {
+ super("Commit Branch");
+ this.teamArt = teamArt;
+ this.commitPopup = commitPopup;
+ this.overrideStateValidation = overrideStateValidation;
+ this.destinationBranch = destinationBranch;
+ this.archiveWorkingBranch = archiveWorkingBranch;
+ }
+
+ private boolean adminOverride;
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ Branch workflowWorkingBranch = null;
+ try {
+ workflowWorkingBranch = teamArt.getWorkingBranch();
+ AtsBranchManager.branchesInCommit.add(workflowWorkingBranch);
+ if (workflowWorkingBranch == null) {
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID,
+ "Commit Branch Failed: Can not locate branch for workflow " + teamArt.getHumanReadableId());
+ }
+
+ // Confirm that all blocking reviews are completed
+ // Loop through this state's blocking reviews to confirm complete
+ if (teamArt.isTeamWorkflow()) {
+ for (ReviewSMArtifact reviewArt : ReviewManager.getReviewsFromCurrentState(teamArt)) {
+ if (reviewArt.getReviewBlockType() == ReviewBlockType.Commit && !reviewArt.isCancelledOrCompleted()) {
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID,
+ "Blocking Review must be completed before commit.");
+ }
+ }
+ }
+
+ if (!overrideStateValidation) {
+ adminOverride = false;
+ // Check extension points for valid commit
+ for (IAtsStateItem item : teamArt.getStateItems().getStateItems(teamArt.getWorkPageDefinition().getId())) {
+ final Result tempResult = item.committing(teamArt);
+ if (tempResult.isFalse()) {
+ // Allow Admin to override state validation
+ if (AtsUtil.isAtsAdmin()) {
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(),
+ "Override State Validation",
+ tempResult.getText() + "\n\nYou are set as Admin, OVERRIDE this?")) {
+ adminOverride = true;
+ } else {
+ adminOverride = false;
+ }
+ }
+ });
+ }
+ if (!adminOverride) {
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, tempResult.getText());
+ }
+ }
+ }
+ }
+
+ commit(commitPopup, workflowWorkingBranch, destinationBranch, archiveWorkingBranch);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ return new Status(Status.ERROR, AtsPlugin.PLUGIN_ID, ex.getLocalizedMessage(), ex);
+ } finally {
+ if (workflowWorkingBranch != null) {
+ AtsBranchManager.branchesInCommit.remove(workflowWorkingBranch);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ private void commit(boolean commitPopup, Branch sourceBranch, Branch destinationBranch, boolean archiveWorkingBranch) throws OseeCoreException {
+ boolean branchCommitted = false;
+ ConflictManagerExternal conflictManager = new ConflictManagerExternal(destinationBranch, sourceBranch);
+
+ if (commitPopup) {
+ branchCommitted = CommitHandler.commitBranch(conflictManager, archiveWorkingBranch);
+ } else {
+ BranchManager.commitBranch(null, conflictManager, archiveWorkingBranch, true);
+ branchCommitted = true;
+ }
+ if (branchCommitted) {
+ // Create reviews as necessary
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Create Reviews upon Commit");
+ AtsBranchManager.createNecessaryBranchEventReviews(StateEventType.CommitBranch, teamArt, transaction);
+ transaction.execute();
+ }
+ }
+
} \ No newline at end of file

Back to the top