Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-09-15 19:20:35 -0400
committerAngel Avila2016-10-04 21:35:16 -0400
commit25ff70fb7a85df79c4462896c61a1eead1f6f91e (patch)
tree39936b5adfe38d84e1a3a1b8a7b9741e243cdb29
parent067a4273a4e824b02d6761a9c41b057f40b09d77 (diff)
downloadorg.eclipse.osee-25ff70fb7a85df79c4462896c61a1eead1f6f91e.tar.gz
org.eclipse.osee-25ff70fb7a85df79c4462896c61a1eead1f6f91e.tar.xz
org.eclipse.osee-25ff70fb7a85df79c4462896c61a1eead1f6f91e.zip
feature: Add New Action to Members tab menu
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionJob.java19
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionWizard.java6
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileUtilClient.java5
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/SprintMemberProvider.java10
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/IMemberProvider.java5
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/WfeMembersTab.java5
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/GoalMemberProvider.java10
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/NewActionToGoalAction.java131
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java10
9 files changed, 189 insertions, 12 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionJob.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionJob.java
index b625f2d0f6e..42a8654250d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionJob.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionJob.java
@@ -45,6 +45,7 @@ public class NewActionJob extends Job {
private final Set<IAtsActionableItem> actionableItems;
private final NewActionWizard wizard;
private final INewActionListener newActionListener;
+ private boolean openOnComplete = true;
public NewActionJob(String title, String desc, ChangeType changeType, String priority, Date needByDate, boolean validationRequired, Set<IAtsActionableItem> actionableItems, NewActionWizard wizard, INewActionListener newActionListener) {
super("Creating New Action");
@@ -82,10 +83,12 @@ public class NewActionJob extends Job {
}
changes.execute();
- // Because this is a job, it will automatically kill any popups that are created during.
- // Thus, if multiple teams were selected to create, don't popup on openAction or dialog
- // will exception out when it is killed at the end of this job.
- AtsUtil.openATSAction(actionArt, AtsOpenOption.OpenAll);
+ if (openOnComplete) {
+ // Because this is a job, it will automatically kill any popups that are created during.
+ // Thus, if multiple teams were selected to create, don't popup on openAction or dialog
+ // will exception out when it is killed at the end of this job.
+ AtsUtil.openATSAction(actionArt, AtsOpenOption.OpenAll);
+ }
} catch (Exception ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getMessage(), ex);
@@ -101,4 +104,12 @@ public class NewActionJob extends Job {
return actionArt;
}
+ public boolean isOpenOnComplete() {
+ return openOnComplete;
+ }
+
+ public void setOpenOnComplete(boolean openOnComplete) {
+ this.openOnComplete = openOnComplete;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionWizard.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionWizard.java
index 9aefa481814..87434b0573d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionWizard.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/actions/wizard/NewActionWizard.java
@@ -46,6 +46,7 @@ public class NewActionWizard extends Wizard implements INewWizard {
private String initialDescription;
private NewActionJob job = null;
private INewActionListener newActionListener;
+ private boolean openOnComplete = true;;
@Override
public boolean performFinish() {
@@ -58,6 +59,7 @@ public class NewActionWizard extends Wizard implements INewWizard {
job = new NewActionJob(getTitle(), getDescription(), getChangeType(), getPriority(), getNeedBy(),
getValidation(), getSelectedIAtsActionableItems(), this, newActionListener);
job.setUser(true);
+ job.setOpenOnComplete(openOnComplete);
job.setPriority(Job.LONG);
job.schedule();
} catch (OseeCoreException ex) {
@@ -170,4 +172,8 @@ public class NewActionWizard extends Wizard implements INewWizard {
this.newActionListener = newActionListener;
}
+ public void setOpenOnComplete(boolean openOnComplete) {
+ this.openOnComplete = openOnComplete;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileUtilClient.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileUtilClient.java
index 4f9c8337af7..f6b7ee78b1e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileUtilClient.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/AgileUtilClient.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ats.agile;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -40,6 +41,10 @@ public class AgileUtilClient {
return backlogArt.getRelatedArtifactsCount(AtsRelationTypes.AgileTeamToBacklog_AgileTeam) == 1;
}
+ public static boolean isSprint(Artifact artifact) {
+ return artifact.isOfType(AtsArtifactTypes.AgileSprint);
+ }
+
public static Collection<Artifact> getRelatedSprints(Artifact awa) {
Set<Artifact> sprints = new HashSet<>();
for (Artifact sprintArt : awa.getRelatedArtifacts(AtsRelationTypes.AgileSprintToItem_Sprint)) {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/SprintMemberProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/SprintMemberProvider.java
index 3534b0e2065..3820aa91a0a 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/SprintMemberProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/SprintMemberProvider.java
@@ -117,4 +117,14 @@ public class SprintMemberProvider extends AbstractMemberProvider {
AtsClientService.get().getSprintItemsCache().decache(getArtifact());
}
+ @Override
+ public boolean isBacklog() {
+ return false;
+ }
+
+ @Override
+ public boolean isSprint() {
+ return true;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/IMemberProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/IMemberProvider.java
index 0738da1c2fb..bdad9cf7383 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/IMemberProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/IMemberProvider.java
@@ -13,7 +13,6 @@ package org.eclipse.osee.ats.editor;
import java.util.List;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
-import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -52,4 +51,8 @@ public interface IMemberProvider {
void deCacheAndReload(boolean pend, IJobChangeListener listener);
+ boolean isBacklog();
+
+ boolean isSprint();
+
}
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 517d96b2dbf..aad0de3c618 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
@@ -47,6 +47,7 @@ import org.eclipse.osee.ats.core.client.artifact.SprintArtifact;
import org.eclipse.osee.ats.core.client.config.AtsBulkLoad;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact;
+import org.eclipse.osee.ats.goal.NewActionToGoalAction;
import org.eclipse.osee.ats.goal.RemoveFromCollectorAction;
import org.eclipse.osee.ats.goal.RemoveFromCollectorAction.RemovedFromCollectorHandler;
import org.eclipse.osee.ats.goal.SetCollectorOrderAction;
@@ -633,6 +634,7 @@ public class WfeMembersTab extends FormPage implements IWorldEditor, ISelectedAt
}
Action setCollectorOrderAction, removeFromCollectorAction;
+ private NewActionToGoalAction newActionToGoalAction;
private void createActions() {
setCollectorOrderAction = new SetCollectorOrderAction(provider, (CollectorArtifact) editor.getAwa(), this);
@@ -648,6 +650,7 @@ public class WfeMembersTab extends FormPage implements IWorldEditor, ISelectedAt
};
removeFromCollectorAction =
new RemoveFromCollectorAction(provider, (CollectorArtifact) editor.getAwa(), this, handler);
+ newActionToGoalAction = new NewActionToGoalAction(provider, (CollectorArtifact) editor.getAwa(), this);
}
@Override
@@ -655,6 +658,8 @@ public class WfeMembersTab extends FormPage implements IWorldEditor, ISelectedAt
MenuManager mm = worldComposite.getXViewer().getMenuManager();
mm.insertBefore(WorldXViewer.MENU_GROUP_ATS_WORLD_EDIT, setCollectorOrderAction);
mm.insertBefore(WorldXViewer.MENU_GROUP_ATS_WORLD_EDIT, removeFromCollectorAction);
+ newActionToGoalAction.refreshText();
+ mm.insertBefore(WorldXViewer.MENU_GROUP_ATS_WORLD_EDIT, newActionToGoalAction);
mm.insertBefore(WorldXViewer.MENU_GROUP_ATS_WORLD_EDIT, new Separator());
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/GoalMemberProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/GoalMemberProvider.java
index 8f78ce369f9..bce5a83b80f 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/GoalMemberProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/GoalMemberProvider.java
@@ -15,13 +15,11 @@ import org.eclipse.nebula.widgets.xviewer.IXViewerFactory;
import org.eclipse.osee.ats.AtsImage;
import org.eclipse.osee.ats.agile.AgileUtilClient;
import org.eclipse.osee.ats.agile.BacklogXViewerFactory;
-import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.api.workflow.IAtsGoal;
import org.eclipse.osee.ats.artifact.GoalManager;
import org.eclipse.osee.ats.core.client.artifact.GoalArtifact;
import org.eclipse.osee.ats.internal.AtsClientService;
-import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -113,11 +111,17 @@ public class GoalMemberProvider extends AbstractMemberProvider {
return Result.TrueResult;
}
- private boolean isBacklog() {
+ @Override
+ public boolean isBacklog() {
return AgileUtilClient.isBacklog(getArtifact());
}
@Override
+ public boolean isSprint() {
+ return false;
+ }
+
+ @Override
public void deCacheArtifact() {
AtsClientService.get().getGoalMembersCache().decache(getArtifact());
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/NewActionToGoalAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/NewActionToGoalAction.java
new file mode 100644
index 00000000000..45607d50de7
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/goal/NewActionToGoalAction.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * 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.goal;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.actions.wizard.NewActionWizard;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
+import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.api.util.IAtsChangeSet;
+import org.eclipse.osee.ats.api.workflow.IAtsAction;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
+import org.eclipse.osee.ats.api.workflow.NewActionAdapter;
+import org.eclipse.osee.ats.core.client.actions.ISelectedAtsArtifacts;
+import org.eclipse.osee.ats.core.client.artifact.CollectorArtifact;
+import org.eclipse.osee.ats.core.client.artifact.GoalArtifact;
+import org.eclipse.osee.ats.core.client.artifact.SprintArtifact;
+import org.eclipse.osee.ats.editor.IMemberProvider;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.internal.AtsClientService;
+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.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NewActionToGoalAction extends Action {
+
+ private final CollectorArtifact collectorArt;
+ private final ISelectedAtsArtifacts selectedAtsArtifacts;
+ private final IMemberProvider memberProvider;
+
+ public static interface RemovedFromCollectorHandler {
+ void removedFromCollector(Collection<? extends Artifact> removed);
+ }
+
+ public NewActionToGoalAction(IMemberProvider memberProvider, CollectorArtifact collectorArt, ISelectedAtsArtifacts selectedAtsArtifacts) {
+ super("Create New Action At This Location");
+ this.memberProvider = memberProvider;
+ this.collectorArt = collectorArt;
+ this.selectedAtsArtifacts = selectedAtsArtifacts;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(AtsImage.NEW_ACTION);
+ }
+
+ @Override
+ public void run() {
+ try {
+ Collection<? extends Artifact> selected = selectedAtsArtifacts.getSelectedAtsArtifacts();
+ final Artifact dropTarget = selected.isEmpty() ? null : selected.iterator().next();
+ List<IAtsActionableItem> ais = new LinkedList<>();
+ if (memberProvider.isBacklog() || memberProvider.isSprint()) {
+ Artifact agileTeam = null;
+ if (memberProvider.isBacklog()) {
+ agileTeam = collectorArt.getRelatedArtifact(AtsRelationTypes.AgileTeamToBacklog_AgileTeam);
+ } else {
+ agileTeam = collectorArt.getRelatedArtifact(AtsRelationTypes.AgileTeamToSprint_AgileTeam);
+ }
+ List<Artifact> atsTeams = agileTeam.getRelatedArtifacts(AtsRelationTypes.AgileTeamToAtsTeam_AtsTeam);
+ for (Artifact atsTeam : atsTeams) {
+ for (Artifact ai : atsTeam.getRelatedArtifacts(AtsRelationTypes.TeamActionableItem_ActionableItem)) {
+ ais.add(AtsClientService.get().getConfigItemFactory().getActionableItem(ai));
+ }
+ }
+ }
+ NewActionWizard wizard = new NewActionWizard();
+ if (!ais.isEmpty()) {
+ wizard.setInitialAias(ais);
+ }
+ wizard.setNewActionListener(new NewActionAdapter() {
+
+ @Override
+ public void teamCreated(IAtsAction action, IAtsTeamWorkflow teamWf, IAtsChangeSet changes) throws OseeCoreException {
+ List<Artifact> related = collectorArt.getRelatedArtifacts(memberProvider.getMemberRelationTypeSide());
+ if (!related.contains(teamWf.getStoreObject())) {
+ changes.relate(collectorArt, memberProvider.getMemberRelationTypeSide(), teamWf.getStoreObject());
+ }
+ if (dropTarget != null) {
+ collectorArt.setRelationOrder(memberProvider.getMemberRelationTypeSide(), dropTarget, false,
+ (Artifact) teamWf.getStoreObject());
+ if (collectorArt.isOfType(AtsArtifactTypes.Goal)) {
+ AtsClientService.get().getGoalMembersCache().decache((GoalArtifact) collectorArt);
+ } else if (memberProvider.isSprint()) {
+ AtsClientService.get().getSprintItemsCache().decache((SprintArtifact) collectorArt);
+ }
+ }
+
+ changes.add(collectorArt);
+ }
+
+ });
+ wizard.setOpenOnComplete(false);
+ WizardDialog dialog =
+ new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.create();
+ dialog.open();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public String getText() {
+ return selectedAtsArtifacts.getSelectedWorkflowArtifacts().isEmpty() ? "Create New Action at End" : "Create New Action At This Location";
+ }
+
+ public void refreshText() {
+ setText(getText());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index b61e24a15db..489e8059893 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -1300,11 +1300,13 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A
List<Artifact> currentOrder = getRelatedArtifacts(relationEnumeration, Artifact.class);
// target artifact doesn't exist
if (!currentOrder.contains(targetArtifact)) {
- // add to end of list if not already in list
- if (!currentOrder.contains(itemToAdd)) {
- currentOrder.add(itemToAdd);
- }
+ throw new OseeStateException("Could not set Relation Order: target not in list");
+ }
+ // add to end of list if not already in list
+ if (!currentOrder.contains(itemToAdd)) {
+ currentOrder.add(itemToAdd);
}
+
boolean result = Collections.moveItem(currentOrder, itemToAdd, targetArtifact, insertAfterTarget);
if (!result) {
throw new OseeStateException("Could not set Relation Order");

Back to the top