Adapt views plugins to TMF
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Mon, 5 Jun 2017 18:53:23 +0000 (14:53 -0400)
committerAlexandre Montplaisir <alexmonthy@efficios.com>
Tue, 27 Jun 2017 19:47:30 +0000 (15:47 -0400)
Change-Id: I43ad92abcc9526fa58b9f802691d58899cdcfc97
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
18 files changed:
common/org.eclipse.tracecompass.common.core/annotations/java/util/Map.eea
common/org.eclipse.tracecompass.common.core/annotations/javafx/collections/SetChangeListener$Change.eea [new file with mode: 0644]
tmf/org.lttng.scope.tmf2.views.core/.classpath
tmf/org.lttng.scope.tmf2.views.core/META-INF/MANIFEST.MF
tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/ScopeCoreActivator.java [new file with mode: 0644]
tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/activator/internal/Activator.java
tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/timegraph/model/provider/TimeGraphModelProvider.java
tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/timegraph/model/provider/statesystem/StateSystemModelArrowProvider.java
tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/timegraph/model/provider/statesystem/StateSystemModelProvider.java
tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/timegraph/model/provider/statesystem/StateSystemModelStateProvider.java
tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/timegraph/model/render/tree/TimeGraphTreeRender.java
tmf/org.lttng.scope.tmf2.views.ui/.classpath
tmf/org.lttng.scope.tmf2.views.ui/META-INF/MANIFEST.MF
tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/ScopeUIActivator.java [new file with mode: 0644]
tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/activator/internal/Activator.java
tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/timeline/TimelineView.java
tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/timeline/widgets/timegraph/layer/TimeGraphArrowLayer.java
tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/timeline/widgets/timegraph/toolbar/drawnevents/PredicateDrawnEventProvider.java

index 1075c454d17bb416502066a7cfc3b45d497486cf..5c0d1a408b92f7c9ce3f60baec0fea8a88103392 100644 (file)
@@ -8,6 +8,9 @@ get
 keySet
  ()Ljava/util/Set<TK;>;
  ()L1java/util/Set<TK;>;
+put
+ (TK;TV;)TV;
+ (TK;TV;)T0V;
 remove
  (Ljava/lang/Object;)TV;
  (Ljava/lang/Object;)T0V;
diff --git a/common/org.eclipse.tracecompass.common.core/annotations/javafx/collections/SetChangeListener$Change.eea b/common/org.eclipse.tracecompass.common.core/annotations/javafx/collections/SetChangeListener$Change.eea
new file mode 100644 (file)
index 0000000..0ae8c4b
--- /dev/null
@@ -0,0 +1,7 @@
+class javafx/collections/SetChangeListener$Change
+getElementAdded
+ ()TE;
+ ()T0E;
+getElementRemoved
+ ()TE;
+ ()T0E;
index 0be7b35db4957563ff7baa2c7ea83854aadeae32..5480bc80152d9604a26638ad3345b275e8994da7 100644 (file)
@@ -2,12 +2,12 @@
 <classpath>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
                <attributes>
-                       <attribute name="annotationpath" value="/org.lttng.scope.common.core/annotations"/>
+                       <attribute name="annotationpath" value="/org.eclipse.tracecompass.common.core/annotations"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
                <attributes>
-                       <attribute name="annotationpath" value="/org.lttng.scope.common.core/annotations"/>
+                       <attribute name="annotationpath" value="/org.eclipse.tracecompass.common.core/annotations"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="src" path="src"/>
index ae32157d626e383c83ad536d21ae8aa84c651aa5..3f46dbe32525c458cdcc4a6f39db415dad0af58b 100644 (file)
@@ -11,9 +11,9 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Eclipse-ExtensibleAPI: true
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.core.resources,
- org.lttng.scope.common.core,
ca.polymtl.dorsal.libdelorean,
- org.eclipse.tracecompass.tmf.core
+ org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.statesystem.core,
+ org.eclipse.tracecompass.common.core
 Export-Package: org.lttng.scope.tmf2.views.core,
  org.lttng.scope.tmf2.views.core.activator.internal;x-internal:=true,
  org.lttng.scope.tmf2.views.core.config,
