Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.skynet')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler2.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java16
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java22
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java8
8 files changed, 75 insertions, 30 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
index 4d14c9e57a4..6509510758a 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
@@ -183,6 +183,7 @@ Import-Package: com.google.common.base;version="15.0.0",
org.json,
org.mozilla.javascript,
org.osgi.framework,
+ org.osgi.service.event;version="1.3.1",
org.osgi.service.packageadmin,
org.osgi.service.prefs;version="1.1.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler.xml b/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler.xml
new file mode 100644
index 00000000000..c2c48d4ac18
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true">
+<implementation class="org.eclipse.osee.framework.ui.skynet.explorer.ArtifactExplorerEventManager"/>
+<service>
+ <provide interface="org.osgi.service.event.EventHandler"/>
+</service>
+ <property name="event.topics" value="framework/access/artifact/lock/modified" />
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler2.xml b/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler2.xml
new file mode 100644
index 00000000000..7d2b64d14af
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/OSGI-INF/access.artifact.lock.topic.handler2.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true">
+<implementation class="org.eclipse.osee.framework.ui.skynet.artifact.editor.ArtifactEditorEventManager"/>
+<service>
+ <provide interface="org.osgi.service.event.EventHandler"/>
+</service>
+ <property name="event.topics" value="framework/access/artifact/lock/modified" />
+</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java
index 65dc33986ea..0cb8a85d498 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/access/PolicyDialog.java
@@ -32,8 +32,8 @@ import org.eclipse.osee.framework.skynet.core.UserManager;
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.event.OseeEventManager;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEvent;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessArtifactLockTopicEvent;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -252,13 +252,13 @@ public class PolicyDialog extends Dialog {
// Send artifact locked event if changed in dialog
if (isArtifactLockedBeforeDialog != null) {
try {
- boolean isArtifactLockedAfterDialog = AccessControlManager.hasLock((Artifact) accessControlledObject);
+ Artifact artifact = (Artifact) accessControlledObject;
+ boolean isArtifactLockedAfterDialog = AccessControlManager.hasLock(artifact);
if (isArtifactLockedAfterDialog != isArtifactLockedBeforeDialog) {
- AccessControlEvent event = new AccessControlEvent();
- event.setEventType(
- isArtifactLockedAfterDialog ? AccessControlEventType.ArtifactsLocked : AccessControlEventType.ArtifactsUnlocked);
- event.getArtifacts().add(((Artifact) accessControlledObject).getBasicGuidArtifact());
- OseeEventManager.kickAccessControlArtifactsEvent(PolicyDialog.class, event);
+ AccessArtifactLockTopicEvent event = new AccessArtifactLockTopicEvent();
+ event.setBranchUuid(artifact.getBranchId());
+ event.addArtifact(artifact.getUuid());
+ OseeEventManager.kickAccessTopicEvent(this, event, AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED);
System.err.println("kicked access control event " + event);
}
} catch (Exception ex) {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java
index 7b3908346a8..54af66f25c9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorEventManager.java
@@ -21,11 +21,10 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.event.EventUtil;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.filter.IEventFilter;
-import org.eclipse.osee.framework.skynet.core.event.listener.IAccessControlEventListener;
import org.eclipse.osee.framework.skynet.core.event.listener.IArtifactEventListener;
import org.eclipse.osee.framework.skynet.core.event.listener.IBranchEventListener;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEvent;
-import org.eclipse.osee.framework.skynet.core.event.model.AccessControlEventType;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessArtifactLockTopicEvent;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
import org.eclipse.osee.framework.skynet.core.event.model.ArtifactEvent;
import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent;
import org.eclipse.osee.framework.skynet.core.event.model.BranchEventType;
@@ -34,6 +33,8 @@ 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.internal.Activator;
import org.eclipse.osee.framework.ui.swt.Displays;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
/**
* Common location for event handling for ArtifactExplorers in order to keep number of registrations and processing to a
@@ -41,9 +42,9 @@ import org.eclipse.osee.framework.ui.swt.Displays;
*
* @author Donald G. Dunne
*/
-public class ArtifactEditorEventManager implements IArtifactEventListener, IBranchEventListener, IAccessControlEventListener {
+public class ArtifactEditorEventManager implements IArtifactEventListener, IBranchEventListener, EventHandler {
- List<IArtifactEditorEventHandler> handlers = new CopyOnWriteArrayList<>();
+ static List<IArtifactEditorEventHandler> handlers = new CopyOnWriteArrayList<>();
static ArtifactEditorEventManager instance;
public static void add(IArtifactEditorEventHandler iWorldEventHandler) {
@@ -51,12 +52,12 @@ public class ArtifactEditorEventManager implements IArtifactEventListener, IBran
instance = new ArtifactEditorEventManager();
OseeEventManager.addListener(instance);
}
- instance.handlers.add(iWorldEventHandler);
+ ArtifactEditorEventManager.handlers.add(iWorldEventHandler);
}
public static void remove(IArtifactEditorEventHandler iWorldEventHandler) {
if (instance != null) {
- instance.handlers.remove(iWorldEventHandler);
+ ArtifactEditorEventManager.handlers.remove(iWorldEventHandler);
}
}
@@ -149,12 +150,13 @@ public class ArtifactEditorEventManager implements IArtifactEventListener, IBran
}
@Override
- public void handleAccessControlArtifactsEvent(Sender sender, AccessControlEvent accessControlEvent) {
+ public void handleEvent(Event event) {
try {
- if (accessControlEvent.getEventType() == AccessControlEventType.ArtifactsLocked || accessControlEvent.getEventType() == AccessControlEventType.ArtifactsUnlocked) {
+ if (AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED.matches(event)) {
for (final IArtifactEditorEventHandler handler : handlers) {
if (!handler.isDisposed()) {
- if (accessControlEvent.getArtifacts().contains(handler.getArtifactFromEditorInput())) {
+ AccessArtifactLockTopicEvent payload = EventUtil.getTopicJson(event, AccessArtifactLockTopicEvent.class);
+ if (payload.matches(handler.getArtifactFromEditorInput())) {
Displays.ensureInDisplayThread(new Runnable() {
@Override
public void run() {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java
index 9d5e102cbac..60dcf27d5b5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorer.java
@@ -416,11 +416,7 @@ public class ArtifactExplorer extends GenericViewPart implements IArtifactExplor
if (!accessControlEvent.isForBranch(branch)) {
return;
}
- if (accessControlEvent.getEventType() == AccessControlEventType.UserAuthenticated ||
- //
- accessControlEvent.getEventType() == AccessControlEventType.ArtifactsUnlocked ||
- //
- accessControlEvent.getEventType() == AccessControlEventType.ArtifactsLocked) {
+ if (accessControlEvent.getEventType() == AccessControlEventType.UserAuthenticated) {
Displays.ensureInDisplayThread(new Runnable() {
@Override
public void run() {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java
index fa52092f6c3..8df48eedba3 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/ArtifactExplorerEventManager.java
@@ -24,6 +24,7 @@ import org.eclipse.osee.framework.skynet.core.event.EventUtil;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.filter.IEventFilter;
import org.eclipse.osee.framework.skynet.core.event.listener.IArtifactEventListener;
+import org.eclipse.osee.framework.skynet.core.event.model.AccessTopicEventType;
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;
@@ -33,16 +34,18 @@ import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
/**
* Common location for event handling for ArtifactExplorers in order to keep number of registrations and processing to a
* minimum.
- *
+ *
* @author Donald G. Dunne
*/
-public class ArtifactExplorerEventManager implements IArtifactEventListener {
+public class ArtifactExplorerEventManager implements IArtifactEventListener, EventHandler {
- List<IArtifactExplorerEventHandler> handlers = new CopyOnWriteArrayList<>();
+ static List<IArtifactExplorerEventHandler> handlers = new CopyOnWriteArrayList<>();
static ArtifactExplorerEventManager instance;
public static void add(IArtifactExplorerEventHandler iWorldEventHandler) {
@@ -50,12 +53,12 @@ public class ArtifactExplorerEventManager implements IArtifactEventListener {
instance = new ArtifactExplorerEventManager();
OseeEventManager.addListener(instance);
}
- instance.handlers.add(iWorldEventHandler);
+ ArtifactExplorerEventManager.handlers.add(iWorldEventHandler);
}
public static void remove(IArtifactExplorerEventHandler iWorldEventHandler) {
if (instance != null) {
- instance.handlers.remove(iWorldEventHandler);
+ ArtifactExplorerEventManager.handlers.remove(iWorldEventHandler);
}
}
@@ -152,4 +155,27 @@ public class ArtifactExplorerEventManager implements IArtifactEventListener {
}
});
}
+
+ @Override
+ public void handleEvent(Event event) {
+ try {
+ if (AccessTopicEventType.ACCESS_ARTIFACT_LOCK_MODIFIED.matches(event)) {
+ for (final IArtifactExplorerEventHandler handler : handlers) {
+ if (!handler.isDisposed()) {
+ Displays.ensureInDisplayThread(new Runnable() {
+
+ @Override
+ public void run() {
+ handler.getArtifactExplorer().getTreeViewer().refresh();
+ handler.getArtifactExplorer().refreshBranchWarning();
+ }
+ });
+ }
+ }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java
index 32a6d934968..66dbe35020f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/explorer/menu/ArtifactExplorerMenu.java
@@ -590,8 +590,12 @@ public class ArtifactExplorerMenu {
}
try {
- AccessControlManager.unLockObjects(unlockArtifacts, UserManager.getUser());
- AccessControlManager.lockObjects(lockArtifacts, UserManager.getUser());
+ if (!unlockArtifacts.isEmpty()) {
+ AccessControlManager.unLockObjects(unlockArtifacts, UserManager.getUser());
+ }
+ if (!lockArtifacts.isEmpty()) {
+ AccessControlManager.lockObjects(lockArtifacts, UserManager.getUser());
+ }
} catch (Exception ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}

Back to the top