Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2010-09-24 11:48:00 -0400
committerRyan D. Brooks2010-09-24 11:48:00 -0400
commitf7668b3e4e34dfe032ee7b68b77d08061f6e155b (patch)
treec61b90457db8185d7403f081f21fc481ed6c4391 /plugins
parentba97ca6a15a004e7ab2edd98d3b5f0b6a4c68500 (diff)
downloadorg.eclipse.osee-f7668b3e4e34dfe032ee7b68b77d08061f6e155b.tar.gz
org.eclipse.osee-f7668b3e4e34dfe032ee7b68b77d08061f6e155b.tar.xz
org.eclipse.osee-f7668b3e4e34dfe032ee7b68b77d08061f6e155b.zip
feature[ats_UYPM6]: Handle coverage events and editor refresh when work product tasks are modified
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/OseeAtsServiceImpl.java12
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java11
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java7
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java3
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java79
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageArtifactTypes.java1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/cm/IOseeCmService.java5
7 files changed, 98 insertions, 20 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/OseeAtsServiceImpl.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/OseeAtsServiceImpl.java
index cae2709ab9b..7652c448a66 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/OseeAtsServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/internal/OseeAtsServiceImpl.java
@@ -22,10 +22,12 @@ import org.eclipse.osee.ats.actions.wizard.NewActionJob;
import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
import org.eclipse.osee.ats.artifact.StateMachineArtifact;
import org.eclipse.osee.ats.artifact.TaskableStateMachineArtifact;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
import org.eclipse.osee.ats.util.AtsUtil;
import org.eclipse.osee.ats.world.WorldEditor;
import org.eclipse.osee.ats.world.WorldEditorSimpleProvider;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
@@ -151,4 +153,14 @@ public class OseeAtsServiceImpl implements IOseeCmService {
}
return AtsImage.ACTION;
}
+
+ @Override
+ public IArtifactType getPcrArtifactType() {
+ return AtsArtifactTypes.TeamWorkflow;
+ }
+
+ @Override
+ public IArtifactType getPcrTaskArtifactType() {
+ return AtsArtifactTypes.Task;
+ }
}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java
index a45137dbf21..bb253f2547a 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditor.java
@@ -280,6 +280,17 @@ public class CoverageEditor extends FormEditor implements IActionable {
coverageEditorOverviewTab.refreshActionHandler();
}
+ public void refreshWorkProductTasks() {
+ Displays.ensureInDisplayThread(new Runnable() {
+
+ @Override
+ public void run() {
+ coverageEditorCoverageTab.refresh();
+ coverageEditorOverviewTab.refreshActionHandler();
+ }
+ });
+ }
+
public static void closeAll() {
Displays.ensureInDisplayThread(new Runnable() {
@Override
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
index 3e19019aff9..0662fcb962e 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorCoverageTab.java
@@ -199,7 +199,9 @@ public class CoverageEditorCoverageTab extends FormPage implements ISaveable, IR
@Override
public void refresh(Object element) {
- xCoverageViewer.getXViewer().refresh(element);
+ if (xCoverageViewer != null && xCoverageViewer.getXViewer() != null && !xCoverageViewer.getXViewer().getTree().isDisposed()) {
+ xCoverageViewer.getXViewer().refresh(element);
+ }
}
@Override
@@ -212,4 +214,7 @@ public class CoverageEditorCoverageTab extends FormPage implements ISaveable, IR
// do nothing
}
+ public void refresh() {
+ xCoverageViewer.getXViewer().refresh();
+ }
}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java
index 021f2d5a2c3..2ec53907640 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java
@@ -20,7 +20,6 @@ import org.eclipse.osee.coverage.model.CoverageImport;
import org.eclipse.osee.coverage.model.CoveragePackage;
import org.eclipse.osee.coverage.model.ICoverage;
import org.eclipse.osee.coverage.model.WorkProductAction;
-import org.eclipse.osee.coverage.store.CoverageArtifactTypes;
import org.eclipse.osee.coverage.store.OseeCoveragePackageStore;
import org.eclipse.osee.coverage.util.CoverageUtil;
import org.eclipse.osee.coverage.util.ISaveable;
@@ -119,7 +118,7 @@ public class CoverageEditorWorkProductTab extends FormPage implements ISaveable
super.performArtifactDrop(dropArtifacts);
System.out.println("Dropped " + dropArtifacts);
for (Artifact artifact : dropArtifacts) {
- if (!artifact.isOfType(CoverageArtifactTypes.TeamWorkflow)) {
+ if (!artifact.isOfType(SkynetGuiPlugin.getInstance().getOseeCmService().getPcrArtifactType())) {
AWorkbench.popup("Related artifact must be a Team Workflow");
return;
}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java
index da50687070b..c9ae6b97316 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java
@@ -26,6 +26,8 @@ import org.eclipse.osee.coverage.model.CoverageItem;
import org.eclipse.osee.coverage.model.CoveragePackage;
import org.eclipse.osee.coverage.model.CoverageUnit;
import org.eclipse.osee.coverage.model.ICoverage;
+import org.eclipse.osee.coverage.model.IWorkProductTaskProvider;
+import org.eclipse.osee.coverage.model.WorkProductTask;
import org.eclipse.osee.coverage.msgs.CoverageChange1;
import org.eclipse.osee.coverage.msgs.CoveragePackageEvent1;
import org.eclipse.osee.coverage.store.CoverageArtifactTypes;
@@ -45,6 +47,7 @@ import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent;
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.skynet.core.event.model.Sender;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.ui.PlatformUI;
/**
@@ -87,7 +90,9 @@ public class CoverageEventManager implements IArtifactEventListener, OseeMessagi
if (artifactTypeEventFilter == null) {
artifactTypeEventFilter =
new ArtifactTypeEventFilter(CoverageArtifactTypes.CoverageFolder, CoverageArtifactTypes.CoverageUnit,
- CoverageArtifactTypes.CoveragePackage);
+ CoverageArtifactTypes.CoveragePackage,
+ SkynetGuiPlugin.getInstance().getOseeCmService().getPcrArtifactType(),
+ SkynetGuiPlugin.getInstance().getOseeCmService().getPcrTaskArtifactType());
}
return artifactTypeEventFilter;
}
@@ -121,8 +126,8 @@ public class CoverageEventManager implements IArtifactEventListener, OseeMessagi
} catch (InterruptedException ex1) {
// do nothing
}
- System.out.println(String.format("Sending CoveragePackageEvent %d items [%s]",
- coverageEvent.getCoverages().size(), coverageEvent.getPackage().getName()));
+ // System.out.println(String.format("Sending CoveragePackageEvent %d items [%s]",
+ // coverageEvent.getCoverages().size(), coverageEvent.getPackage().getName()));
if (connectionNode != null) {
try {
CoveragePackageEvent1 event1 = getCoveragePackageEvent(coverageEvent);
@@ -155,19 +160,18 @@ public class CoverageEventManager implements IArtifactEventListener, OseeMessagi
public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
for (CoverageEditor editor : new CopyOnWriteArrayList<CoverageEditor>(editors)) {
try {
+ if (!editor.getBranch().getGuid().equals(artifactEvent.getBranchGuid())) {
+ return;
+ }
+ boolean updatedWorkProductCache = false;
for (EventBasicGuidArtifact eventArt : artifactEvent.getArtifacts()) {
if (editor.getCoverageEditorInput().getCoveragePackageArtifact() == null) {
return;
}
- if (!editor.getCoverageEditorInput().getCoveragePackageArtifact().getBranch().getGuid().equals(
- eventArt.getBranchGuid())) {
- return;
- }
- if (eventArt.is(EventModType.Deleted, EventModType.ChangeType, EventModType.Purged)) {
- if (eventArt.getGuid().equals(editor.getCoverageEditorInput().getCoveragePackageArtifact().getGuid())) {
- unregister(editor);
- editor.closeEditor();
- }
+ checkForCoveragePackageDeletion(editor, eventArt);
+ // Only update work product cache once
+ if (!updatedWorkProductCache) {
+ updatedWorkProductCache = checkForWorkProductTaskModified(editor, eventArt);
}
}
} catch (OseeCoreException ex) {
@@ -176,6 +180,49 @@ public class CoverageEventManager implements IArtifactEventListener, OseeMessagi
}
}
+ private boolean checkForWorkProductTaskModified(CoverageEditor editor, EventBasicGuidArtifact eventArt) {
+ try {
+ CoveragePackage coveragePackage = (CoveragePackage) editor.getCoverageEditorInput().getCoveragePackageBase();
+ // if one of the related tasks is modified
+ if (isWorkProductTasksEquals(coveragePackage.getWorkProductTaskProvider(), eventArt)) {
+ // reload the related actions/tasks
+ coveragePackage.getWorkProductTaskProvider().reload();
+ // reset the product task names
+ OseeCoveragePackageStore cpStore = new OseeCoveragePackageStore(coveragePackage, editor.getBranch());
+ cpStore.loadWorkProductTaskNames(coveragePackage.getCoverageUnits());
+ // refresh the editors
+ editor.refreshWorkProductTasks();
+ return true;
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ return false;
+ }
+
+ private boolean isWorkProductTasksEquals(IWorkProductTaskProvider taskProvider, EventBasicGuidArtifact eventArt) {
+ for (WorkProductTask task : taskProvider.getWorkProductTasks()) {
+ if (task.getGuid().equals(eventArt.getGuid())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void checkForCoveragePackageDeletion(CoverageEditor editor, EventBasicGuidArtifact eventArt) {
+ try {
+ if (!eventArt.getGuid().equals(editor.getCoverageEditorInput().getCoveragePackageArtifact().getGuid())) {
+ return;
+ }
+ if (eventArt.is(EventModType.Deleted, EventModType.ChangeType, EventModType.Purged)) {
+ unregister(editor);
+ editor.closeEditor();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+
@Override
public void fail(Throwable th) {
OseeLog.log(CoverageEventManager.class, Level.SEVERE, th);
@@ -209,7 +256,7 @@ public class CoverageEventManager implements IArtifactEventListener, OseeMessagi
private void processCoveragePackageEvent(CoveragePackageEvent coverageEvent) {
if (coverageEvent != null) {
- System.out.println(String.format("Receiving coverageEvent [%s]", coverageEvent.getPackage().getName()));
+ // System.out.println(String.format("Receiving coverageEvent [%s]", coverageEvent.getPackage().getName()));
CoverageChange packageCoverage = coverageEvent.getPackage();
CoverageEventType packageModType = packageCoverage.getEventType();
for (CoverageEditor editor : new CopyOnWriteArrayList<CoverageEditor>(editors)) {
@@ -231,8 +278,8 @@ public class CoverageEventManager implements IArtifactEventListener, OseeMessagi
}
- private void handleCoverageEditorSaveEvent(CoverageEditor editor, CoveragePackage coveragePackage, CoveragePackageEvent coverageEvent) throws OseeCoreException {
- System.out.println("handle coverage save event => " + coverageEvent.getCoverages().size() + " items");
+ private void handleCoverageEditorSaveEvent(CoverageEditor editor, CoveragePackage coveragePackage, CoveragePackageEvent coverageEvent) {
+ // System.out.println("handle coverage save event => " + coverageEvent.getCoverages().size() + " items");
for (CoverageChange change : coverageEvent.getCoverages()) {
if (change.getEventType() == CoverageEventType.Modified) {
reloadCoverage(editor, coveragePackage, change);
@@ -241,7 +288,7 @@ public class CoverageEventManager implements IArtifactEventListener, OseeMessagi
}
private void reloadCoverage(CoverageEditor editor, CoveragePackage coveragePackage, CoverageChange change) {
- System.out.println("handle reloadCoverage coverage => " + change);
+ // System.out.println("handle reloadCoverage coverage => " + change);
ICoverage coverage = coveragePackage.getCoverage(change.getGuid());
if (coverage != null) {
if (coverage instanceof CoverageItem) {
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageArtifactTypes.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageArtifactTypes.java
index 8be2165234a..df3de999e94 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageArtifactTypes.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageArtifactTypes.java
@@ -22,7 +22,6 @@ public final class CoverageArtifactTypes extends NamedIdentity implements IArtif
public static final IArtifactType CoveragePackage = new CoverageArtifactTypes("AARFcyA9zyD3uEK8akgA", "Coverage Package");
public static final IArtifactType CoverageUnit = new CoverageArtifactTypes("ALZS3MQdCCIUvEYlZeAA", "Coverage Unit");
public static final IArtifactType CoverageFolder = new CoverageArtifactTypes("ALZR_AbpJTTf6QQn2iAA", "Coverage Folder");
- public static final IArtifactType TeamWorkflow = new CoverageArtifactTypes("AAMFDhSiF2OD+wiUqugA", "Team Workflow");
// @formatter:on
private CoverageArtifactTypes(String guid, String name) {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/cm/IOseeCmService.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/cm/IOseeCmService.java
index 9bcb24de307..9b5ba35b9cf 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/cm/IOseeCmService.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/cm/IOseeCmService.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.ui.skynet.cm;
import java.util.Collection;
import java.util.Date;
import java.util.List;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.ui.swt.KeyedImage;
@@ -48,4 +49,8 @@ public interface IOseeCmService {
Artifact createWorkTask(String name, String parentPcrGuid);
Artifact createPcr(String title, String description, String changeType, String priority, Date needByDate, Collection<String> productNames);
+
+ IArtifactType getPcrArtifactType();
+
+ IArtifactType getPcrTaskArtifactType();
}

Back to the top