Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-09-28 13:30:24 -0400
committerDonald Dunne2016-09-29 22:06:41 -0400
commita7facf988c8ca799e5fba83ea73042665d6009da (patch)
tree8b617da3155e2ffc32b634a9420baf90155aef30
parentb6a2ec81a632fa77b81cfc912395b10a3aa3e929 (diff)
downloadorg.eclipse.osee-a7facf988c8ca799e5fba83ea73042665d6009da.tar.gz
org.eclipse.osee-a7facf988c8ca799e5fba83ea73042665d6009da.tar.xz
org.eclipse.osee-a7facf988c8ca799e5fba83ea73042665d6009da.zip
bug[ats_ATS303551]: Add OpenWorkPackageByIdAction
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/EvNavigateItems.java2
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/OpenWorkPackageByIdAction.java107
2 files changed, 109 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/EvNavigateItems.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/EvNavigateItems.java
index 5be2af11f6..dd9939ed05 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/EvNavigateItems.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/EvNavigateItems.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.ats.navigate.SearchNavigateItem;
import org.eclipse.osee.ats.world.search.AtsSearchWorkPackageSearchItem;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
/**
* @author Donald G. Dunne
@@ -27,6 +28,7 @@ public class EvNavigateItems {
public static void createSection(XNavigateItem parent, List<XNavigateItem> items) {
try {
XNavigateItem evItems = new XNavigateItem(parent, "Earned Value", AtsImage.E_BOXED);
+ new XNavigateItemAction(evItems, new OpenWorkPackageByIdAction(), AtsImage.WORK_PACKAGE);
new WorkPackageConfigReport(evItems);
new WorkPackageQBDReport(evItems);
new SearchNavigateItem(evItems, new AtsSearchWorkPackageSearchItem());
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/OpenWorkPackageByIdAction.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/OpenWorkPackageByIdAction.java
new file mode 100644
index 0000000000..d5426d054f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/ev/OpenWorkPackageByIdAction.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * 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.ev;
+
+import java.util.LinkedList;
+import java.util.List;
+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.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.core.util.AtsUtilCore;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.artifact.massEditor.MassArtifactEditor;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class OpenWorkPackageByIdAction extends Action {
+
+ public static final IAttributeType FinancialSystemId =
+ TokenFactory.createAttributeType(0x1000555145600EEL, "Financial System Id");
+
+ public OpenWorkPackageByIdAction() {
+ this("Open Work Package by ID(s)");
+ }
+
+ public OpenWorkPackageByIdAction(String name) {
+ super(name);
+ setToolTipText(getText());
+ }
+
+ @Override
+ public void run() {
+ EntryDialog dialog = new EntryDialog(getText(), "Enter Work Package guid, activity id or financial id");
+ if (dialog.open() == Window.OK) {
+ final List<String> ids = new LinkedList<String>();
+ final List<String> guids = new LinkedList<>();
+ for (String str : dialog.getEntry().split(",")) {
+ str = str.replaceAll("^\\s+", "");
+ str = str.replaceAll("\\s+$", "");
+ if (Strings.isValid(str)) {
+ if (GUID.isValid(str)) {
+ guids.add(str);
+ } else {
+ ids.add(str);
+ }
+ }
+ Job searchWps = new Job(getText()) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ List<Artifact> results = new LinkedList<>();
+ if (!guids.isEmpty()) {
+ results.addAll(ArtifactQuery.getArtifactListFromIds(guids, AtsUtilCore.getAtsBranch()));
+ }
+ if (!ids.isEmpty()) {
+ results.addAll(ArtifactQuery.getArtifactListFromAttributeValues(AtsAttributeTypes.ActivityId, ids,
+ AtsUtilCore.getAtsBranch(), 5));
+ AttributeType type = AttributeTypeManager.getType(FinancialSystemId);
+ if (type != null) {
+ results.addAll(ArtifactQuery.getArtifactListFromAttributeValues(FinancialSystemId, ids,
+ AtsUtilCore.getAtsBranch(), 5));
+ }
+ }
+ if (results.isEmpty()) {
+ AWorkbench.popup("No Work Packages found with id(s): " + dialog.getEntry());
+ } else {
+ MassArtifactEditor.editArtifacts(getName(), results);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Jobs.startJob(searchWps, true);
+ }
+ }
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ return ImageManager.getImageDescriptor(AtsImage.WORK_PACKAGE);
+ }
+
+}

Back to the top