|
Lines 67-73
Link Here
|
| 67 |
ControlListener, SelectionListener, MouseTrackListener, |
67 |
ControlListener, SelectionListener, MouseTrackListener, |
| 68 |
TraverseListener, ISelectionProvider { |
68 |
TraverseListener, ISelectionProvider { |
| 69 |
|
69 |
|
| 70 |
public static final boolean DEFAULT_DRAW_THREAD_JOIN = true; |
70 |
private static final int DRAG_NONE = 0; |
|
|
71 |
private static final int DRAG_TRACE_ITEM = 1; |
| 72 |
private static final int DRAG_GROUP_ITEM = 2; |
| 73 |
private static final int DRAG_SPLIT_LINE = 3; |
| 74 |
public static final boolean DEFAULT_DRAW_THREAD_JOIN = true; |
| 71 |
public static final boolean DEFAULT_DRAW_THREAD_WAIT = true; |
75 |
public static final boolean DEFAULT_DRAW_THREAD_WAIT = true; |
| 72 |
public static final boolean DEFAULT_DRAW_THREAD_RELEASE = true; |
76 |
public static final boolean DEFAULT_DRAW_THREAD_RELEASE = true; |
| 73 |
public static int H_SCROLLBAR_MAX = Integer.MAX_VALUE - 1; |
77 |
public static int H_SCROLLBAR_MAX = Integer.MAX_VALUE - 1; |
|
Lines 81-88
Link Here
|
| 81 |
private boolean _mouseHover = false; |
85 |
private boolean _mouseHover = false; |
| 82 |
private int _itemHeightDefault = 19; |
86 |
private int _itemHeightDefault = 19; |
| 83 |
private int _itemHeight = _itemHeightDefault; |
87 |
private int _itemHeight = _itemHeightDefault; |
|
|
88 |
private int _minimumItemWidth = 0; |
| 84 |
private int _topItem = 0; |
89 |
private int _topItem = 0; |
| 85 |
private int _dragState = 0; |
90 |
private int _dragState = DRAG_NONE; |
| 86 |
private int _hitIdx = 0; |
91 |
private int _hitIdx = 0; |
| 87 |
private int _dragX0 = 0; |
92 |
private int _dragX0 = 0; |
| 88 |
private int _dragX = 0; |
93 |
private int _dragX = 0; |
|
Lines 137-149
Link Here
|
| 137 |
if (scrollHor != null) { |
142 |
if (scrollHor != null) { |
| 138 |
scrollHor.addSelectionListener(this); |
143 |
scrollHor.addSelectionListener(this); |
| 139 |
} |
144 |
} |
| 140 |
mouseScrollFilterListener = new Listener() { |
|
|
| 141 |
// This filter is used to prevent scrolling of the view when the |
| 142 |
// mouse wheel is used to zoom |
| 143 |
public void handleEvent(Event event) { |
| 144 |
event.doit = false; |
| 145 |
} |
| 146 |
}; |
| 147 |
|
145 |
|
| 148 |
_dragCursor3 = new Cursor(super.getDisplay(), SWT.CURSOR_SIZEWE); |
146 |
_dragCursor3 = new Cursor(super.getDisplay(), SWT.CURSOR_SIZEWE); |
| 149 |
_WaitCursor = new Cursor(super.getDisplay(), SWT.CURSOR_WAIT); |
147 |
_WaitCursor = new Cursor(super.getDisplay(), SWT.CURSOR_WAIT); |
|
Lines 455-461
Link Here
|
| 455 |
if (zoomIn) { |
453 |
if (zoomIn) { |
| 456 |
newInterval = Math.max(Math.round((double) interval * 0.8), _timeProvider.getMinTimeInterval()); |
454 |
newInterval = Math.max(Math.round((double) interval * 0.8), _timeProvider.getMinTimeInterval()); |
| 457 |
} else { |
455 |
} else { |
| 458 |
newInterval = Math.round((double) interval * 1.25); |
456 |
newInterval = (long) Math.ceil((double) interval * 1.25); |
| 459 |
} |
457 |
} |
| 460 |
long center = time0 + Math.round(((double) (xPos - nameSpace) / timeSpace * interval)); |
458 |
long center = time0 + Math.round(((double) (xPos - nameSpace) / timeSpace * interval)); |
| 461 |
long newTime0 = center - Math.round((double) newInterval * (center - time0) / interval); |
459 |
long newTime0 = center - Math.round((double) newInterval * (center - time0) / interval); |
|
Lines 631-637
Link Here
|
| 631 |
return idx >= 0 ? (Item) _data._items[idx] : null; |
629 |
return idx >= 0 ? (Item) _data._items[idx] : null; |
| 632 |
} |
630 |
} |
| 633 |
|
631 |
|
| 634 |
long hitTimeTest(int x, int y) { |
632 |
long hitTimeTest(int x) { |
| 635 |
if (null == _timeProvider) |
633 |
if (null == _timeProvider) |
| 636 |
return -1; |
634 |
return -1; |
| 637 |
long hitTime = -1; |
635 |
long hitTime = -1; |
|
Lines 653-677
Link Here
|
| 653 |
} |
651 |
} |
| 654 |
|
652 |
|
| 655 |
void selectItem(int idx, boolean addSelection) { |
653 |
void selectItem(int idx, boolean addSelection) { |
|
|
654 |
boolean changed = false; |
| 656 |
if (addSelection) { |
655 |
if (addSelection) { |
| 657 |
if (idx >= 0 && idx < _data._items.length) { |
656 |
if (idx >= 0 && idx < _data._items.length) { |
| 658 |
Item item = (Item) _data._items[idx]; |
657 |
Item item = (Item) _data._items[idx]; |
|
|
658 |
changed = (item._selected == false); |
| 659 |
item._selected = true; |
659 |
item._selected = true; |
| 660 |
} |
660 |
} |
| 661 |
} else { |
661 |
} else { |
| 662 |
for (int i = 0; i < _data._items.length; i++) { |
662 |
for (int i = 0; i < _data._items.length; i++) { |
| 663 |
Item item = (Item) _data._items[i]; |
663 |
Item item = (Item) _data._items[i]; |
|
|
664 |
if (i == idx && item._selected == false) { |
| 665 |
changed = true; |
| 666 |
} |
| 664 |
item._selected = i == idx; |
667 |
item._selected = i == idx; |
| 665 |
} |
668 |
} |
| 666 |
} |
669 |
} |
| 667 |
boolean changed = ensureVisibleItem(idx, true); |
670 |
changed |= ensureVisibleItem(idx, true); |
| 668 |
if (!changed) |
671 |
if (changed) |
| 669 |
redraw(); |
672 |
redraw(); |
| 670 |
} |
673 |
} |
| 671 |
|
674 |
|
| 672 |
public void selectItem(ITmfTimeAnalysisEntry trace, boolean addSelection) { |
675 |
public void selectItem(ITmfTimeAnalysisEntry trace, boolean addSelection) { |
| 673 |
Integer idx = _data.findTraceItemIndex(trace); |
676 |
Integer idx = _data.findTraceItemIndex(trace); |
| 674 |
selectItem(idx, addSelection); |
677 |
if (idx != null) { |
|
|
678 |
selectItem(idx, addSelection); |
| 679 |
} |
| 675 |
} |
680 |
} |
| 676 |
|
681 |
|
| 677 |
public int countPerPage() { |
682 |
public int countPerPage() { |
|
Lines 958-969
Link Here
|
| 958 |
if (drawTracesInteraction) |
963 |
if (drawTracesInteraction) |
| 959 |
drawTraceInteractions(bound, e.gc); |
964 |
drawTraceInteractions(bound, e.gc); |
| 960 |
|
965 |
|
|
|
966 |
// draw empty name space background |
| 967 |
if (_itemHeight * items.length < bound.height) { |
| 968 |
gc.setBackground(_colors.getBkColor(false, false, true)); |
| 969 |
drawBackground(gc, bound.x, _itemHeight * items.length, nameWidth, bound.height - _itemHeight * items.length); |
| 970 |
} |
| 971 |
|
| 961 |
// draw drag line, no line if name space is 0. |
972 |
// draw drag line, no line if name space is 0. |
| 962 |
if (3 == _dragState) { |
973 |
if (DRAG_SPLIT_LINE == _dragState) { |
| 963 |
gc.setForeground(_colors.getColor(TraceColorScheme.BLACK)); |
974 |
gc.setForeground(_colors.getColor(TraceColorScheme.BLACK)); |
| 964 |
gc.drawLine(bound.x + nameWidth, bound.y, bound.x + nameWidth, |
975 |
gc.drawLine(bound.x + nameWidth, bound.y, bound.x + nameWidth, |
| 965 |
bound.y + bound.height - 1); |
976 |
bound.y + bound.height - 1); |
| 966 |
} else if (0 == _dragState && _mouseHover |
977 |
} else if (DRAG_NONE == _dragState && _mouseHover |
| 967 |
&& _timeProvider.getNameSpace() > 0) { |
978 |
&& _timeProvider.getNameSpace() > 0) { |
| 968 |
gc.setForeground(_colors.getColor(TraceColorScheme.RED)); |
979 |
gc.setForeground(_colors.getColor(TraceColorScheme.RED)); |
| 969 |
gc.drawLine(bound.x + nameWidth, bound.y, bound.x + nameWidth, |
980 |
gc.drawLine(bound.x + nameWidth, bound.y, bound.x + nameWidth, |
|
Lines 1090-1101
Link Here
|
| 1090 |
ITmfTimeAnalysisEntry trace = ((TraceItem) item)._trace; |
1101 |
ITmfTimeAnalysisEntry trace = ((TraceItem) item)._trace; |
| 1091 |
|
1102 |
|
| 1092 |
int x0 = rect.x; |
1103 |
int x0 = rect.x; |
| 1093 |
List<TimeEvent> list = trace.getTraceEvents(); |
1104 |
Iterator<ITimeEvent> iterator = trace.getTraceEventsIterator(); |
| 1094 |
// Iterator it = list.iterator(); |
|
|
| 1095 |
int count = list.size(); |
| 1096 |
ITimeEvent lastEvent = null; |
1105 |
ITimeEvent lastEvent = null; |
| 1097 |
if (count > 0) { |
1106 |
if (iterator.hasNext()) { |
| 1098 |
ITimeEvent currEvent = list.get(0); |
1107 |
ITimeEvent currEvent = iterator.next(); |
| 1099 |
ITimeEvent nextEvent = null; |
1108 |
ITimeEvent nextEvent = null; |
| 1100 |
long currEventTime = currEvent.getTime(); |
1109 |
long currEventTime = currEvent.getTime(); |
| 1101 |
long nextEventTime = currEventTime; |
1110 |
long nextEventTime = currEventTime; |
|
Lines 1113-1120
Link Here
|
| 1113 |
while (x0 <= xEnd && null != currEvent) { |
1122 |
while (x0 <= xEnd && null != currEvent) { |
| 1114 |
boolean stopped = false;// currEvent instanceof |
1123 |
boolean stopped = false;// currEvent instanceof |
| 1115 |
// TsfTmTraceDeadEvent; |
1124 |
// TsfTmTraceDeadEvent; |
| 1116 |
if (idx < count) { |
1125 |
if (iterator.hasNext()) { |
| 1117 |
nextEvent = list.get(idx); |
1126 |
nextEvent = iterator.next(); |
| 1118 |
nextEventTime = nextEvent.getTime(); |
1127 |
nextEventTime = nextEvent.getTime(); |
| 1119 |
idx++; |
1128 |
idx++; |
| 1120 |
} else if (stopped) { |
1129 |
} else if (stopped) { |
|
Lines 1236-1248
Link Here
|
| 1236 |
ITmfTimeAnalysisEntry trace = ((TraceItem) item)._trace; |
1245 |
ITmfTimeAnalysisEntry trace = ((TraceItem) item)._trace; |
| 1237 |
|
1246 |
|
| 1238 |
double x0 = rect.x; |
1247 |
double x0 = rect.x; |
| 1239 |
List<TimeEvent> list = trace.getTraceEvents(); |
1248 |
Iterator<ITimeEvent> iterator = trace.getTraceEventsIterator(); |
| 1240 |
// Iterator it = list.iterator(); |
|
|
| 1241 |
int count = list.size(); |
| 1242 |
ITimeEvent lastEvent = null; |
1249 |
ITimeEvent lastEvent = null; |
| 1243 |
// Trace.debug("count is: " + count); |
1250 |
// Trace.debug("count is: " + count); |
| 1244 |
if (count > 0) { |
1251 |
if (iterator.hasNext()) { |
| 1245 |
ITimeEvent currEvent = list.get(0); |
1252 |
ITimeEvent currEvent = iterator.next(); |
| 1246 |
ITimeEvent nextEvent = null; |
1253 |
ITimeEvent nextEvent = null; |
| 1247 |
long currEventTime = currEvent.getTime(); |
1254 |
long currEventTime = currEvent.getTime(); |
| 1248 |
long nextEventTime = currEventTime; |
1255 |
long nextEventTime = currEventTime; |
|
Lines 1265-1272
Link Here
|
| 1265 |
while (x0 <= xEnd && null != currEvent) { |
1272 |
while (x0 <= xEnd && null != currEvent) { |
| 1266 |
boolean stopped = false;// currEvent instanceof |
1273 |
boolean stopped = false;// currEvent instanceof |
| 1267 |
// TsfTmTraceDeadEvent; |
1274 |
// TsfTmTraceDeadEvent; |
| 1268 |
if (idx < count) { |
1275 |
if (iterator.hasNext()) { |
| 1269 |
nextEvent = list.get(idx); |
1276 |
nextEvent = iterator.next(); |
| 1270 |
nextEventTime = nextEvent.getTime(); |
1277 |
nextEventTime = nextEvent.getTime(); |
| 1271 |
idx++; |
1278 |
idx++; |
| 1272 |
} else if (stopped) { |
1279 |
} else if (stopped) { |
|
Lines 1408-1416
Link Here
|
| 1408 |
ITmfTimeAnalysisEntry trace = ((TraceItem) item)._trace; |
1415 |
ITmfTimeAnalysisEntry trace = ((TraceItem) item)._trace; |
| 1409 |
|
1416 |
|
| 1410 |
double x0 = rect.x; |
1417 |
double x0 = rect.x; |
| 1411 |
List<TimeEvent> list = trace.getTraceEvents(); |
1418 |
long maxDuration = (_timeProvider.getTimeSpace() == 0) ? Long.MAX_VALUE : 1 * (_timeProvider.getTime1() - _timeProvider.getTime0()) / _timeProvider.getTimeSpace(); |
| 1412 |
// Iterator it = list.iterator(); |
1419 |
Iterator<ITimeEvent> iterator = trace.getTraceEventsIterator(_timeProvider.getTime0(), _timeProvider.getTime1(), maxDuration); |
| 1413 |
int count = list.size(); |
|
|
| 1414 |
// ITimeEvent lastEvent = null; |
1420 |
// ITimeEvent lastEvent = null; |
| 1415 |
// if (Trace.isDEBUG()) { |
1421 |
// if (Trace.isDEBUG()) { |
| 1416 |
// Trace.debug("\n\t\t\tTrace: " + trace.getName() |
1422 |
// Trace.debug("\n\t\t\tTrace: " + trace.getName() |
|
Lines 1424-1431
Link Here
|
| 1424 |
// Clean up to empty line to draw on top |
1430 |
// Clean up to empty line to draw on top |
| 1425 |
int xEnd = rect.x + rect.width; |
1431 |
int xEnd = rect.x + rect.width; |
| 1426 |
fillSpace(rect, gc, selected, _rect1.x, xEnd, xEnd); |
1432 |
fillSpace(rect, gc, selected, _rect1.x, xEnd, xEnd); |
| 1427 |
if (count > 0) { |
1433 |
if (iterator.hasNext()) { |
| 1428 |
ITimeEvent currEvent = list.get(0); |
1434 |
ITimeEvent currEvent = iterator.next(); |
| 1429 |
ITimeEvent nextEvent = null; |
1435 |
ITimeEvent nextEvent = null; |
| 1430 |
long currEventTime = currEvent.getTime(); |
1436 |
long currEventTime = currEvent.getTime(); |
| 1431 |
long currEventDuration = currEvent.getDuration(); |
1437 |
long currEventDuration = currEvent.getDuration(); |
|
Lines 1445-1452
Link Here
|
| 1445 |
// refresh current event duration as the loop moves |
1451 |
// refresh current event duration as the loop moves |
| 1446 |
currEventDuration = currEvent.getDuration(); |
1452 |
currEventDuration = currEvent.getDuration(); |
| 1447 |
// TsfTmTraceDeadEvent; |
1453 |
// TsfTmTraceDeadEvent; |
| 1448 |
if (idx < count) { |
1454 |
if (iterator.hasNext()) { |
| 1449 |
nextEvent = list.get(idx); |
1455 |
nextEvent = iterator.next(); |
| 1450 |
nextEventTime = nextEvent.getTime(); |
1456 |
nextEventTime = nextEvent.getTime(); |
| 1451 |
idx++; |
1457 |
idx++; |
| 1452 |
} else if (stopped) { |
1458 |
} else if (stopped) { |
|
Lines 1485-1494
Link Here
|
| 1485 |
if (x1 >= rect.x && x0 <= xEnd) { |
1491 |
if (x1 >= rect.x && x0 <= xEnd) { |
| 1486 |
if (currEventDuration != 0) { |
1492 |
if (currEventDuration != 0) { |
| 1487 |
x0 = (double) (x0 >= rect.x ? x0 : rect.x); |
1493 |
x0 = (double) (x0 >= rect.x ? x0 : rect.x); |
| 1488 |
_rect1.width = (int) ((x1 <= xEnd ? x1 : xEnd) - x0); |
1494 |
_rect1.width = (int) Math.ceil(x1 <= xEnd ? x1 : xEnd) - (int) x0; |
| 1489 |
} else { |
1495 |
} else { |
| 1490 |
_rect1.width = 2; // make punctual events 2 pixels wide |
1496 |
_rect1.width = 1; // make punctual events 2 pixels wide |
| 1491 |
} |
1497 |
} |
|
|
1498 |
_rect1.width = Math.max(_minimumItemWidth, _rect1.width); |
| 1492 |
_rect1.x = (int) x0; |
1499 |
_rect1.x = (int) x0; |
| 1493 |
boolean timeSelected = currEventTime <= selectedTime |
1500 |
boolean timeSelected = currEventTime <= selectedTime |
| 1494 |
&& selectedTime < nextEventTime; |
1501 |
&& selectedTime < nextEventTime; |
|
Lines 1638-1654
Link Here
|
| 1638 |
public void focusGained(FocusEvent e) { |
1645 |
public void focusGained(FocusEvent e) { |
| 1639 |
_isInFocus = true; |
1646 |
_isInFocus = true; |
| 1640 |
redraw(); |
1647 |
redraw(); |
| 1641 |
getDisplay().addFilter(SWT.MouseWheel, mouseScrollFilterListener); |
1648 |
if (mouseScrollFilterListener == null) { |
|
|
1649 |
mouseScrollFilterListener = new Listener() { |
| 1650 |
// This filter is used to prevent scrolling of the view when the |
| 1651 |
// mouse wheel is used to zoom |
| 1652 |
public void handleEvent(Event event) { |
| 1653 |
event.doit = false; |
| 1654 |
} |
| 1655 |
}; |
| 1656 |
getDisplay().addFilter(SWT.MouseWheel, mouseScrollFilterListener); |
| 1657 |
} |
| 1642 |
} |
1658 |
} |
| 1643 |
|
1659 |
|
| 1644 |
public void focusLost(FocusEvent e) { |
1660 |
public void focusLost(FocusEvent e) { |
| 1645 |
_isInFocus = false; |
1661 |
_isInFocus = false; |
| 1646 |
if (0 != _dragState) { |
1662 |
if (DRAG_NONE != _dragState) { |
| 1647 |
setCapture(false); |
1663 |
setCapture(false); |
| 1648 |
_dragState = 0; |
1664 |
_dragState = DRAG_NONE; |
| 1649 |
} |
1665 |
} |
| 1650 |
redraw(); |
1666 |
redraw(); |
| 1651 |
getDisplay().removeFilter(SWT.MouseWheel, mouseScrollFilterListener); |
1667 |
if (mouseScrollFilterListener != null) { |
|
|
1668 |
getDisplay().removeFilter(SWT.MouseWheel, mouseScrollFilterListener); |
| 1669 |
mouseScrollFilterListener = null; |
| 1670 |
} |
| 1652 |
} |
1671 |
} |
| 1653 |
|
1672 |
|
| 1654 |
public boolean isInFocus() { |
1673 |
public boolean isInFocus() { |
|
Lines 1659-1665
Link Here
|
| 1659 |
if (null == _timeProvider) |
1678 |
if (null == _timeProvider) |
| 1660 |
return; |
1679 |
return; |
| 1661 |
Point size = getCtrlSize(); |
1680 |
Point size = getCtrlSize(); |
| 1662 |
if (1 == _dragState) { |
1681 |
if (DRAG_TRACE_ITEM == _dragState) { |
| 1663 |
int nameWidth = _timeProvider.getNameSpace(); |
1682 |
int nameWidth = _timeProvider.getNameSpace(); |
| 1664 |
int x = e.x - nameWidth; |
1683 |
int x = e.x - nameWidth; |
| 1665 |
if (x > 0 && size.x > nameWidth && _dragX != x) { |
1684 |
if (x > 0 && size.x > nameWidth && _dragX != x) { |
|
Lines 1678-1687
Link Here
|
| 1678 |
} |
1697 |
} |
| 1679 |
_timeProvider.setStartFinishTime(time0, time1); |
1698 |
_timeProvider.setStartFinishTime(time0, time1); |
| 1680 |
} |
1699 |
} |
| 1681 |
} else if (3 == _dragState) { |
1700 |
} else if (DRAG_SPLIT_LINE == _dragState) { |
| 1682 |
_dragX = e.x; |
1701 |
_dragX = e.x; |
| 1683 |
_timeProvider.setNameSpace(_hitIdx + _dragX - _dragX0); |
1702 |
_timeProvider.setNameSpace(_hitIdx + _dragX - _dragX0); |
| 1684 |
} else if (0 == _dragState) { |
1703 |
} else if (DRAG_NONE == _dragState) { |
| 1685 |
boolean mouseHover = hitSplitTest(e.x, e.y) > 0; |
1704 |
boolean mouseHover = hitSplitTest(e.x, e.y) > 0; |
| 1686 |
if (_mouseHover != mouseHover) |
1705 |
if (_mouseHover != mouseHover) |
| 1687 |
redraw(); |
1706 |
redraw(); |
|
Lines 1769-1775
Link Here
|
| 1769 |
if (namewidth != 0) { |
1788 |
if (namewidth != 0) { |
| 1770 |
idx = hitSplitTest(e.x, e.y); |
1789 |
idx = hitSplitTest(e.x, e.y); |
| 1771 |
if (idx > 0) { |
1790 |
if (idx > 0) { |
| 1772 |
_dragState = 3; |
1791 |
_dragState = DRAG_SPLIT_LINE; |
| 1773 |
_dragX = _dragX0 = e.x; |
1792 |
_dragX = _dragX0 = e.x; |
| 1774 |
_hitIdx = _timeProvider.getNameSpace(); |
1793 |
_hitIdx = _timeProvider.getNameSpace(); |
| 1775 |
; |
1794 |
; |
|
Lines 1783-1822
Link Here
|
| 1783 |
idx = hitTest(e.x, e.y); |
1802 |
idx = hitTest(e.x, e.y); |
| 1784 |
if (idx >= 0) { |
1803 |
if (idx >= 0) { |
| 1785 |
if (_data._items[idx] instanceof TraceItem) { |
1804 |
if (_data._items[idx] instanceof TraceItem) { |
| 1786 |
long hitTime = hitTimeTest(e.x, e.y); |
1805 |
long hitTime = hitTimeTest(e.x); |
| 1787 |
if (hitTime >= 0) { |
1806 |
if (hitTime >= 0) { |
| 1788 |
_timeProvider.setSelectedTimeInt(hitTime, false); |
1807 |
// _timeProvider.setSelectedTimeInt(hitTime, false); |
| 1789 |
setCapture(true); |
1808 |
setCapture(true); |
| 1790 |
_dragState = 1; |
1809 |
_dragState = DRAG_TRACE_ITEM; |
| 1791 |
_dragX = _dragX0 = e.x - _timeProvider.getNameSpace(); |
1810 |
_dragX = _dragX0 = e.x - _timeProvider.getNameSpace(); |
|
|
1811 |
_hitIdx = idx; |
| 1792 |
_time0bak = _timeProvider.getTime0(); |
1812 |
_time0bak = _timeProvider.getTime0(); |
| 1793 |
_time1bak = _timeProvider.getTime1(); |
1813 |
_time1bak = _timeProvider.getTime1(); |
|
|
1814 |
return; |
| 1794 |
} |
1815 |
} |
| 1795 |
} else if (_data._items[idx] instanceof GroupItem) { |
1816 |
} else if (_data._items[idx] instanceof GroupItem) { |
| 1796 |
_hitIdx = idx; |
1817 |
_dragX0 = e.x; |
| 1797 |
_dragState = 2; |
1818 |
_dragState = DRAG_GROUP_ITEM; |
| 1798 |
} |
1819 |
} |
| 1799 |
selectItem(idx, false); |
1820 |
selectItem(idx, false); |
| 1800 |
fireSelectionChanged(); |
1821 |
fireSelectionChanged(); |
| 1801 |
} else { |
1822 |
} else { |
| 1802 |
selectItem(idx, false); // clear selection |
1823 |
selectItem(idx, false); // clear selection |
|
|
1824 |
redraw(); |
| 1803 |
} |
1825 |
} |
| 1804 |
} |
1826 |
} |
| 1805 |
} |
1827 |
} |
| 1806 |
|
1828 |
|
| 1807 |
public void mouseUp(MouseEvent e) { |
1829 |
public void mouseUp(MouseEvent e) { |
| 1808 |
if (0 != _dragState) { |
1830 |
if (DRAG_NONE != _dragState) { |
| 1809 |
setCapture(false); |
1831 |
setCapture(false); |
| 1810 |
if (1 == _dragState) { |
1832 |
if (DRAG_TRACE_ITEM == _dragState) { |
| 1811 |
// Notify time provider to check the need for listener notification |
1833 |
// Notify time provider to check the need for listener notification |
| 1812 |
_timeProvider.notifyStartFinishTime(); |
1834 |
_timeProvider.notifyStartFinishTime(); |
| 1813 |
} else if (2 == _dragState) { |
1835 |
if (_dragX == _dragX0) { // click without drag |
| 1814 |
if (hitTest(e.x, e.y) == _hitIdx) |
1836 |
long time = hitTimeTest(e.x); |
|
|
1837 |
_timeProvider.setSelectedTimeInt(time, false); |
| 1838 |
selectItem(_hitIdx, false); |
| 1839 |
fireSelectionChanged(); |
| 1840 |
} |
| 1841 |
} else if (DRAG_GROUP_ITEM == _dragState) { |
| 1842 |
if (e.x == _dragX0) // click without drag |
| 1815 |
toggle(_hitIdx); |
1843 |
toggle(_hitIdx); |
| 1816 |
} else if (3 == _dragState) { |
1844 |
} else if (DRAG_SPLIT_LINE == _dragState) { |
| 1817 |
redraw(); |
1845 |
redraw(); |
| 1818 |
} |
1846 |
} |
| 1819 |
_dragState = 0; |
1847 |
_dragState = DRAG_NONE; |
| 1820 |
} |
1848 |
} |
| 1821 |
} |
1849 |
} |
| 1822 |
|
1850 |
|
|
Lines 1874-1880
Link Here
|
| 1874 |
} |
1902 |
} |
| 1875 |
|
1903 |
|
| 1876 |
public void mouseScrolled(MouseEvent e) { |
1904 |
public void mouseScrolled(MouseEvent e) { |
| 1877 |
if (!_isInFocus) |
1905 |
if (!_isInFocus || _dragState != DRAG_NONE) |
| 1878 |
return; |
1906 |
return; |
| 1879 |
if (e.count > 0) { |
1907 |
if (e.count > 0) { |
| 1880 |
zoom(true); |
1908 |
zoom(true); |
|
Lines 1920-1925
Link Here
|
| 1920 |
this._itemHeight = rowHeight; |
1948 |
this._itemHeight = rowHeight; |
| 1921 |
} |
1949 |
} |
| 1922 |
|
1950 |
|
|
|
1951 |
public void setMinimumItemWidth(int width) { |
| 1952 |
this._minimumItemWidth = width; |
| 1953 |
} |
| 1954 |
|
| 1923 |
public Vector<ITmfTimeAnalysisEntry> getFilteredOut() { |
1955 |
public Vector<ITmfTimeAnalysisEntry> getFilteredOut() { |
| 1924 |
return _data.getFilteredOut(); |
1956 |
return _data.getFilteredOut(); |
| 1925 |
} |
1957 |
} |
|
Lines 2056-2076
Link Here
|
| 2056 |
if (trace == null) |
2088 |
if (trace == null) |
| 2057 |
return null; |
2089 |
return null; |
| 2058 |
|
2090 |
|
| 2059 |
int traceId = trace.getId(); |
|
|
| 2060 |
|
| 2061 |
Integer idx = null; |
| 2062 |
for (int i = 0; i < _items.length; i++) { |
2091 |
for (int i = 0; i < _items.length; i++) { |
| 2063 |
idx = i; |
|
|
| 2064 |
Object item = _items[i]; |
2092 |
Object item = _items[i]; |
| 2065 |
if (item instanceof TraceItem) { |
2093 |
if (item instanceof TraceItem) { |
| 2066 |
TraceItem ti = (TraceItem) item; |
2094 |
TraceItem ti = (TraceItem) item; |
| 2067 |
if (ti._trace.getId() == traceId) { |
2095 |
if (ti._trace == trace) { |
| 2068 |
break; |
2096 |
return i; |
| 2069 |
} |
2097 |
} |
| 2070 |
} |
2098 |
} |
| 2071 |
} |
2099 |
} |
| 2072 |
|
2100 |
|
| 2073 |
return idx; |
2101 |
return null; |
| 2074 |
} |
2102 |
} |
| 2075 |
|
2103 |
|
| 2076 |
public void updateItems() { |
2104 |
public void updateItems() { |
|
Lines 2164-2169
Link Here
|
| 2164 |
// item = findTraceItem(parent); |
2192 |
// item = findTraceItem(parent); |
| 2165 |
// } |
2193 |
// } |
| 2166 |
|
2194 |
|
|
|
2195 |
/* |
| 2196 |
* Check if this is still needed! |
| 2167 |
ITmfTimeAnalysisEntry localTraceItem = item._trace; |
2197 |
ITmfTimeAnalysisEntry localTraceItem = item._trace; |
| 2168 |
// Local trace found |
2198 |
// Local trace found |
| 2169 |
Vector<TimeEvent> children = localTraceItem.getTraceEvents(); |
2199 |
Vector<TimeEvent> children = localTraceItem.getTraceEvents(); |
|
Lines 2179-2184
Link Here
|
| 2179 |
} |
2209 |
} |
| 2180 |
// Add the new item |
2210 |
// Add the new item |
| 2181 |
children.add(childItem); |
2211 |
children.add(childItem); |
|
|
2212 |
*/ |
| 2182 |
|
2213 |
|
| 2183 |
} |
2214 |
} |
| 2184 |
|
2215 |
|