import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.logging.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.ui.signal.TmfTimeViewAlignmentInfo;
/* The desired number of points per pixel */
private static final double RESOLUTION = 1.0;
+ private static final Logger LOGGER = TraceCompassLog.getLogger(TmfCommonXLineChartViewer.class);
+ private static final String LOG_STRING_WITH_PARAM = "[TmfCommonXLineChart:%s] viewerId=%s, %s"; //$NON-NLS-1$
+ private static final String LOG_STRING = "[TmfCommonXLineChart:%s] viewerId=%s"; //$NON-NLS-1$
private static final int[] LINE_COLORS = { SWT.COLOR_BLUE, SWT.COLOR_RED, SWT.COLOR_GREEN,
SWT.COLOR_MAGENTA, SWT.COLOR_CYAN,
reinitialize();
}
+ /**
+ * Formats a log message for this class
+ *
+ * @param event
+ * The event to log, that will be appended to the class name to
+ * make the full event name
+ * @param parameters
+ * The string of extra parameters to add to the log message, in
+ * the format name=value[, name=value]*, or <code>null</code> for
+ * no params
+ * @return The complete log message for this class
+ */
+ private String getLogMessage(String event, @Nullable String parameters) {
+ if (parameters == null) {
+ return String.format(LOG_STRING, event, getClass().getName());
+ }
+ return String.format(LOG_STRING_WITH_PARAM, event, getClass().getName(), parameters);
+ }
+
/**
* Forces a reinitialization of the data sources, even if it has already
* been initialized for this trace before
// Don't use TmfUiRefreshHandler (bug 467751)
@Override
public void run() {
+ LOGGER.info(() -> getLogMessage("InitializeThreadStart", "tid=" + getId())); //$NON-NLS-1$ //$NON-NLS-2$
initializeDataSource();
if (!getSwtChart().isDisposed()) {
getDisplay().asyncExec(new Runnable() {
}
});
}
+ LOGGER.info(() -> getLogMessage("InitializeThreadEnd", "tid=" + getId())); //$NON-NLS-1$ //$NON-NLS-2$
}
};
thread.start();
@Override
public void run() {
+ LOGGER.info(() -> getLogMessage("UpdateThreadStart", "numRequests=" + fNumRequests + ", tid=" + getId())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
+ LOGGER.info(() -> getLogMessage("UpdateDataStart", "tid=" + getId())); //$NON-NLS-1$ //$NON-NLS-2$
updateData(getWindowStartTime(), getWindowEndTime(), fNumRequests, fMonitor);
+ LOGGER.info(() -> getLogMessage("UpdateDataEnd", "tid=" + getId())); //$NON-NLS-1$ //$NON-NLS-2$
}
});
updateThreadFinished(this);
+ LOGGER.info(() -> getLogMessage("UpdateThreadEnd", "tid=" + getId())); //$NON-NLS-1$ //$NON-NLS-2$
}
public void cancel() {
+ LOGGER.info(() -> getLogMessage("UpdateThreadCanceled", "tid=" + getId())); //$NON-NLS-1$ //$NON-NLS-2$
fMonitor.setCanceled(true);
}
}
* The array of values for the series
*/
protected void setSeries(String seriesName, double[] seriesValues) {
- if (fXValues.length > seriesValues.length) {
- throw new IllegalStateException();
+ if (fXValues.length != seriesValues.length) {
+ throw new IllegalStateException("All series in list must be of length : " + fXValues.length); //$NON-NLS-1$
}
fSeriesValues.put(seriesName, seriesValues);
}
IAxisTick xTick = getSwtChart().getAxisSet().getXAxis(0).getTick();
xTick.setFormat(tmfChartTimeStampFormat);
- final double start = xValues[0];
- int lastX = xValues.length - 1;
- double end = (start == xValues[lastX]) ? start + 1 : xValues[lastX];
+ final double start = 0.0;
+ double end = getWindowEndTime() - getWindowStartTime();
getSwtChart().getAxisSet().getXAxis(0).setRange(new Range(start, end));
if (maxy > miny) {
getSwtChart().getAxisSet().getYAxis(0).setRange(new Range(miny, maxy));