Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Tasse2013-12-04 13:29:10 -0500
committerPatrick Tasse2013-12-06 09:43:23 -0500
commit4bf37e3782337a831d98a012bdfd88927b31b5f4 (patch)
tree2cc117d28988d7c31e74cf5d1eae96145edc467a
parent6b0dbcc7fc63dcd85b6c964dce8fc452ab4d5a95 (diff)
downloadorg.eclipse.linuxtools-4bf37e3782337a831d98a012bdfd88927b31b5f4.tar.gz
org.eclipse.linuxtools-4bf37e3782337a831d98a012bdfd88927b31b5f4.tar.xz
org.eclipse.linuxtools-4bf37e3782337a831d98a012bdfd88927b31b5f4.zip
tmf: Fix mouse actions disabled when no visible events in histogram
Change conditions from zero events to empty time window to detect unused histogram and disable mouse actions. Also removes some unnecessary checks. Change-Id: I761473005d6b004101741c535e8ec98a2bc0870f Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com> Reviewed-on: https://git.eclipse.org/r/19324 Tested-by: Hudson CI Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java12
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java2
3 files changed, 6 insertions, 10 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java
index ebb16cba99..9fa0bf4a73 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java
@@ -108,7 +108,7 @@ public class FullTraceHistogram extends Histogram {
@Override
public void mouseDown(MouseEvent event) {
- if (fScaledData != null && fDragState == DRAG_NONE && fDataModel.getNbEvents() != 0) {
+ if (fScaledData != null && fDragState == DRAG_NONE && fDataModel.getStartTime() < fDataModel.getEndTime()) {
if (event.button == 2 || (event.button == 1 && (event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL)) {
fDragState = DRAG_RANGE;
fDragButton = event.button;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
index b2882d7ea1..41611e8177 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
@@ -629,7 +629,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
* Update the range text controls
*/
private void updateRangeTextControls() {
- if (fDataModel != null && fDataModel.getStartTime() < fDataModel.getEndTime()) {
+ if (fDataModel.getStartTime() < fDataModel.getEndTime()) {
fTimeRangeStartText.setText(TmfTimestampFormat.getDefaulTimeFormat().format(fDataModel.getStartTime()));
fTimeRangeEndText.setText(TmfTimestampFormat.getDefaulTimeFormat().format(fDataModel.getEndTime()));
} else {
@@ -838,7 +838,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
@Override
public void mouseDown(final MouseEvent event) {
- if (fScaledData != null && event.button == 1 && fDragState == DRAG_NONE && fDataModel.getNbEvents() != 0) {
+ if (fScaledData != null && event.button == 1 && fDragState == DRAG_NONE && fDataModel.getStartTime() < fDataModel.getEndTime()) {
fDragState = DRAG_SELECTION;
fDragButton = event.button;
if ((event.stateMask & SWT.MODIFIER_MASK) == SWT.SHIFT) {
@@ -876,7 +876,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
*/
@Override
public void mouseMove(MouseEvent event) {
- if (fDragState == DRAG_SELECTION && fDataModel.getNbEvents() > 0) {
+ if (fDragState == DRAG_SELECTION && fDataModel.getStartTime() < fDataModel.getEndTime()) {
fSelectionEnd = Math.max(getStartTime(), Math.min(getEndTime(), getTimestamp(event.x)));
fScaledData.fSelectionEndBucket = (int) ((fSelectionEnd - fScaledData.fFirstBucketTime) / fScaledData.fBucketDuration);
fCanvas.redraw();
@@ -897,7 +897,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
@Override
public void mouseHover(final MouseEvent event) {
- if (fDataModel.getNbEvents() > 0 && fScaledData != null) {
+ if (fDataModel.getStartTime() < fDataModel.getEndTime() && fScaledData != null) {
int delimiterIndex = (int) ((fDataModel.getEndTime() - fScaledData.getFirstBucketTime()) / fScaledData.fBucketDuration) + 1;
if (event.x < delimiterIndex) {
final String tooltip = formatToolTipLabel(event.x - fOffset);
@@ -965,10 +965,6 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
*/
@TmfSignalHandler
public void timestampFormatUpdated(TmfTimestampFormatUpdateSignal signal) {
- if (fDataModel.getNbEvents() == 0) {
- return;
- }
-
updateRangeTextControls();
fComposite.layout();
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java
index 04b99e932e..d86862048a 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/TimeRangeHistogram.java
@@ -114,7 +114,7 @@ public class TimeRangeHistogram extends Histogram {
@Override
public void mouseDown(MouseEvent event) {
- if (fScaledData != null && fDragState == DRAG_NONE && fDataModel.getNbEvents() != 0) {
+ if (fScaledData != null && fDragState == DRAG_NONE && fDataModel.getStartTime() < fDataModel.getEndTime()) {
if (event.button == 2 || (event.button == 1 && (event.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL)) {
fDragState = DRAG_RANGE;
fDragButton = event.button;

Back to the top