protected LocalResourceManager fResourceManager = new LocalResourceManager(JFaceResources.getResources());\r
protected Color[] fEventColorMap = null;\r
\r
+ private MouseScrollNotifier fMouseScrollNotifier;\r
+ private Object fMouseScrollNotifierLock = new Object();\r
+ private class MouseScrollNotifier extends Thread {\r
+ private final static long DELAY = 400L;\r
+ private final static long POLLING_INTERVAL = 10L;\r
+ private long fLastScrollTime = Long.MAX_VALUE;\r
+\r
+ @Override\r
+ public void run() {\r
+ while ((System.currentTimeMillis() - fLastScrollTime) < DELAY) {\r
+ try {\r
+ Thread.sleep(POLLING_INTERVAL);\r
+ } catch (Exception e) {\r
+ return;\r
+ }\r
+ }\r
+ if (!isInterrupted()) {\r
+ Display.getDefault().asyncExec(new Runnable() {\r
+ @Override\r
+ public void run() {\r
+ if (isDisposed()) {\r
+ return;\r
+ }\r
+ _timeProvider.notifyStartFinishTime();\r
+ }\r
+ });\r
+ }\r
+ synchronized (fMouseScrollNotifierLock) {\r
+ fMouseScrollNotifier = null;\r
+ }\r
+ }\r
+\r
+ public void mouseScrolled() {\r
+ fLastScrollTime = System.currentTimeMillis();\r
+ }\r
+ }\r
+\r
public TimeGraphControl(Composite parent, TimeGraphColorScheme colors) {\r
\r
super(parent, colors, SWT.NO_BACKGROUND | SWT.H_SCROLL | SWT.DOUBLE_BUFFERED);\r
long newTime0 = center - Math.round((double) newInterval * (center - time0) / interval);\r
long newTime1 = newTime0 + newInterval;\r
_timeProvider.setStartFinishTime(newTime0, newTime1);\r
+ synchronized (fMouseScrollNotifierLock) {\r
+ if (fMouseScrollNotifier == null) {\r
+ fMouseScrollNotifier = new MouseScrollNotifier();\r
+ fMouseScrollNotifier.start();\r
+ }\r
+ fMouseScrollNotifier.mouseScrolled();\r
+ }\r
}\r
\r
/**\r
redraw();\r
}\r
_mouseOverSplitLine = mouseOverSplitLine;\r
- // Make sure any time changes are notified to the application e.g.\r
- // getting back from the horizontal scroll bar or zoomed using the\r
- // mouse wheel\r
- _timeProvider.notifyStartFinishTime();\r
}\r
updateCursor(e.x, e.y);\r
}\r
TimeGraphItem item = threadStates.getItem(pt);\r
_tipTable.remove(0, _tipTable.getItemCount() - 1);\r
fillValues(pt, threadStates, item);\r
- _tipTable.getColumn(0).setWidth(200);\r
+ _tipTable.getColumn(0).pack();\r
_tipTable.getColumn(1).pack();\r
- _tipTable.setSize(_tipTable.computeSize(SWT.DEFAULT, 200));\r
_tipShell.pack();\r
_tipPosition = control.toDisplay(pt);\r
_tipShell.pack();\r