tmf: Switch tmf.ui to Java 7 + fix warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / widgets / timegraph / TimeGraphPresentationProvider.java
index ab2d21d4dc9d3f5ebea805a38a18754e3a877da2..05d11bbb46550bf5292a3b917013fd7da5d229ce 100644 (file)
@@ -14,6 +14,8 @@
 
 package org.eclipse.linuxtools.tmf.ui.widgets.timegraph;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import org.eclipse.linuxtools.internal.tmf.ui.Messages;
@@ -36,6 +38,9 @@ public class TimeGraphPresentationProvider implements ITimeGraphPresentationProv
     private ITmfTimeGraphDrawingHelper fDrawingHelper;
     private final String fStateTypeName;
 
+    // The list of listeners for graph color changes
+    private final List<ITimeGraphColorListener> fListeners = new ArrayList<>();
+
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
@@ -153,4 +158,32 @@ public class TimeGraphPresentationProvider implements ITimeGraphPresentationProv
         return true;
     }
 
+    /**
+     * @since 3.0
+     */
+    @Override
+    public void addColorListener(ITimeGraphColorListener listener) {
+        if (!fListeners.contains(listener)) {
+            fListeners.add(listener);
+        }
+    }
+
+    /**
+     * @since 3.0
+     */
+    @Override
+    public void removeColorListener(ITimeGraphColorListener listener) {
+        fListeners.remove(listener);
+    }
+
+    /**
+     * Notifies listeners of the state table change
+     * @since 3.0
+     */
+    protected void fireColorSettingsChanged() {
+        for (ITimeGraphColorListener listener : fListeners) {
+            listener.colorSettingsChanged(getStateTable());
+        }
+    }
+
 }
This page took 0.024624 seconds and 5 git commands to generate.