tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / TimeCompressionBar.java
CommitLineData
73005152 1/**********************************************************************
c8422608 2 * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
73005152
BH
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
013a5f1c
AM
7 *
8 * Contributors:
c8422608
AM
9 * IBM - Initial API and implementation
10 * Bernd Hufmann - Updated for TMF
73005152 11 **********************************************************************/
c8422608 12
73005152
BH
13package org.eclipse.linuxtools.tmf.ui.views.uml2sd;
14
15import java.util.ArrayList;
16import java.util.Arrays;
17import java.util.List;
18
8fd82db5 19import org.eclipse.linuxtools.internal.tmf.ui.Activator;
3bd46eef
AM
20import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
21import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
73005152
BH
22import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessage;
23import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.AsyncMessageReturn;
24import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.BaseMessage;
25import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ExecutionOccurrence;
26import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Frame;
27import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode;
28import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.ITimeRange;
29import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Lifeline;
30import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.Metrics;
31import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SDTimeEvent;
32import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SyncMessage;
33import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor;
34import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.impl.ColorImpl;
35import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
36import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.TimeEventComparator;
37import org.eclipse.swt.SWT;
38import org.eclipse.swt.accessibility.ACC;
39import org.eclipse.swt.accessibility.Accessible;
40import org.eclipse.swt.accessibility.AccessibleAdapter;
41import org.eclipse.swt.accessibility.AccessibleControlAdapter;
42import org.eclipse.swt.accessibility.AccessibleControlEvent;
43import org.eclipse.swt.accessibility.AccessibleEvent;
44import org.eclipse.swt.events.DisposeEvent;
45import org.eclipse.swt.events.DisposeListener;
46import org.eclipse.swt.events.FocusEvent;
47import org.eclipse.swt.events.FocusListener;
48import org.eclipse.swt.events.KeyEvent;
49import org.eclipse.swt.events.MouseEvent;
50import org.eclipse.swt.events.TraverseEvent;
51import org.eclipse.swt.events.TraverseListener;
52import org.eclipse.swt.graphics.Color;
53import org.eclipse.swt.graphics.GC;
54import org.eclipse.swt.graphics.Image;
55import org.eclipse.swt.widgets.Composite;
56import org.eclipse.swt.widgets.Control;
57import org.eclipse.swt.widgets.Display;
58
59/**
df0b8ff4
BH
60 * <p>
61 * The time compression bar implementation.
62 * </p>
013a5f1c 63 *
df0b8ff4 64 * @version 1.0
73005152 65 * @author sveyrier
73005152
BH
66 */
67public class TimeCompressionBar extends ScrollView implements DisposeListener {
68
df0b8ff4
BH
69 // ------------------------------------------------------------------------
70 // Attributes
71 // ------------------------------------------------------------------------
72
73005152
BH
73 /**
74 * The listener list
75 */
eb63f5ff 76 protected List<ITimeCompressionListener> fListenerList = null;
df0b8ff4
BH
77 /**
78 * The current frame displayed.
79 */
eb63f5ff 80 protected Frame fFrame = null;
df0b8ff4
BH
81 /**
82 * List of time events.
83 */
eb63f5ff 84 protected List<SDTimeEvent> fNodeList = null;
df0b8ff4
BH
85 /**
86 * The minimum time delta.
87 */
eb63f5ff 88 protected ITmfTimestamp fMinTime = new TmfTimestamp();
df0b8ff4
BH
89 /**
90 * The maximum time delta.
91 */
eb63f5ff 92 protected ITmfTimestamp fMaxTime = new TmfTimestamp();
df0b8ff4
BH
93 /**
94 * The current zoom value.
95 */
eb63f5ff 96 protected float fZoomValue = 1;
df0b8ff4
BH
97 /**
98 * The tooltip to display.
99 */
eb63f5ff 100 protected DrawableToolTip fTooltip = null;
df0b8ff4 101 /**
013a5f1c 102 * Array of colors for displaying wight of time deltas.
df0b8ff4 103 */
eb63f5ff 104 protected ColorImpl[] fColors;
df0b8ff4
BH
105 /**
106 * The accessible object reference.
107 */
eb63f5ff 108 protected Accessible fAccessible = null;
df0b8ff4
BH
109 /**
110 * The focused widget reference.
111 */
eb63f5ff 112 protected int fFocusedWidget = -1;
df0b8ff4 113 /**
013a5f1c 114 * The sequence diagram view reference.
df0b8ff4 115 */
73005152 116 protected SDView view = null;
df0b8ff4
BH
117 /**
118 * The current lifeline.
119 */
eb63f5ff 120 protected Lifeline fLifeline = null;
df0b8ff4
BH
121 /**
122 * The current start event value.
123 */
eb63f5ff 124 protected int fLifelineStart = 0;
df0b8ff4
BH
125 /**
126 * The current number of events.
127 */
eb63f5ff 128 protected int fLifelineNumEvents = 0;
df0b8ff4 129 /**
013a5f1c 130 * The Current color of range to display.
df0b8ff4 131 */
eb63f5ff 132 protected IColor fLifelineColor = null;
df0b8ff4 133 /**
013a5f1c 134 * The next graph node y coordinate.
df0b8ff4 135 */
eb63f5ff 136 protected int fNextNodeY = 0;
df0b8ff4 137 /**
013a5f1c 138 * The previous graph node y coordinate.
df0b8ff4 139 */
eb63f5ff 140 protected int fPrevNodeY = 0;
73005152 141
df0b8ff4
BH
142 // ------------------------------------------------------------------------
143 // Constructors
144 // ------------------------------------------------------------------------
145 /**
146 * Standard constructor
013a5f1c 147 *
df0b8ff4
BH
148 * @param parent The parent composite
149 * @param s The style bits
150 */
73005152
BH
151 public TimeCompressionBar(Composite parent, int s) {
152 super(parent, s | SWT.NO_BACKGROUND, false);
153 setVScrollBarMode(ScrollView.ALWAYS_OFF);
154 setHScrollBarMode(ScrollView.ALWAYS_OFF);
eb63f5ff
BH
155 fListenerList = new ArrayList<ITimeCompressionListener>();
156 fColors = new ColorImpl[10];
157 fColors[0] = new ColorImpl(Display.getDefault(), 255, 229, 229);
158 fColors[1] = new ColorImpl(Display.getDefault(), 255, 204, 204);
159 fColors[2] = new ColorImpl(Display.getDefault(), 255, 178, 178);
160 fColors[3] = new ColorImpl(Display.getDefault(), 255, 153, 153);
161 fColors[4] = new ColorImpl(Display.getDefault(), 255, 127, 127);
162 fColors[5] = new ColorImpl(Display.getDefault(), 255, 102, 102);
163 fColors[6] = new ColorImpl(Display.getDefault(), 255, 76, 76);
164 fColors[7] = new ColorImpl(Display.getDefault(), 255, 51, 51);
165 fColors[8] = new ColorImpl(Display.getDefault(), 255, 25, 25);
166 fColors[9] = new ColorImpl(Display.getDefault(), 255, 0, 0);
73005152
BH
167 super.addDisposeListener(this);
168
eb63f5ff 169 fAccessible = getViewControl().getAccessible();
73005152 170
eb63f5ff 171 fAccessible.addAccessibleListener(new AccessibleAdapter() {
73005152
BH
172 @Override
173 public void getName(AccessibleEvent e) {
73005152 174 // Case toolTip
eb63f5ff
BH
175 if (e.childID == 0) {
176 if (fTooltip != null) {
177 e.result = fTooltip.getAccessibleText();
df0b8ff4 178 }
73005152
BH
179 } else if (e.childID == 1) {
180 createFakeTooltip();
eb63f5ff 181 e.result = fTooltip.getAccessibleText();
73005152
BH
182 }
183 }
184 });
185
eb63f5ff 186 fAccessible.addAccessibleControlListener(new AccessibleControlAdapter() {
73005152
BH
187 @Override
188 public void getFocus(AccessibleControlEvent e) {
eb63f5ff 189 if (fFocusedWidget == -1) {
73005152 190 e.childID = ACC.CHILDID_SELF;
df0b8ff4
BH
191 }
192 else {
eb63f5ff 193 e.childID = fFocusedWidget;
df0b8ff4 194 }
73005152
BH
195 }
196
197 @Override
198 public void getRole(AccessibleControlEvent e) {
199 switch (e.childID) {
200 case ACC.CHILDID_SELF:
201 e.detail = ACC.ROLE_CLIENT_AREA;
202 break;
203 case 0:
204 e.detail = ACC.ROLE_TOOLTIP;
205 break;
206 case 1:
207 e.detail = ACC.ROLE_LABEL;
208 break;
eb63f5ff
BH
209 default:
210 break;
73005152
BH
211 }
212 }
213
214 @Override
215 public void getState(AccessibleControlEvent e) {
216 e.detail = ACC.STATE_FOCUSABLE;
217 if (e.childID == ACC.CHILDID_SELF) {
218 e.detail |= ACC.STATE_FOCUSED;
219 } else {
220 e.detail |= ACC.STATE_SELECTABLE;
eb63f5ff 221 if (e.childID == fFocusedWidget) {
73005152 222 e.detail |= ACC.STATE_FOCUSED | ACC.STATE_SELECTED | ACC.STATE_CHECKED;
df0b8ff4 223 }
73005152
BH
224 }
225 }
226 });
227
3145ec83 228 getViewControl().addTraverseListener(new LocalTraverseListener());
73005152 229
3145ec83 230 addTraverseListener(new LocalTraverseListener());
73005152
BH
231
232 getViewControl().addFocusListener(new FocusListener() {
73005152
BH
233 @Override
234 public void focusGained(FocusEvent e) {
73005152
BH
235 redraw();
236 }
237
238 @Override
239 public void focusLost(FocusEvent e) {
240 redraw();
241 }
242 });
243 }
244
df0b8ff4
BH
245 // ------------------------------------------------------------------------
246 // Methods
247 // ------------------------------------------------------------------------
248
249 /**
250 * Sets the focus widget
013a5f1c 251 *
df0b8ff4
BH
252 * @param newFocusShape widget reference to set
253 */
73005152 254 void setFocus(int newFocusShape) {
eb63f5ff
BH
255 fFocusedWidget = newFocusShape;
256 if (fFocusedWidget == -1) {
73005152
BH
257 getViewControl().getAccessible().setFocus(ACC.CHILDID_SELF);
258 } else {
eb63f5ff 259 getViewControl().getAccessible().setFocus(fFocusedWidget);
73005152
BH
260 }
261 }
262
df0b8ff4
BH
263 /**
264 * Sets the current frame.
013a5f1c 265 *
df0b8ff4
BH
266 * @param theFrame The frame to set
267 */
73005152 268 public void setFrame(Frame theFrame) {
eb63f5ff
BH
269 fFrame = theFrame;
270 fMinTime = fFrame.getMinTime();
271 fMaxTime = fFrame.getMaxTime();
73005152
BH
272 }
273
274 @Override
275 protected void drawContents(GC gc, int clipx, int clipy, int clipw, int cliph) {
eb63f5ff 276 if (fFrame == null) {
73005152 277 return;
df0b8ff4 278 }
eb63f5ff 279 fNodeList = new ArrayList<SDTimeEvent>();
73005152
BH
280 int messageArraysStep = 1;
281
eb63f5ff
BH
282 if ((Metrics.getMessageFontHeigth() + Metrics.MESSAGES_NAME_SPACING * 2) * fZoomValue < Metrics.MESSAGE_SIGNIFICANT_VSPACING + 1) {
283 messageArraysStep = Math.round(Metrics.MESSAGE_SIGNIFICANT_VSPACING + 1 / ((Metrics.getMessageFontHeigth() + Metrics.MESSAGES_NAME_SPACING * 2) * fZoomValue));
df0b8ff4 284 }
73005152 285
eb63f5ff 286 int firstVisible = fFrame.getFirstVisibleSyncMessage();
df0b8ff4 287 if (firstVisible > 0) {
73005152 288 firstVisible = firstVisible - 1;
df0b8ff4 289 }
eb63f5ff
BH
290 for (int i = firstVisible; i < fFrame.syncMessageCount(); i = i + messageArraysStep) {
291 SyncMessage m = fFrame.getSyncMessage(i);
73005152 292 if (m.hasTimeInfo()) {
abbdd66a 293 SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getEventOccurrence(), m);
eb63f5ff
BH
294 fNodeList.add(t);
295 if (m.getY() * fZoomValue > getContentsY() + getVisibleHeight()) {
73005152 296 break;
df0b8ff4 297 }
73005152
BH
298 }
299 }
300
eb63f5ff 301 firstVisible = fFrame.getFirstVisibleSyncMessageReturn();
df0b8ff4 302 if (firstVisible > 0) {
73005152 303 firstVisible = firstVisible - 1;
df0b8ff4 304 }
eb63f5ff
BH
305 for (int i = firstVisible; i < fFrame.syncMessageReturnCount(); i = i + messageArraysStep) {
306 SyncMessage m = fFrame.getSyncMessageReturn(i);
73005152 307 if (m.hasTimeInfo()) {
abbdd66a 308 SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getEventOccurrence(), m);
eb63f5ff
BH
309 fNodeList.add(t);
310 if (m.getY() * fZoomValue > getContentsY() + getVisibleHeight()) {
73005152 311 break;
df0b8ff4 312 }
73005152
BH
313 }
314 }
315
eb63f5ff 316 firstVisible = fFrame.getFirstVisibleAsyncMessage();
df0b8ff4 317 if (firstVisible > 0) {
73005152 318 firstVisible = firstVisible - 1;
df0b8ff4 319 }
eb63f5ff
BH
320 for (int i = firstVisible; i < fFrame.asyncMessageCount(); i = i + messageArraysStep) {
321 AsyncMessage m = fFrame.getAsyncMessage(i);
73005152 322 if (m.hasTimeInfo()) {
abbdd66a 323 SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getStartOccurrence(), m);
eb63f5ff 324 fNodeList.add(t);
abbdd66a 325 t = new SDTimeEvent(m.getEndTime(), m.getEndOccurrence(), m);
eb63f5ff
BH
326 fNodeList.add(t);
327 if (m.getY() * fZoomValue > getContentsY() + getVisibleHeight()) {
73005152 328 break;
df0b8ff4 329 }
73005152
BH
330 }
331 }
332
eb63f5ff 333 firstVisible = fFrame.getFirstVisibleAsyncMessageReturn();
df0b8ff4 334 if (firstVisible > 0) {
73005152 335 firstVisible = firstVisible - 1;
df0b8ff4 336 }
eb63f5ff
BH
337 for (int i = firstVisible; i < fFrame.asyncMessageReturnCount(); i = i + messageArraysStep) {
338 AsyncMessageReturn m = fFrame.getAsyncMessageReturn(i);
73005152 339 if (m.hasTimeInfo()) {
abbdd66a 340 SDTimeEvent t = new SDTimeEvent(m.getStartTime(), m.getStartOccurrence(), m);
eb63f5ff 341 fNodeList.add(t);
abbdd66a 342 t = new SDTimeEvent(m.getEndTime(), m.getEndOccurrence(), m);
eb63f5ff
BH
343 fNodeList.add(t);
344 if (m.getY() * fZoomValue > getContentsY() + getVisibleHeight()) {
73005152 345 break;
df0b8ff4 346 }
73005152
BH
347 }
348 }
349
eb63f5ff 350 List<SDTimeEvent> executionOccurrencesWithTime = fFrame.getExecutionOccurrencesWithTime();
73005152 351 if (executionOccurrencesWithTime != null) {
eb63f5ff 352 fNodeList.addAll(executionOccurrencesWithTime);
73005152
BH
353 }
354
eb63f5ff 355 SDTimeEvent[] temp = fNodeList.toArray(new SDTimeEvent[fNodeList.size()]);
73005152 356 Arrays.sort(temp, new TimeEventComparator());
eb63f5ff 357 fNodeList = Arrays.asList(temp);
73005152
BH
358
359 Image dbuffer = null;
360 GC gcim = null;
361 try {
362 dbuffer = new Image(getDisplay(), getClientArea().width, getClientArea().height);
363 } catch (Exception e) {
8fd82db5 364 Activator.getDefault().logError("Error creating image", e); //$NON-NLS-1$
73005152
BH
365 }
366 gcim = new GC(dbuffer);
eb63f5ff 367 for (int i = 0; i < fNodeList.size() - 1; i++) {
abbdd66a
AM
368 SDTimeEvent m1 = fNodeList.get(i);
369 SDTimeEvent m2 = fNodeList.get(i + 1);
eb63f5ff
BH
370
371 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
372 BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
373 BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
374 if ((mes2.getStartLifeline() == null) || (mes1.getEndLifeline() == null)) {
375 continue;
73005152
BH
376 }
377 }
378
eb63f5ff
BH
379 fMinTime = fFrame.getMinTime();
380 fMaxTime = fFrame.getMaxTime();
381 ITmfTimestamp minMaxdelta = fMaxTime.getDelta(fMinTime);
73005152
BH
382 double gr = (minMaxdelta.getValue()) / (double) 10;
383
eb63f5ff 384 ITmfTimestamp delta = m2.getTime().getDelta(m1.getTime()).getDelta(fMinTime);
73005152 385 long absDelta = Math.abs(delta.getValue());
013a5f1c 386
73005152
BH
387 ColorImpl color;
388 if (gr != 0) {
389 int colIndex = Math.round((float) (absDelta / gr));
eb63f5ff
BH
390 if (colIndex < fColors.length && colIndex > 0) {
391 color = fColors[colIndex - 1];
df0b8ff4 392 } else if (colIndex <= 0) {
eb63f5ff 393 color = fColors[0];
df0b8ff4 394 } else {
eb63f5ff 395 color = fColors[fColors.length - 1];
df0b8ff4
BH
396 }
397 } else {
eb63f5ff 398 color = fColors[0];
df0b8ff4 399 }
73005152 400
df0b8ff4 401 if (color.getColor() instanceof Color) {
73005152 402 gcim.setBackground((Color) color.getColor());
df0b8ff4 403 }
73005152
BH
404 int y1 = ((GraphNode) m1.getGraphNode()).getY();
405 int y2 = ((GraphNode) m2.getGraphNode()).getY();
406 if (m1.getGraphNode() instanceof AsyncMessage) {
407 AsyncMessage as = (AsyncMessage) m1.getGraphNode();
df0b8ff4 408 if (as.getEndTime() == m1.getTime()) {
73005152 409 y1 += as.getHeight();
df0b8ff4 410 }
73005152
BH
411 }
412 if (m2.getGraphNode() instanceof AsyncMessage) {
413 AsyncMessage as = (AsyncMessage) m2.getGraphNode();
df0b8ff4 414 if (as.getEndTime() == m2.getTime()) {
73005152 415 y2 += as.getHeight();
df0b8ff4 416 }
73005152
BH
417 }
418 if (m1.getGraphNode() instanceof ExecutionOccurrence) {
419
420 ExecutionOccurrence eo = (ExecutionOccurrence) m1.getGraphNode();
df0b8ff4 421 if (m1.getEvent() == eo.getEndOccurrence()) {
73005152 422 y1 += eo.getHeight();
df0b8ff4 423 }
73005152
BH
424
425 if (m2.getGraphNode() instanceof ExecutionOccurrence) {
426
427 ExecutionOccurrence eo2 = (ExecutionOccurrence) m2.getGraphNode();
df0b8ff4 428 if (m2.getEvent() == eo2.getEndOccurrence()) {
73005152 429 y2 += eo2.getHeight();
df0b8ff4 430 }
73005152
BH
431
432 }
433 }
eb63f5ff 434 gcim.fillRectangle(contentsToViewX(0), contentsToViewY(Math.round(y1 * fZoomValue)), 10, Math.round((y2 - y1) * fZoomValue) + 1);
73005152
BH
435 if (messageArraysStep == 1) {
436 Color backupColor = gcim.getForeground();
437 gcim.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
eb63f5ff 438 gcim.drawRectangle(contentsToViewX(0), contentsToViewY(Math.round(y1 * fZoomValue)), 9, Math.round((y2 - y1) * fZoomValue));
73005152
BH
439 gcim.setForeground(backupColor);
440 }
441 }
442 if (getViewControl().isFocusControl() || isFocusControl()) {
eb63f5ff 443 gcim.drawFocus(contentsToViewX(0), contentsToViewY(Math.round(fPrevNodeY * fZoomValue)), contentsToViewX(10), Math.round((fNextNodeY - fPrevNodeY) * fZoomValue));
73005152
BH
444 }
445 try {
446 gc.drawImage(dbuffer, 0, 0, getClientArea().width, getClientArea().height, 0, 0, getClientArea().width, getClientArea().height);
447 } catch (Exception e) {
8fd82db5 448 Activator.getDefault().logError("Error drawing image", e); //$NON-NLS-1$
73005152
BH
449 }
450 gcim.dispose();
451 if (dbuffer != null) {
452 dbuffer.dispose();
453 }
454 gc.dispose();
455 }
456
df0b8ff4
BH
457 /**
458 * Checks for focus of children.
013a5f1c 459 *
a0a88f65
AM
460 * @param children
461 * Control to check
df0b8ff4
BH
462 * @return true if child is on focus else false
463 */
a0a88f65
AM
464 protected boolean checkFocusOnChilds(Control children) {
465 if (children instanceof Composite) {
466 Control[] child = ((Composite) children).getChildren();
73005152
BH
467 for (int i = 0; i < child.length; i++) {
468 if (child[i].isFocusControl()) {
469 return true;
df0b8ff4 470 }
abbdd66a 471 checkFocusOnChilds(child[i]);
73005152
BH
472 }
473 }
474 return false;
475 }
476
477 @Override
478 public boolean isFocusControl() {
479 Control[] child = getChildren();
480 for (int i = 0; i < child.length; i++) {
481 if (child[i].isFocusControl()) {
482 return true;
df0b8ff4 483 }
abbdd66a 484 checkFocusOnChilds(child[i]);
73005152
BH
485 }
486 return false;
487 }
488
489 @Override
490 protected void contentsMouseMoveEvent(MouseEvent event) {
eb63f5ff
BH
491 if (fTooltip != null) {
492 fTooltip.hideToolTip();
df0b8ff4 493 }
73005152
BH
494 super.contentsMouseMoveEvent(event);
495 if (!isFocusControl() || getViewControl().isFocusControl()) {
496 Control[] child = getParent().getChildren();
497 for (int i = 0; i < child.length; i++) {
498 if (child[i].isFocusControl()) {
73005152
BH
499 break;
500 }
501 }
502 }
503 setFocus(-1);
504 }
505
506 @Override
507 protected void contentsMouseHover(MouseEvent e) {
eb63f5ff
BH
508 if (fTooltip == null) {
509 fTooltip = new DrawableToolTip(this);
73005152 510 }
eb63f5ff 511 if (fFrame != null) {
73005152 512 setFocus(0);
eb63f5ff 513 for (int i = 0; i < fNodeList.size() - 1; i++) {
abbdd66a
AM
514 SDTimeEvent m1 = fNodeList.get(i);
515 SDTimeEvent m2 = fNodeList.get(i + 1);
73005152 516
eb63f5ff
BH
517 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
518 BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
519 BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
520 if ((mes2.getStartLifeline() == null) || (mes1.getEndLifeline() == null)) {
521 continue;
73005152
BH
522 }
523 }
524
525 int y1 = ((GraphNode) m1.getGraphNode()).getY();
526 int y2 = ((GraphNode) m2.getGraphNode()).getY();
527
528 if (m1.getGraphNode() instanceof AsyncMessage) {
529 AsyncMessage as = (AsyncMessage) m1.getGraphNode();
df0b8ff4 530 if (as.getEndTime() == m1.getTime()) {
73005152 531 y1 += as.getHeight();
df0b8ff4 532 }
73005152
BH
533 }
534 if (m2.getGraphNode() instanceof AsyncMessage) {
535 AsyncMessage as = (AsyncMessage) m2.getGraphNode();
df0b8ff4 536 if (as.getEndTime() == m2.getTime()) {
73005152 537 y2 += as.getHeight();
df0b8ff4 538 }
73005152
BH
539 }
540 if (m1.getGraphNode() instanceof ExecutionOccurrence) {
541 ExecutionOccurrence eo = (ExecutionOccurrence) m1.getGraphNode();
df0b8ff4 542 if (m1.getEvent() == eo.getEndOccurrence()) {
73005152 543 y1 += eo.getHeight();
df0b8ff4 544 }
73005152
BH
545
546 if (m2.getGraphNode() instanceof ExecutionOccurrence) {
547
548 ExecutionOccurrence eo2 = (ExecutionOccurrence) m2.getGraphNode();
df0b8ff4 549 if (m2.getEvent() == eo2.getEndOccurrence()) {
73005152 550 y2 += eo2.getHeight();
df0b8ff4 551 }
73005152
BH
552 }
553 }
eb63f5ff
BH
554 int m1Y = Math.round(y1 * fZoomValue);
555 int m2Y = Math.round(y2 * fZoomValue);
73005152 556 if ((m1Y < e.y) && (m2Y >= e.y)) {
df0b8ff4 557 ITmfTimestamp delta = m2.getTime().getDelta(m1.getTime());
eb63f5ff 558 fTooltip.showToolTip(delta, fMinTime, fMaxTime);
73005152
BH
559 }
560 }
561 }
562 setFocus(0);
563 }
564
565 @Override
566 protected void contentsMouseExit(MouseEvent e) {
013a5f1c 567 if (fTooltip != null) {
eb63f5ff 568 fTooltip.hideToolTip();
013a5f1c 569 }
73005152
BH
570 }
571
572 @Override
573 protected void contentsMouseUpEvent(MouseEvent event) {
574 selectTimeDelta(event.y, 0);
575 setFocus();
576 super.contentsMouseUpEvent(event);
577 }
578
579 /**
a55887ca
AM
580 * Force the time compression bar to highlight the event occurrences between
581 * the two given messages. The event occurrences are highlighted on the
582 * first message's end lifeline
013a5f1c 583 *
a55887ca
AM
584 * @param mes1
585 * the first message
586 * @param mes2
587 * the second message
73005152
BH
588 */
589 public void highlightRegion(BaseMessage mes1, BaseMessage mes2) {
013a5f1c 590 BaseMessage localMes1 = mes1;
eb63f5ff 591 BaseMessage localMes2 = mes2;
013a5f1c 592
eb63f5ff 593 if (fFrame == null) {
73005152 594 return;
df0b8ff4 595 }
eb63f5ff 596 if (!(localMes1 instanceof ITimeRange)) {
73005152 597 return;
df0b8ff4 598 }
eb63f5ff 599 if (!(localMes2 instanceof ITimeRange)) {
73005152 600 return;
df0b8ff4 601 }
eb63f5ff
BH
602 ITimeRange t1 = (ITimeRange) localMes1;
603 ITimeRange t2 = (ITimeRange) localMes2;
73005152 604
4df4581d 605 ITmfTimestamp time1 = t1.getStartTime();
606 ITmfTimestamp time2 = t2.getStartTime();
eb63f5ff
BH
607 int event1 = localMes1.getEventOccurrence();
608 int event2 = localMes2.getEventOccurrence();
73005152 609
eb63f5ff
BH
610 if (localMes1 instanceof AsyncMessage) {
611 AsyncMessage as = (AsyncMessage) localMes1;
73005152
BH
612 time1 = as.getEndTime();
613 event1 = as.getEndOccurrence();
614 }
eb63f5ff
BH
615 if (localMes2 instanceof AsyncMessage) {
616 AsyncMessage as = (AsyncMessage) localMes2;
73005152
BH
617 if (as.getEndOccurrence() > as.getStartOccurrence()) {
618 time1 = as.getEndTime();
619 event1 = as.getEndOccurrence();
620 } else {
621 time1 = as.getStartTime();
622 event1 = as.getStartOccurrence();
623 }
624 }
625
626 if (event1 > event2) {
eb63f5ff
BH
627 BaseMessage tempMes = localMes2;
628 localMes2 = localMes1;
629 localMes1 = tempMes;
73005152 630
eb63f5ff
BH
631 t1 = (ITimeRange) localMes1;
632 t2 = (ITimeRange) localMes2;
73005152
BH
633
634 time1 = t1.getStartTime();
635 time2 = t2.getStartTime();
eb63f5ff
BH
636 event1 = localMes1.getEventOccurrence();
637 event2 = localMes2.getEventOccurrence();
73005152 638
eb63f5ff
BH
639 if (localMes1 instanceof AsyncMessage) {
640 AsyncMessage as = (AsyncMessage) localMes1;
73005152
BH
641 time1 = as.getEndTime();
642 event1 = as.getEndOccurrence();
643 }
eb63f5ff
BH
644 if (localMes2 instanceof AsyncMessage) {
645 AsyncMessage as = (AsyncMessage) localMes2;
73005152
BH
646 if (as.getEndOccurrence() > as.getStartOccurrence()) {
647 time1 = as.getEndTime();
648 event1 = as.getEndOccurrence();
649 } else {
650 time1 = as.getStartTime();
651 event1 = as.getStartOccurrence();
652 }
653 }
654 }
655
eb63f5ff 656 ITmfTimestamp minMaxdelta = fMaxTime.getDelta(fMinTime);
73005152
BH
657 double gr = (minMaxdelta.getValue()) / (double) 10;
658
eb63f5ff 659 ITmfTimestamp delta = time2.getDelta(time1).getDelta(fMinTime);
73005152
BH
660 long absDelta = Math.abs(delta.getValue());
661
662 int colIndex = 0;
663 if (gr != 0) {
664 colIndex = Math.round((float) (absDelta / gr));
eb63f5ff
BH
665 if (colIndex >= fColors.length) {
666 colIndex = fColors.length - 1;
df0b8ff4 667 } else if (colIndex < 0) {
73005152 668 colIndex = 0;
df0b8ff4
BH
669 }
670 } else {
73005152 671 colIndex = 0;
df0b8ff4 672 }
eb63f5ff 673 for (int j = 0; j < fListenerList.size(); j++) {
abbdd66a 674 ITimeCompressionListener list = fListenerList.get(j);
eb63f5ff
BH
675 if (localMes1.getEndLifeline() != null) {
676 list.deltaSelected(localMes1.getEndLifeline(), event1, event2 - event1, fColors[colIndex]);
677 } else if (localMes2.getStartLifeline() != null) {
678 list.deltaSelected(localMes2.getStartLifeline(), event1, event2 - event1, fColors[colIndex]);
df0b8ff4 679 } else {
eb63f5ff 680 list.deltaSelected(localMes1.getStartLifeline(), event1, event2 - event1, fColors[colIndex]);
df0b8ff4 681 }
73005152
BH
682 }
683 }
684
685 /**
686 * Force the time compression bar to highlight the event occurrences between the two given messages. The event
687 * occurrences are highlighted on the first message's end lifeline
013a5f1c 688 *
73005152 689 * @param mes1 the first message
df0b8ff4 690 * @param mes2 the second message
73005152
BH
691 */
692 public void highlightRegionSync(final BaseMessage mes1, final BaseMessage mes2) {
693 getDisplay().syncExec(new Runnable() {
694 @Override
695 public void run() {
696 highlightRegion(mes1, mes2);
697 }
698 });
699 }
700
701 @Override
702 public void scrollBy(int x, int y) {
703 }
704
df0b8ff4
BH
705 /**
706 * Sets the zoom value.
013a5f1c 707 *
df0b8ff4
BH
708 * @param value The zoom value to set.
709 */
73005152 710 public void setZoom(float value) {
eb63f5ff 711 fZoomValue = value;
73005152
BH
712 redraw();
713 }
714
df0b8ff4
BH
715 /**
716 * Adds a listener to the time compression listener list to be notified about selected deltas.
013a5f1c 717 *
df0b8ff4
BH
718 * @param listener The listener to add
719 */
73005152 720 public void addTimeCompressionListener(ITimeCompressionListener listener) {
eb63f5ff
BH
721 if (!fListenerList.contains(listener)) {
722 fListenerList.add(listener);
df0b8ff4 723 }
73005152
BH
724 }
725
df0b8ff4
BH
726 /**
727 * Removes a time compression listener.
013a5f1c 728 *
df0b8ff4
BH
729 * @param listener The listener to remove.
730 */
73005152 731 public void removeSelectionChangedListener(ITimeCompressionListener listener) {
eb63f5ff 732 fListenerList.remove(listener);
73005152
BH
733 }
734
735 @Override
736 public void widgetDisposed(DisposeEvent e) {
eb63f5ff
BH
737 if (fTooltip != null) {
738 fTooltip.dispose();
df0b8ff4 739 }
73005152 740 super.removeDisposeListener(this);
eb63f5ff
BH
741 for (int i = 0; i < fColors.length; i++) {
742 fColors[i].dispose();
df0b8ff4 743 }
73005152
BH
744 }
745
746 @Override
eb63f5ff
BH
747 protected void keyPressedEvent(KeyEvent event) {
748 if (fTooltip != null) {
749 fTooltip.hideToolTip();
df0b8ff4 750 }
73005152
BH
751 if (!isFocusControl() || getViewControl().isFocusControl()) {
752 Control[] child = getParent().getChildren();
753 for (int i = 0; i < child.length; i++) {
754 if (child[i].isFocusControl()) {
755 // getViewControl().setFocus();
756 break;
757 }
758 }
759 }
760 setFocus(-1);
761
762 boolean top = false;
eb63f5ff 763 if (fNextNodeY == 0) {
73005152 764 top = true;
df0b8ff4 765 }
eb63f5ff
BH
766 if ((fFrame != null) && (fNextNodeY == 0)) {
767 for (int i = 0; i < fNodeList.size() - 1 && i < 1; i++) {
abbdd66a
AM
768 SDTimeEvent m1 = fNodeList.get(i);
769 SDTimeEvent m2 = fNodeList.get(i + 1);
eb63f5ff
BH
770 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
771 BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
772 BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
773 if ((mes2.getStartLifeline() == null) || (mes1.getEndLifeline() == null)) {
774 continue;
73005152
BH
775 }
776 }
777
778 int y1 = ((GraphNode) m1.getGraphNode()).getY();
779 int y2 = ((GraphNode) m2.getGraphNode()).getY();
780 if (m1.getGraphNode() instanceof AsyncMessage) {
781 AsyncMessage as = (AsyncMessage) m1.getGraphNode();
df0b8ff4 782 if (as.getEndTime() == m1.getTime()) {
73005152 783 y1 += as.getHeight();
df0b8ff4 784 }
73005152
BH
785 }
786 if (m2.getGraphNode() instanceof AsyncMessage) {
787 AsyncMessage as = (AsyncMessage) m2.getGraphNode();
df0b8ff4 788 if (as.getEndTime() == m2.getTime()) {
73005152 789 y2 += as.getHeight();
df0b8ff4 790 }
73005152
BH
791 }
792 if (m1.getGraphNode() instanceof ExecutionOccurrence) {
793 ExecutionOccurrence eo = (ExecutionOccurrence) m1.getGraphNode();
df0b8ff4 794 if (m1.getEvent() == eo.getEndOccurrence()) {
73005152 795 y1 += eo.getHeight();
df0b8ff4 796 }
73005152
BH
797
798 if (m2.getGraphNode() instanceof ExecutionOccurrence) {
799
800 ExecutionOccurrence eo2 = (ExecutionOccurrence) m2.getGraphNode();
df0b8ff4 801 if (m2.getEvent() == eo2.getEndOccurrence()) {
73005152 802 y2 += eo2.getHeight();
df0b8ff4 803 }
73005152
BH
804 }
805 }
eb63f5ff
BH
806 fPrevNodeY = Math.round(y1 * fZoomValue);
807 fNextNodeY = Math.round(y2 * fZoomValue);
73005152
BH
808 }
809 }
810
eb63f5ff
BH
811 if (fLifeline != null) {
812 for (int j = 0; j < fListenerList.size(); j++) {
abbdd66a 813 ITimeCompressionListener list = fListenerList.get(j);
eb63f5ff 814 list.deltaSelected(fLifeline, fLifelineStart, fLifelineNumEvents, fLifelineColor);
73005152 815 }
df0b8ff4 816 }
73005152 817
eb63f5ff 818 if (event.keyCode == SWT.ARROW_DOWN) {
df0b8ff4 819 if (!top) {
eb63f5ff 820 selectTimeDelta(fNextNodeY + 1, 1);
df0b8ff4 821 } else {
eb63f5ff 822 selectTimeDelta(fPrevNodeY + 1, 1);
df0b8ff4 823 }
73005152 824 setFocus(1);
eb63f5ff
BH
825 } else if (event.keyCode == SWT.ARROW_UP) {
826 selectTimeDelta(fPrevNodeY - 1, 2);
73005152 827 setFocus(1);
eb63f5ff
BH
828 } else if (event.keyCode == SWT.ARROW_RIGHT) {
829 selectTimeDelta(fPrevNodeY, 1);
73005152
BH
830 setFocus(1);
831 }
eb63f5ff 832 super.keyPressedEvent(event);
73005152
BH
833 }
834
73005152 835 /**
df0b8ff4 836 * Selects the time delta for given delta y coordinate and direction.
013a5f1c
AM
837 *
838 * @param dy The delta in y coordinate.
df0b8ff4 839 * @param direction 0 no direction, 1 = down, 2 = up
73005152
BH
840 */
841 protected void selectTimeDelta(int dy, int direction) {
842 SDTimeEvent lastM1 = null;
843 SDTimeEvent lastM2 = null;
844 int lastY1 = 0;
845 int lastY2 = 0;
846 boolean done = false;
eb63f5ff
BH
847 if (fFrame != null) {
848 for (int i = 0; i < fNodeList.size() - 1; i++) {
abbdd66a
AM
849 SDTimeEvent m1 = fNodeList.get(i);
850 SDTimeEvent m2 = fNodeList.get(i + 1);
eb63f5ff
BH
851 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
852 BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
853 BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
854 if ((mes2.getStartLifeline() == null) || (mes1.getEndLifeline() == null)) {
855 continue;
73005152
BH
856 }
857 }
858
859 int y1 = ((GraphNode) m1.getGraphNode()).getY();
860 int y2 = ((GraphNode) m2.getGraphNode()).getY();
861 if (m1.getGraphNode() instanceof AsyncMessage) {
862 AsyncMessage as = (AsyncMessage) m1.getGraphNode();
df0b8ff4 863 if (as.getEndTime() == m1.getTime()) {
73005152 864 y1 += as.getHeight();
df0b8ff4 865 }
73005152
BH
866 }
867 if (m2.getGraphNode() instanceof AsyncMessage) {
868 AsyncMessage as = (AsyncMessage) m2.getGraphNode();
df0b8ff4 869 if (as.getEndTime() == m2.getTime()) {
73005152 870 y2 += as.getHeight();
df0b8ff4 871 }
73005152
BH
872 }
873 if (m1.getGraphNode() instanceof ExecutionOccurrence) {
874 ExecutionOccurrence eo = (ExecutionOccurrence) m1.getGraphNode();
df0b8ff4 875 if (m1.getEvent() == eo.getEndOccurrence()) {
73005152 876 y1 += eo.getHeight();
df0b8ff4 877 }
73005152
BH
878
879 if (m2.getGraphNode() instanceof ExecutionOccurrence) {
73005152 880 ExecutionOccurrence eo2 = (ExecutionOccurrence) m2.getGraphNode();
df0b8ff4 881 if (m2.getEvent() == eo2.getEndOccurrence()) {
73005152 882 y2 += eo2.getHeight();
df0b8ff4 883 }
73005152
BH
884 }
885 }
eb63f5ff
BH
886 int m1Y = Math.round(y1 * fZoomValue);
887 int m2Y = Math.round(y2 * fZoomValue);
73005152
BH
888
889 if ((m1Y < dy) && (m2Y > dy) || (!done && m2Y > dy && direction == 1 && lastM1 != null) || (!done && m1Y > dy && direction == 2 && lastM1 != null)) {
890 if (m1Y > dy && direction == 2) {
891 m1 = lastM1;
892 m2 = lastM2;
893 m1Y = lastY1;
894 m2Y = lastY2;
895 }
896 done = true;
eb63f5ff
BH
897 fPrevNodeY = m1Y;
898 fNextNodeY = m2Y;
899 ITmfTimestamp minMaxdelta = fMaxTime.getDelta(fMinTime);
73005152
BH
900 double gr = (minMaxdelta.getValue()) / (double) 10;
901
eb63f5ff 902 ITmfTimestamp delta = m2.getTime().getDelta(m1.getTime()).getDelta(fMinTime);
73005152
BH
903 long absDelta = Math.abs(delta.getValue());
904
905 int colIndex = 0;
906 if (gr != 0) {
907 colIndex = Math.round((float) (absDelta / gr));
eb63f5ff
BH
908 if (colIndex >= fColors.length) {
909 colIndex = fColors.length - 1;
df0b8ff4 910 } else if (colIndex < 0) {
73005152 911 colIndex = 0;
df0b8ff4
BH
912 }
913 } else {
73005152 914 colIndex = 0;
df0b8ff4 915 }
73005152
BH
916 if (m1.getGraphNode() instanceof BaseMessage) {
917 BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
918 if (mes1.getEndLifeline() != null) {
eb63f5ff
BH
919 fLifeline = mes1.getEndLifeline();
920 fLifelineStart = m1.getEvent();
921 fLifelineNumEvents = m2.getEvent() - m1.getEvent();
922 fLifelineColor = fColors[colIndex];
73005152 923 } else if (m2.getGraphNode() instanceof BaseMessage && ((BaseMessage) m2.getGraphNode()).getStartLifeline() != null) {
eb63f5ff
BH
924 fLifeline = ((BaseMessage) m2.getGraphNode()).getStartLifeline();
925 fLifelineStart = m1.getEvent();
926 fLifelineNumEvents = m2.getEvent() - m1.getEvent();
927 fLifelineColor = fColors[colIndex];
73005152 928 } else {
eb63f5ff
BH
929 fLifeline = mes1.getStartLifeline();
930 fLifelineStart = m1.getEvent();
931 fLifelineNumEvents = m2.getEvent() - m1.getEvent();
932 fLifelineColor = fColors[colIndex];
73005152
BH
933 }
934 } else if (m1.getGraphNode() instanceof ExecutionOccurrence) {
935 if (m2.getGraphNode() instanceof ExecutionOccurrence) {
936 ExecutionOccurrence eo = (ExecutionOccurrence) m2.getGraphNode();
eb63f5ff
BH
937 fLifeline = eo.getLifeline();
938 fLifelineStart = m1.getEvent();
939 fLifelineNumEvents = m2.getEvent() - m1.getEvent();
940 fLifelineColor = fColors[colIndex];
73005152
BH
941 } else {
942 ExecutionOccurrence eo = (ExecutionOccurrence) m1.getGraphNode();
eb63f5ff
BH
943 fLifeline = eo.getLifeline();
944 fLifelineStart = m1.getEvent();
945 fLifelineNumEvents = m2.getEvent() - m1.getEvent();
946 fLifelineColor = fColors[colIndex];
73005152
BH
947 }
948 }
eb63f5ff 949 for (int j = 0; j < fListenerList.size(); j++) {
abbdd66a 950 ITimeCompressionListener list = fListenerList.get(j);
eb63f5ff 951 list.deltaSelected(fLifeline, fLifelineStart, fLifelineNumEvents, fLifelineColor);
73005152
BH
952 }
953 break;
73005152 954 }
abbdd66a
AM
955 lastM1 = m1;
956 lastM2 = m2;
957 lastY1 = m1Y;
958 lastY2 = m2Y;
73005152
BH
959 }
960 }
961 }
962
df0b8ff4 963 /**
013a5f1c 964 * Creates a fake tool tip.
df0b8ff4 965 */
73005152 966 protected void createFakeTooltip() {
eb63f5ff
BH
967 if (fTooltip == null) {
968 fTooltip = new DrawableToolTip(this);
73005152 969 }
df0b8ff4 970
eb63f5ff 971 if (fFrame != null) {
73005152 972 setFocus(0);
eb63f5ff 973 for (int i = 0; i < fNodeList.size() - 1; i++) {
abbdd66a
AM
974 SDTimeEvent m1 = fNodeList.get(i);
975 SDTimeEvent m2 = fNodeList.get(i + 1);
73005152 976
eb63f5ff
BH
977 if ((SDViewPref.getInstance().excludeExternalTime()) && ((m1.getGraphNode() instanceof BaseMessage) && (m2.getGraphNode() instanceof BaseMessage))) {
978 BaseMessage mes1 = (BaseMessage) m1.getGraphNode();
979 BaseMessage mes2 = (BaseMessage) m2.getGraphNode();
980 if ((mes2.getStartLifeline() == null) || (mes1.getEndLifeline() == null)) {
981 continue;
73005152
BH
982 }
983 }
984
985 int y1 = ((GraphNode) m1.getGraphNode()).getY();
986 int y2 = ((GraphNode) m2.getGraphNode()).getY();
987
988 if (m1.getGraphNode() instanceof AsyncMessage) {
989 AsyncMessage as = (AsyncMessage) m1.getGraphNode();
df0b8ff4 990 if (as.getEndTime() == m1.getTime()) {
73005152 991 y1 += as.getHeight();
df0b8ff4 992 }
73005152
BH
993 }
994 if (m2.getGraphNode() instanceof AsyncMessage) {
995 AsyncMessage as = (AsyncMessage) m2.getGraphNode();
df0b8ff4 996 if (as.getEndTime() == m2.getTime()) {
73005152 997 y2 += as.getHeight();
df0b8ff4 998 }
73005152
BH
999 }
1000 if (m1.getGraphNode() instanceof ExecutionOccurrence) {
1001 ExecutionOccurrence eo = (ExecutionOccurrence) m1.getGraphNode();
df0b8ff4 1002 if (m1.getEvent() == eo.getEndOccurrence()) {
73005152 1003 y1 += eo.getHeight();
df0b8ff4 1004 }
73005152
BH
1005
1006 if (m2.getGraphNode() instanceof ExecutionOccurrence) {
1007
1008 ExecutionOccurrence eo2 = (ExecutionOccurrence) m2.getGraphNode();
df0b8ff4 1009 if (m2.getEvent() == eo2.getEndOccurrence()) {
73005152 1010 y2 += eo2.getHeight();
df0b8ff4 1011 }
73005152
BH
1012 }
1013 }
eb63f5ff
BH
1014 int m1Y = Math.round(y1 * fZoomValue);
1015 int m2Y = Math.round(y2 * fZoomValue);
1016 if ((m1Y < fPrevNodeY + 1) && (m2Y >= fPrevNodeY + 1)) {
df0b8ff4 1017 ITmfTimestamp delta = m2.getTime().getDelta(m1.getTime());
eb63f5ff
BH
1018 fTooltip.showToolTip(delta, fMinTime, fMaxTime);
1019 fTooltip.hideToolTip();
73005152
BH
1020 }
1021 }
1022 }
1023 }
013a5f1c 1024
3145ec83
BH
1025 /**
1026 * Traverse Listener implementation.
1027 */
1028 protected static class LocalTraverseListener implements TraverseListener {
3145ec83
BH
1029 @Override
1030 public void keyTraversed(TraverseEvent e) {
1031 if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) {
1032 e.doit = true;
1033 }
1034 }
1035 }
73005152 1036}
This page took 0.088029 seconds and 5 git commands to generate.