/*******************************************************************************
 * Copyright (c) 2009, 2014 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:
 *   Francois Chouinard - Initial API and implementation
 *   Patrick Tasse - Deprecate current time
 *******************************************************************************/

package org.eclipse.tracecompass.tmf.core.signal;

import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;

/**
 * A new range has been selected for the visible (zoom) time range.
 *
 * To update the selection range instead, use
 * {@link TmfSelectionRangeUpdatedSignal}.
 *
 * @author Francois Chouinard
 */
public class TmfWindowRangeUpdatedSignal extends TmfSignal {

    private final TmfTimeRange fCurrentRange;
    private final boolean fEcho;

    /**
     * Constructor
     *
     * @param source
     *            Object sending this signal
     * @param range
     *            The new time range
     */
    public TmfWindowRangeUpdatedSignal(Object source, TmfTimeRange range) {
        this(source, range, false);
    }

    public TmfWindowRangeUpdatedSignal(Object source, TmfTimeRange range, boolean echo) {
        super(source);
        fCurrentRange = range;
        fEcho = echo;
    }

    /**
     * @return This signal's time range
     */
    public TmfTimeRange getCurrentRange() {
        return fCurrentRange;
    }

    public boolean echo() {
        return fEcho;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder(getClass().getSimpleName());
        sb.append(" [source="); //$NON-NLS-1$

        if (getSource() != null) {
            sb.append(getSource().toString());
        } else {
            sb.append("null"); //$NON-NLS-1$
        }

        sb.append(", range="); //$NON-NLS-1$

        if (fCurrentRange != null) {
            sb.append(fCurrentRange.toString());
        } else {
            sb.append("null"); //$NON-NLS-1$
        }
        sb.append(']');
        return sb.toString();
    }
}

@@ -681,16 +681,60 @@
 Range;%0A%0A
+import com.google.common.base.MoreObjects;%0A%0A
 /**%0A * A
@@ -1344,32 +1344,405 @@
  false);%0A    %7D%0A%0A
+    /**%0A     * Constructor%0A     *%0A     * @param source%0A     *            Object sending this signal%0A     * @param range%0A     *            The new time range%0A     * @param echo%0A     *            The echo flag. Can checked by recipients to determine if they%0A     *            should process this signal or not, even though they might be%0A     *            the source.%0A     */%0A
     public TmfWi
@@ -2031,24 +2031,65 @@
 nge;%0A    %7D%0A%0A
+    /**%0A     * @return Echo flag%0A     */%0A
     public b
@@ -2190,264 +2190,47 @@
     
-StringBuilder sb = new StringBuilder(getClass().getSimpleName());%0A        sb.append(%22 %5Bsource=%22); //$NON-NLS-1$%0A%0A        if (getSource() != null) %7B%0A            sb.append(getSource().toString());%0A        %7D else %7B%0A            sb.append(%22null%22); //$NON-NLS-1$
+return MoreObjects.toStringHelper(this)
 %0A   
@@ -2238,190 +2238,90 @@
     
-%7D%0A%0A
     
-    sb.append(%22, range=%22); //$NON-NLS-1$%0A%0A        if (fCurrentRange != null) %7B%0A            sb.append(fCurrentRange.toString());%0A        %7D else %7B%0A            sb.append(%22null%22);
+.add(%22timerange%22, fCurrentRange) //$NON-NLS-1$%0A            .add(%22echo%22, fEcho)
  //$
@@ -2343,51 +2343,12 @@
     
-%7D%0A
     
-    sb.append('%5D');%0A        return sb
 .toS

Document and add to toString() the signal "echo" flag