diff --git a/tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/ScopeCoreActivator.java b/tmf/org.lttng.scope.tmf2.views.core/src/org/lttng/scope/tmf2/views/core/ScopeCoreActivator.java
new file mode 100644 (file)
index 0000000..7f4b254
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
+ *
+ * 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
+ */
+
+package org.lttng.scope.tmf2.views.core;
+
+import static java.util.Objects.requireNonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.annotation.Nullable;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author Alexandre Montplaisir
+ */
+public abstract class ScopeCoreActivator extends Plugin {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /** Map of all the registered activators, indexed by activator classes */
+    private static final Map<Class<? extends ScopeCoreActivator>, ScopeCoreActivator> CORE_ACTIVATORS =
+            Collections.synchronizedMap(new HashMap<Class<? extends ScopeCoreActivator>, ScopeCoreActivator>());
+
+    /** This instance's plug-in ID */
+    private final String fPluginId;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     */
+    public ScopeCoreActivator() {
+        fPluginId = requireNonNull(getBundle().getSymbolicName());
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Return this plug-in's ID.
+     *
+     * @return The plug-in ID
+     */
+    public String getPluginId() {
+        return fPluginId;
+    }
+
+    /**
+     * Get a registered activator. Subclasses should implement their own public
+     * getInstance() method, which returns the result of this.
+     *
+     * @param activatorClass
+     *            The activator's runtime class
+     * @return The corresponding activator
+     */
+    protected static <T extends ScopeCoreActivator> T getInstance(Class<T> activatorClass) {
+        ScopeCoreActivator activator = CORE_ACTIVATORS.get(activatorClass);
+        if (activator == null) {
+            /* The activator should be registered at this point! */
+            throw new IllegalStateException();
+        }
+        /*
+         * We inserted the corresponding class into the map ourselves, cast
+         * should always be safe.
+         */
+        @SuppressWarnings("unchecked")
+        T ret = (T) activator;
+        return ret;
+    }
+
+    // ------------------------------------------------------------------------
+    // Abstract methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * Additional actions to run at the plug-in startup
+     */
+    protected abstract void startActions();
+
+    /**
+     * Additional actions to run at the plug-in shtudown
+     */
+    protected abstract void stopActions();
+
+    // ------------------------------------------------------------------------
+    // ore.eclipse.core.runtime.Plugin
+    // ------------------------------------------------------------------------
+
+    @Override
+    public final void start(@Nullable BundleContext context) throws Exception {
+        super.start(context);
+        Class<? extends ScopeCoreActivator> activatorClass = this.getClass();
+        synchronized (CORE_ACTIVATORS) {
+            if (CORE_ACTIVATORS.containsKey(activatorClass)) {
+                logError("Duplicate Activator : " + activatorClass.getCanonicalName()); //$NON-NLS-1$
+            }
+            CORE_ACTIVATORS.put(activatorClass, this);
+        }
+        startActions();
+    }
+
+    @Override
+    public final void stop(@Nullable BundleContext context) throws Exception {
+        stopActions();
+        CORE_ACTIVATORS.remove(this.getClass());
+        super.stop(context);
+    }
+
+    // ------------------------------------------------------------------------
+    // Logging helpers
+    // ------------------------------------------------------------------------
+
+    /**
+     * Log a message with severity INFO.
+     *
+     * @param message
+     *            The message to log
+     * @param exception
+     *            Optional exception to attach to the message
+     */
+    public void logInfo(@Nullable String message, Throwable... exception) {
+        if (exception.length < 1) {
+            getLog().log(new Status(IStatus.INFO, fPluginId, nullToEmptyString(message)));
+        } else {
+            getLog().log(new Status(IStatus.INFO, fPluginId, nullToEmptyString(message), exception[0]));
+        }
+    }
+
+
+    /**
+     * Log a message with severity WARNING.
+     *
+     * @param message
+     *            The message to log
+     * @param exception
+     *            Optional exception to attach to the message
+     */
+    public void logWarning(@Nullable String message, Throwable... exception) {
+        if (exception.length < 1) {
+            getLog().log(new Status(IStatus.WARNING, fPluginId, nullToEmptyString(message)));
+        } else {
+            getLog().log(new Status(IStatus.WARNING, fPluginId, nullToEmptyString(message), exception[0]));
+        }
+    }
+
+    /**
+     * Log a message with severity ERROR.
+     *
+     * @param message
+     *            The message to log
+     * @param exception
+     *            Optional exception to attach to the message
+     */
+    public void logError(@Nullable String message, Throwable... exception) {
+        if (exception.length < 1) {
+            getLog().log(new Status(IStatus.ERROR, fPluginId, nullToEmptyString(message)));
+        } else {
+            getLog().log(new Status(IStatus.ERROR, fPluginId, nullToEmptyString(message), exception[0]));
+        }
+    }
+
+}
index c65947995f2c366eac51f05bfc48a1643544ca6b..0393979df3636c66d542e20c52c54943addd9f40 100644 (file)
@@ -9,7 +9,7 @@
 
 package org.lttng.scope.tmf2.views.core.activator.internal;
 
-import org.lttng.scope.common.core.ScopeCoreActivator;
+import org.lttng.scope.tmf2.views.core.ScopeCoreActivator;
 import org.lttng.scope.tmf2.views.core.context.ViewGroupContext;
 
 /**
index 18fa89d97647c83ccd8f9766be5e64be85e45458..78920510beb67ab7e4dac7ad92b001b88119e0ff 100644 (file)
@@ -9,7 +9,7 @@
 
 package org.lttng.scope.tmf2.views.core.timegraph.model.provider;
 
-import static org.lttng.scope.common.core.NonNullUtils.nullToEmptyString;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
 
 import java.util.HashSet;
 import java.util.List;
index 3e79da82bd3bccb6687f5d78390679d156045a8e..882b9507752b6384d0e38cf5b3f8287dae7bc2b7 100644 (file)
@@ -12,6 +12,7 @@ package org.lttng.scope.tmf2.views.core.timegraph.model.provider.statesystem;
 import java.util.concurrent.FutureTask;
 
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
 import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.lttng.scope.tmf2.views.core.TimeRange;
@@ -20,8 +21,6 @@ import org.lttng.scope.tmf2.views.core.timegraph.model.render.arrows.TimeGraphAr
 import org.lttng.scope.tmf2.views.core.timegraph.model.render.arrows.TimeGraphArrowSeries;
 import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeRender;
 
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-
 /**
  * Basic implementation of a {@link TimeGraphModelArrowProvider} backed by a
  * state system.
index 2b251dcafeb976a1179bbc58e47fb3974e05206f..489688c5d40268f3dbaf947852889752a7dcff53 100644 (file)
@@ -17,6 +17,9 @@ import java.util.function.Function;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
+import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
+import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.lttng.scope.tmf2.views.core.timegraph.model.provider.TimeGraphModelProvider;
@@ -24,10 +27,6 @@ import org.lttng.scope.tmf2.views.core.timegraph.model.provider.arrows.ITimeGrap
 import org.lttng.scope.tmf2.views.core.timegraph.model.provider.states.ITimeGraphModelStateProvider;
 import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeRender;
 
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateSystemDisposedException;
-import ca.polymtl.dorsal.libdelorean.interval.ITmfStateInterval;
-
 /**
  * Basic implementation of a {@link TimeGraphModelProvider} backed by a state
  * system.
index 797a9f92d01fadd9f8f0e00733de5225bcb60ebc..96ee9b520c9f0ffe6b3847e9690330c876e2026f 100644 (file)
@@ -17,6 +17,10 @@ import java.util.concurrent.FutureTask;
 import java.util.function.Function;
 
 import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
+import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
+import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
+import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.lttng.scope.tmf2.views.core.MathUtils;
@@ -34,11 +38,6 @@ import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTree
 
 import com.google.common.collect.Iterables;
 
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateSystemDisposedException;
-import ca.polymtl.dorsal.libdelorean.interval.ITmfStateInterval;
-
 /**
  * Basic implementation of a {@link TimeGraphModelStateProvider} backed by a state
  * system.
index 4be4991705feab8053519aa01de01595e8372d3a..77b7bd161983257ae645fababf1ab8e6c517e7e3 100644 (file)
@@ -14,7 +14,7 @@ import java.util.Objects;
 import java.util.stream.Collectors;
 
 import org.eclipse.jdt.annotation.Nullable;
-import org.lttng.scope.common.core.StreamUtils.StreamFlattener;
+import org.eclipse.tracecompass.common.core.StreamUtils.StreamFlattener;
 
 /**
  * Render of a tree of the timegraph. Contains the tree elements that compose
index 0be7b35db4957563ff7baa2c7ea83854aadeae32..5480bc80152d9604a26638ad3345b275e8994da7 100644 (file)
@@ -2,12 +2,12 @@
 <classpath>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
                <attributes>
-                       <attribute name="annotationpath" value="/org.lttng.scope.common.core/annotations"/>
+                       <attribute name="annotationpath" value="/org.eclipse.tracecompass.common.core/annotations"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
                <attributes>
-                       <attribute name="annotationpath" value="/org.lttng.scope.common.core/annotations"/>
+                       <attribute name="annotationpath" value="/org.eclipse.tracecompass.common.core/annotations"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="src" path="src"/>
index 4503ded77248cd1c2369f507ebc47fc7a50d1118..950203b8b6751edde8e363b45f702bb9cf712168 100644 (file)
@@ -10,12 +10,11 @@ Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.ui,
- org.lttng.scope.common.core,
- org.lttng.scope.common.ui,
  org.lttng.scope.tmf2.views.core,
  org.eclipse.tracecompass.tmf.core,
  org.eclipse.tracecompass.tmf.ui,
- org.eclipse.core.resources
+ org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core
 Export-Package: org.lttng.scope.tmf2.views.ui.activator.internal;x-internal:=true,
  org.lttng.scope.tmf2.views.ui.jfx,
  org.lttng.scope.tmf2.views.ui.jfx.examples,
diff --git a/tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/ScopeUIActivator.java b/tmf/org.lttng.scope.tmf2.views.ui/src/org/lttng/scope/tmf2/views/ui/ScopeUIActivator.java
new file mode 100644 (file)
index 0000000..ac21668
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
+ *
+ * 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
+ */
+
+package org.lttng.scope.tmf2.views.ui;
+
+import static java.util.Objects.requireNonNull;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author Alexandre Montplaisir
+ */
+public abstract class ScopeUIActivator extends AbstractUIPlugin {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+    /** Map of all the registered activators, indexed by activator classes */
+    private static final Map<Class<? extends ScopeUIActivator>, ScopeUIActivator> UI_ACTIVATORS =
+            Collections.synchronizedMap(new HashMap<Class<? extends ScopeUIActivator>, ScopeUIActivator>());
+
+    /** This instance's plug-in ID */
+    private final String fPluginId;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     */
+    public ScopeUIActivator() {
+        fPluginId = requireNonNull(getBundle().getSymbolicName());
+    }
+
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Return this plug-in's ID.
+     *
+     * @return The plug-in ID
+     */
+    public String getPluginId() {
+        return fPluginId;
+    }
+
+    /**
+     * Get a registered activator. Subclasses should implement their own public
+     * getInstance() method, which returns the result of this.
+     *
+     * @param activatorClass
+     *            The activator's runtime class
+     * @return The corresponding activator
+     */
+    protected static <T extends ScopeUIActivator> T getInstance(Class<T> activatorClass) {
+        ScopeUIActivator activator = UI_ACTIVATORS.get(activatorClass);
+        if (activator == null) {
+            /* The activator should be registered at this point! */
+            throw new IllegalStateException();
+        }
+        /*
+         * We inserted the corresponding class into the map ourselves, cast
+         * should always be safe.
+         */
+        @SuppressWarnings("unchecked")
+        T ret = (T) activator;
+        return ret;
+    }
+
+    /**
+     * Get an {@link Image} from a path within the plugin.
+     *
+     * @param path
+     *            The path to the image
+     * @return The image object, or null if it could not be found
+     */
+    public @Nullable Image getImageFromPath(String path) {
+        ImageDescriptor id = getImageDescripterFromPath(path);
+        if (id == null) {
+            return null;
+        }
+        return id.createImage();
+    }
+
+    /**
+     * Get the image descriptor from a path within the plugin.
+     *
+     * @param path
+     *            The path to the image
+     *
+     * @return The corresponding image descriptor, or null if the image is not
+     *         found
+     */
+    public @Nullable ImageDescriptor getImageDescripterFromPath(String path) {
+        return AbstractUIPlugin.imageDescriptorFromPlugin(fPluginId, path);
+    }
+
+    // ------------------------------------------------------------------------
+    // Abstract methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * Additional actions to run at the plug-in startup
+     */
+    protected abstract void startActions();
+
+    /**
+     * Additional actions to run at the plug-in shtudown
+     */
+    protected abstract void stopActions();
+
+    // ------------------------------------------------------------------------
+    // ore.eclipse.core.runtime.Plugin
+    // ------------------------------------------------------------------------
+
+    @Override
+    public final void start(@Nullable BundleContext context) throws Exception {
+        super.start(context);
+        Class<? extends ScopeUIActivator> activatorClass = this.getClass();
+        synchronized (UI_ACTIVATORS) {
+            if (UI_ACTIVATORS.containsKey(activatorClass)) {
+                logError("Duplicate Activator : " + activatorClass.getCanonicalName()); //$NON-NLS-1$
+            }
+            UI_ACTIVATORS.put(activatorClass, this);
+        }
+        startActions();
+    }
+
+    @Override
+    public final void stop(@Nullable BundleContext context) throws Exception {
+        stopActions();
+        UI_ACTIVATORS.remove(this.getClass());
+        super.stop(context);
+    }
+
+    // ------------------------------------------------------------------------
+    // Logging helpers
+    // ------------------------------------------------------------------------
+
+    /**
+     * Log a message with severity INFO.
+     *
+     * @param message
+     *            The message to log
+     * @param exception
+     *            Optional exception to attach to the message
+     */
+    public void logInfo(@Nullable String message, Throwable... exception) {
+        if (exception.length < 1) {
+            getLog().log(new Status(IStatus.INFO, fPluginId, nullToEmptyString(message)));
+        } else {
+            getLog().log(new Status(IStatus.INFO, fPluginId, nullToEmptyString(message), exception[0]));
+        }
+    }
+
+
+    /**
+     * Log a message with severity WARNING.
+     *
+     * @param message
+     *            The message to log
+     * @param exception
+     *            Optional exception to attach to the message
+     */
+    public void logWarning(@Nullable String message, Throwable... exception) {
+        if (exception.length < 1) {
+            getLog().log(new Status(IStatus.WARNING, fPluginId, nullToEmptyString(message)));
+        } else {
+            getLog().log(new Status(IStatus.WARNING, fPluginId, nullToEmptyString(message), exception[0]));
+        }
+    }
+
+    /**
+     * Log a message with severity ERROR.
+     *
+     * @param message
+     *            The message to log
+     * @param exception
+     *            Optional exception to attach to the message
+     */
+    public void logError(@Nullable String message, Throwable... exception) {
+        if (exception.length < 1) {
+            getLog().log(new Status(IStatus.ERROR, fPluginId, nullToEmptyString(message)));
+        } else {
+            getLog().log(new Status(IStatus.ERROR, fPluginId, nullToEmptyString(message), exception[0]));
+        }
+    }
+
+}
index ec33727fa7793be0d934d3d305b21ce183a224b5..c418eac2274f6f9d44fc392450f2f9acd649b1f1 100644 (file)
@@ -9,7 +9,7 @@
 
 package org.lttng.scope.tmf2.views.ui.activator.internal;
 
-import org.lttng.scope.common.ui.ScopeUIActivator;
+import org.lttng.scope.tmf2.views.ui.ScopeUIActivator;
 
 import javafx.application.Platform;
 
index 0a074ba4f0db5114b534132d0d8c40653a5f8aa3..10bc762c63a643d08d834832616a1b64c79b486d 100644 (file)
@@ -14,6 +14,7 @@ import static java.util.Objects.requireNonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tracecompass.common.core.StreamUtils;
 import org.eclipse.tracecompass.tmf.ui.views.TmfView;
 import org.lttng.scope.tmf2.views.core.context.ViewGroupContext;
 import org.lttng.scope.tmf2.views.ui.jfx.JfxUtils;
index 061e19d7aefa1e2ed00a819d38fef549ff0c2535..b6f90082ac58d1d1d3a79374fa7b51568bfdddab 100644 (file)
@@ -28,8 +28,6 @@ import org.lttng.scope.tmf2.views.ui.jfx.JfxColorFactory;
 import org.lttng.scope.tmf2.views.ui.timeline.widgets.timegraph.TimeGraphWidget;
 import org.lttng.scope.tmf2.views.ui.timeline.widgets.timegraph.VerticalPosition;
 
-import com.google.common.collect.ImmutableMap;
-
 import javafx.application.Platform;
 import javafx.scene.Group;
 import javafx.scene.paint.Paint;
@@ -45,7 +43,7 @@ public class TimeGraphArrowLayer extends TimeGraphLayer {
                 widget.getControl().getModelRenderProvider().getArrowProviders();
 
         fArrowProvidersConfig = arrowProviders.stream()
-                .collect(ImmutableMap.toImmutableMap(
+                .collect(Collectors.toMap(
                         Function.identity(),
                         ap -> {
                             Group group = new Group();
index 96f5476c372df7c297973561b7a40b3982993873..b9032666b6d4119af85767c8efbb166d9b110b96 100644 (file)
@@ -16,6 +16,7 @@ import java.util.Objects;
 import java.util.Optional;
 import java.util.concurrent.FutureTask;
 import java.util.function.Predicate;
+import java.util.stream.Collectors;
 
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
@@ -34,8 +35,6 @@ import org.lttng.scope.tmf2.views.core.timegraph.model.render.drawnevents.TimeGr
 import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeElement;
 import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeRender;
 
-import com.google.common.collect.ImmutableList;
-
 class PredicateDrawnEventProvider extends TimeGraphDrawnEventProvider {
 
     /** Maximum number of matching events */
@@ -128,7 +127,7 @@ class PredicateDrawnEventProvider extends TimeGraphDrawnEventProvider {
                 .filter(Objects::nonNull)
                 /* TimeGraphEvent -> TimeGraphDrawnEvent */
                 .map(tgEvent -> new TimeGraphDrawnEvent(tgEvent, getEventSeries(), null))
-                .collect(ImmutableList.toImmutableList());
+                .collect(Collectors.toList());
 
         return new TimeGraphDrawnEventRender(timeRange, drawnEvents);
     }
This page took 0.039443 seconds and 5 git commands to generate.