Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2011-12-15 22:44:14 +0000
committerddunne2011-12-15 22:44:42 +0000
commit5e1986461454fb0651a66aa264699841d993d1b1 (patch)
tree5812cfaae3a04a155af99d5d2c8752244bc89e4b /plugins/org.eclipse.osee.ats
parent69c5edb0826155588e6cbfa84318e21d7bf2de8d (diff)
downloadorg.eclipse.osee-5e1986461454fb0651a66aa264699841d993d1b1.tar.gz
org.eclipse.osee-5e1986461454fb0651a66aa264699841d993d1b1.tar.xz
org.eclipse.osee-5e1986461454fb0651a66aa264699841d993d1b1.zip
feature[ats_EYSRP]: Add toggle to enable Resolution field to be retired
Diffstat (limited to 'plugins/org.eclipse.osee.ats')
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPercentCompleteHeader.java14
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java30
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java31
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java45
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SMAStatusDialog.java17
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java10
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TransitionStatusDialog.java213
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/TransitionToMenu.java97
8 files changed, 379 insertions, 78 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPercentCompleteHeader.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPercentCompleteHeader.java
index 575bef036c9..feff0a975e0 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPercentCompleteHeader.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPercentCompleteHeader.java
@@ -10,15 +10,16 @@
*******************************************************************************/
package org.eclipse.osee.ats.editor;
+import java.text.NumberFormat;
import java.util.logging.Level;
import org.eclipse.osee.ats.core.type.AtsAttributeTypes;
import org.eclipse.osee.ats.core.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.core.workflow.PercentCompleteTotalUtil;
import org.eclipse.osee.ats.internal.Activator;
-import org.eclipse.osee.ats.util.PromptChangeUtil;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.IntegerDialog;
import org.eclipse.osee.framework.ui.swt.ALayout;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.swt.SWT;
@@ -63,7 +64,16 @@ public class SMAPercentCompleteHeader extends Composite {
@Override
public void linkActivated(HyperlinkEvent e) {
try {
- PromptChangeUtil.promptChangeAttribute(sma, AtsAttributeTypes.PercentComplete, true, false);
+ IntegerDialog dialog =
+ new IntegerDialog("Enter Percent Complete",
+ "Enter Percent Complete (0 to 99)\n\n(use Transition to mark complete.)", 0, 99);
+ dialog.setNumberFormat(NumberFormat.getIntegerInstance());
+ dialog.setEntry(sma.getSoleAttributeValue(AtsAttributeTypes.PercentComplete, ""));
+ if (dialog.open() == 0) {
+ Integer intValue = dialog.getInt();
+ sma.setSoleAttributeValue(AtsAttributeTypes.PercentComplete, intValue);
+ sma.persist("ATS Workflow Editor - set Percent Complete");
+ }
} catch (Exception ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java
index 046d1fbdcf7..274d999128b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java
@@ -12,12 +12,14 @@ package org.eclipse.osee.ats.editor;
import java.util.Arrays;
import java.util.Collection;
+import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.core.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.core.workflow.transition.TransitionStatusData;
import org.eclipse.osee.ats.util.widgets.dialog.TaskOptionStatusDialog;
+import org.eclipse.osee.ats.util.widgets.dialog.TransitionStatusDialog;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.ui.PlatformUI;
/**
* @author Donald G. Dunne
@@ -46,14 +48,24 @@ public class SMAPromptChangeHoursSpent {
return result;
}
- TaskOptionStatusDialog tsd =
- new TaskOptionStatusDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Enter State Hours Spend", false, null, awas);
- if (tsd.open() == 0) {
- SMAPromptChangeStatus.performChangeStatus(awas, null,
- tsd.getSelectedOptionDef() != null ? tsd.getSelectedOptionDef().getName() : null,
- tsd.getHours().getFloat(), tsd.getPercent().getInt(), tsd.isSplitHours(), persist);
- return Result.TrueResult;
+ if (AtsUtilCore.isAtsUsingResolutionOptions()) {
+ TaskOptionStatusDialog tsd = new TaskOptionStatusDialog("Enter State Hours Spent", false, null, awas);
+ if (tsd.open() == 0) {
+ SMAPromptChangeStatus.performChangeStatus(awas, null,
+ tsd.getSelectedOptionDef() != null ? tsd.getSelectedOptionDef().getName() : null,
+ tsd.getHours().getFloat(), tsd.getPercent().getInt(), tsd.isSplitHours(), persist);
+ return Result.TrueResult;
+ }
+ } else {
+ TransitionStatusData data = new TransitionStatusData(awas, false);
+ TransitionStatusDialog dialog =
+ new TransitionStatusDialog("Enter Hours Spent",
+ "Enter percent complete and number of hours you spent since last status.", data);
+ if (dialog.open() == 0) {
+ SMAPromptChangeStatus.performChangeStatus(awas, null, null, data.getAdditionalHours(), data.getPercent(),
+ data.isSplitHoursBetweenItems(), persist);
+ return Result.TrueResult;
+ }
}
return Result.FalseResult;
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
index df33c1c2c70..3e019b25f3c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
@@ -20,15 +20,16 @@ import org.eclipse.osee.ats.core.type.AtsArtifactTypes;
import org.eclipse.osee.ats.core.type.AtsAttributeTypes;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.core.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.core.workflow.transition.TransitionStatusData;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.util.widgets.dialog.TaskOptionStatusDialog;
+import org.eclipse.osee.ats.util.widgets.dialog.TransitionStatusDialog;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
-import org.eclipse.ui.PlatformUI;
/**
* @author Donald G. Dunne
@@ -92,14 +93,24 @@ public class SMAPromptChangeStatus {
if (awas.iterator().next().isOfType(AtsArtifactTypes.Task) && ((TaskArtifact) awas.iterator().next()).isUsingTaskResolutionOptions()) {
options = ((TaskArtifact) awas.iterator().next()).getTaskResolutionOptionDefintions();
}
- TaskOptionStatusDialog tsd =
- new TaskOptionStatusDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Enter State Status", true, options, awas);
- if (tsd.open() == 0) {
- performChangeStatus(awas, options,
- tsd.getSelectedOptionDef() != null ? tsd.getSelectedOptionDef().getName() : null,
- tsd.getHours().getFloat(), tsd.getPercent().getInt(), tsd.isSplitHours(), persist);
- return Result.TrueResult;
+ if (AtsUtilCore.isAtsUsingResolutionOptions()) {
+ TaskOptionStatusDialog tsd = new TaskOptionStatusDialog("Enter State Status", true, options, awas);
+ if (tsd.open() == 0) {
+ performChangeStatus(awas, options,
+ tsd.getSelectedOptionDef() != null ? tsd.getSelectedOptionDef().getName() : null,
+ tsd.getHours().getFloat(), tsd.getPercent().getInt(), tsd.isSplitHours(), persist);
+ return Result.TrueResult;
+ }
+ } else {
+ TransitionStatusData data = new TransitionStatusData(awas, true);
+ TransitionStatusDialog dialog =
+ new TransitionStatusDialog("Enter Hours Spent",
+ "Enter percent complete and number of hours you spent since last status.", data);
+ if (dialog.open() == 0) {
+ performChangeStatus(awas, options, null, data.getAdditionalHours(), data.getPercent(),
+ data.isSplitHoursBetweenItems(), persist);
+ return Result.TrueResult;
+ }
}
return Result.FalseResult;
}
@@ -120,7 +131,7 @@ public class SMAPromptChangeStatus {
if (options != null && AtsUtilCore.isAtsUsingResolutionOptions()) {
awa.setSoleAttributeValue(AtsAttributeTypes.Resolution, selectedOption);
}
- if (awa.isOfType(AtsArtifactTypes.Task)) {
+ if (AtsUtilCore.isAtsUsingResolutionOptions() && awa.isOfType(AtsArtifactTypes.Task)) {
Result result = TaskManager.statusPercentChanged(((TaskArtifact) awa), hours, percent, transaction);
if (result.isFalse()) {
AWorkbench.popup(result);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java
index 14d1d4d1f0f..a29e8dcc5a6 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WETransitionComposite.java
@@ -31,12 +31,14 @@ import org.eclipse.osee.ats.core.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.core.workflow.transition.ITransitionHelper;
import org.eclipse.osee.ats.core.workflow.transition.TransitionHelperAdapter;
import org.eclipse.osee.ats.core.workflow.transition.TransitionResults;
+import org.eclipse.osee.ats.core.workflow.transition.TransitionStatusData;
import org.eclipse.osee.ats.core.workflow.transition.TransitionToOperation;
import org.eclipse.osee.ats.editor.stateItem.AtsStateItemManager;
import org.eclipse.osee.ats.editor.stateItem.IAtsStateItem;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.util.widgets.dialog.SMAStatusDialog;
+import org.eclipse.osee.ats.util.widgets.dialog.TransitionStatusDialog;
import org.eclipse.osee.ats.workdef.StateDefinitionLabelProvider;
import org.eclipse.osee.ats.workdef.StateDefinitionViewSorter;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -62,7 +64,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.Hyperlink;
@@ -100,24 +101,11 @@ public class WETransitionComposite extends Composite {
transitionToStateCombo = new XComboViewer("Transition To State Combo", SWT.NONE);
transitionToStateCombo.setDisplayLabel(false);
List<Object> allPages = new ArrayList<Object>();
- for (StateDefinition nextState : awa.getToStates()) {
+ for (StateDefinition nextState : awa.getToStatesWithCompleteCancelReturnStates()) {
if (!allPages.contains(nextState)) {
allPages.add(nextState);
}
}
- StateDefinition currState = awa.getStateDefinition();
- if (currState.isCompletedPage()) {
- StateDefinition completedFromState = awa.getWorkDefinition().getStateByName(awa.getCompletedFromState());
- if (completedFromState != null && !allPages.contains(completedFromState)) {
- allPages.add(completedFromState);
- }
- }
- if (currState.isCancelledPage()) {
- StateDefinition cancelledFromState = awa.getWorkDefinition().getStateByName(awa.getCancelledFromState());
- if (cancelledFromState != null && !allPages.contains(cancelledFromState)) {
- allPages.add(cancelledFromState);
- }
- }
transitionToStateCombo.setInput(allPages);
transitionToStateCombo.setLabelProvider(new StateDefinitionLabelProvider());
transitionToStateCombo.setContentProvider(new ArrayContentProvider());
@@ -324,15 +312,26 @@ public class WETransitionComposite extends Composite {
// Otherwise, open dialog to ask for hours complete
String msg =
awa.getStateMgr().getCurrentStateName() + " State\n\n" + AtsUtilCore.doubleToI18nString(awa.getStateMgr().getHoursSpent()) + " hours already spent on this state.\n" + "Enter the additional number of hours you spent on this state.";
- SMAStatusDialog tsd =
- new SMAStatusDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Enter Hours Spent",
- msg, false, Arrays.asList(awa));
- int result = tsd.open();
- if (result == 0) {
- awa.getStateMgr().updateMetrics(tsd.getHours().getFloat(), 100, true);
- return true;
+ // Remove after ATS Resolution options is removed 0.9.9_SR5ish
+ if (AtsUtilCore.isAtsUsingResolutionOptions()) {
+ SMAStatusDialog tsd = new SMAStatusDialog("Enter Hours Spent", msg, false, Arrays.asList(awa));
+ int result = tsd.open();
+ if (result == 0) {
+ awa.getStateMgr().updateMetrics(tsd.getHours().getFloat(), 100, true);
+ return true;
+ } else {
+ return false;
+ }
} else {
- return false;
+ TransitionStatusData data = new TransitionStatusData(Arrays.asList(awa), false);
+ TransitionStatusDialog dialog = new TransitionStatusDialog("Enter Hours Spent", msg, data);
+ int result = dialog.open();
+ if (result == 0) {
+ awa.getStateMgr().updateMetrics(data.getAdditionalHours(), 100, true);
+ return true;
+ } else {
+ return false;
+ }
}
} else {
return true;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SMAStatusDialog.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SMAStatusDialog.java
index 69936e31598..b9849662a3d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SMAStatusDialog.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/SMAStatusDialog.java
@@ -33,8 +33,13 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
+/**
+ * Replaced by TransitionStatusDialog. Remove once AtsUtilCore.isAtsUsingResolutionOptions gets removed. Around
+ * 0.9.9_SR4/5.
+ *
+ * @author Donald G Dunne
+ */
public class SMAStatusDialog extends MessageDialog {
protected Label statusLabel;
@@ -47,12 +52,10 @@ public class SMAStatusDialog extends MessageDialog {
protected final Collection<? extends AbstractWorkflowArtifact> awas;
private Integer defaultPercent = null;
- public SMAStatusDialog(Shell parentShell, String dialogTitle, String dialogMessage, Collection<? extends AbstractWorkflowArtifact> awas) {
- this(parentShell, dialogTitle, dialogMessage, true, awas);
- }
-
- public SMAStatusDialog(Shell parentShell, String dialogTitle, String dialogMessage, boolean showPercent, Collection<? extends AbstractWorkflowArtifact> awas) {
- super(parentShell, dialogTitle, null, dialogMessage, MessageDialog.NONE, new String[] {"OK", "Cancel"}, 0);
+ public SMAStatusDialog(String dialogTitle, String dialogMessage, boolean showPercent, Collection<? extends AbstractWorkflowArtifact> awas) {
+ super(Displays.getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.NONE, new String[] {
+ "OK",
+ "Cancel"}, 0);
this.showPercent = showPercent;
this.awas = awas;
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java
index fca53f27308..a9c16575403 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TaskOptionStatusDialog.java
@@ -33,10 +33,12 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
/**
- * @author Donald G. Dunne
+ * Replaced by TransitionStatusDialog. Remove once AtsUtilCore.isAtsUsingResolutionOptions gets removed. Around
+ * 0.9.9_SR4/5.
+ *
+ * @author Donald G Dunne
*/
public class TaskOptionStatusDialog extends SMAStatusDialog {
@@ -48,8 +50,8 @@ public class TaskOptionStatusDialog extends SMAStatusDialog {
private final static String OPTION_MESSAGE =
"Select resolution, enter percent complete and number of hours you spent since last status.";
- public TaskOptionStatusDialog(Shell parentShell, String dialogTitle, boolean showPercent, List<TaskResOptionDefinition> options, Collection<? extends AbstractWorkflowArtifact> tasks) {
- super(parentShell, dialogTitle, options == null ? MESSAGE : OPTION_MESSAGE, showPercent, tasks);
+ public TaskOptionStatusDialog(String dialogTitle, boolean showPercent, List<TaskResOptionDefinition> options, Collection<? extends AbstractWorkflowArtifact> tasks) {
+ super(dialogTitle, options == null ? MESSAGE : OPTION_MESSAGE, showPercent, tasks);
this.options = options;
if (options != null) {
for (TaskResOptionDefinition trd : options) {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TransitionStatusDialog.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TransitionStatusDialog.java
new file mode 100644
index 00000000000..32b205171ea
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/dialog/TransitionStatusDialog.java
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.util.widgets.dialog;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osee.ats.core.workflow.transition.TransitionStatusData;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.framework.core.util.Result;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.widgets.XFloat;
+import org.eclipse.osee.framework.ui.skynet.widgets.XPercent;
+import org.eclipse.osee.framework.ui.skynet.widgets.XRadioButton;
+import org.eclipse.osee.framework.ui.swt.Displays;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * Replacement dialog for SMAStatusDialog. Remove SMAStatusDialog when AtsUtilCore.isAtsUsingResolutionOptions is no
+ * longer needed. Should be around 0.9.9_SR4/5
+ *
+ * @author Donald G Dunne
+ */
+public class TransitionStatusDialog extends MessageDialog {
+
+ protected Label statusLabel;
+ protected XPercent percent = new XPercent("Percent Complete");
+ protected XFloat hours = new XFloat("Additional Hours Spent");
+ protected XRadioButton splitRadio = new XRadioButton("Split Hours Spent between Items");
+ protected XRadioButton eachRadio = new XRadioButton("Apply Hours Spent to each Item");
+ private Button okButton;
+ private final TransitionStatusData data;
+
+ public TransitionStatusDialog(String dialogTitle, String dialogMessage, TransitionStatusData data) {
+ super(Displays.getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.NONE, new String[] {
+ "OK",
+ "Cancel"}, 0);
+ this.data = data;
+ }
+
+ protected void createPreCustomArea(Composite parent) {
+ // do nothing
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+
+ statusLabel = new Label(parent, SWT.NONE);
+ statusLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
+ updateStatusLabel();
+
+ if (data.getAwas().size() > 1) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText("Mulitple objects being statused. All objects will be set to percent\ncomplete and hours spent will be split or added into each item.");
+ }
+
+ createPreCustomArea(parent);
+
+ boolean percentSet = false;
+ if (data.isPercentRequired()) {
+ percent.setRequiredEntry(true);
+ percent.setToolTip("Enter total percent complete.");
+ percent.createWidgets(parent, 2);
+ try {
+ Integer defaultPercent = data.getDefaultPercent();
+ if (defaultPercent != null) {
+ data.setPercent(defaultPercent);
+ percent.set(defaultPercent);
+ percentSet = true;
+ } else if (data.getAwas().size() == 1) {
+ int currentPercent = data.getAwas().iterator().next().getStateMgr().getPercentComplete();
+ data.setPercent(currentPercent);
+ percent.set(currentPercent);
+ percentSet = true;
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ percent.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
+ IStatus status = percent.isValid();
+ if (status.getSeverity() != IStatus.OK) {
+ data.setPercent(null);
+ } else {
+ data.setPercent(percent.getInt());
+ }
+ updateButtons();
+ updateStatusLabel();
+ };
+ });
+ percent.getLabelWidget().addListener(SWT.MouseUp, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if (event.button == 3) {
+ data.setPercent(99);
+ percent.set("99");
+ data.setAdditionalHours(1.0);
+ hours.set("1");
+ updateStatusLabel();
+ }
+ }
+ });
+ }
+
+ hours.setRequiredEntry(true);
+ hours.setToolTip("Enter hours spent since last status entry.");
+ hours.createWidgets(parent, 2);
+ hours.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
+ IStatus status = hours.isValid();
+ if (status.getSeverity() != IStatus.OK) {
+ data.setAdditionalHours(null);
+ } else {
+ data.setAdditionalHours(hours.getFloat());
+ }
+ updateButtons();
+ updateStatusLabel();
+ };
+ });
+
+ if (data.getAwas().size() > 1) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout(2, false));
+ comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ eachRadio.createWidgets(comp, 2);
+ eachRadio.setSelected(data.isApplyHoursToEachItem());
+ eachRadio.setToolTip("Hours Spent will be added to to time spent for each object.");
+ eachRadio.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ data.setApplyHoursToEachItem(eachRadio.isSelected());
+ updateButtons();
+ updateStatusLabel();
+ }
+
+ });
+
+ splitRadio.createWidgets(comp, 2);
+ splitRadio.setSelected(data.isSplitHoursBetweenItems());
+ splitRadio.setToolTip("Hours Spent will be divided equaly by the number of objects " + "and added to the existing hours spent for the object.");
+ splitRadio.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ data.setSplitHoursBetweenItems(splitRadio.isSelected());
+ updateButtons();
+ updateStatusLabel();
+ }
+
+ });
+ }
+ updateStatusLabel();
+ if (!data.isPercentRequired() || percentSet) {
+ hours.setFocus();
+ }
+ return parent;
+ }
+
+ protected void updateStatusLabel() {
+ IStatus result = isComplete();
+ statusLabel.setText(result.isOK() ? "" : result.getMessage());
+ statusLabel.getParent().layout();
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Control c = super.createButtonBar(parent);
+ okButton = getButton(0);
+ okButton.setEnabled(false);
+ return c;
+ }
+
+ protected IStatus isComplete() {
+ Result result = data.isValid();
+ if (result.isFalse()) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, result.getText());
+ }
+ return Status.OK_STATUS;
+ }
+
+ private void updateButtons() {
+ okButton.setEnabled(isComplete().isOK());
+ }
+
+ public TransitionStatusData getData() {
+ return data;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/TransitionToMenu.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/TransitionToMenu.java
index 17edcbbf394..aa073f86602 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/TransitionToMenu.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/TransitionToMenu.java
@@ -26,15 +26,18 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.nebula.widgets.xviewer.XViewer;
import org.eclipse.osee.ats.AtsImage;
import org.eclipse.osee.ats.core.team.TeamState;
+import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.core.workdef.StateDefinition;
import org.eclipse.osee.ats.core.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.core.workflow.transition.ITransitionHelper;
import org.eclipse.osee.ats.core.workflow.transition.TransitionHelperAdapter;
import org.eclipse.osee.ats.core.workflow.transition.TransitionResults;
+import org.eclipse.osee.ats.core.workflow.transition.TransitionStatusData;
import org.eclipse.osee.ats.core.workflow.transition.TransitionToOperation;
import org.eclipse.osee.ats.editor.SMAPromptChangeStatus;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.util.widgets.dialog.SMAStatusDialog;
+import org.eclipse.osee.ats.util.widgets.dialog.TransitionStatusDialog;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.operation.Operations;
import org.eclipse.osee.framework.core.util.Result;
@@ -49,7 +52,6 @@ import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.PlatformUI;
/**
* @author Donald G. Dunne
@@ -64,7 +66,11 @@ public class TransitionToMenu {
if (treeItem.getData() instanceof AbstractWorkflowArtifact) {
AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) treeItem.getData();
awas.add(awa);
- toStateDefs.addAll(awa.getStateDefinition().getToStates());
+ try {
+ toStateDefs.addAll(awa.getToStatesWithCompleteCancelReturnStates());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
}
}
if (toStateDefs.isEmpty()) {
@@ -115,28 +121,73 @@ public class TransitionToMenu {
@Override
public void run() {
- StateDefinition stateDef = awas.iterator().next().getWorkDefinition().getStateByName(toStateName);
- boolean showPercentCompleted = !stateDef.isCompletedOrCancelledPage();
- SMAStatusDialog tsd =
- new SMAStatusDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- "Enter Hours Spent", "Enter additional hours spent in current state(s)", showPercentCompleted,
- getAwas());
- if (stateDef.getRecommendedPercentComplete() != null) {
- tsd.setDefaultPercent(stateDef.getRecommendedPercentComplete());
- }
- int dialogResult = tsd.open();
- if (dialogResult == 0) {
- try {
- SMAPromptChangeStatus.performChangeStatus(awas, null, null, tsd.getHours().getFloat(),
- tsd.getPercent().getInt(), tsd.isSplitHours(), true);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
- result.set(false);
- result.setTextWithFormat(
- "Exception handling extra hours spent for transition to [%s] (see log)", getToStateName());
+ StateDefinition toStateDef = awas.iterator().next().getWorkDefinition().getStateByName(toStateName);
+ boolean showPercentCompleted = !toStateDef.isCompletedOrCancelledPage();
+ try {
+ if (AtsUtilCore.isAtsUsingResolutionOptions()) {
+ SMAStatusDialog tsd =
+ new SMAStatusDialog("Enter Hours Spent", "Enter additional hours spent in current state(s)",
+ showPercentCompleted, getAwas());
+ if (toStateDef.getRecommendedPercentComplete() != null) {
+ tsd.setDefaultPercent(toStateDef.getRecommendedPercentComplete());
+ }
+ int dialogResult = tsd.open();
+ if (dialogResult == 0) {
+ try {
+ SMAPromptChangeStatus.performChangeStatus(awas, null, null, tsd.getHours().getFloat(),
+ tsd.getPercent().getInt(), tsd.isSplitHours(), true);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ result.set(false);
+ result.setTextWithFormat(
+ "Exception handling extra hours spent for transition to [%s] (see log)",
+ getToStateName());
+ }
+ } else {
+ result.setCancelled(true);
+ }
+ } else {
+ TransitionStatusData data = new TransitionStatusData(getAwas(), showPercentCompleted);
+ if (toStateDef.getRecommendedPercentComplete() != null) {
+ data.setDefaultPercent(toStateDef.getRecommendedPercentComplete());
+ data.setPercent(100);
+ } else if (toStateDef.isCompletedOrCancelledPage()) {
+ data.setDefaultPercent(100);
+ data.setPercent(100);
+ }
+ String title = null;
+ String message = null;
+ if (data.isPercentRequired()) {
+ title = "Enter Percent and Hours Spent";
+ message = "Enter percent complete and additional hours spent in current state(s)";
+ } else {
+ title = "Enter Hours Spent";
+ message = "Enter additional hours spent in current state(s)";
+ }
+ TransitionStatusDialog dialog = new TransitionStatusDialog(title, message, data);
+
+ int dialogResult = dialog.open();
+ if (dialogResult == 0) {
+ try {
+ SMAPromptChangeStatus.performChangeStatus(awas, null, null, data.getAdditionalHours(),
+ data.getPercent(), data.isSplitHoursBetweenItems(), true);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ result.set(false);
+ result.setTextWithFormat(
+ "Exception handling extra hours spent for transition to [%s] (see log)",
+ getToStateName());
+ }
+ } else {
+ result.setCancelled(true);
+ }
}
- } else {
- result.setCancelled(true);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ result.set(false);
+ result.setTextWithFormat("Exception handling extra hours spent for transition to [%s] (see log)",
+ getToStateName());
+
}
}
}, true);

Back to the top