Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-08-04 18:25:36 +0000
committerRyan D. Brooks2016-08-31 16:18:08 +0000
commit554b448db650acd1e387852648b7a787ad8977e5 (patch)
tree401cdea9acd52314306cddff53d7b6c3b9a298e2
parent32cabe6212237d9558083c15e04c6d1cae7558b0 (diff)
downloadorg.eclipse.osee-554b448db650acd1e387852648b7a787ad8977e5.tar.gz
org.eclipse.osee-554b448db650acd1e387852648b7a787ad8977e5.tar.xz
org.eclipse.osee-554b448db650acd1e387852648b7a787ad8977e5.zip
bug[ats_ATS306966]: Cleanup ATS Editor layout and unused method
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WfeMembersTab.java116
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/WorkflowMetrics.java16
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorkflowMetricsUI.java98
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java5
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java70
6 files changed, 235 insertions, 72 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WfeMembersTab.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WfeMembersTab.java
index 05b3190922..517d96b2db 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WfeMembersTab.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WfeMembersTab.java
@@ -29,6 +29,8 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
@@ -53,6 +55,7 @@ import org.eclipse.osee.ats.world.IMenuActionProvider;
import org.eclipse.osee.ats.world.IWorldEditor;
import org.eclipse.osee.ats.world.IWorldEditorProvider;
import org.eclipse.osee.ats.world.IWorldViewerEventHandler;
+import org.eclipse.osee.ats.world.WorkflowMetricsUI;
import org.eclipse.osee.ats.world.WorldComposite;
import org.eclipse.osee.ats.world.WorldViewDragAndDrop;
import org.eclipse.osee.ats.world.WorldXViewer;
@@ -72,14 +75,18 @@ import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact
import org.eclipse.osee.framework.skynet.core.event.model.EventModType;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.action.CollapseAllAction;
import org.eclipse.osee.framework.ui.skynet.action.ExpandAllAction;
import org.eclipse.osee.framework.ui.skynet.action.RefreshAction;
import org.eclipse.osee.framework.ui.skynet.artifact.ArtifactTransfer;
+import org.eclipse.osee.framework.ui.skynet.artifact.editor.parts.AttributeFormPart;
import org.eclipse.osee.framework.ui.skynet.util.FormsUtil;
import org.eclipse.osee.framework.ui.skynet.util.LoadingComposite;
+import org.eclipse.osee.framework.ui.swt.ALayout;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ExceptionComposite;
+import org.eclipse.osee.framework.ui.swt.FontManager;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
import org.eclipse.osee.framework.ui.swt.Widgets;
@@ -89,11 +96,14 @@ import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.ScrolledForm;
@@ -113,6 +123,7 @@ public class WfeMembersTab extends FormPage implements IWorldEditor, ISelectedAt
private static Map<String, Integer> guidToScrollLocation = new HashMap<>();
private final ReloadJobChangeAdapter reloadAdapter;
private final IMemberProvider provider;
+ private WorkflowMetricsUI workflowMetricsUi;
public WfeMembersTab(WorkflowEditor editor, IMemberProvider provider) {
super(editor, ID, provider.getMembersName());
@@ -264,10 +275,11 @@ public class WfeMembersTab extends FormPage implements IWorldEditor, ISelectedAt
*/
private boolean createMembersBody() {
if (!Widgets.isAccessible(worldComposite)) {
- worldComposite = new WorldComposite(this, provider.getXViewerFactory(provider.getArtifact()),
- bodyComp, SWT.BORDER, false);
+ worldComposite =
+ new WorldComposite(this, provider.getXViewerFactory(provider.getArtifact()), bodyComp, SWT.BORDER, false);
new MembersDragAndDrop(worldComposite, WorkflowEditor.EDITOR_ID);
+ worldComposite.setLayout(ALayout.getZeroMarginLayout());
if (editor.getAwa().isOfType(AtsArtifactTypes.Goal)) {
worldComposite.getXViewer().setParentGoal((GoalArtifact) editor.getAwa());
@@ -281,9 +293,15 @@ public class WfeMembersTab extends FormPage implements IWorldEditor, ISelectedAt
gd.widthHint = 100;
gd.heightHint = 100;
worldComposite.setLayoutData(gd);
+ workflowMetricsUi = new WorkflowMetricsUI(worldComposite, editor.getToolkit());
+
+ editor.getToolkit().adapt(worldComposite);
reload();
createActions();
+
+ AttributeFormPart.setLabelFonts(worldComposite, FontManager.getDefaultLabelFont());
+
return true;
}
return false;
@@ -441,6 +459,12 @@ public class WfeMembersTab extends FormPage implements IWorldEditor, ISelectedAt
toolBarMgr.add(new ExpandAllAction(worldComposite.getXViewer()));
toolBarMgr.add(new CollapseAllAction(worldComposite.getXViewer()));
toolBarMgr.add(new RefreshAction(worldComposite));
+
+ toolBarMgr.add(new Separator());
+
+ createDropDownMenuActions();
+ toolBarMgr.add(new DropDownAction());
+
scrolledForm.updateToolBar();
}
@@ -706,4 +730,92 @@ public class WfeMembersTab extends FormPage implements IWorldEditor, ISelectedAt
return null;
}
+ public class DropDownAction extends Action implements IMenuCreator {
+ private Menu fMenu;
+
+ public DropDownAction() {
+ setText("Other");
+ setMenuCreator(this);
+ setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
+ addKeyListener();
+ }
+
+ @Override
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fMenu = new Menu(parent);
+ addActionToMenu(fMenu, workflowMetricsUi.getOrCreateAction());
+ return fMenu;
+ }
+
+ @Override
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ @Override
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ @Override
+ public void run() {
+ // provided for subclass implementation
+ }
+
+ /**
+ * Get's rid of the menu, because the menu hangs on to * the searches, etc.
+ */
+ void clear() {
+ dispose();
+ }
+
+ private void addKeyListener() {
+ Tree tree = worldComposite.getXViewer().getTree();
+ GridData gridData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL);
+ gridData.heightHint = 100;
+ gridData.widthHint = 100;
+ tree.setLayoutData(gridData);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ worldComposite.getXViewer().getTree().addKeyListener(new KeyListener() {
+ @Override
+ public void keyPressed(KeyEvent event) {
+ // do nothing
+ }
+
+ @Override
+ public void keyReleased(KeyEvent event) {
+ // if CTRL key is already pressed
+ if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) {
+ if (event.keyCode == 'a') {
+ worldComposite.getXViewer().getTree().setSelection(
+ worldComposite.getXViewer().getTree().getItems());
+ } else if (event.keyCode == 'x') {
+ workflowMetricsUi.getOrCreateAction().setChecked(
+ !workflowMetricsUi.getOrCreateAction().isChecked());
+ workflowMetricsUi.getOrCreateAction().run();
+ }
+ }
+ }
+ });
+ }
+ }
+
+ protected void createDropDownMenuActions() {
+ workflowMetricsUi.getOrCreateAction();
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/WorkflowMetrics.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/WorkflowMetrics.java
index 8f5c1a4899..76a290eb69 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/WorkflowMetrics.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/WorkflowMetrics.java
@@ -18,6 +18,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
import org.eclipse.osee.ats.api.user.IAtsUser;
import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.column.RemainingHoursColumn;
@@ -34,6 +35,7 @@ import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.DateUtil;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
/**
@@ -47,6 +49,7 @@ public class WorkflowMetrics {
double manDaysNeeded = 0;
double cummulativeWorkflowPercentComplete = 0;
double percentCompleteByWorkflowPercents = 0;
+ double points = 0, pointsNumeric = 0;
Date estimatedReleaseDate;
long daysTillRel = 0;
@@ -109,6 +112,8 @@ public class WorkflowMetrics {
manDaysNeeded = 0;
cummulativeWorkflowPercentComplete = 0;
manDaysNeeded = 0;
+ points = 0;
+ pointsNumeric = 0;
for (AbstractWorkflowArtifact team : awas) {
hrsRemainFromEstimates += RemainingHoursColumn.getRemainingHours(team);
estHours += EstimatedHoursUtil.getEstimatedHours(team);
@@ -116,6 +121,9 @@ public class WorkflowMetrics {
manDaysNeeded += WorkDaysNeededColumn.getWorldViewManDaysNeeded(team);
cummulativeWorkflowPercentComplete +=
PercentCompleteTotalUtil.getPercentCompleteTotal(team, AtsClientService.get().getServices());
+ String ptsStr = team.getSoleAttributeValue(AtsAttributeTypes.Points, null);
+ points += Strings.isNumeric(ptsStr) ? Integer.valueOf(ptsStr) : 0;
+ pointsNumeric += team.getSoleAttributeValue(AtsAttributeTypes.PointsNumeric, 0.0);
}
if (hrsRemainFromEstimates != 0) {
manDaysNeeded = hrsRemainFromEstimates / manHoursPerDay;
@@ -133,9 +141,11 @@ public class WorkflowMetrics {
if (estimatedReleaseDate != null && estimatedReleaseDate.after(today)) {
daysTillRel = DateUtil.getWorkingDaysBetween(today, estimatedReleaseDate);
}
- str = String.format("TeamWFs: %s Tasks: %s EstHrs: %5.2f %sCmp: %5.2f RmnHrs: %5.2f HrsSpnt: %5.2f %s %s",
- getNumTeamWfs(), getNumTasks(), estHours, "%", percentCompleteByWorkflowPercents, hrsRemainFromEstimates,
- hrsSpent, manDaysNeeded > 0 ? String.format("ManDaysNeeded: %5.2f ", manDaysNeeded) : "",
+ str = String.format(
+ "TeamWFs: %s Tasks: %s Revs: %s EstHrs: %5.2f %sCmp: %5.2f RmnHrs: %5.2f HrsSpnt: %5.2f Pts: %s PtsNum: %s %s %s",
+ getNumTeamWfs(), getNumTasks(), getNumReviews(), estHours, "%", percentCompleteByWorkflowPercents,
+ hrsRemainFromEstimates, hrsSpent, points, pointsNumeric,
+ manDaysNeeded > 0 ? String.format("ManDaysNeeded: %5.2f ", manDaysNeeded) : "",
version != null ? String.format("Version: %s EstRelDate: %s DaysLeft: %d ", version.getName(),
estimatedReleaseDate == null ? "Not Set" : DateUtil.getMMDDYY(estimatedReleaseDate), daysTillRel) : "");
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorkflowMetricsUI.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorkflowMetricsUI.java
new file mode 100644
index 0000000000..09f1901bfd
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorkflowMetricsUI.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.world;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.util.WorkflowMetrics;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+import org.eclipse.osee.framework.ui.skynet.XFormToolkit;
+import org.eclipse.osee.framework.ui.swt.FontManager;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class WorkflowMetricsUI {
+
+ protected Label showReleaseMetricsLabel;
+ private Action selectionMetricsAction;
+ private final WorldComposite worldComposite;
+ protected final XFormToolkit toolkit;
+
+ public WorkflowMetricsUI(WorldComposite worldComposite, XFormToolkit toolkit) {
+ this.worldComposite = worldComposite;
+ this.toolkit = toolkit;
+ }
+
+ private void updateExtraInfoLine() throws OseeCoreException {
+ if (selectionMetricsAction != null && selectionMetricsAction.isChecked()) {
+ if (showReleaseMetricsLabel == null || showReleaseMetricsLabel.isDisposed()) {
+ showReleaseMetricsLabel = toolkit.createLabel(worldComposite.getParent(), "");
+ showReleaseMetricsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ showReleaseMetricsLabel.setFont(FontManager.getCourierNew12Bold());
+ }
+ if (worldComposite.getXViewer() != null && worldComposite.getXViewer().getSelectedWorkflowArtifacts() != null && !worldComposite.getXViewer().getSelectedWorkflowArtifacts().isEmpty()) {
+ showReleaseMetricsLabel.setText(
+ WorkflowMetrics.getEstRemainMetrics(worldComposite.getXViewer().getSelectedWorkflowArtifacts(), null,
+ worldComposite.getXViewer().getSelectedWorkflowArtifacts().iterator().next().getManHrsPerDayPreference(),
+ null));
+ } else {
+ showReleaseMetricsLabel.setText("");
+ }
+ } else {
+ showReleaseMetricsLabel.dispose();
+ }
+ worldComposite.getParent().layout();
+ }
+
+ public Action getOrCreateAction() {
+ if (selectionMetricsAction == null) {
+ selectionMetricsAction = new Action("Show Release Metrics by Selection - Ctrl-X", IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ try {
+ updateExtraInfoLine();
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+ selectionMetricsAction.setToolTipText("Show Release Metrics by Selection - Ctrl-X");
+ selectionMetricsAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PAGE));
+ addSelectionListener();
+ }
+ return selectionMetricsAction;
+ }
+
+ private void addSelectionListener() {
+ worldComposite.getXViewer().getTree().addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (selectionMetricsAction != null) {
+ if (selectionMetricsAction.isChecked()) {
+ selectionMetricsAction.run();
+ }
+ }
+ }
+ });
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
index 786f62d71b..3835752c28 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldComposite.java
@@ -52,7 +52,6 @@ import org.eclipse.osee.ats.world.search.WorldSearchItem;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.DateUtil;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -284,7 +283,6 @@ public class WorldComposite extends Composite implements IOseeTreeReportProvider
public void run() {
String useTitle = Strings.truncate(title, WorldEditor.TITLE_MAX_LENGTH);
iWorldEditor.setTableTitle(useTitle, warning);
- worldXViewer.setReportingTitle(useTitle + " - " + DateUtil.getDateNow());
};
});
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
index 3449c3b952..bce2219dbf 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXViewer.java
@@ -94,7 +94,6 @@ import org.eclipse.swt.widgets.TreeItem;
* @author Donald G. Dunne
*/
public class WorldXViewer extends XViewer implements ISelectedAtsArtifacts, IPersistAltLeftClickProvider, ISelectedTeamWorkflowArtifacts, ISelectedArtifacts, IDirtiableEditor {
- private String title;
private String extendedStatusString = "";
public static final String MENU_GROUP_ATS_WORLD_EDIT = "ATS WORLD EDIT";
public static final String MENU_GROUP_ATS_WORLD_OPEN = "ATS WORLD OPEN";
@@ -523,10 +522,6 @@ public class WorldXViewer extends XViewer implements ISelectedAtsArtifacts, IPer
return actionArts;
}
- public void setReportingTitle(String title) {
- this.title = title;
- }
-
public List<Artifact> getSelectedArtifactItems() {
List<Artifact> arts = new ArrayList<>();
TreeItem items[] = getTree().getSelection();
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
index 0b21fe967b..56e4a2d5f2 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/world/WorldXWidgetActionPage.java
@@ -43,7 +43,6 @@ import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.ats.internal.Activator;
import org.eclipse.osee.ats.task.TaskComposite;
-import org.eclipse.osee.ats.util.WorkflowMetrics;
import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
@@ -82,7 +81,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Tree;
@@ -110,11 +108,10 @@ public class WorldXWidgetActionPage extends FormPage {
public static final String MENU_GROUP_PRE = "world.menu.group.pre";
private final WorldEditor worldEditor;
private WorldComposite worldComposite;
- private Action filterCompletedAction, filterMyAssigneeAction, selectionMetricsAction, toAction, toGoal, toReview,
- toWorkFlow, toTask;
+ private Action filterCompletedAction, filterMyAssigneeAction, toAction, toGoal, toReview, toWorkFlow, toTask;
private final WorldCompletedFilter worldCompletedFilter = new WorldCompletedFilter();
private WorldAssigneeFilter worldAssigneeFilter = null;
- protected Label showReleaseMetricsLabel;
+ private WorkflowMetricsUI workflowMetricsUi;
public WorldXWidgetActionPage(WorldEditor worldEditor) {
super(worldEditor, ID, (worldEditor.isTaskEditor() ? "Tasks" : "Actions"));
@@ -308,16 +305,16 @@ public class WorldXWidgetActionPage extends FormPage {
resultsContainer = toolkit.createClientContainer(resultsSection, 1);
- showReleaseMetricsLabel = toolkit.createLabel(resultsContainer, "");
- showReleaseMetricsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
worldComposite = new WorldComposite(worldEditor, resultsContainer, SWT.BORDER | SWT.NO_SCROLL);
+ worldComposite.setLayout(ALayout.getZeroMarginLayout());
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 100;
gd.heightHint = 100;
worldComposite.setLayoutData(gd);
+ workflowMetricsUi = new WorkflowMetricsUI(worldComposite, toolkit);
toolkit.adapt(worldComposite);
+
return resultsSection;
}
@@ -354,7 +351,6 @@ public class WorldXWidgetActionPage extends FormPage {
setMenuCreator(this);
setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.GEAR));
addKeyListener();
- addSelectionListener();
}
@Override
@@ -364,9 +360,7 @@ public class WorldXWidgetActionPage extends FormPage {
}
fMenu = new Menu(parent);
- if (!worldEditor.isTaskEditor()) {
- addActionToMenu(fMenu, selectionMetricsAction);
- }
+ addActionToMenu(fMenu, workflowMetricsUi.getOrCreateAction());
addActionToMenu(fMenu, filterCompletedAction);
addActionToMenu(fMenu, filterMyAssigneeAction);
if (!worldEditor.isTaskEditor()) {
@@ -436,8 +430,9 @@ public class WorldXWidgetActionPage extends FormPage {
worldComposite.getXViewer().getTree().setSelection(
worldComposite.getXViewer().getTree().getItems());
} else if (event.keyCode == 'x') {
- selectionMetricsAction.setChecked(!selectionMetricsAction.isChecked());
- selectionMetricsAction.run();
+ workflowMetricsUi.getOrCreateAction().setChecked(
+ !workflowMetricsUi.getOrCreateAction().isChecked());
+ workflowMetricsUi.getOrCreateAction().run();
} else if (event.keyCode == 'f') {
filterCompletedAction.setChecked(!filterCompletedAction.isChecked());
filterCompletedAction.run();
@@ -518,40 +513,6 @@ public class WorldXWidgetActionPage extends FormPage {
return taskComposite;
}
- private void addSelectionListener() {
- worldComposite.getXViewer().getTree().addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (selectionMetricsAction != null) {
- if (selectionMetricsAction.isChecked()) {
- selectionMetricsAction.run();
- } else {
- if (worldComposite != null) {
- showReleaseMetricsLabel.setText("");
- }
- }
- }
- }
- });
- }
-
- public void updateExtraInfoLine() throws OseeCoreException {
- if (selectionMetricsAction != null && selectionMetricsAction.isChecked()) {
- if (worldComposite.getXViewer() != null && worldComposite.getXViewer().getSelectedWorkflowArtifacts() != null && !worldComposite.getXViewer().getSelectedWorkflowArtifacts().isEmpty()) {
- showReleaseMetricsLabel.setText(
- WorkflowMetrics.getEstRemainMetrics(worldComposite.getXViewer().getSelectedWorkflowArtifacts(), null,
- worldComposite.getXViewer().getSelectedWorkflowArtifacts().iterator().next().getManHrsPerDayPreference(),
- null));
- } else {
- showReleaseMetricsLabel.setText("");
- }
- } else {
- showReleaseMetricsLabel.setText("");
- }
- showReleaseMetricsLabel.getParent().layout();
- }
-
protected void createDropDownMenuActions() {
try {
worldAssigneeFilter = new WorldAssigneeFilter();
@@ -559,18 +520,7 @@ public class WorldXWidgetActionPage extends FormPage {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
- selectionMetricsAction = new Action("Show Release Metrics by Selection - Ctrl-X", IAction.AS_CHECK_BOX) {
- @Override
- public void run() {
- try {
- updateExtraInfoLine();
- } catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- }
- };
- selectionMetricsAction.setToolTipText("Show Release Metrics by Selection - Ctrl-X");
- selectionMetricsAction.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.PAGE));
+ workflowMetricsUi.getOrCreateAction();
filterCompletedAction = new Action("Filter Out Completed/Cancelled - Ctrl-F", IAction.AS_CHECK_BOX) {

Back to the top