aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2018-05-13 12:41:30 -0400
committerAndrey Loskutov2018-05-14 10:09:46 -0400
commit5f797dffaa986e7bf619ecc7a06c6f5152d51353 (patch)
tree4575c1cd8cd08abdad79bcb81c67255682d38a24
parent1ff2fc9f648ef39acf83d8f0ed09d66ec4207624 (diff)
downloadeclipse.platform.runtime-5f797dffaa986e7bf619ecc7a06c6f5152d51353.tar.gz
eclipse.platform.runtime-5f797dffaa986e7bf619ecc7a06c6f5152d51353.tar.xz
eclipse.platform.runtime-5f797dffaa986e7bf619ecc7a06c6f5152d51353.zip
Bug 534612 - add ACTIVATED/DEACTIVATED event types and report themI20180515-1440I20180515-1300I20180515-0950I20180515-0800I20180514-2000
Change-Id: I273d34cec39a31920bcdd4a38f8eb3ce448e296d Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java17
-rw-r--r--bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/IEclipseContextDebugger.java2
2 files changed, 16 insertions, 3 deletions
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
index 2addd36f9..d73fc6993 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
@@ -50,6 +50,12 @@ public class EclipseContext implements IEclipseContext {
*/
public static final String DEBUG_STRING = "debugString"; //$NON-NLS-1$
+ /**
+ * String used in {@link #toString()} to name contexts not providing the value
+ * for the {@link #DEBUG_STRING} variable
+ */
+ public static final String ANONYMOUS_CONTEXT_NAME = "Anonymous Context"; //$NON-NLS-1$
+
static class Scheduled {
public TrackableComputationExt runnable;
@@ -218,8 +224,9 @@ public class EclipseContext implements IEclipseContext {
}
}
- if (debugAddOn != null)
+ if (debugAddOn != null) {
debugAddOn.notify(this, IEclipseContextDebugger.EventType.DISPOSED, null);
+ }
}
@Override
@@ -437,7 +444,7 @@ public class EclipseContext implements IEclipseContext {
@Override
public String toString() {
Object debugString = localValues.get(DEBUG_STRING);
- return debugString instanceof String ? ((String) debugString) : "Anonymous Context"; //$NON-NLS-1$
+ return debugString instanceof String ? ((String) debugString) : ANONYMOUS_CONTEXT_NAME;
}
private void trackAccess(String name) {
@@ -672,6 +679,9 @@ public class EclipseContext implements IEclipseContext {
if (this == parent.getActiveChild())
return;
parent.set(ACTIVE_CHILD, this);
+ if (debugAddOn != null) {
+ debugAddOn.notify(this, IEclipseContextDebugger.EventType.ACTIVATED, null);
+ }
}
@Override
@@ -689,6 +699,9 @@ public class EclipseContext implements IEclipseContext {
if (this != parent.getActiveChild())
return; // this is not an active context; return
parent.set(ACTIVE_CHILD, null);
+ if (debugAddOn != null) {
+ debugAddOn.notify(this, IEclipseContextDebugger.EventType.DEACTIVATED, null);
+ }
}
// This method is for debug only, do not use externally
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/IEclipseContextDebugger.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/IEclipseContextDebugger.java
index df862eed3..0d7afd594 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/IEclipseContextDebugger.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/IEclipseContextDebugger.java
@@ -15,7 +15,7 @@ public interface IEclipseContextDebugger {
String SERVICE_NAME = IEclipseContextDebugger.class.getName();
public enum EventType {
- CONSTRUCTED, DISPOSED, LISTENER_ADDED
+ CONSTRUCTED, DISPOSED, LISTENER_ADDED, ACTIVATED, DEACTIVATED
}
void notify(EclipseContext context, EventType type, Object data);