Make the TmfLocation final and get rid of clone()
authorFrancois Chouinard <fchouinard@gmail.com>
Fri, 28 Sep 2012 22:10:40 +0000 (18:10 -0400)
committerFrancois Chouinard <fchouinard@gmail.com>
Wed, 3 Oct 2012 14:20:19 +0000 (10:20 -0400)
- Make fLocation final
- Make TmfLocation concrete classes 'final'
- Remove clone() - not needed anymore
- Fix test cases

Change-Id: Ie4b67907aa53f8b6d7ba513caa6a8eecdbb624b4
Signed-off-by: Francois Chouinard <fchouinard@gmail.com>
Reviewed-on: https://git.eclipse.org/r/7985

24 files changed:
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfIteratorTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfLocationTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfTraceTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentCheckpointIndexTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfExperimentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfLocationTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfMultiTraceExperimentTest.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfStringLocation.java
org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/trace/TmfTraceTest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfExperimentContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfExperimentLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/trace/TmfLocationArray.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIterator.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfLightweightContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfTrace.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/ITmfLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfCheckpointIndexer.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfContext.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfExperiment.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfLongLocation.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/trace/TmfTimestampLocation.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/rawviewer/TmfRawEventViewer.java

index 96d4cb93a2dcf806038ba1ea3e0a5a102872f36c..6de0a3935cc12e451238ca6388ce97802e0461e0 100644 (file)
@@ -59,7 +59,6 @@ public class CtfIteratorTest {
     public void setUp() throws TmfTraceException {
         fixture = new CtfIterator(createTrace());
         CtfLocation ctfLocation = new CtfLocation(new CtfLocationData(1, 0));
-        ctfLocation.setLocation(new CtfLocationData(1, 0));
         fixture.setLocation(ctfLocation);
         fixture.increaseRank();
     }
@@ -166,7 +165,6 @@ public class CtfIteratorTest {
     public void testEquals_other() throws TmfTraceException {
         CtfIterator obj = new CtfIterator(createTrace());
         CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationData(1, 0));
-        ctfLocation1.setLocation(new CtfLocationData(1, 0));
         obj.setLocation(ctfLocation1);
         obj.increaseRank();
 
@@ -264,7 +262,6 @@ public class CtfIteratorTest {
     @Test
     public void testSetLocation() {
         CtfLocation location = new CtfLocation(new CtfLocationData(1, 0));
-        location.setLocation(new CtfLocationData(1, 0));
         fixture.setLocation(location);
     }
 }
index 0f3378d82a2e947fdd85984c06f376494f87e088..f946f47182d2b4f55b924514e27c75c4f969408a 100644 (file)
@@ -51,7 +51,6 @@ public class CtfLocationTest {
     @Before
     public void setUp() {
         fixture = new CtfLocation(new CtfLocationData(1, 0));
-        fixture.setLocation(new CtfLocationData(1, 0));
     }
 
     /**
@@ -121,7 +120,7 @@ public class CtfLocationTest {
     @Test
     public void testSetLocation() {
         CtfLocationData location = new CtfLocationData(1337, 7331);
-        fixture.setLocation(location);
+        fixture = new CtfLocation(location);
     }
 
     /**
index 5d81111557ab8f779cadae766c160b4c5c24fbfd..22bea4db2cb148b203e0c145634407b65e6d174a 100644 (file)
@@ -214,7 +214,6 @@ public class CtfTmfTraceTest {
     public void testGetLocationRatio() {
         final CtfLocationData location2 = new CtfLocationData(1, 0);
         CtfLocation location = new CtfLocation(location2);
-        location.setLocation(location2);
         double result = fixture.getLocationRatio(location);
 
         assertEquals(Double.NEGATIVE_INFINITY, result, 0.1);
index b2353c6919afec35bda9b67b1b7335067d503f52..e44f2b1a5b7a3f149487eb0f3801c32490b6043b 100644 (file)
@@ -133,8 +133,8 @@ public class TmfExperimentCheckpointIndexTest extends TestCase {
             TmfExperimentLocation expLocation = (TmfExperimentLocation) checkpoint.getLocation();
             TmfLocationArray locations = expLocation.getLocationInfo();
             ITmfContext[] trcContexts = new ITmfContext[2];
-            trcContexts[0] = new TmfContext(locations.getLocations()[0], (i * pageSize) / 2);
-            trcContexts[1] = new TmfContext(locations.getLocations()[1], (i * pageSize) / 2);
+            trcContexts[0] = new TmfContext(locations.getLocation(0), (i * pageSize) / 2);
+            trcContexts[1] = new TmfContext(locations.getLocation(1), (i * pageSize) / 2);
             TmfExperimentContext expContext = new TmfExperimentContext(trcContexts);
             expContext.getEvents()[0] = fTestTraces[0].getNext(fTestTraces[0].seekEvent((i * pageSize) / 2));
             expContext.getEvents()[1] = fTestTraces[1].getNext(fTestTraces[1].seekEvent((i * pageSize) / 2));
@@ -191,8 +191,8 @@ public class TmfExperimentCheckpointIndexTest extends TestCase {
             TmfExperimentLocation expLocation = (TmfExperimentLocation) checkpoint.getLocation();
             TmfLocationArray locations = expLocation.getLocationInfo();
             ITmfContext[] trcContexts = new ITmfContext[2];
-            trcContexts[0] = new TmfContext(locations.getLocations()[0], (i * pageSize) / 2);
-            trcContexts[1] = new TmfContext(locations.getLocations()[1], (i * pageSize) / 2);
+            trcContexts[0] = new TmfContext(locations.getLocation(0), (i * pageSize) / 2);
+            trcContexts[1] = new TmfContext(locations.getLocation(1), (i * pageSize) / 2);
             TmfExperimentContext expContext = new TmfExperimentContext(trcContexts);
             expContext.getEvents()[0] = testTraces[0].getNext(testTraces[0].seekEvent((i * pageSize) / 2));
             expContext.getEvents()[1] = testTraces[1].getNext(testTraces[1].seekEvent((i * pageSize) / 2));
index 6c8f03f5d39aafdcf2d17ef6b18fc064e8b95408..d3ca984e19179661c85b0ff2c7633254dbedc55c 100644 (file)
@@ -800,7 +800,7 @@ public class TmfExperimentTest extends TestCase {
     public void testGetNextLocation() {
         ITmfContext context1 = fExperiment.seekEvent(0);
         fExperiment.getNext(context1);
-        ITmfLocation location = context1.getLocation().clone();
+        ITmfLocation location = context1.getLocation();
         ITmfEvent event1 = fExperiment.getNext(context1);
         ITmfContext context2 = fExperiment.seekEvent(location);
         ITmfEvent event2 = fExperiment.getNext(context2);
@@ -810,7 +810,7 @@ public class TmfExperimentTest extends TestCase {
     public void testGetNextEndLocation() {
         ITmfContext context1 = fExperiment.seekEvent(fExperiment.getNbEvents() - 1);
         fExperiment.getNext(context1);
-        ITmfLocation location = context1.getLocation().clone();
+        ITmfLocation location = context1.getLocation();
         ITmfContext context2 = fExperiment.seekEvent(location);
         ITmfEvent event = fExperiment.getNext(context2);
         assertNull("Event", event);
index dabaa22c06ce62f9affb36fea37e25e24eba85ab..dc47e9d8a317c86099226905154a53c53ceb8ee9 100644 (file)
@@ -87,36 +87,6 @@ public class TmfLocationTest extends TestCase {
         assertEquals("TmfLocation", aTimestamp, location4.getLocationInfo());
     }
 
-    // ------------------------------------------------------------------------
-    // clone
-    // ------------------------------------------------------------------------
-
-    public void testClone() {
-        try {
-            TmfStringLocation location1 = fLocation1.clone();
-            TmfStringLocation location2 = fLocation2.clone();
-            TmfLongLocation location3 = fLocation3.clone();
-            TmfTimestampLocation location4 = fLocation4.clone();
-
-            assertEquals("clone", fLocation1, location1);
-            assertEquals("clone", fLocation2, location2);
-            assertEquals("clone", fLocation3, location3);
-            assertEquals("clone", fLocation4, location4);
-
-            assertEquals("clone", fLocation1.getLocationInfo(), location1.getLocationInfo());
-            assertEquals("clone", fLocation2.getLocationInfo(), location2.getLocationInfo());
-            assertEquals("clone", fLocation3.getLocationInfo(), location3.getLocationInfo());
-            assertEquals("clone", fLocation4.getLocationInfo(), location4.getLocationInfo());
-
-            assertNull("clone", location1.getLocationInfo());
-            assertEquals("clone", aString, location2.getLocationInfo());
-            assertEquals("clone", aLong, location3.getLocationInfo());
-            assertEquals("clone", aTimestamp, location4.getLocationInfo());
-        } catch (InternalError e) {
-            fail("clone()");
-        }
-    }
-
     // ------------------------------------------------------------------------
     // hashCode
     // ------------------------------------------------------------------------
index 09840f791069d6ef230c6105756f6f85fce88dbd..a49a6844f8b1ecc198f7d0e62cec806c057d22ee 100644 (file)
@@ -648,7 +648,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     public void testGetNextLocation() {
         ITmfContext context1 = fExperiment.seekEvent(0);
         fExperiment.getNext(context1);
-        ITmfLocation location = context1.getLocation().clone();
+        ITmfLocation location = context1.getLocation();
         ITmfEvent event1 = fExperiment.getNext(context1);
         ITmfContext context2 = fExperiment.seekEvent(location);
         ITmfEvent event2 = fExperiment.getNext(context2);
@@ -658,7 +658,7 @@ public class TmfMultiTraceExperimentTest extends TestCase {
     public void testGetNextEndLocation() {
         ITmfContext context1 = fExperiment.seekEvent(fExperiment.getNbEvents() - 1);
         fExperiment.getNext(context1);
-        ITmfLocation location = context1.getLocation().clone();
+        ITmfLocation location = context1.getLocation();
         ITmfContext context2 = fExperiment.seekEvent(location);
         ITmfEvent event = fExperiment.getNext(context2);
         assertNull("Event", event);
index 36f1fe881313791b4e5f113ca277cced9626f8f4..0489687b378c736fedfa3d8363e8a9b2a84ee757 100644 (file)
@@ -44,21 +44,4 @@ public class TmfStringLocation extends TmfLocation {
         return (String) super.getLocationInfo();
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#clone()
-     */
-    @Override
-    public TmfStringLocation clone() {
-        return (TmfStringLocation) super.clone();
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#cloneValue()
-     */
-    @Override
-    protected String cloneLocationInfo() {
-        // No need to clone a String
-        return getLocationInfo();
-    }
-
 }
index dba2a4540613a061fac55c3ec91a5b99cf353530..143dc5ff3fc4e0305de66a0b2edb3280812829e3 100644 (file)
@@ -1175,7 +1175,7 @@ public class TmfTraceTest extends TestCase {
     public void testGetNextLocation() {
         ITmfContext context1 = fTrace.seekEvent(0);
         fTrace.getNext(context1);
-        ITmfLocation location = context1.getLocation().clone();
+        ITmfLocation location = context1.getLocation();
         ITmfEvent event1 = fTrace.getNext(context1);
         ITmfContext context2 = fTrace.seekEvent(location);
         ITmfEvent event2 = fTrace.getNext(context2);
@@ -1185,7 +1185,7 @@ public class TmfTraceTest extends TestCase {
     public void testGetNextEndLocation() {
         ITmfContext context1 = fTrace.seekEvent(fTrace.getNbEvents() - 1);
         fTrace.getNext(context1);
-        ITmfLocation location = context1.getLocation().clone();
+        ITmfLocation location = context1.getLocation();
         ITmfContext context2 = fTrace.seekEvent(location);
         ITmfEvent event = fTrace.getNext(context2);
         assertNull("Event", event);
index 236e3a2ddd17335440733cd38b2a0e74289c9d0b..deda088286a57247012fc34c591ca0ee202d1a9e 100644 (file)
@@ -94,7 +94,7 @@ public class TmfExperimentContext extends TmfContext {
         this(other.cloneContexts());
         fEvents = other.fEvents;
         if (other.getLocation() != null) {
-            setLocation(other.getLocation().clone());
+            setLocation(other.getLocation());
         }
         setRank(other.getRank());
         setLastTrace(other.fLastTraceRead);
index 0ac87ff1b6cad763f2b4355d29f50b929e6cd2c7..68cbec14af08f50b7deae7c9508a8a60b5ff599f 100644 (file)
@@ -15,6 +15,7 @@ package org.eclipse.linuxtools.internal.tmf.core.trace;
 
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 
+
 /**
  * The experiment location in TMF.
  * <p>
@@ -30,9 +31,9 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
  *
  * @see TmfLocationArray
  */
-public class TmfExperimentLocation implements ITmfLocation {
+public final class TmfExperimentLocation implements ITmfLocation {
 
-    TmfLocationArray fLocation;
+    private final TmfLocationArray fLocation;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -56,19 +57,16 @@ public class TmfExperimentLocation implements ITmfLocation {
         this(location.getLocationInfo());
     }
 
-    // ------------------------------------------------------------------------
-    // Cloneable
-    // ------------------------------------------------------------------------
-
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#clone()
+    /**
+     * The "update" constructor. Copies the array of locations and updates
+     * a single entry.
+     *
+     * @param exp_location the experiment location
+     * @param index the entry to modify
+     * @param location the new entry
      */
-    @Override
-    public TmfExperimentLocation clone() {
-//        super.clone(); // To keep FindBugs happy
-        TmfLocationArray array = getLocationInfo();
-        TmfLocationArray clones = array.clone();
-        return new TmfExperimentLocation(clones);
+    public TmfExperimentLocation(TmfExperimentLocation exp_location, int index, ITmfLocation location) {
+        fLocation = new TmfLocationArray(exp_location.fLocation, index, location);
     }
 
     // ------------------------------------------------------------------------
@@ -82,9 +80,11 @@ public class TmfExperimentLocation implements ITmfLocation {
     @SuppressWarnings("nls")
     public String toString() {
         StringBuilder result = new StringBuilder("[TmfExperimentLocation");
-        ITmfLocation[] locations = getLocationInfo().getLocations();
-        for (ITmfLocation location : locations) {
+        int index = 0;
+        ITmfLocation location = getLocationInfo().getLocation(index);
+        while (location != null) {
             result.append("[" + location + "]");
+            location = getLocationInfo().getLocation(++index);
         }
         result.append("]");
         return result.toString();
index 41c35566f332f9f47ce2589c75bd0faecc98cd2f..4d3c5fb616b55f80ba0709a5366a68bee27a2ec7 100644 (file)
@@ -17,6 +17,7 @@ import java.util.Arrays;
 
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
 
+
 /**
  * A convenience class to store trace location arrays. The main purpose is to
  * provide a Comparable implementation for TmfExperimentLocation.
@@ -24,7 +25,7 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
  * @version 1.0
  * @author Patrick Tasse
  */
-public class TmfLocationArray implements Comparable<TmfLocationArray>, Cloneable {
+public final class TmfLocationArray implements Comparable<TmfLocationArray> {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -45,34 +46,36 @@ public class TmfLocationArray implements Comparable<TmfLocationArray>, Cloneable
         fLocations = locations;
     }
 
-    // ------------------------------------------------------------------------
-    // Getters
-    // ------------------------------------------------------------------------
-
     /**
-     * Get the locations inside this array
+     * The "update" constructor. Copies the array of locations and updates
+     * a single entry.
      *
-     * @return the locations
+     * @param locations the locations
+     * @param index the entry to modify
+     * @param location the new entry
      */
-    public ITmfLocation[] getLocations() {
-        return fLocations;
+    public TmfLocationArray(TmfLocationArray locations, int index, ITmfLocation location) {
+        assert(locations != null && index >= 0 && index < locations.fLocations.length);
+        fLocations = Arrays.copyOf(locations.fLocations, locations.fLocations.length);
+        fLocations[index] = location;
     }
 
     // ------------------------------------------------------------------------
-    // Cloneable
+    // Getters
     // ------------------------------------------------------------------------
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#clone()
+    /**
+     * Get a specific location
+     *
+     * @param index the location element
+     *
+     * @return the specific location (possibly null)
      */
-    @Override
-    public TmfLocationArray clone() {
-        ITmfLocation[] clones = new ITmfLocation[fLocations.length];
-        for (int i = 0; i < fLocations.length; i++) {
-            ITmfLocation location = fLocations[i];
-            clones[i] = (location != null) ? location.clone() : null;
+    public ITmfLocation getLocation(int index) {
+        if (fLocations != null && index >= 0 && index < fLocations.length) {
+            return fLocations[index];
         }
-        return new TmfLocationArray(clones);
+        return null;
     }
 
     // ------------------------------------------------------------------------
index 6e981c3b9315a87ce2c8e809e33245fd134be89b..bd5e3a60132620e5c9e021c61e986c41cf11b7b6 100644 (file)
@@ -150,7 +150,7 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         }
         /* Seek the current location accordingly */
         if (ret) {
-            curLocation.setLocation(new CtfLocationData(getCurrentEvent().getTimestamp().getValue(), index));
+            curLocation = new CtfLocation(new CtfLocationData(getCurrentEvent().getTimestamp().getValue(), index));
         } else {
             curLocation = NULL_LOCATION;
         }
@@ -255,9 +255,9 @@ public class CtfIterator extends CTFTraceReader implements ITmfContext,
         if (ret) {
             final long timestampValue = getCurrentEvent().getTimestamp().getValue();
             if (timestamp == timestampValue) {
-                curLocation.setLocation(timestampValue, index + 1);
+                curLocation = new CtfLocation(timestampValue, index + 1);
             } else {
-                curLocation.setLocation(timestampValue, 0L);
+                curLocation = new CtfLocation(timestampValue, 0L);
             }
         } else {
             curLocation = NULL_LOCATION;
index 7ca9fb0ac9be811eee957c875cb776517a5c12a6..01da9726134c640bf15dfae5bbb3a166a187e9ba 100644 (file)
@@ -21,9 +21,9 @@ import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
  * @version 1.0
  * @author Matthew Khouzam
  */
-public class CtfLocation implements ITmfLocation, Cloneable {
+public final class CtfLocation implements ITmfLocation {
 
-    private CtfLocationData fLocation;
+    private final CtfLocationData fLocation;
 
     /**
      * An invalid location
@@ -36,8 +36,8 @@ public class CtfLocation implements ITmfLocation, Cloneable {
      * @param timestamp
      *            The timestamp of this location
      */
-    public CtfLocation(ITmfTimestamp timestamp) {
-        setLocation(new CtfLocationData(timestamp.getValue(), 0));
+    public CtfLocation(final ITmfTimestamp timestamp) {
+        this(timestamp.getValue(), 0);
     }
 
     /**
@@ -49,46 +49,34 @@ public class CtfLocation implements ITmfLocation, Cloneable {
      *            The index of this location for this timestamp
      * @since 2.0
      */
-    public CtfLocation(ITmfTimestamp timestamp, long index) {
-        setLocation(new CtfLocationData(timestamp.getValue(), index));
+    public CtfLocation(final ITmfTimestamp timestamp, long index) {
+        this(timestamp.getValue(), index);
     }
 
     /**
-     * Copy constructor
+     * Change this location's timestamp and index values.
      *
-     * @param location
-     *            Other location to copy
+     * @param timestampValue
+     *            The new timestamp
+     * @param index
+     *            The new index
      * @since 2.0
      */
-    public CtfLocation(CtfLocationData location) {
-        setLocation(location);
+    public CtfLocation(final long timestampValue, final long index) {
+       this(new CtfLocationData(timestampValue, index));
     }
 
     /**
-     * Move this location to another location's position.
+     * Copy constructor
      *
      * @param location
-     *            The location to seek to
-     * @since 2.0
-     */
-    public void setLocation(CtfLocationData location) {
-        this.fLocation = location;
-    }
-
-    /**
-     * Change this location's timestamp and index values.
-     *
-     * @param timestampValue
-     *            The new timestamp
-     * @param index
-     *            The new index
+     *            Other location to copy
      * @since 2.0
      */
-    public void setLocation(long timestampValue, long index) {
-       this.fLocation = new CtfLocationData(timestampValue, index);
+    public CtfLocation(final CtfLocationData location) {
+        fLocation = location;
     }
 
-
     /**
      * Get the Location Data of this location
      *
@@ -155,5 +143,4 @@ public class CtfLocation implements ITmfLocation, Cloneable {
         return "CtfLocation: " + getLocationInfo().toString(); //$NON-NLS-1$
     }
 
-
 }
index d0ead87744fa4cb33b32b1dff350442a792fde8a..8bfab465d840c5a0d47331c10b2a228a800b62fc 100644 (file)
@@ -127,12 +127,12 @@ public class CtfTmfLightweightContext implements ITmfContext {
         if (currentEvent != null) {
             final long timestampValue = currentEvent.getTimestamp().getValue();
             if (curLocationData.getTimestamp() == timestampValue) {
-                curLocation.setLocation(timestampValue, curLocationData.getIndex() + 1);
+                curLocation = new CtfLocation(timestampValue, curLocationData.getIndex() + 1);
             } else {
-                curLocation.setLocation(timestampValue, 0L);
+                curLocation = new CtfLocation(timestampValue, 0L);
             }
         } else {
-            curLocation.setLocation(CtfLocation.INVALID_LOCATION);
+            curLocation = new CtfLocation(CtfLocation.INVALID_LOCATION);
         }
 
         return retVal;
@@ -151,7 +151,7 @@ public class CtfTmfLightweightContext implements ITmfContext {
      * @return success or not
      */
     public synchronized boolean seek(final long timestamp) {
-        curLocation.setLocation(timestamp, 0);
+        curLocation = new CtfLocation(timestamp, 0);
         return getIterator().seek(timestamp);
     }
 
@@ -164,7 +164,7 @@ public class CtfTmfLightweightContext implements ITmfContext {
      * @since 2.0
      */
     public synchronized boolean seek(final CtfLocationData location) {
-        curLocation.setLocation(location);
+        curLocation = new CtfLocation(location);
         return getIterator().seek(location);
     }
 
index 40abf1aa1db649cd5e898741a3a0be85d7310673..196eb577b4d74b812e2650159f89962179449134 100644 (file)
@@ -211,13 +211,13 @@ public class CtfTmfTrace extends TmfTrace implements ITmfEventParser {
         }
         if (currentLocation.getLocationInfo() == CtfLocation.INVALID_LOCATION) {
             ((CtfTmfTimestamp) getEndTime()).setType(TimestampType.NANOS);
-            currentLocation.setLocation(getEndTime().getValue() + 1, 0L);
+            currentLocation = new CtfLocation(getEndTime().getValue() + 1, 0L);
         }
         context.setLocation(currentLocation);
         if (location == null) {
             CtfTmfEvent event = getIterator(this, context).getCurrentEvent();
             if (event != null) {
-                currentLocation.setLocation(event.getTimestamp().getValue(), 0);
+                currentLocation = new CtfLocation(event.getTimestamp().getValue(), 0);
             }
         }
         if(context.getRank() != 0) {
index ccf856268eb6a52f9bbdaa0e54c2850f17d17a94..be286d68ccca2cca22f8d954cc6f917a1eda7d48 100644 (file)
@@ -20,7 +20,7 @@ package org.eclipse.linuxtools.tmf.core.trace;
  * enough information to allow the positioning of the trace 'pointer' to read an
  * arbitrary event.
  * <p>
- * This location is trace-specific and must be comparable.
+ * This location is trace-specific, must be comparable and immutable.
  *
  * @version 2.0
  * @author Francois Chouinard
@@ -39,13 +39,4 @@ public interface ITmfLocation {
      */
     public Comparable<?> getLocationInfo();
 
-    // ------------------------------------------------------------------------
-    // Operations
-    // ------------------------------------------------------------------------
-
-    /**
-     * @return a clone of the location
-     */
-    public ITmfLocation clone();
-
 }
index fd6026fdf7383ab30adef9d5f1b247fe824c0175..0dcfa9c18b4f26370771cd7b29914f7b658d29c6 100644 (file)
@@ -331,7 +331,7 @@ public class TmfCheckpointIndexer implements ITmfTraceIndexer {
         if (context instanceof TmfExperimentContext) {
             return saveExpContext(context);
         }
-        TmfContext ctx = new TmfContext(context.getLocation().clone(), context.getRank());
+        TmfContext ctx = new TmfContext(context.getLocation(), context.getRank());
         return ctx;
     }
 
@@ -341,10 +341,10 @@ public class TmfCheckpointIndexer implements ITmfTraceIndexer {
         ITmfContext[] trcCtxts = new TmfContext[size];
         for (int i = 0; i < size; i++) {
             ITmfContext ctx = expContext.getContexts()[i];
-            trcCtxts[i] = (ctx != null) ? new TmfContext(ctx.getLocation().clone(), ctx.getRank()) : null;
+            trcCtxts[i] = (ctx != null) ? new TmfContext(ctx.getLocation(), ctx.getRank()) : null;
         }
         TmfExperimentContext expCtx = new TmfExperimentContext(trcCtxts);
-        expCtx.setLocation(context.getLocation().clone());
+        expCtx.setLocation(context.getLocation());
         expCtx.setRank(context.getRank());
         ITmfEvent[] trcEvts = expCtx.getEvents();
         for (int i = 0; i < size; i++) {
@@ -370,11 +370,11 @@ public class TmfCheckpointIndexer implements ITmfTraceIndexer {
         for (int i = 0; i < size; i++) {
             ITmfTrace trace = ((TmfExperiment) fTrace).getTraces()[i];
             ITmfContext ctx = expContext.getContexts()[i];
-            trcCtxts[i] = trace.seekEvent(ctx.getLocation().clone());
+            trcCtxts[i] = trace.seekEvent(ctx.getLocation());
             trcCtxts[i].setRank(ctx.getRank());
         }
         TmfExperimentContext ctx = new TmfExperimentContext(trcCtxts);
-        ctx.setLocation(context.getLocation().clone());
+        ctx.setLocation(context.getLocation());
         ctx.setRank(context.getRank());
         ITmfEvent[] trcEvts = expContext.getEvents();
         for (int i = 0; i < size; i++) {
index d0dd6c3e50578a1f3c9aa353c7dd4cd378ae3f1b..6e08185653cdc76e5557b0f9b8dd333025c8d332 100644 (file)
@@ -92,7 +92,7 @@ public class TmfContext implements ITmfContext, Cloneable {
         TmfContext clone = null;
         try {
             clone = (TmfContext) super.clone();
-            clone.fLocation = (fLocation != null) ? fLocation.clone() : null;
+            clone.fLocation = (fLocation != null) ? fLocation : null;
             clone.fRank = fRank;
         } catch (final CloneNotSupportedException e) {
         }
index b517a9ef55daa57e93d98db29e24aa0fb3b6c55f..20ac701cb48934a9725bce887a3a7aacbb1369f3 100644 (file)
@@ -288,24 +288,30 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
             return null;
         }
 
-        // Instantiate the location
-        final TmfExperimentLocation expLocation = (location == null)
-                ? new TmfExperimentLocation(new TmfLocationArray(new ITmfLocation[fTraces.length]))
-                : (TmfExperimentLocation) location.clone();
-
         // Create and populate the context's traces contexts
         final TmfExperimentContext context = new TmfExperimentContext(new ITmfContext[fTraces.length]);
+        ITmfLocation[] expLocations = new ITmfLocation[fTraces.length];
+        if (location != null) {
+            TmfExperimentLocation locations = (TmfExperimentLocation) location;
+            int index = 0;
+            ITmfLocation l = locations.getLocationInfo().getLocation(index);
+            while (index < expLocations.length && l != null) {
+                expLocations[index] = l;
+                l = locations.getLocationInfo().getLocation(++index);
+            }
+        }
 
+        // Position the traces
         for (int i = 0; i < fTraces.length; i++) {
             // Get the relevant trace attributes
-            final ITmfLocation trcLocation = expLocation.getLocationInfo().getLocations()[i];
+            final ITmfLocation trcLocation = expLocations[i];
             context.getContexts()[i] = fTraces[i].seekEvent(trcLocation);
-            expLocation.getLocationInfo().getLocations()[i] = context.getContexts()[i].getLocation().clone();
+            expLocations[i] = context.getContexts()[i].getLocation();
             context.getEvents()[i] = fTraces[i].getNext(context.getContexts()[i]);
         }
 
         // Finalize context
-        context.setLocation(expLocation);
+        context.setLocation(new TmfExperimentLocation(new TmfLocationArray(expLocations)));
         context.setLastTrace(TmfExperimentContext.NO_TRACE);
         context.setRank((location == null) ? 0 : ITmfContext.UNKNOWN_RANK);
 
@@ -412,10 +418,9 @@ public class TmfExperiment extends TmfTrace implements ITmfEventParser {
                 expContext.setLastTrace(trace);
                 final ITmfContext traceContext = expContext.getContexts()[trace];
 
-                TmfExperimentLocation location = (TmfExperimentLocation) expContext.getLocation();
-                if (location != null) {
-                    location.getLocationInfo().getLocations()[trace] = traceContext.getLocation().clone();
-                }
+                expContext.setLocation(new TmfExperimentLocation(
+                        (TmfExperimentLocation) expContext.getLocation(),
+                        trace, traceContext.getLocation()));
 
                 fExperimentContext = expContext.clone();
                 processEvent(event);
index a5fb1b54eff3ae35a6f88d5ac42ad8b060a73dd6..363ceef022c201c807c51ae099a4123a83abb5be 100644 (file)
@@ -21,13 +21,13 @@ package org.eclipse.linuxtools.tmf.core.trace;
  * @version 2.0
  * @author Francois Chouinard
  */
-public abstract class TmfLocation implements ITmfLocation, Cloneable {
+public abstract class TmfLocation implements ITmfLocation {
 
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
 
-    private Comparable<?> fLocationInfo;
+    private final Comparable<?> fLocationInfo;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -74,32 +74,6 @@ public abstract class TmfLocation implements ITmfLocation, Cloneable {
         return fLocationInfo;
     }
 
-    // ------------------------------------------------------------------------
-    // Cloneable
-    // ------------------------------------------------------------------------
-
-    /* (non-Javadoc)
-     * @see java.lang.Object#clone()
-     */
-    @Override
-    public TmfLocation clone() {
-        TmfLocation clone = null;
-        try {
-            clone = (TmfLocation) super.clone();
-            clone.fLocationInfo = cloneLocationInfo();
-        } catch (CloneNotSupportedException e) {
-        }
-        return clone;
-    }
-
-    /**
-     * Delegate to the locationInfo cloning to the subclasses
-     *
-     * @return the locationInfo clone
-     * @since 2.0
-     */
-    protected abstract Comparable<?> cloneLocationInfo();
-
     // ------------------------------------------------------------------------
     // Object
     // ------------------------------------------------------------------------
index 01547b6b3088ba4c560a4710e572e10aa4713dc4..b54ec5da31d08603c9e703f493799f0f545617cd 100644 (file)
@@ -18,7 +18,7 @@ package org.eclipse.linuxtools.tmf.core.trace;
  * @author Francois Chouinard
  * @since 2.0
  */
-public class TmfLongLocation extends TmfLocation {
+public final class TmfLongLocation extends TmfLocation {
 
     /**
      * The normal constructor
@@ -46,21 +46,4 @@ public class TmfLongLocation extends TmfLocation {
         return (Long) super.getLocationInfo();
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#clone()
-     */
-    @Override
-    public TmfLongLocation clone() {
-        return (TmfLongLocation) super.clone();
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#cloneValue()
-     */
-    @Override
-    protected Long cloneLocationInfo() {
-        // No need to clone a Long
-        return getLocationInfo();
-    }
-
 }
index 985dece5e169f65af5c1c65401fecfe8430bcfd2..8c60870bb157413c99540a3ec40da1019c291be8 100644 (file)
@@ -21,7 +21,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
  * @author Francois Chouinard
  * @since 2.0
  */
-public class TmfTimestampLocation extends TmfLocation {
+public final class TmfTimestampLocation extends TmfLocation {
 
     /**
      * The normal constructor
@@ -49,20 +49,4 @@ public class TmfTimestampLocation extends TmfLocation {
         return (ITmfTimestamp) super.getLocationInfo();
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#clone()
-     */
-    @Override
-    public TmfTimestampLocation clone() {
-        return (TmfTimestampLocation) super.clone();
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.core.trace.TmfLocation#cloneValue()
-     */
-    @Override
-    protected ITmfTimestamp cloneLocationInfo() {
-        return getLocationInfo().clone();
-    }
-
 }
index df1f027b2bc266aa07bcd4a20929128ab9df7fed..4931aef197d567ff76ed7516a793f58dee210ded 100644 (file)
-/*******************************************************************************
- * Copyright (c) 2010, 2012 Ericsson
- *
- * 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
- *
- * Contributors:
- *   Patrick Tasse - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.ui.widgets.rawviewer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CaretEvent;
-import org.eclipse.swt.custom.CaretListener;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.MouseWheelListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Slider;
-
-/**
- * TmfRawEventViewer allows for the display of the raw data for an arbitrarily
- * large number of TMF events.
- *
- * It is essentially a Composite of a StyledText area and a Slider, where the number
- * of visible lines in the StyledText control is set to fill the viewer display area.
- * An underlying data model is used to store a cache of event raw text line data.
- * The slider is ratio-based.
- *
- * @version 1.0
- * @author Patrick Tasse
- */
-public class TmfRawEventViewer extends Composite implements ControlListener, SelectionListener, KeyListener, CaretListener, MouseMoveListener, MouseTrackListener, MouseWheelListener {
-
-    private static final Color COLOR_BACKGROUND_ODD = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
-    private static final Color COLOR_BACKGROUND_EVEN = new Color(Display.getDefault(), 242, 242, 242);
-    private static final Color COLOR_BACKGROUND_SELECTED = new Color(Display.getDefault(), 231, 246, 254);
-    private static final Color COLOR_BACKGROUND_HIGHLIGHTED = new Color(Display.getDefault(), 246, 252, 255);
-    private static final int MAX_LINE_DATA_SIZE = 1000;
-    private static final int SLIDER_MAX = 1000000;
-
-    private ITmfTrace fTrace;
-    private ITmfContext fBottomContext;
-
-    private ScrolledComposite fScrolledComposite;
-    private Composite fTextArea;
-    private StyledText fStyledText;
-    private Font fFixedFont;
-    private Slider fSlider;
-
-    private final List<LineData> fLines = new ArrayList<LineData>();
-    private boolean fActualRanks = false;
-    private int fTopLineIndex;
-    private int fLastTopLineIndex;
-    private final CaretPosition[] fStoredCaretPosition = new CaretPosition[]
-            { new CaretPosition(0, 0), new CaretPosition(0,0)};
-    private int fNumVisibleLines;
-    private ITmfLocation fSelectedLocation = null;
-    private long fHighlightedRank = Long.MIN_VALUE;
-    private int fCursorYCoordinate = -1;
-    private int fHoldSelection = 0;
-
-    private static class LineData {
-        long rank;
-        ITmfLocation location;
-        String string;
-        public LineData(long rank, ITmfLocation location, String string) {
-            this.rank = rank;
-            this.location = location;
-            if (string.length() == 0) {
-                this.string = " "; // workaround for setLineBackground has no effect on empty line //$NON-NLS-1$
-            } else {
-                this.string = string;
-            }
-        }
-        @Override
-        public String toString() {
-            return rank + " [" + location + "]: " + string; //$NON-NLS-1$ //$NON-NLS-2$
-        }
-    }
-
-    private static class CaretPosition {
-        int time;
-        int caretOffset;
-        public CaretPosition(int time, int caretOffset) {
-            this.time = time;
-            this.caretOffset = caretOffset;
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Constructor
-    // ------------------------------------------------------------------------
-
-    /**
-     * Constructor
-     * @param parent The parent composite
-     * @param style The style bits
-     */
-    public TmfRawEventViewer(Composite parent, int style) {
-        super(parent, style & (~SWT.H_SCROLL) & (~SWT.V_SCROLL));
-
-        // Set the layout
-        GridLayout gridLayout = new GridLayout();
-        gridLayout.numColumns = 2;
-        gridLayout.horizontalSpacing = 0;
-        gridLayout.verticalSpacing = 0;
-        gridLayout.marginWidth = 0;
-        gridLayout.marginHeight = 0;
-        setLayout(gridLayout);
-
-        // Create the controls
-        createTextArea(style & SWT.H_SCROLL);
-        createSlider(style & SWT.V_SCROLL);
-
-        // Prevent the slider from being traversed
-        setTabList(new Control[] { fScrolledComposite });
-    }
-
-    @Override
-    public void dispose() {
-        if (fFixedFont != null) {
-            fFixedFont.dispose();
-            fFixedFont = null;
-        }
-        super.dispose();
-    }
-
-    // ------------------------------------------------------------------------
-    // Text area handling
-    // ------------------------------------------------------------------------
-
-    /**
-     * Create the text area and add listeners
-     */
-    private void createTextArea(int style) {
-        fScrolledComposite = new ScrolledComposite(this, style);
-        fScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        fTextArea = new Composite(fScrolledComposite, SWT.NONE);
-        fTextArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        fScrolledComposite.setContent(fTextArea);
-        fScrolledComposite.setExpandHorizontal(true);
-        fScrolledComposite.setExpandVertical(true);
-        fScrolledComposite.setAlwaysShowScrollBars(true);
-        fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-        fScrolledComposite.addControlListener(this);
-
-        GridLayout textAreaGridLayout = new GridLayout();
-        textAreaGridLayout.marginHeight = 0;
-        textAreaGridLayout.marginWidth = 0;
-        fTextArea.setLayout(textAreaGridLayout);
-
-        if (fFixedFont == null) {
-            if (System.getProperty("os.name").contains("Windows")) { //$NON-NLS-1$ //$NON-NLS-2$
-                fFixedFont = new Font(Display.getCurrent(), new FontData("Courier New", 10, SWT.NORMAL)); //$NON-NLS-1$
-            } else {
-                fFixedFont = new Font(Display.getCurrent(), new FontData("Monospace", 10, SWT.NORMAL)); //$NON-NLS-1$
-            }
-        }
-
-        fStyledText = new StyledText(fTextArea, SWT.READ_ONLY);
-        fStyledText.setFont(fFixedFont);
-        fStyledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
-        fStyledText.addCaretListener(this);
-        fStyledText.addMouseMoveListener(this);
-        fStyledText.addMouseTrackListener(this);
-        fStyledText.addMouseWheelListener(this);
-        fStyledText.addListener(SWT.MouseWheel, new Listener() { // disable mouse scroll of horizontal scroll bar
-            @Override
-            public void handleEvent(Event event) { event.doit = false; }});
-        fStyledText.addKeyListener(this);
-
-        fTextArea.setBackground(fStyledText.getBackground());
-        fTextArea.addMouseListener(new MouseAdapter() {
-            @Override
-            public void mouseDown(MouseEvent e) {
-                fTextArea.setFocus();
-            }});
-    }
-
-    // ------------------------------------------------------------------------
-    // Slider handling
-    // ------------------------------------------------------------------------
-
-    private void createSlider(int style) {
-        fSlider = new Slider(this, SWT.VERTICAL);
-        fSlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
-        fSlider.setValues(0, 0, SLIDER_MAX, SLIDER_MAX, 1, 1);
-        fSlider.addSelectionListener(this);
-        if ((style & SWT.V_SCROLL) == 0) {
-            fSlider.setVisible(false);
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // Controls interactions
-    // ------------------------------------------------------------------------
-
-    @Override
-    public boolean setFocus() {
-        boolean isVisible = isVisible();
-        if (isVisible) {
-            fTextArea.setFocus();
-        }
-        return isVisible;
-    }
-
-    @Override
-    public void setMenu(Menu menu) {
-        fStyledText.setMenu(menu);
-    }
-
-    /**
-     * Sets the trace and updates the content
-     * @param trace The trace to set
-     */
-    public void setTrace(ITmfTrace trace) {
-        fTrace = trace;
-        fTopLineIndex = 0;
-        fLines.clear();
-        refreshEventCount();
-    }
-
-    /**
-     * Refreshes the event count, updates the slider thumb and loads display
-     */
-    public void refreshEventCount() {
-        if (fTrace != null) {
-            if (fTrace.getNbEvents() > 0) {
-                fSlider.setThumb((int) Math.max(SLIDER_MAX / fTrace.getNbEvents(), 1));
-            } else {
-                fSlider.setThumb(SLIDER_MAX);
-            }
-
-            if (!isVisible()) {
-                return;
-            }
-
-            if (fLines.size() == 0) {
-                setTopRank(0);
-            } else if (fLines.size() < fNumVisibleLines) {
-                fBottomContext = null;
-                loadLineData();
-                fillTextArea();
-                //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
-                fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
-            }
-        } else {
-            fBottomContext = null;
-            fillTextArea();
-            fSlider.setThumb(SLIDER_MAX);
-            fSlider.setSelection(0);
-        }
-    }
-
-    /**
-     * Selects the event of given rank and makes it visible.
-     * @param rank The rank of event
-     */
-    public void selectAndReveal(long rank) {
-        if (fTrace == null || !isVisible()) {
-            return;
-        }
-        if (fActualRanks && fTopLineIndex < fLines.size() && rank >= fLines.get(fTopLineIndex).rank) {
-            int lastVisibleIndex = Math.min(fTopLineIndex + fNumVisibleLines, fLines.size()) - 1;
-            if (rank <= fLines.get(lastVisibleIndex).rank) {
-                for (int i = fTopLineIndex; i < fLines.size(); i++) {
-                    if (fLines.get(i).rank == rank) {
-                        fSelectedLocation = fLines.get(i).location;
-                        break;
-                    }
-                }
-                refreshLineBackgrounds();
-                return;
-            }
-        }
-        setTopRank(rank);
-        if (fLines.size() > 0 && fHoldSelection == 0) {
-            fSelectedLocation = fLines.get(0).location;
-            refreshLineBackgrounds();
-        }
-    }
-
-    /**
-     * Add a selection listener
-     * @param listener A listener to add
-     */
-    public void addSelectionListener(Listener listener) {
-        checkWidget();
-        if (listener == null) {
-            SWT.error (SWT.ERROR_NULL_ARGUMENT);
-        }
-        addListener (SWT.Selection, listener);
-    }
-
-    /**
-     * Remove selection listener
-     * @param listener A listener to remove
-     */
-    public void removeSelectionListener(Listener listener) {
-        checkWidget();
-        if (listener == null) {
-            SWT.error (SWT.ERROR_NULL_ARGUMENT);
-        }
-        removeListener(SWT.Selection, listener);
-    }
-
-    private void sendSelectionEvent(LineData lineData) {
-        Event event = new Event();
-        if (fActualRanks) {
-            event.data = Long.valueOf(lineData.rank);
-        } else {
-            event.data = lineData.location;
-        }
-        notifyListeners(SWT.Selection, event);
-    }
-
-    private void setTopRank(long rank) {
-        fBottomContext = fTrace.seekEvent(rank);
-        if (fBottomContext == null) {
-            return;
-        }
-        fLines.clear();
-        fActualRanks = true;
-        fTopLineIndex = 0;
-        loadLineData();
-        refreshTextArea();
-        if (fLines.size() == 0) {
-            fSlider.setSelection(0);
-        } else {
-            //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
-            fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
-        }
-    }
-
-    private void setTopPosition(double ratio) {
-        fBottomContext = fTrace.seekEvent(ratio);
-        if (fBottomContext == null) {
-            return;
-        }
-        fBottomContext.setRank(0);
-        fLines.clear();
-        fActualRanks = false;
-        fTopLineIndex = 0;
-        loadLineData();
-        refreshTextArea();
-    }
-
-    private void loadLineData() {
-        if (fTopLineIndex < 0) {
-            //if (fLines.size() > 0 && fLines.get(0).rank > 0) {
-                //long endRank = fLines.get(0).rank;
-                //long startRank = Math.max(0, endRank - fNumVisibleLines);
-                //TmfContext context = fTrace.seekEvent(startRank);
-                //int index = 0;
-                //while (context.getRank() < endRank) {
-                    //long rank = context.getRank();
-                    //ITmfLocation<?> location = context.getLocation();
-                    //TmfEvent event = fTrace.getNextEvent(context);
-                    //String[] lines = event.getRawText().split("\r?\n");
-                    //for (int i = 0; i < lines.length; i++) {
-                        //String line = lines[i];
-                        //LineData lineData = new LineData(rank, location, line);
-                        //fLines.add(index++, lineData);
-                        //fTopLineIndex++;
-                        //fLastTopLineIndex++;
-                    //}
-                //}
-            //}
-            if (fLines.size() > 0 && fTrace.getLocationRatio(fLines.get(0).location) > 0) {
-                double lastRatio = fTrace.getLocationRatio(fLines.get(fLines.size() - 1).location);
-                double firstRatio = fTrace.getLocationRatio(fLines.get(0).location);
-                double delta;
-                boolean singleEvent = false;
-                if (firstRatio != lastRatio) {
-                    // approximate ratio of at least 20 items
-                    delta = Math.max(20, fNumVisibleLines) * (lastRatio - firstRatio) / (fLines.size() - 1);
-                } else {
-                    delta = Math.pow(10, -15);
-                    singleEvent = true;
-                }
-                while (fTopLineIndex < 0) {
-                    ITmfLocation endLocation = fLines.get(0).location;
-                    firstRatio = Math.max(0, firstRatio - delta);
-                    ITmfContext context = fTrace.seekEvent(firstRatio);
-                    ITmfLocation location;
-                    int index = 0;
-                    long rank = 0;
-                    while (!context.getLocation().equals(endLocation)) {
-                        location = context.getLocation().clone();
-                        ITmfEvent event = fTrace.getNext(context);
-                        if (event == null) {
-                            break;
-                        }
-                        if (event.getContent() != null && event.getContent().getValue() != null) {
-                            String[] lines = event.getContent().getValue().toString().split("\r?\n"); //$NON-NLS-1$
-                            for (int i = 0; i < lines.length; i++) {
-                                String line = lines[i];
-                                LineData lineData = new LineData(rank, location, line);
-                                fLines.add(index++, lineData);
-                                fTopLineIndex++;
-                                fLastTopLineIndex++;
-                            }
-                        } else {
-                            LineData lineData = new LineData(rank, location, ""); //$NON-NLS-1$
-                            fLines.add(index++, lineData);
-                            fTopLineIndex++;
-                            fLastTopLineIndex++;
-                        }
-                        rank++;
-                    }
-                    long rankOffset = fLines.get(index).rank - rank;
-                    for (int i = 0; i < index; i++) {
-                        fLines.get(i).rank += rankOffset;
-                    }
-                    if (firstRatio == 0) {
-                        break;
-                    }
-                    if (singleEvent) {
-                        delta = Math.min(delta * 10, 0.1);
-                    }
-                }
-            }
-            if (fTopLineIndex < 0) {
-                fTopLineIndex = 0;
-            }
-        }
-
-        while (fLines.size() - fTopLineIndex < fNumVisibleLines) {
-            if (fBottomContext == null) {
-                if (fLines.size() == 0) {
-                    fBottomContext = fTrace.seekEvent(0);
-                } else {
-                    //fBottomContext = fTrace.seekEvent(fLines.get(fLines.size() - 1).rank + 1);
-                    fBottomContext = fTrace.seekEvent(fLines.get(fLines.size() - 1).location);
-                    fTrace.getNext(fBottomContext);
-                }
-                if (fBottomContext == null) {
-                    break;
-                }
-            }
-            long rank = fBottomContext.getRank();
-            ITmfLocation location = fBottomContext.getLocation() != null ? fBottomContext.getLocation().clone() : null;
-            ITmfEvent event = fTrace.getNext(fBottomContext);
-            if (event == null) {
-                break;
-            }
-            if (event.getContent() != null && event.getContent().getValue() != null) {
-                for (String line : event.getContent().getValue().toString().split("\r?\n")) { //$NON-NLS-1$
-                    int crPos;
-                    if ((crPos = line.indexOf('\r')) != -1) {
-                        line = line.substring(0, crPos);
-                    }
-                    LineData lineData = new LineData(rank, location, line);
-                    fLines.add(lineData);
-                }
-            } else {
-                LineData lineData = new LineData(rank, location, ""); //$NON-NLS-1$
-                fLines.add(lineData);
-            }
-        }
-        fTopLineIndex = Math.max(0, Math.min(fTopLineIndex, fLines.size() - 1));
-
-        if (fLines.size() > MAX_LINE_DATA_SIZE) {
-            if (fTopLineIndex < MAX_LINE_DATA_SIZE / 2) {
-                long rank = fLines.get(MAX_LINE_DATA_SIZE - 1).rank;
-                for (int i = MAX_LINE_DATA_SIZE; i < fLines.size(); i++) {
-                    if (fLines.get(i).rank > rank) {
-                        fLines.subList(i, fLines.size()).clear();
-                        fBottomContext = null;
-                        break;
-                    }
-                }
-            } else {
-                long rank = fLines.get(fLines.size() - MAX_LINE_DATA_SIZE).rank;
-                for (int i = fLines.size() - MAX_LINE_DATA_SIZE - 1; i >= 0; i--) {
-                    if (fLines.get(i).rank < rank) {
-                        fLines.subList(0, i + 1).clear();
-                        fTopLineIndex -= (i + 1);
-                        fLastTopLineIndex -= (i + 1);
-                        break;
-                    }
-                }
-            }
-        }
-    }
-
-    private void refreshTextArea() {
-        fStyledText.setText(""); //$NON-NLS-1$
-        for (int i = 0; i < fLines.size() - fTopLineIndex && i < fNumVisibleLines; i++) {
-            if (i > 0)
-            {
-                fStyledText.append("\n"); //$NON-NLS-1$
-            }
-            LineData lineData = fLines.get(fTopLineIndex + i);
-            fStyledText.append(lineData.string);
-            setLineBackground(i, lineData);
-        }
-        fTextArea.layout();
-        fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-        fLastTopLineIndex = fTopLineIndex;
-    }
-
-    private void fillTextArea() {
-        int nextLine = fStyledText.getCharCount() == 0 ? 0 : fStyledText.getLineCount();
-        for (int i = nextLine; i < fLines.size() - fTopLineIndex && i < fNumVisibleLines; i++) {
-            if (i > 0)
-            {
-                fStyledText.append("\n"); //$NON-NLS-1$
-            }
-            LineData lineData = fLines.get(fTopLineIndex + i);
-            fStyledText.append(lineData.string);
-            setLineBackground(i, lineData);
-        }
-        int endLine = Math.min(fNumVisibleLines, fLines.size());
-        if (endLine < fStyledText.getLineCount()) {
-            int endOffset = fStyledText.getOffsetAtLine(endLine) - 1;
-            if (endOffset > fStyledText.getCharCount()) {
-                fHoldSelection++;
-                fStyledText.replaceTextRange(endOffset, fStyledText.getCharCount() - endOffset, ""); //$NON-NLS-1$
-                fHoldSelection--;
-            }
-        }
-        fTextArea.layout();
-        fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-    }
-
-    private void updateTextArea() {
-        if (fTopLineIndex < fLastTopLineIndex) {
-            StringBuffer insertedText = new StringBuffer();
-            for (int i = fTopLineIndex; i < fLastTopLineIndex; i++) {
-                insertedText.append(fLines.get(i).string + "\n"); //$NON-NLS-1$
-            }
-            fStyledText.replaceTextRange(0, 0, insertedText.toString());
-            for (int i = 0; i < fLastTopLineIndex - fTopLineIndex; i++) {
-                LineData lineData = fLines.get(fTopLineIndex + i);
-                setLineBackground(i, lineData);
-            }
-            fLastTopLineIndex = fTopLineIndex;
-        } else if (fTopLineIndex > fLastTopLineIndex) {
-            int length = 0;
-            for (int i = 0; i < fTopLineIndex - fLastTopLineIndex && i < fNumVisibleLines; i++) {
-                length += fLines.get(i + fLastTopLineIndex).string.length();
-                if (i < fStyledText.getLineCount()) {
-                    length += 1;
-                }
-            }
-            fStyledText.replaceTextRange(0, length, ""); //$NON-NLS-1$
-            fLastTopLineIndex = fTopLineIndex;
-            fillTextArea();
-        }
-        int endLine = Math.min(fNumVisibleLines, fLines.size());
-        if (endLine < fStyledText.getLineCount()) {
-            int endOffset = fStyledText.getOffsetAtLine(endLine) - 1;
-            if (endOffset > fStyledText.getCharCount()) {
-                fStyledText.replaceTextRange(endOffset, fStyledText.getCharCount() - endOffset, ""); //$NON-NLS-1$
-            }
-        }
-        fTextArea.layout();
-        fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-    }
-
-    private void refreshLineBackgrounds() {
-        for (int i = 0; (i < fStyledText.getLineCount()) && (i < fNumVisibleLines) && (i < fLines.size() - fTopLineIndex); i++) {
-            LineData lineData = fLines.get(fTopLineIndex + i);
-            setLineBackground(i, lineData);
-        }
-    }
-
-    private void setLineBackground(int index, LineData lineData) {
-        if (lineData.location.equals(fSelectedLocation)) {
-            fStyledText.setLineBackground(index, 1, COLOR_BACKGROUND_SELECTED);
-        } else if (lineData.rank == fHighlightedRank) {
-            fStyledText.setLineBackground(index, 1, COLOR_BACKGROUND_HIGHLIGHTED);
-        } else if (lineData.rank % 2 == 0) {
-            fStyledText.setLineBackground(index, 1, COLOR_BACKGROUND_EVEN);
-        } else {
-            fStyledText.setLineBackground(index, 1, COLOR_BACKGROUND_ODD);
-        }
-    }
-
-    private void storeCaretPosition(int time, int caretOffset) {
-        if (fStoredCaretPosition[0].time == time) {
-            fStoredCaretPosition[0].caretOffset = caretOffset;
-        } else {
-            fStoredCaretPosition[1] = fStoredCaretPosition[0];
-            fStoredCaretPosition[0] = new CaretPosition(time, caretOffset);
-        }
-    }
-
-    private int getPreviousCaretOffset(int time) {
-        if (fStoredCaretPosition[0].time == time) {
-            return fStoredCaretPosition[1].caretOffset;
-        }
-        return fStoredCaretPosition[0].caretOffset;
-    }
-
-    private void updateHighlightedRank() {
-        if (fCursorYCoordinate < 0 || fCursorYCoordinate > fStyledText.getSize().y) {
-            if (fHighlightedRank != Long.MIN_VALUE) {
-                fHighlightedRank = Long.MIN_VALUE;
-                refreshLineBackgrounds();
-            }
-            return;
-        }
-        int offset = fStyledText.getOffsetAtLocation(new Point(0, fCursorYCoordinate));
-        int line = fStyledText.getLineAtOffset(offset);
-        if (line < fLines.size() - fTopLineIndex) {
-            LineData lineData = fLines.get(fTopLineIndex + line);
-            if (fHighlightedRank != lineData.rank) {
-                fHighlightedRank = lineData.rank;
-                refreshLineBackgrounds();
-            }
-        } else {
-            if (fHighlightedRank != Long.MIN_VALUE) {
-                fHighlightedRank = Long.MIN_VALUE;
-                refreshLineBackgrounds();
-            }
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // ControlListener (ScrolledComposite)
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void controlResized(ControlEvent event) {
-        int areaHeight = fScrolledComposite.getSize().y;
-        if (fScrolledComposite.getHorizontalBar() != null) {
-            areaHeight -= fScrolledComposite.getHorizontalBar().getSize().y;
-        }
-        int lineHeight = fStyledText.getLineHeight();
-        fNumVisibleLines = Math.max((areaHeight + lineHeight - 1) / lineHeight, 1);
-
-        if (fBottomContext != null) {
-            loadLineData();
-            fillTextArea();
-        }
-    }
-
-    @Override
-    public void controlMoved(ControlEvent e) {
-    }
-
-    // ------------------------------------------------------------------------
-    // SelectionListener (Slider)
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void widgetSelected(SelectionEvent e) {
-        fTextArea.setFocus();
-        if (fLines.size() == 0) {
-            return;
-        }
-        if (e.detail == SWT.DRAG) {
-            return;
-        }
-        fHoldSelection++;
-        switch (e.detail) {
-        case SWT.NONE: {
-            //long rank = (long) (fTrace.getNbEvents() * ((double) fSlider.getSelection() / SLIDER_MAX));
-            //setTopRank(rank);
-            if (fSlider.getSelection() == 0 || fSlider.getThumb() == SLIDER_MAX) {
-                fLines.clear();
-                setTopPosition(0.0);
-                break;
-            }
-            double ratio = (double) fSlider.getSelection() / (SLIDER_MAX - fSlider.getThumb());
-            double delta = Math.pow(10, -15);
-            fLines.clear();
-            while (fLines.size() == 0) {
-                setTopPosition(ratio);
-                if (ratio == 0.0) {
-                    break;
-                }
-                delta = Math.min(delta * 10, 0.1);
-                ratio = Math.max(ratio - delta, 0.0);
-            }
-            break;
-        }
-        case SWT.ARROW_DOWN: {
-            if (fTopLineIndex >= fLines.size()) {
-                break;
-            }
-            fTopLineIndex++;
-            loadLineData();
-            updateTextArea();
-            break;
-        }
-        case SWT.PAGE_DOWN: {
-            fTopLineIndex += Math.max(fNumVisibleLines - 1, 1);
-            loadLineData();
-            updateTextArea();
-            break;
-        }
-        case SWT.ARROW_UP: {
-            //if (fLines.size() == 0 || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {
-            if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {
-                break;
-            }
-            fTopLineIndex--;
-            loadLineData();
-            updateTextArea();
-            break;
-        }
-        case SWT.PAGE_UP: {
-            fTopLineIndex -= Math.max(fNumVisibleLines - 1, 1);
-            loadLineData();
-            updateTextArea();
-            break;
-        }
-        case SWT.HOME: {
-            //selectAndReveal(0);
-            setTopPosition(0.0);
-            break;
-        }
-        case SWT.END: {
-            //if (fTrace.getNbEvents() > 0) {
-            //selectAndReveal(fTrace.getNbEvents() - 1);
-            //}
-            double ratio = 1.0;
-            double delta = Math.pow(10, -15);
-            fLines.clear();
-            while (fLines.size() == 0) {
-                setTopPosition(ratio);
-                if (ratio == 0.0) {
-                    break;
-                }
-                delta = Math.min(delta * 10, 0.1);
-                ratio = Math.max(ratio - delta, 0.0);
-            }
-            break;
-        }
-        default:
-            break;
-        }
-        //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
-        if (e.detail != SWT.NONE) {
-            fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
-        }
-
-        fHoldSelection = 0;
-    }
-
-    @Override
-    public void widgetDefaultSelected(SelectionEvent e) {
-    }
-
-    // ------------------------------------------------------------------------
-    // KeyListener (StyledText)
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void keyPressed(KeyEvent e) {
-        if (fLines.size() == 0) {
-            return;
-        }
-        int caretOffset = fStyledText.getCaretOffset();
-        int previousCaretOffset = getPreviousCaretOffset(e.time);
-        int previousLineAtCaretPosition = fStyledText.getLineAtOffset(previousCaretOffset);
-        int previousColumnAtCaretPosition = getPreviousCaretOffset(e.time) - fStyledText.getOffsetAtLine(previousLineAtCaretPosition);
-        switch (e.keyCode) {
-        case SWT.ARROW_DOWN: {
-            if (previousLineAtCaretPosition < (fNumVisibleLines - 2)) {
-                break;
-            }
-            fHoldSelection++;
-            fTopLineIndex++;
-            loadLineData();
-            updateTextArea();
-            fHoldSelection--;
-            LineData lineData = fLines.get(fTopLineIndex + fStyledText.getLineAtOffset(fStyledText.getCaretOffset()));
-            if (!lineData.location.equals(fSelectedLocation)) {
-                fSelectedLocation = lineData.location;
-                refreshLineBackgrounds();
-                sendSelectionEvent(lineData);
-            }
-            break;
-        }
-        case SWT.PAGE_DOWN: {
-            if (previousLineAtCaretPosition >= (fNumVisibleLines - 1)) {
-                fHoldSelection++;
-                if (fLines.get(fTopLineIndex + previousLineAtCaretPosition).rank % 2 == 0) {
-                    fStyledText.setLineBackground(previousLineAtCaretPosition, 1, COLOR_BACKGROUND_EVEN);
-                } else {
-                    fStyledText.setLineBackground(previousLineAtCaretPosition, 1, COLOR_BACKGROUND_ODD);
-                }
-                fSelectedLocation = null;
-                fTopLineIndex += Math.max(fNumVisibleLines - 1, 1);
-                loadLineData();
-                updateTextArea();
-                fHoldSelection--;
-            }
-            int line = Math.min(fNumVisibleLines - 1, fStyledText.getLineCount() - 1);
-            int offset = fStyledText.getOffsetAtLine(line);
-            fStyledText.setSelection(offset + Math.min(previousColumnAtCaretPosition, fLines.get(fTopLineIndex + line).string.length()));
-            break;
-        }
-        case SWT.ARROW_RIGHT: {
-            if (previousCaretOffset < fStyledText.getCharCount() || previousLineAtCaretPosition < (fNumVisibleLines - 2)) {
-                break;
-            }
-            fHoldSelection++;
-            fTopLineIndex++;
-            loadLineData();
-            updateTextArea();
-            fHoldSelection--;
-            fStyledText.setSelection(fStyledText.getCaretOffset() + 1);
-            break;
-        }
-        case SWT.ARROW_UP: {
-            if (previousLineAtCaretPosition > 0) {
-                break;
-            }
-            if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {
-                break;
-            }
-            fHoldSelection++;
-            fTopLineIndex--;
-            loadLineData();
-            updateTextArea();
-            fHoldSelection--;
-            LineData lineData = fLines.get(fTopLineIndex);
-            if (!lineData.location.equals(fSelectedLocation)) {
-                fSelectedLocation = lineData.location;
-                refreshLineBackgrounds();
-                sendSelectionEvent(lineData);
-            }
-            fStyledText.setSelection(caretOffset);
-            break;
-        }
-        case SWT.PAGE_UP: {
-            if (previousLineAtCaretPosition > 0) {
-                break;
-            }
-            fHoldSelection++;
-            fTopLineIndex -= Math.max(fNumVisibleLines - 1, 1);
-            loadLineData();
-            updateTextArea();
-            fHoldSelection--;
-            LineData lineData = fLines.get(fTopLineIndex);
-            if (!lineData.location.equals(fSelectedLocation)) {
-                fSelectedLocation = lineData.location;
-                refreshLineBackgrounds();
-                sendSelectionEvent(lineData);
-            }
-            fStyledText.setSelection(caretOffset);
-            break;
-        }
-        case SWT.ARROW_LEFT: {
-            if (previousCaretOffset > 0) {
-                break;
-            }
-            if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {
-                break;
-            }
-            long topRank = fLines.get(fTopLineIndex).rank;
-            fHoldSelection++;
-            fTopLineIndex--;
-            loadLineData();
-            updateTextArea();
-            fHoldSelection--;
-            LineData lineData = fLines.get(fTopLineIndex);
-            if (!lineData.location.equals(fSelectedLocation)) {
-                fSelectedLocation = lineData.location;
-                refreshLineBackgrounds();
-                sendSelectionEvent(lineData);
-            }
-            if (topRank != fLines.get(fTopLineIndex).rank) {
-                fStyledText.setSelection(fLines.get(fTopLineIndex).string.length());
-            }
-            break;
-        }
-        case SWT.HOME: {
-            if ((e.stateMask & SWT.CTRL) == 0) {
-                break;
-            }
-            //selectAndReveal(0);
-            setTopPosition(0.0);
-            LineData lineData = fLines.get(fTopLineIndex);
-            if (!lineData.location.equals(fSelectedLocation)) {
-                fSelectedLocation = lineData.location;
-                refreshLineBackgrounds();
-                sendSelectionEvent(lineData);
-            }
-            break;
-        }
-        case SWT.END: {
-            if ((e.stateMask & SWT.CTRL) == 0) {
-                break;
-            }
-            //if (fTrace.getNbEvents() > 0) {
-            //selectAndReveal(fTrace.getNbEvents() - 1);
-            //}
-            double ratio = 1.0;
-            double delta = Math.pow(10, -15);
-            fLines.clear();
-            while (fLines.size() == 0) {
-                setTopPosition(ratio);
-                if (ratio == 0.0) {
-                    break;
-                }
-                delta = Math.min(delta * 10, 0.1);
-                ratio = Math.max(ratio - delta, 0.0);
-            }
-            LineData lineData = fLines.get(fTopLineIndex);
-            if (!lineData.location.equals(fSelectedLocation)) {
-                fSelectedLocation = lineData.location;
-                refreshLineBackgrounds();
-                sendSelectionEvent(lineData);
-            }
-            break;
-        }
-        default:
-            break;
-        }
-        //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
-        updateHighlightedRank();
-        fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
-    }
-
-    @Override
-    public void keyReleased(KeyEvent e) {
-    }
-
-    // ------------------------------------------------------------------------
-    // CaretListener (StyledText)
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void caretMoved(CaretEvent event) {
-        if (fHoldSelection == 0) {
-            int line = fStyledText.getLineAtOffset(event.caretOffset);
-            if (fTopLineIndex + line < fLines.size()) {
-                LineData lineData = fLines.get(fTopLineIndex + line);
-                if (!lineData.location.equals(fSelectedLocation)) {
-                    fSelectedLocation = lineData.location;
-                    refreshLineBackgrounds();
-                    sendSelectionEvent(lineData);
-                }
-            }
-        }
-        storeCaretPosition(event.time, event.caretOffset);
-        if (fHoldSelection == 0) {
-            Point caret = fStyledText.getLocationAtOffset(fStyledText.getCaretOffset());
-            Point origin = fScrolledComposite.getOrigin();
-            if (origin.x > caret.x) {
-                origin.x = caret.x;
-            } else if (caret.x - origin.x > fScrolledComposite.getSize().x) {
-                origin.x = caret.x - fScrolledComposite.getSize().x + 1;
-            }
-            fScrolledComposite.setOrigin(origin);
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // MouseMoveListener (StyledText)
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void mouseMove(MouseEvent e) {
-        fCursorYCoordinate = e.y;
-        if (e.y < 0 || e.y > fStyledText.getSize().y) {
-            if (fHighlightedRank != Long.MIN_VALUE) {
-                fHighlightedRank = Long.MIN_VALUE;
-                refreshLineBackgrounds();
-            }
-            return;
-        }
-        int offset = fStyledText.getOffsetAtLocation(new Point(0, e.y));
-        int line = fStyledText.getLineAtOffset(offset);
-        if (line < fLines.size() - fTopLineIndex) {
-            LineData lineData = fLines.get(fTopLineIndex + line);
-            if (fHighlightedRank != lineData.rank) {
-                fHighlightedRank = lineData.rank;
-                refreshLineBackgrounds();
-            }
-        } else {
-            if (fHighlightedRank != Long.MIN_VALUE) {
-                fHighlightedRank = Long.MIN_VALUE;
-                refreshLineBackgrounds();
-            }
-        }
-    }
-
-    // ------------------------------------------------------------------------
-    // MouseTrackListener (StyledText)
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void mouseExit(MouseEvent e) {
-        fCursorYCoordinate = -1;
-        if (fHighlightedRank != Long.MIN_VALUE) {
-            fHighlightedRank = Long.MIN_VALUE;
-            refreshLineBackgrounds();
-        }
-    }
-
-    @Override
-    public void mouseEnter(MouseEvent e) {
-        fCursorYCoordinate = e.y;
-    }
-
-    @Override
-    public void mouseHover(MouseEvent e) {
-    }
-
-    // ------------------------------------------------------------------------
-    // MouseWheelListener (StyledText)
-    // ------------------------------------------------------------------------
-
-    @Override
-    public void mouseScrolled(MouseEvent e) {
-        if (fLines.size() == 0) {
-            return;
-        }
-        fHoldSelection++;
-        fTopLineIndex -= e.count;
-        loadLineData();
-        updateTextArea();
-        fHoldSelection = 0;
-        //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));
-        updateHighlightedRank();
-        fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));
-    }
-
-}
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2012 Ericsson\r
+ *\r
+ * All rights reserved. This program and the accompanying materials are\r
+ * made available under the terms of the Eclipse Public License v1.0 which\r
+ * accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *   Patrick Tasse - Initial API and implementation\r
+ ******************************************************************************/\r
+\r
+package org.eclipse.linuxtools.tmf.ui.widgets.rawviewer;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;\r
+import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;\r
+import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;\r
+import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.custom.CaretEvent;\r
+import org.eclipse.swt.custom.CaretListener;\r
+import org.eclipse.swt.custom.ScrolledComposite;\r
+import org.eclipse.swt.custom.StyledText;\r
+import org.eclipse.swt.events.ControlEvent;\r
+import org.eclipse.swt.events.ControlListener;\r
+import org.eclipse.swt.events.KeyEvent;\r
+import org.eclipse.swt.events.KeyListener;\r
+import org.eclipse.swt.events.MouseAdapter;\r
+import org.eclipse.swt.events.MouseEvent;\r
+import org.eclipse.swt.events.MouseMoveListener;\r
+import org.eclipse.swt.events.MouseTrackListener;\r
+import org.eclipse.swt.events.MouseWheelListener;\r
+import org.eclipse.swt.events.SelectionEvent;\r
+import org.eclipse.swt.events.SelectionListener;\r
+import org.eclipse.swt.graphics.Color;\r
+import org.eclipse.swt.graphics.Font;\r
+import org.eclipse.swt.graphics.FontData;\r
+import org.eclipse.swt.graphics.Point;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.Event;\r
+import org.eclipse.swt.widgets.Listener;\r
+import org.eclipse.swt.widgets.Menu;\r
+import org.eclipse.swt.widgets.Slider;\r
+\r
+/**\r
+ * TmfRawEventViewer allows for the display of the raw data for an arbitrarily\r
+ * large number of TMF events.\r
+ *\r
+ * It is essentially a Composite of a StyledText area and a Slider, where the number\r
+ * of visible lines in the StyledText control is set to fill the viewer display area.\r
+ * An underlying data model is used to store a cache of event raw text line data.\r
+ * The slider is ratio-based.\r
+ *\r
+ * @version 1.0\r
+ * @author Patrick Tasse\r
+ */\r
+public class TmfRawEventViewer extends Composite implements ControlListener, SelectionListener,\r
+                KeyListener, CaretListener, MouseMoveListener, MouseTrackListener, MouseWheelListener {\r
+\r
+    private static final Color COLOR_BACKGROUND_ODD = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);\r
+    private static final Color COLOR_BACKGROUND_EVEN = new Color(Display.getDefault(), 242, 242, 242);\r
+    private static final Color COLOR_BACKGROUND_SELECTED = new Color(Display.getDefault(), 231, 246, 254);\r
+    private static final Color COLOR_BACKGROUND_HIGHLIGHTED = new Color(Display.getDefault(), 246, 252, 255);\r
+    private static final int MAX_LINE_DATA_SIZE = 1000;\r
+    private static final int SLIDER_MAX = 1000000;\r
+\r
+    private ITmfTrace fTrace;\r
+    private ITmfContext fBottomContext;\r
+\r
+    private ScrolledComposite fScrolledComposite;\r
+    private Composite fTextArea;\r
+    private StyledText fStyledText;\r
+    private Font fFixedFont;\r
+       private Slider fSlider;\r
+\r
+       private final List<LineData> fLines = new ArrayList<LineData>();\r
+       private boolean fActualRanks = false;\r
+       private int fTopLineIndex;\r
+       private int fLastTopLineIndex;\r
+       private final CaretPosition[] fStoredCaretPosition = new CaretPosition[]\r
+                   { new CaretPosition(0, 0), new CaretPosition(0,0)};\r
+       private int fNumVisibleLines;\r
+    private ITmfLocation fSelectedLocation = null;\r
+    private long fHighlightedRank = Long.MIN_VALUE;\r
+    private int fCursorYCoordinate = -1;\r
+    private int fHoldSelection = 0;\r
+\r
+       private static class LineData {\r
+           long rank;\r
+           ITmfLocation location;\r
+           String string;\r
+           public LineData(long rank, ITmfLocation location, String string) {\r
+               this.rank = rank;\r
+               this.location = location;\r
+            if (string.length() == 0) {\r
+                this.string = " "; // workaround for setLineBackground has no effect on empty line //$NON-NLS-1$\r
+            } else {\r
+                this.string = string;\r
+            }\r
+           }\r
+        @Override\r
+        public String toString() {\r
+            return rank + " [" + location + "]: " + string; //$NON-NLS-1$ //$NON-NLS-2$\r
+        }\r
+       }\r
+\r
+       private static class CaretPosition {\r
+           int time;\r
+           int caretOffset;\r
+           public CaretPosition(int time, int caretOffset) {\r
+               this.time = time;\r
+               this.caretOffset = caretOffset;\r
+           }\r
+       }\r
+\r
+       // ------------------------------------------------------------------------\r
+       // Constructor\r
+       // ------------------------------------------------------------------------\r
+\r
+       /**\r
+        * Constructor\r
+        * @param parent The parent composite\r
+        * @param style The style bits\r
+        */\r
+       public TmfRawEventViewer(Composite parent, int style) {\r
+               super(parent, style & (~SWT.H_SCROLL) & (~SWT.V_SCROLL));\r
+\r
+               // Set the layout\r
+               GridLayout gridLayout = new GridLayout();\r
+               gridLayout.numColumns = 2;\r
+               gridLayout.horizontalSpacing = 0;\r
+               gridLayout.verticalSpacing = 0;\r
+        gridLayout.marginWidth = 0;\r
+        gridLayout.marginHeight = 0;\r
+               setLayout(gridLayout);\r
+\r
+               // Create the controls\r
+               createTextArea(style & SWT.H_SCROLL);\r
+               createSlider(style & SWT.V_SCROLL);\r
+\r
+               // Prevent the slider from being traversed\r
+               setTabList(new Control[] { fScrolledComposite });\r
+       }\r
+\r
+    @Override\r
+       public void dispose() {\r
+        if (fFixedFont != null) {\r
+            fFixedFont.dispose();\r
+            fFixedFont = null;\r
+        }\r
+           super.dispose();\r
+       }\r
+\r
+       // ------------------------------------------------------------------------\r
+       // Text area handling\r
+       // ------------------------------------------------------------------------\r
+\r
+    /**\r
+        * Create the text area and add listeners\r
+        */\r
+       private void createTextArea(int style) {\r
+           fScrolledComposite = new ScrolledComposite(this, style);\r
+           fScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
+           fTextArea = new Composite(fScrolledComposite, SWT.NONE);\r
+        fTextArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));\r
+        fScrolledComposite.setContent(fTextArea);\r
+        fScrolledComposite.setExpandHorizontal(true);\r
+        fScrolledComposite.setExpandVertical(true);\r
+        fScrolledComposite.setAlwaysShowScrollBars(true);\r
+        fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));\r
+        fScrolledComposite.addControlListener(this);\r
+\r
+        GridLayout textAreaGridLayout = new GridLayout();\r
+        textAreaGridLayout.marginHeight = 0;\r
+        textAreaGridLayout.marginWidth = 0;\r
+        fTextArea.setLayout(textAreaGridLayout);\r
+\r
+        if (fFixedFont == null) {\r
+            if (System.getProperty("os.name").contains("Windows")) { //$NON-NLS-1$ //$NON-NLS-2$\r
+                fFixedFont = new Font(Display.getCurrent(), new FontData("Courier New", 10, SWT.NORMAL)); //$NON-NLS-1$\r
+            } else {\r
+                fFixedFont = new Font(Display.getCurrent(), new FontData("Monospace", 10, SWT.NORMAL)); //$NON-NLS-1$\r
+            }\r
+        }\r
+\r
+        fStyledText = new StyledText(fTextArea, SWT.READ_ONLY);\r
+        fStyledText.setFont(fFixedFont);\r
+        fStyledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));\r
+\r
+        fStyledText.addCaretListener(this);\r
+        fStyledText.addMouseMoveListener(this);\r
+        fStyledText.addMouseTrackListener(this);\r
+        fStyledText.addMouseWheelListener(this);\r
+        fStyledText.addListener(SWT.MouseWheel, new Listener() { // disable mouse scroll of horizontal scroll bar\r
+            @Override\r
+            public void handleEvent(Event event) { event.doit = false; }});\r
+        fStyledText.addKeyListener(this);\r
+\r
+        fTextArea.setBackground(fStyledText.getBackground());\r
+        fTextArea.addMouseListener(new MouseAdapter() {\r
+                       @Override\r
+            public void mouseDown(MouseEvent e) {\r
+                               fTextArea.setFocus();\r
+            }});\r
+       }\r
+\r
+       // ------------------------------------------------------------------------\r
+       // Slider handling\r
+       // ------------------------------------------------------------------------\r
+\r
+       private void createSlider(int style) {\r
+               fSlider = new Slider(this, SWT.VERTICAL);\r
+        fSlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));\r
+        fSlider.setValues(0, 0, SLIDER_MAX, SLIDER_MAX, 1, 1);\r
+               fSlider.addSelectionListener(this);\r
+        if ((style & SWT.V_SCROLL) == 0) {\r
+            fSlider.setVisible(false);\r
+        }\r
+       }\r
+\r
+       // ------------------------------------------------------------------------\r
+       // Controls interactions\r
+       // ------------------------------------------------------------------------\r
+\r
+       @Override\r
+       public boolean setFocus() {\r
+               boolean isVisible = isVisible();\r
+               if (isVisible) {\r
+                       fTextArea.setFocus();\r
+               }\r
+               return isVisible;\r
+       }\r
+\r
+    @Override\r
+    public void setMenu(Menu menu) {\r
+        fStyledText.setMenu(menu);\r
+    }\r
+\r
+    /**\r
+     * Sets the trace and updates the content\r
+     * @param trace The trace to set\r
+     */\r
+    public void setTrace(ITmfTrace trace) {\r
+           fTrace = trace;\r
+           fTopLineIndex = 0;\r
+           fLines.clear();\r
+           refreshEventCount();\r
+       }\r
+\r
+    /**\r
+     * Refreshes the event count, updates the slider thumb and loads display\r
+     */\r
+       public void refreshEventCount() {\r
+               if (fTrace != null) {\r
+                       if (fTrace.getNbEvents() > 0) {\r
+                               fSlider.setThumb((int) Math.max(SLIDER_MAX / fTrace.getNbEvents(), 1));\r
+                       } else {\r
+                               fSlider.setThumb(SLIDER_MAX);\r
+                       }\r
+\r
+                       if (!isVisible()) {\r
+                return;\r
+            }\r
+\r
+                       if (fLines.size() == 0) {\r
+                       setTopRank(0);\r
+                   } else if (fLines.size() < fNumVisibleLines) {\r
+                       fBottomContext = null;\r
+                       loadLineData();\r
+                       fillTextArea();\r
+                   //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));\r
+                   fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));\r
+                   }\r
+        } else {\r
+            fBottomContext = null;\r
+            fillTextArea();\r
+            fSlider.setThumb(SLIDER_MAX);\r
+            fSlider.setSelection(0);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Selects the event of given rank and makes it visible.\r
+        * @param rank The rank of event\r
+        */\r
+    public void selectAndReveal(long rank) {\r
+        if (fTrace == null || !isVisible()) {\r
+            return;\r
+        }\r
+        if (fActualRanks && fTopLineIndex < fLines.size() && rank >= fLines.get(fTopLineIndex).rank) {\r
+            int lastVisibleIndex = Math.min(fTopLineIndex + fNumVisibleLines, fLines.size()) - 1;\r
+            if (rank <= fLines.get(lastVisibleIndex).rank) {\r
+                for (int i = fTopLineIndex; i < fLines.size(); i++) {\r
+                    if (fLines.get(i).rank == rank) {\r
+                        fSelectedLocation = fLines.get(i).location;\r
+                        break;\r
+                    }\r
+                }\r
+                refreshLineBackgrounds();\r
+                return;\r
+            }\r
+        }\r
+        setTopRank(rank);\r
+        if (fLines.size() > 0 && fHoldSelection == 0) {\r
+            fSelectedLocation = fLines.get(0).location;\r
+            refreshLineBackgrounds();\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Add a selection listener\r
+     * @param listener A listener to add\r
+     */\r
+    public void addSelectionListener(Listener listener) {\r
+        checkWidget();\r
+        if (listener == null) {\r
+            SWT.error (SWT.ERROR_NULL_ARGUMENT);\r
+        }\r
+        addListener (SWT.Selection, listener);\r
+    }\r
+\r
+    /**\r
+     * Remove selection listener\r
+     * @param listener A listener to remove\r
+     */\r
+    public void removeSelectionListener(Listener listener) {\r
+        checkWidget();\r
+        if (listener == null) {\r
+            SWT.error (SWT.ERROR_NULL_ARGUMENT);\r
+        }\r
+        removeListener(SWT.Selection, listener);\r
+    }\r
+\r
+    private void sendSelectionEvent(LineData lineData) {\r
+        Event event = new Event();\r
+        if (fActualRanks) {\r
+            event.data = Long.valueOf(lineData.rank);\r
+        } else {\r
+            event.data = lineData.location;\r
+        }\r
+        notifyListeners(SWT.Selection, event);\r
+    }\r
+\r
+    private void setTopRank(long rank) {\r
+        fBottomContext = fTrace.seekEvent(rank);\r
+        if (fBottomContext == null) {\r
+            return;\r
+        }\r
+        fLines.clear();\r
+        fActualRanks = true;\r
+        fTopLineIndex = 0;\r
+        loadLineData();\r
+        refreshTextArea();\r
+        if (fLines.size() == 0) {\r
+            fSlider.setSelection(0);\r
+        } else {\r
+            //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));\r
+            fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));\r
+        }\r
+    }\r
+\r
+    private void setTopPosition(double ratio) {\r
+        fBottomContext = fTrace.seekEvent(ratio);\r
+        if (fBottomContext == null) {\r
+            return;\r
+        }\r
+        fBottomContext.setRank(0);\r
+        fLines.clear();\r
+        fActualRanks = false;\r
+        fTopLineIndex = 0;\r
+        loadLineData();\r
+        refreshTextArea();\r
+    }\r
+\r
+       private void loadLineData() {\r
+        if (fTopLineIndex < 0) {\r
+            //if (fLines.size() > 0 && fLines.get(0).rank > 0) {\r
+                //long endRank = fLines.get(0).rank;\r
+                //long startRank = Math.max(0, endRank - fNumVisibleLines);\r
+                //TmfContext context = fTrace.seekEvent(startRank);\r
+                //int index = 0;\r
+                //while (context.getRank() < endRank) {\r
+                    //long rank = context.getRank();\r
+                    //ITmfLocation<?> location = context.getLocation();\r
+                    //TmfEvent event = fTrace.getNextEvent(context);\r
+                    //String[] lines = event.getRawText().split("\r?\n");\r
+                    //for (int i = 0; i < lines.length; i++) {\r
+                        //String line = lines[i];\r
+                        //LineData lineData = new LineData(rank, location, line);\r
+                        //fLines.add(index++, lineData);\r
+                        //fTopLineIndex++;\r
+                        //fLastTopLineIndex++;\r
+                    //}\r
+                //}\r
+            //}\r
+            if (fLines.size() > 0 && fTrace.getLocationRatio(fLines.get(0).location) > 0) {\r
+               double lastRatio = fTrace.getLocationRatio(fLines.get(fLines.size() - 1).location);\r
+                double firstRatio = fTrace.getLocationRatio(fLines.get(0).location);\r
+                double delta;\r
+                boolean singleEvent = false;\r
+                if (firstRatio != lastRatio) {\r
+                    // approximate ratio of at least 20 items\r
+                    delta = Math.max(20, fNumVisibleLines) * (lastRatio - firstRatio) / (fLines.size() - 1);\r
+                } else {\r
+                    delta = Math.pow(10, -15);\r
+                    singleEvent = true;\r
+                }\r
+                while (fTopLineIndex < 0) {\r
+                    ITmfLocation endLocation = fLines.get(0).location;\r
+                    firstRatio = Math.max(0, firstRatio - delta);\r
+                    ITmfContext context = fTrace.seekEvent(firstRatio);\r
+                    ITmfLocation location;\r
+                    int index = 0;\r
+                    long rank = 0;\r
+                    while (!context.getLocation().equals(endLocation)) {\r
+                        location = context.getLocation();\r
+                        ITmfEvent event = fTrace.getNext(context);\r
+                        if (event == null) {\r
+                               break;\r
+                        }\r
+                        if (event.getContent() != null && event.getContent().getValue() != null) {\r
+                            String[] lines = event.getContent().getValue().toString().split("\r?\n"); //$NON-NLS-1$\r
+                            for (int i = 0; i < lines.length; i++) {\r
+                                String line = lines[i];\r
+                                LineData lineData = new LineData(rank, location, line);\r
+                                fLines.add(index++, lineData);\r
+                                fTopLineIndex++;\r
+                                fLastTopLineIndex++;\r
+                            }\r
+                        } else {\r
+                            LineData lineData = new LineData(rank, location, ""); //$NON-NLS-1$\r
+                            fLines.add(index++, lineData);\r
+                            fTopLineIndex++;\r
+                            fLastTopLineIndex++;\r
+                        }\r
+                        rank++;\r
+                    }\r
+                    long rankOffset = fLines.get(index).rank - rank;\r
+                    for (int i = 0; i < index; i++) {\r
+                        fLines.get(i).rank += rankOffset;\r
+                    }\r
+                    if (firstRatio == 0) {\r
+                        break;\r
+                    }\r
+                    if (singleEvent) {\r
+                       delta = Math.min(delta * 10, 0.1);\r
+                    }\r
+                }\r
+            }\r
+            if (fTopLineIndex < 0) {\r
+                fTopLineIndex = 0;\r
+            }\r
+        }\r
+\r
+           while (fLines.size() - fTopLineIndex < fNumVisibleLines) {\r
+               if (fBottomContext == null) {\r
+                   if (fLines.size() == 0) {\r
+                       fBottomContext = fTrace.seekEvent(0);\r
+                   } else {\r
+                    //fBottomContext = fTrace.seekEvent(fLines.get(fLines.size() - 1).rank + 1);\r
+                       fBottomContext = fTrace.seekEvent(fLines.get(fLines.size() - 1).location);\r
+                       fTrace.getNext(fBottomContext);\r
+                   }\r
+                   if (fBottomContext == null) {\r
+                       break;\r
+                   }\r
+               }\r
+            long rank = fBottomContext.getRank();\r
+            ITmfLocation location = fBottomContext.getLocation() != null ? fBottomContext.getLocation() : null;\r
+            ITmfEvent event = fTrace.getNext(fBottomContext);\r
+            if (event == null) {\r
+                break;\r
+            }\r
+            if (event.getContent() != null && event.getContent().getValue() != null) {\r
+                for (String line : event.getContent().getValue().toString().split("\r?\n")) { //$NON-NLS-1$\r
+                    int crPos;\r
+                    if ((crPos = line.indexOf('\r')) != -1) {\r
+                       line = line.substring(0, crPos);\r
+                    }\r
+                    LineData lineData = new LineData(rank, location, line);\r
+                    fLines.add(lineData);\r
+                }\r
+            } else {\r
+                LineData lineData = new LineData(rank, location, ""); //$NON-NLS-1$\r
+                fLines.add(lineData);\r
+            }\r
+           }\r
+           fTopLineIndex = Math.max(0, Math.min(fTopLineIndex, fLines.size() - 1));\r
+\r
+           if (fLines.size() > MAX_LINE_DATA_SIZE) {\r
+               if (fTopLineIndex < MAX_LINE_DATA_SIZE / 2) {\r
+                   long rank = fLines.get(MAX_LINE_DATA_SIZE - 1).rank;\r
+                   for (int i = MAX_LINE_DATA_SIZE; i < fLines.size(); i++) {\r
+                       if (fLines.get(i).rank > rank) {\r
+                           fLines.subList(i, fLines.size()).clear();\r
+                           fBottomContext = null;\r
+                           break;\r
+                       }\r
+                   }\r
+               } else {\r
+                   long rank = fLines.get(fLines.size() - MAX_LINE_DATA_SIZE).rank;\r
+                   for (int i = fLines.size() - MAX_LINE_DATA_SIZE - 1; i >= 0; i--) {\r
+                    if (fLines.get(i).rank < rank) {\r
+                        fLines.subList(0, i + 1).clear();\r
+                        fTopLineIndex -= (i + 1);\r
+                        fLastTopLineIndex -= (i + 1);\r
+                        break;\r
+                    }\r
+                   }\r
+               }\r
+           }\r
+       }\r
+\r
+    private void refreshTextArea() {\r
+        fStyledText.setText(""); //$NON-NLS-1$\r
+        for (int i = 0; i < fLines.size() - fTopLineIndex && i < fNumVisibleLines; i++) {\r
+            if (i > 0)\r
+             {\r
+                fStyledText.append("\n"); //$NON-NLS-1$\r
+            }\r
+            LineData lineData = fLines.get(fTopLineIndex + i);\r
+            fStyledText.append(lineData.string);\r
+            setLineBackground(i, lineData);\r
+        }\r
+        fTextArea.layout();\r
+        fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));\r
+        fLastTopLineIndex = fTopLineIndex;\r
+    }\r
+\r
+    private void fillTextArea() {\r
+        int nextLine = fStyledText.getCharCount() == 0 ? 0 : fStyledText.getLineCount();\r
+        for (int i = nextLine; i < fLines.size() - fTopLineIndex && i < fNumVisibleLines; i++) {\r
+            if (i > 0)\r
+             {\r
+                fStyledText.append("\n"); //$NON-NLS-1$\r
+            }\r
+            LineData lineData = fLines.get(fTopLineIndex + i);\r
+            fStyledText.append(lineData.string);\r
+            setLineBackground(i, lineData);\r
+        }\r
+        int endLine = Math.min(fNumVisibleLines, fLines.size());\r
+        if (endLine < fStyledText.getLineCount()) {\r
+           int endOffset = fStyledText.getOffsetAtLine(endLine) - 1;\r
+           if (endOffset > fStyledText.getCharCount()) {\r
+                fHoldSelection++;\r
+               fStyledText.replaceTextRange(endOffset, fStyledText.getCharCount() - endOffset, ""); //$NON-NLS-1$\r
+                fHoldSelection--;\r
+           }\r
+        }\r
+        fTextArea.layout();\r
+        fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));\r
+    }\r
+\r
+       private void updateTextArea() {\r
+           if (fTopLineIndex < fLastTopLineIndex) {\r
+               StringBuffer insertedText = new StringBuffer();\r
+               for (int i = fTopLineIndex; i < fLastTopLineIndex; i++) {\r
+                   insertedText.append(fLines.get(i).string + "\n"); //$NON-NLS-1$\r
+               }\r
+               fStyledText.replaceTextRange(0, 0, insertedText.toString());\r
+            for (int i = 0; i < fLastTopLineIndex - fTopLineIndex; i++) {\r
+                LineData lineData = fLines.get(fTopLineIndex + i);\r
+                setLineBackground(i, lineData);\r
+            }\r
+               fLastTopLineIndex = fTopLineIndex;\r
+           } else if (fTopLineIndex > fLastTopLineIndex) {\r
+               int length = 0;\r
+               for (int i = 0; i < fTopLineIndex - fLastTopLineIndex && i < fNumVisibleLines; i++) {\r
+                   length += fLines.get(i + fLastTopLineIndex).string.length();\r
+                   if (i < fStyledText.getLineCount()) {\r
+                    length += 1;\r
+                }\r
+               }\r
+               fStyledText.replaceTextRange(0, length, ""); //$NON-NLS-1$\r
+            fLastTopLineIndex = fTopLineIndex;\r
+            fillTextArea();\r
+           }\r
+        int endLine = Math.min(fNumVisibleLines, fLines.size());\r
+        if (endLine < fStyledText.getLineCount()) {\r
+           int endOffset = fStyledText.getOffsetAtLine(endLine) - 1;\r
+           if (endOffset > fStyledText.getCharCount()) {\r
+               fStyledText.replaceTextRange(endOffset, fStyledText.getCharCount() - endOffset, ""); //$NON-NLS-1$\r
+           }\r
+        }\r
+           fTextArea.layout();\r
+           fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));\r
+       }\r
+\r
+       private void refreshLineBackgrounds() {\r
+        for (int i = 0; (i < fStyledText.getLineCount()) && (i < fNumVisibleLines) && (i < fLines.size() - fTopLineIndex); i++) {\r
+            LineData lineData = fLines.get(fTopLineIndex + i);\r
+            setLineBackground(i, lineData);\r
+        }\r
+       }\r
+\r
+       private void setLineBackground(int index, LineData lineData) {\r
+        if (lineData.location.equals(fSelectedLocation)) {\r
+            fStyledText.setLineBackground(index, 1, COLOR_BACKGROUND_SELECTED);\r
+        } else if (lineData.rank == fHighlightedRank) {\r
+            fStyledText.setLineBackground(index, 1, COLOR_BACKGROUND_HIGHLIGHTED);\r
+        } else if (lineData.rank % 2 == 0) {\r
+            fStyledText.setLineBackground(index, 1, COLOR_BACKGROUND_EVEN);\r
+        } else {\r
+            fStyledText.setLineBackground(index, 1, COLOR_BACKGROUND_ODD);\r
+        }\r
+       }\r
+\r
+       private void storeCaretPosition(int time, int caretOffset) {\r
+           if (fStoredCaretPosition[0].time == time) {\r
+               fStoredCaretPosition[0].caretOffset = caretOffset;\r
+           } else {\r
+               fStoredCaretPosition[1] = fStoredCaretPosition[0];\r
+               fStoredCaretPosition[0] = new CaretPosition(time, caretOffset);\r
+           }\r
+       }\r
+\r
+       private int getPreviousCaretOffset(int time) {\r
+           if (fStoredCaretPosition[0].time == time) {\r
+               return fStoredCaretPosition[1].caretOffset;\r
+           }\r
+        return fStoredCaretPosition[0].caretOffset;\r
+       }\r
+\r
+       private void updateHighlightedRank() {\r
+        if (fCursorYCoordinate < 0 || fCursorYCoordinate > fStyledText.getSize().y) {\r
+            if (fHighlightedRank != Long.MIN_VALUE) {\r
+                fHighlightedRank = Long.MIN_VALUE;\r
+                refreshLineBackgrounds();\r
+            }\r
+            return;\r
+        }\r
+        int offset = fStyledText.getOffsetAtLocation(new Point(0, fCursorYCoordinate));\r
+        int line = fStyledText.getLineAtOffset(offset);\r
+        if (line < fLines.size() - fTopLineIndex) {\r
+            LineData lineData = fLines.get(fTopLineIndex + line);\r
+            if (fHighlightedRank != lineData.rank) {\r
+                fHighlightedRank = lineData.rank;\r
+                refreshLineBackgrounds();\r
+            }\r
+        } else {\r
+            if (fHighlightedRank != Long.MIN_VALUE) {\r
+                fHighlightedRank = Long.MIN_VALUE;\r
+                refreshLineBackgrounds();\r
+            }\r
+        }\r
+       }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // ControlListener (ScrolledComposite)\r
+    // ------------------------------------------------------------------------\r
+\r
+    @Override\r
+    public void controlResized(ControlEvent event) {\r
+        int areaHeight = fScrolledComposite.getSize().y;\r
+        if (fScrolledComposite.getHorizontalBar() != null) {\r
+            areaHeight -= fScrolledComposite.getHorizontalBar().getSize().y;\r
+        }\r
+        int lineHeight = fStyledText.getLineHeight();\r
+        fNumVisibleLines = Math.max((areaHeight + lineHeight - 1) / lineHeight, 1);\r
+\r
+        if (fBottomContext != null) {\r
+            loadLineData();\r
+            fillTextArea();\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public void controlMoved(ControlEvent e) {\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // SelectionListener (Slider)\r
+    // ------------------------------------------------------------------------\r
+\r
+    @Override\r
+    public void widgetSelected(SelectionEvent e) {\r
+       fTextArea.setFocus();\r
+        if (fLines.size() == 0) {\r
+            return;\r
+        }\r
+        if (e.detail == SWT.DRAG) {\r
+            return;\r
+        }\r
+        fHoldSelection++;\r
+        switch (e.detail) {\r
+            case SWT.NONE: {\r
+                //long rank = (long) (fTrace.getNbEvents() * ((double) fSlider.getSelection() / SLIDER_MAX));\r
+                //setTopRank(rank);\r
+               if (fSlider.getSelection() == 0 || fSlider.getThumb() == SLIDER_MAX) {\r
+                    fLines.clear();\r
+                    setTopPosition(0.0);\r
+                    break;\r
+               }\r
+                double ratio = (double) fSlider.getSelection() / (SLIDER_MAX - fSlider.getThumb());\r
+                double delta = Math.pow(10, -15);\r
+                fLines.clear();\r
+                while (fLines.size() == 0) {\r
+                    setTopPosition(ratio);\r
+                    if (ratio == 0.0) {\r
+                        break;\r
+                    }\r
+                    delta = Math.min(delta * 10, 0.1);\r
+                    ratio = Math.max(ratio - delta, 0.0);\r
+                }\r
+                break;\r
+            }\r
+            case SWT.ARROW_DOWN: {\r
+                if (fTopLineIndex >= fLines.size()) {\r
+                    break;\r
+                }\r
+                fTopLineIndex++;\r
+                loadLineData();\r
+                updateTextArea();\r
+                break;\r
+            }\r
+            case SWT.PAGE_DOWN: {\r
+                fTopLineIndex += Math.max(fNumVisibleLines - 1, 1);\r
+                loadLineData();\r
+                updateTextArea();\r
+                break;\r
+            }\r
+            case SWT.ARROW_UP: {\r
+                //if (fLines.size() == 0 || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {\r
+                if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {\r
+                    break;\r
+                }\r
+                fTopLineIndex--;\r
+                loadLineData();\r
+                updateTextArea();\r
+                break;\r
+            }\r
+            case SWT.PAGE_UP: {\r
+                fTopLineIndex -= Math.max(fNumVisibleLines - 1, 1);\r
+                loadLineData();\r
+                updateTextArea();\r
+                break;\r
+            }\r
+            case SWT.HOME: {\r
+                //selectAndReveal(0);\r
+                setTopPosition(0.0);\r
+                break;\r
+            }\r
+            case SWT.END: {\r
+                //if (fTrace.getNbEvents() > 0) {\r
+                    //selectAndReveal(fTrace.getNbEvents() - 1);\r
+                //}\r
+                double ratio = 1.0;\r
+                double delta = Math.pow(10, -15);\r
+                fLines.clear();\r
+                while (fLines.size() == 0) {\r
+                    setTopPosition(ratio);\r
+                    if (ratio == 0.0) {\r
+                        break;\r
+                    }\r
+                    delta = Math.min(delta * 10, 0.1);\r
+                    ratio = Math.max(ratio - delta, 0.0);\r
+                }\r
+                break;\r
+            }\r
+            default:\r
+                break;\r
+        }\r
+        //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));\r
+        if (e.detail != SWT.NONE) {\r
+            fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));\r
+        }\r
+\r
+        fHoldSelection = 0;\r
+    }\r
+\r
+    @Override\r
+    public void widgetDefaultSelected(SelectionEvent e) {\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // KeyListener (StyledText)\r
+    // ------------------------------------------------------------------------\r
+\r
+    @Override\r
+    public void keyPressed(KeyEvent e) {\r
+        if (fLines.size() == 0) {\r
+            return;\r
+        }\r
+        int caretOffset = fStyledText.getCaretOffset();\r
+        int previousCaretOffset = getPreviousCaretOffset(e.time);\r
+        int previousLineAtCaretPosition = fStyledText.getLineAtOffset(previousCaretOffset);\r
+        int previousColumnAtCaretPosition = getPreviousCaretOffset(e.time) - fStyledText.getOffsetAtLine(previousLineAtCaretPosition);\r
+        switch (e.keyCode) {\r
+            case SWT.ARROW_DOWN: {\r
+                if (previousLineAtCaretPosition < (fNumVisibleLines - 2)) {\r
+                    break;\r
+                }\r
+                fHoldSelection++;\r
+                fTopLineIndex++;\r
+                loadLineData();\r
+                updateTextArea();\r
+                fHoldSelection--;\r
+                LineData lineData = fLines.get(fTopLineIndex + fStyledText.getLineAtOffset(fStyledText.getCaretOffset()));\r
+                if (!lineData.location.equals(fSelectedLocation)) {\r
+                    fSelectedLocation = lineData.location;\r
+                    refreshLineBackgrounds();\r
+                    sendSelectionEvent(lineData);\r
+                }\r
+                break;\r
+            }\r
+            case SWT.PAGE_DOWN: {\r
+                if (previousLineAtCaretPosition >= (fNumVisibleLines - 1)) {\r
+                    fHoldSelection++;\r
+                    if (fLines.get(fTopLineIndex + previousLineAtCaretPosition).rank % 2 == 0) {\r
+                        fStyledText.setLineBackground(previousLineAtCaretPosition, 1, COLOR_BACKGROUND_EVEN);\r
+                    } else {\r
+                        fStyledText.setLineBackground(previousLineAtCaretPosition, 1, COLOR_BACKGROUND_ODD);\r
+                    }\r
+                    fSelectedLocation = null;\r
+                    fTopLineIndex += Math.max(fNumVisibleLines - 1, 1);\r
+                    loadLineData();\r
+                    updateTextArea();\r
+                    fHoldSelection--;\r
+                }\r
+                int line = Math.min(fNumVisibleLines - 1, fStyledText.getLineCount() - 1);\r
+                int offset = fStyledText.getOffsetAtLine(line);\r
+                fStyledText.setSelection(offset + Math.min(previousColumnAtCaretPosition, fLines.get(fTopLineIndex + line).string.length()));\r
+                break;\r
+            }\r
+            case SWT.ARROW_RIGHT: {\r
+                if (previousCaretOffset < fStyledText.getCharCount() || previousLineAtCaretPosition < (fNumVisibleLines - 2)) {\r
+                    break;\r
+                }\r
+                fHoldSelection++;\r
+                fTopLineIndex++;\r
+                loadLineData();\r
+                updateTextArea();\r
+                fHoldSelection--;\r
+                fStyledText.setSelection(fStyledText.getCaretOffset() + 1);\r
+                break;\r
+            }\r
+            case SWT.ARROW_UP: {\r
+                if (previousLineAtCaretPosition > 0) {\r
+                    break;\r
+                }\r
+                if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {\r
+                    break;\r
+                }\r
+                fHoldSelection++;\r
+                fTopLineIndex--;\r
+                loadLineData();\r
+                updateTextArea();\r
+                fHoldSelection--;\r
+                LineData lineData = fLines.get(fTopLineIndex);\r
+                if (!lineData.location.equals(fSelectedLocation)) {\r
+                    fSelectedLocation = lineData.location;\r
+                    refreshLineBackgrounds();\r
+                    sendSelectionEvent(lineData);\r
+                }\r
+                fStyledText.setSelection(caretOffset);\r
+                break;\r
+            }\r
+            case SWT.PAGE_UP: {\r
+                if (previousLineAtCaretPosition > 0) {\r
+                    break;\r
+                }\r
+                fHoldSelection++;\r
+                fTopLineIndex -= Math.max(fNumVisibleLines - 1, 1);\r
+                loadLineData();\r
+                updateTextArea();\r
+                fHoldSelection--;\r
+                LineData lineData = fLines.get(fTopLineIndex);\r
+                if (!lineData.location.equals(fSelectedLocation)) {\r
+                    fSelectedLocation = lineData.location;\r
+                    refreshLineBackgrounds();\r
+                    sendSelectionEvent(lineData);\r
+                }\r
+                fStyledText.setSelection(caretOffset);\r
+                break;\r
+            }\r
+            case SWT.ARROW_LEFT: {\r
+                if (previousCaretOffset > 0) {\r
+                    break;\r
+                }\r
+                if (fLines.size() == 0) {// || (fTopLineIndex == 0 && fLines.get(0).rank == 0)) {\r
+                    break;\r
+                }\r
+                long topRank = fLines.get(fTopLineIndex).rank;\r
+                fHoldSelection++;\r
+                fTopLineIndex--;\r
+                loadLineData();\r
+                updateTextArea();\r
+                fHoldSelection--;\r
+                LineData lineData = fLines.get(fTopLineIndex);\r
+                if (!lineData.location.equals(fSelectedLocation)) {\r
+                    fSelectedLocation = lineData.location;\r
+                    refreshLineBackgrounds();\r
+                    sendSelectionEvent(lineData);\r
+                }\r
+                if (topRank != fLines.get(fTopLineIndex).rank) {\r
+                    fStyledText.setSelection(fLines.get(fTopLineIndex).string.length());\r
+                }\r
+                break;\r
+            }\r
+            case SWT.HOME: {\r
+                if ((e.stateMask & SWT.CTRL) == 0) {\r
+                    break;\r
+                }\r
+                //selectAndReveal(0);\r
+                setTopPosition(0.0);\r
+                LineData lineData = fLines.get(fTopLineIndex);\r
+                if (!lineData.location.equals(fSelectedLocation)) {\r
+                    fSelectedLocation = lineData.location;\r
+                    refreshLineBackgrounds();\r
+                    sendSelectionEvent(lineData);\r
+                }\r
+                break;\r
+            }\r
+            case SWT.END: {\r
+                if ((e.stateMask & SWT.CTRL) == 0) {\r
+                    break;\r
+                }\r
+                //if (fTrace.getNbEvents() > 0) {\r
+                    //selectAndReveal(fTrace.getNbEvents() - 1);\r
+                //}\r
+                double ratio = 1.0;\r
+                double delta = Math.pow(10, -15);\r
+                fLines.clear();\r
+                while (fLines.size() == 0) {\r
+                    setTopPosition(ratio);\r
+                    if (ratio == 0.0) {\r
+                        break;\r
+                    }\r
+                    delta = Math.min(delta * 10, 0.1);\r
+                    ratio = Math.max(ratio - delta, 0.0);\r
+                }\r
+                LineData lineData = fLines.get(fTopLineIndex);\r
+                if (!lineData.location.equals(fSelectedLocation)) {\r
+                    fSelectedLocation = lineData.location;\r
+                    refreshLineBackgrounds();\r
+                    sendSelectionEvent(lineData);\r
+                }\r
+                break;\r
+            }\r
+            default:\r
+                break;\r
+        }\r
+        //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));\r
+        updateHighlightedRank();\r
+        fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));\r
+    }\r
+\r
+    @Override\r
+    public void keyReleased(KeyEvent e) {\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // CaretListener (StyledText)\r
+    // ------------------------------------------------------------------------\r
+\r
+    @Override\r
+    public void caretMoved(CaretEvent event) {\r
+        if (fHoldSelection == 0) {\r
+            int line = fStyledText.getLineAtOffset(event.caretOffset);\r
+            if (fTopLineIndex + line < fLines.size()) {\r
+                LineData lineData = fLines.get(fTopLineIndex + line);\r
+                if (!lineData.location.equals(fSelectedLocation)) {\r
+                    fSelectedLocation = lineData.location;\r
+                    refreshLineBackgrounds();\r
+                    sendSelectionEvent(lineData);\r
+                }\r
+            }\r
+        }\r
+        storeCaretPosition(event.time, event.caretOffset);\r
+        if (fHoldSelection == 0) {\r
+            Point caret = fStyledText.getLocationAtOffset(fStyledText.getCaretOffset());\r
+            Point origin = fScrolledComposite.getOrigin();\r
+            if (origin.x > caret.x) {\r
+                origin.x = caret.x;\r
+            } else if (caret.x - origin.x > fScrolledComposite.getSize().x) {\r
+                origin.x = caret.x - fScrolledComposite.getSize().x + 1;\r
+            }\r
+            fScrolledComposite.setOrigin(origin);\r
+        }\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // MouseMoveListener (StyledText)\r
+    // ------------------------------------------------------------------------\r
+\r
+    @Override\r
+    public void mouseMove(MouseEvent e) {\r
+        fCursorYCoordinate = e.y;\r
+        if (e.y < 0 || e.y > fStyledText.getSize().y) {\r
+            if (fHighlightedRank != Long.MIN_VALUE) {\r
+                fHighlightedRank = Long.MIN_VALUE;\r
+                refreshLineBackgrounds();\r
+            }\r
+            return;\r
+        }\r
+        int offset = fStyledText.getOffsetAtLocation(new Point(0, e.y));\r
+        int line = fStyledText.getLineAtOffset(offset);\r
+        if (line < fLines.size() - fTopLineIndex) {\r
+            LineData lineData = fLines.get(fTopLineIndex + line);\r
+            if (fHighlightedRank != lineData.rank) {\r
+                fHighlightedRank = lineData.rank;\r
+                refreshLineBackgrounds();\r
+            }\r
+        } else {\r
+            if (fHighlightedRank != Long.MIN_VALUE) {\r
+                fHighlightedRank = Long.MIN_VALUE;\r
+                refreshLineBackgrounds();\r
+            }\r
+        }\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // MouseTrackListener (StyledText)\r
+    // ------------------------------------------------------------------------\r
+\r
+    @Override\r
+    public void mouseExit(MouseEvent e) {\r
+        fCursorYCoordinate = -1;\r
+        if (fHighlightedRank != Long.MIN_VALUE) {\r
+            fHighlightedRank = Long.MIN_VALUE;\r
+            refreshLineBackgrounds();\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public void mouseEnter(MouseEvent e) {\r
+        fCursorYCoordinate = e.y;\r
+    }\r
+\r
+    @Override\r
+    public void mouseHover(MouseEvent e) {\r
+    }\r
+\r
+    // ------------------------------------------------------------------------\r
+    // MouseWheelListener (StyledText)\r
+    // ------------------------------------------------------------------------\r
+\r
+    @Override\r
+    public void mouseScrolled(MouseEvent e) {\r
+        if (fLines.size() == 0) {\r
+            return;\r
+        }\r
+        fHoldSelection++;\r
+        fTopLineIndex -= e.count;\r
+        loadLineData();\r
+        updateTextArea();\r
+        fHoldSelection = 0;\r
+        //fSlider.setSelection((int) (SLIDER_MAX * ((double) fLines.get(fTopLineIndex).rank / fTrace.getNbEvents())));\r
+        updateHighlightedRank();\r
+        fSlider.setSelection((int) (SLIDER_MAX * fTrace.getLocationRatio(fLines.get(fTopLineIndex).location)));\r
+    }\r
+\r
+}\r
This page took 0.076752 seconds and 5 git commands to generate.