diff options
author | ddunne | 2008-09-19 17:50:31 +0000 |
---|---|---|
committer | ddunne | 2008-09-19 17:50:31 +0000 |
commit | 2a797a0be6d3cc844ed4d4a8febc85f11c1ed0d3 (patch) | |
tree | 338d9f7e22c6262697ccb4e8831353e91363619c | |
parent | c77193bf096bc6848f207a1285cb3aea77936bcf (diff) | |
download | org.eclipse.osee-2a797a0be6d3cc844ed4d4a8febc85f11c1ed0d3.tar.gz org.eclipse.osee-2a797a0be6d3cc844ed4d4a8febc85f11c1ed0d3.tar.xz org.eclipse.osee-2a797a0be6d3cc844ed4d4a8febc85f11c1ed0d3.zip |
Optimizing event handling
5 files changed, 6 insertions, 66 deletions
diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java index 5a900c1e023..d7979f725cb 100644 --- a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/StateMachineArtifact.java @@ -37,10 +37,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactType; import org.eclipse.osee.framework.skynet.core.artifact.Branch; import org.eclipse.osee.framework.skynet.core.artifact.BranchPersistenceManager; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; -import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData; -import org.eclipse.osee.framework.skynet.core.event.IFrameworkTransactionEventListener; -import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; -import org.eclipse.osee.framework.skynet.core.event.Sender; import org.eclipse.osee.framework.skynet.core.exception.MultipleAttributesExist; import org.eclipse.osee.framework.skynet.core.exception.OseeCoreException; import org.eclipse.osee.framework.skynet.core.relation.CoreRelationEnumeration; @@ -60,7 +56,7 @@ import org.eclipse.swt.graphics.Image; /** * @author Donald G. Dunne */ -public abstract class StateMachineArtifact extends ATSArtifact implements IWorldViewArtifact, IFrameworkTransactionEventListener, ISubscribableArtifact, IFavoriteableArtifact { +public abstract class StateMachineArtifact extends ATSArtifact implements IWorldViewArtifact, ISubscribableArtifact, IFavoriteableArtifact { protected SMAManager smaMgr; private final Set<IRelationEnumeration> smaEditorRelations = new HashSet<IRelationEnumeration>(); @@ -95,7 +91,6 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IWorld public void onInitializationComplete() { super.onInitializationComplete(); initializeSMA(); - OseeEventManager.addListener(this, this); } /* (non-Javadoc) @@ -1226,25 +1221,4 @@ public abstract class StateMachineArtifact extends ATSArtifact implements IWorld return ""; } - /* (non-Javadoc) - * @see org.eclipse.osee.framework.skynet.core.eventx.IFrameworkTransactionEventListener#handleFrameworkTransactionEvent(org.eclipse.osee.framework.ui.plugin.event.Sender.Source, org.eclipse.osee.framework.skynet.core.eventx.FrameworkTransactionData) - */ - @Override - public void handleFrameworkTransactionEvent(Sender sender, FrameworkTransactionData transData) { - if (isDeleted()) return; - try { - // Check if LocalEvent and NOT RemoteEvent. Since EventService will handle moving access - // control changes across the OSEE instances, only handle local events - if (sender.isLocal()) { - // Only update access control if THIS artifact is modified - if (transData.isChanged(this)) { - // Update branch access control - smaMgr.getBranchMgr().updateBranchAccessControl(); - } - } - } catch (Exception ex) { - OSEELog.logException(AtsPlugin.class, ex, false); - } - } - } diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java index 7ebe4872e73..edf1694925a 100644 --- a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditor.java @@ -132,6 +132,7 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtiableEdito if (smaMgr != null && !smaMgr.getSma().isDeleted() && smaMgr.getSma().isSMAEditorDirty().isTrue()) smaMgr.getSma().revertSMA(); workFlowTab.dispose(); if (taskComposite != null) taskComposite.dispose(); + OseeEventManager.removeListeners(this); super.dispose(); } @@ -163,7 +164,7 @@ public class SMAEditor extends AbstractArtifactEditor implements IDirtiableEdito @Override public String toString() { - return "SMAEditor " + smaMgr.getSma().getHumanReadableId() + " - " + smaMgr.getSma().getArtifactTypeName() + " - " + smaMgr.getSma().getDescriptiveName(); + return "SMAEditor - " + smaMgr.getSma().getHumanReadableId() + " - " + smaMgr.getSma().getArtifactTypeName() + " named \"" + smaMgr.getSma().getDescriptiveName() + "\""; } @Override diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMATaskComposite.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMATaskComposite.java index 03fd9e9eb46..efb968f53a0 100644 --- a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMATaskComposite.java +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMATaskComposite.java @@ -63,7 +63,7 @@ public class SMATaskComposite extends Composite implements IArtifactsPurgedEvent @Override public String toString() { try { - return "SMATaskComposite: " + xTaskViewer.getIXTaskViewer().getParentSmaMgr().getSma(); + return "SMATaskComposite for SMA \"" + xTaskViewer.getIXTaskViewer().getParentSmaMgr().getSma() + "\""; } catch (Exception ex) { return "SMATaskComposite " + ex.getLocalizedMessage(); } diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchAccessHandler.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchAccessHandler.java index 93e15712fd6..bf0dbc917bc 100644 --- a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchAccessHandler.java +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsBranchAccessHandler.java @@ -59,6 +59,7 @@ public class AtsBranchAccessHandler implements IBranchEventListener { ((StateMachineArtifact) artifact).getSmaMgr().getBranchMgr().updateBranchAccessControl();
}
}
+ // TODO Need to remove branch access control if branch deleted, archived, etc
} catch (BranchDoesNotExist ex) {
OseeLog.log(AtsPlugin.class, Level.INFO, ex);
} catch (Exception ex) {
diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerItem.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerItem.java index b40a44e4878..16f5fa100e6 100644 --- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerItem.java +++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/group/GroupExplorerItem.java @@ -16,18 +16,13 @@ import java.util.List; import java.util.logging.Level; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; -import org.eclipse.osee.framework.skynet.core.event.FrameworkTransactionData; -import org.eclipse.osee.framework.skynet.core.event.IFrameworkTransactionEventListener; -import org.eclipse.osee.framework.skynet.core.event.OseeEventManager; -import org.eclipse.osee.framework.skynet.core.event.Sender; import org.eclipse.osee.framework.skynet.core.relation.CoreRelationEnumeration; -import org.eclipse.osee.framework.ui.plugin.util.Displays; import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin; /** * @author Donald G. Dunne */ -public class GroupExplorerItem implements IFrameworkTransactionEventListener { +public class GroupExplorerItem { private final Artifact artifact; private final TreeViewer treeViewer; @@ -40,7 +35,6 @@ public class GroupExplorerItem implements IFrameworkTransactionEventListener { this.artifact = artifact; this.parentItem = parentItem; this.groupExplorer = groupExplorer; - OseeEventManager.addListener(this, this); } public boolean contains(Artifact artifact) { @@ -64,7 +58,6 @@ public class GroupExplorerItem implements IFrameworkTransactionEventListener { } public void dispose() { - OseeEventManager.removeListeners(this); if (groupItems != null) for (GroupExplorerItem item : groupItems) item.dispose(); } @@ -130,33 +123,4 @@ public class GroupExplorerItem implements IFrameworkTransactionEventListener { return parentItem; } - /* (non-Javadoc) - * @see org.eclipse.osee.framework.skynet.core.eventx.IFrameworkTransactionEventListener#handleFrameworkTransactionEvent(org.eclipse.osee.framework.ui.plugin.event.Sender.Source, org.eclipse.osee.framework.skynet.core.eventx.FrameworkTransactionData) - */ - @Override - public void handleFrameworkTransactionEvent(Sender sender, final FrameworkTransactionData transData) { - if (transData.isHasEvent(artifact)) { - final GroupExplorerItem tai = this; - Displays.ensureInDisplayThread(new Runnable() { - @Override - public void run() { - if (treeViewer == null || treeViewer.getTree().isDisposed() || (artifact != null && artifact.isDeleted())) { - dispose(); - return; - } - - if (transData.isDeleted(artifact)) { - treeViewer.refresh(); - groupExplorer.restoreSelection(); - } else if (transData.isChanged(artifact)) { - treeViewer.update(tai, null); - } else if (transData.isRelChange(artifact)) { - populateUpdateCategory(); - treeViewer.refresh(tai); - groupExplorer.restoreSelection(); - } - } - }); - } - } } |