1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.views
.resources
;
15 import java
.util
.ArrayList
;
16 import java
.util
.Arrays
;
17 import java
.util
.Comparator
;
18 import java
.util
.Iterator
;
19 import java
.util
.List
;
21 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
22 import org
.eclipse
.core
.runtime
.NullProgressMonitor
;
23 import org
.eclipse
.jface
.action
.Action
;
24 import org
.eclipse
.jface
.action
.IToolBarManager
;
25 import org
.eclipse
.jface
.action
.Separator
;
26 import org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.core
.Attributes
;
27 import org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.Messages
;
28 import org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.views
.resources
.ResourcesEntry
.Type
;
29 import org
.eclipse
.linuxtools
.lttng2
.kernel
.core
.trace
.CtfKernelTrace
;
30 import org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
.CtfTmfTimestamp
;
31 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
32 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfEvent
;
33 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimeRange
;
34 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimestamp
;
35 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.AttributeNotFoundException
;
36 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.StateValueTypeException
;
37 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TimeRangeException
;
38 import org
.eclipse
.linuxtools
.tmf
.core
.interval
.ITmfStateInterval
;
39 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfExperimentSelectedSignal
;
40 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfRangeSynchSignal
;
41 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignalHandler
;
42 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfStateSystemBuildCompleted
;
43 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTimeSynchSignal
;
44 import org
.eclipse
.linuxtools
.tmf
.core
.statesystem
.IStateSystemQuerier
;
45 import org
.eclipse
.linuxtools
.tmf
.core
.statesystem
.IStateSystemQuerier2
;
46 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
47 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.TmfExperiment
;
48 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.TmfView
;
49 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.ITimeGraphRangeListener
;
50 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.ITimeGraphTimeListener
;
51 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.TimeGraphRangeUpdateEvent
;
52 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.TimeGraphTimeEvent
;
53 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.TimeGraphViewer
;
54 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
55 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
56 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.TimeEvent
;
57 import org
.eclipse
.swt
.SWT
;
58 import org
.eclipse
.swt
.widgets
.Composite
;
59 import org
.eclipse
.swt
.widgets
.Display
;
60 import org
.eclipse
.ui
.IActionBars
;
63 * Main implementation for the LTTng 2.0 kernel Resource view
65 * @author Patrick Tasse
67 public class ResourcesView
extends TmfView
{
69 // ------------------------------------------------------------------------
71 // ------------------------------------------------------------------------
74 public static final String ID
= "org.eclipse.linuxtools.lttng2.kernel.ui.views.resources"; //$NON-NLS-1$
76 /** Initial time range */
77 private static final long INITIAL_WINDOW_OFFSET
= (1L * 100 * 1000 * 1000); // .1sec
82 private enum State
{ IDLE
, BUSY
, PENDING
};
84 // ------------------------------------------------------------------------
86 // ------------------------------------------------------------------------
88 // The time graph viewer
89 TimeGraphViewer fTimeGraphViewer
;
91 // The selected experiment
92 private TmfExperiment
<ITmfEvent
> fSelectedExperiment
;
94 // The time graph entry list
95 private ArrayList
<TraceEntry
> fEntryList
;
97 // The time graph entry list synchronization object
98 final private Object fEntryListSyncObj
= new Object();
101 private long fStartTime
;
104 private long fEndTime
;
107 private final int fDisplayWidth
;
109 // The next resource action
110 private Action fNextResourceAction
;
112 // The previous resource action
113 private Action fPreviousResourceAction
;
116 private ZoomThread fZoomThread
;
118 // The redraw state used to prevent unnecessary queuing of display runnables
119 private State fRedrawState
= State
.IDLE
;
121 // The redraw synchronization object
122 final private Object fSyncObj
= new Object();
124 // ------------------------------------------------------------------------
126 // ------------------------------------------------------------------------
128 private class TraceEntry
implements ITimeGraphEntry
{
130 private final CtfKernelTrace fTrace
;
132 private final long fTraceStartTime
;
134 private final long fTraceEndTime
;
135 // The children of the entry
136 private final ArrayList
<ResourcesEntry
> fChildren
;
138 private final String fName
;
140 public TraceEntry(CtfKernelTrace trace
, String name
, long startTime
, long endTime
) {
142 fChildren
= new ArrayList
<ResourcesEntry
>();
144 fTraceStartTime
= startTime
;
145 fTraceEndTime
= endTime
;
149 public ITimeGraphEntry
getParent() {
154 public boolean hasChildren() {
155 return fChildren
!= null && fChildren
.size() > 0;
159 public ResourcesEntry
[] getChildren() {
160 return fChildren
.toArray(new ResourcesEntry
[0]);
164 public String
getName() {
169 public long getStartTime() {
170 return fTraceStartTime
;
174 public long getEndTime() {
175 return fTraceEndTime
;
179 public boolean hasTimeEvents() {
184 public Iterator
<ITimeEvent
> getTimeEventsIterator() {
189 public <T
extends ITimeEvent
> Iterator
<T
> getTimeEventsIterator(long startTime
, long stopTime
, long visibleDuration
) {
193 public CtfKernelTrace
getTrace() {
197 public void addChild(ResourcesEntry entry
) {
199 for (index
= 0; index
< fChildren
.size(); index
++) {
200 ResourcesEntry other
= fChildren
.get(index
);
201 if (entry
.getType().compareTo(other
.getType()) < 0) {
203 } else if (entry
.getType().equals(other
.getType())) {
204 if (entry
.getId() < other
.getId()) {
209 entry
.setParent(this);
210 fChildren
.add(index
, entry
);
214 private static class TraceEntryComparator
implements Comparator
<ITimeGraphEntry
> {
216 public int compare(ITimeGraphEntry o1
, ITimeGraphEntry o2
) {
217 int result
= o1
.getStartTime() < o2
.getStartTime() ?
-1 : o1
.getStartTime() > o2
.getStartTime() ?
1 : 0;
219 result
= o1
.getName().compareTo(o2
.getName());
225 private class ZoomThread
extends Thread
{
226 private final long fZoomStartTime
;
227 private final long fZoomEndTime
;
228 private final IProgressMonitor fMonitor
;
230 public ZoomThread(long startTime
, long endTime
) {
231 super("ResourcesView zoom"); //$NON-NLS-1$
232 fZoomStartTime
= startTime
;
233 fZoomEndTime
= endTime
;
234 fMonitor
= new NullProgressMonitor();
239 ArrayList
<TraceEntry
> entryList
= null;
240 synchronized (fEntryListSyncObj
) {
241 entryList
= fEntryList
;
243 if (entryList
== null) {
246 long resolution
= Math
.max(1, (fZoomEndTime
- fZoomStartTime
) / fDisplayWidth
);
247 for (TraceEntry traceEntry
: entryList
) {
248 for (ITimeGraphEntry child
: traceEntry
.getChildren()) {
249 if (fMonitor
.isCanceled()) {
252 ResourcesEntry entry
= (ResourcesEntry
) child
;
253 if (fZoomStartTime
<= fStartTime
&& fZoomEndTime
>= fEndTime
) {
254 entry
.setZoomedEventList(null);
256 List
<ITimeEvent
> zoomedEventList
= getEventList(entry
, fZoomStartTime
, fZoomEndTime
, resolution
, true, fMonitor
);
257 if (zoomedEventList
!= null) {
258 entry
.setZoomedEventList(zoomedEventList
);
266 public void cancel() {
267 fMonitor
.setCanceled(true);
271 // ------------------------------------------------------------------------
273 // ------------------------------------------------------------------------
276 * Default constructor
278 public ResourcesView() {
280 fDisplayWidth
= Display
.getDefault().getBounds().width
;
283 // ------------------------------------------------------------------------
285 // ------------------------------------------------------------------------
288 * @see org.eclipse.linuxtools.tmf.ui.views.TmfView#createPartControl(org.eclipse.swt.widgets.Composite)
291 public void createPartControl(Composite parent
) {
292 fTimeGraphViewer
= new TimeGraphViewer(parent
, SWT
.NONE
);
294 fTimeGraphViewer
.setTimeGraphProvider(new ResourcesPresentationProvider());
296 fTimeGraphViewer
.setTimeCalendarFormat(true);
298 fTimeGraphViewer
.addRangeListener(new ITimeGraphRangeListener() {
300 public void timeRangeUpdated(TimeGraphRangeUpdateEvent event
) {
301 long startTime
= event
.getStartTime();
302 long endTime
= event
.getEndTime();
303 TmfTimeRange range
= new TmfTimeRange(new CtfTmfTimestamp(startTime
), new CtfTmfTimestamp(endTime
));
304 TmfTimestamp time
= new CtfTmfTimestamp(fTimeGraphViewer
.getSelectedTime());
305 broadcast(new TmfRangeSynchSignal(ResourcesView
.this, range
, time
));
306 startZoomThread(startTime
, endTime
);
310 fTimeGraphViewer
.addTimeListener(new ITimeGraphTimeListener() {
312 public void timeSelected(TimeGraphTimeEvent event
) {
313 long time
= event
.getTime();
314 broadcast(new TmfTimeSynchSignal(ResourcesView
.this, new CtfTmfTimestamp(time
)));
318 final Thread thread
= new Thread("ResourcesView build") { //$NON-NLS-1$
321 if (TmfExperiment
.getCurrentExperiment() != null) {
322 selectExperiment(TmfExperiment
.getCurrentExperiment());
328 // View Action Handling
330 contributeToActionBars();
334 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
337 public void setFocus() {
338 fTimeGraphViewer
.setFocus();
341 // ------------------------------------------------------------------------
343 // ------------------------------------------------------------------------
346 * Handler for the ExperimentSelected signal
349 * The incoming signal
352 public void experimentSelected(final TmfExperimentSelectedSignal
<?
extends TmfEvent
> signal
) {
353 if (signal
.getExperiment().equals(fSelectedExperiment
)) {
357 final Thread thread
= new Thread("ResourcesView build") { //$NON-NLS-1$
360 selectExperiment(signal
.getExperiment());
367 * Handler for the TimeSynch signal
370 * The incoming signal
373 public void synchToTime(final TmfTimeSynchSignal signal
) {
374 if (signal
.getSource() == this || fSelectedExperiment
== null) {
377 final long time
= signal
.getCurrentTime().normalize(0, -9).getValue();
378 Display
.getDefault().asyncExec(new Runnable() {
381 if (fTimeGraphViewer
.getControl().isDisposed()) {
384 fTimeGraphViewer
.setSelectedTime(time
, true);
385 startZoomThread(fTimeGraphViewer
.getTime0(), fTimeGraphViewer
.getTime1());
391 * Handler for the RangeSynch signal
394 * The incoming signal
397 public void synchToRange(final TmfRangeSynchSignal signal
) {
398 if (signal
.getSource() == this || fSelectedExperiment
== null) {
401 final long startTime
= signal
.getCurrentRange().getStartTime().normalize(0, -9).getValue();
402 final long endTime
= signal
.getCurrentRange().getEndTime().normalize(0, -9).getValue();
403 final long time
= signal
.getCurrentTime().normalize(0, -9).getValue();
404 Display
.getDefault().asyncExec(new Runnable() {
407 if (fTimeGraphViewer
.getControl().isDisposed()) {
410 fTimeGraphViewer
.setStartFinishTime(startTime
, endTime
);
411 fTimeGraphViewer
.setSelectedTime(time
, false);
412 startZoomThread(startTime
, endTime
);
418 * Handler for the StatesystemBuildCompleted signal
421 * The incoming signal
424 public void stateSystemBuildCompleted (final TmfStateSystemBuildCompleted signal
) {
425 final TmfExperiment
<?
> selectedExperiment
= fSelectedExperiment
;
426 if (selectedExperiment
== null || selectedExperiment
.getTraces() == null) {
429 for (ITmfTrace
<?
> trace
: selectedExperiment
.getTraces()) {
430 if (trace
== signal
.getTrace() && trace
instanceof CtfKernelTrace
) {
431 final Thread thread
= new Thread("ResourcesView build") { //$NON-NLS-1$
435 selectExperiment(selectedExperiment
);
443 // ------------------------------------------------------------------------
445 // ------------------------------------------------------------------------
447 @SuppressWarnings("unchecked")
448 private void selectExperiment(TmfExperiment
<?
> experiment
) {
449 fStartTime
= Long
.MAX_VALUE
;
450 fEndTime
= Long
.MIN_VALUE
;
451 fSelectedExperiment
= (TmfExperiment
<ITmfEvent
>) experiment
;
452 ArrayList
<TraceEntry
> entryList
= new ArrayList
<TraceEntry
>();
453 for (ITmfTrace
<?
> trace
: experiment
.getTraces()) {
454 if (trace
instanceof CtfKernelTrace
) {
455 CtfKernelTrace ctfKernelTrace
= (CtfKernelTrace
) trace
;
456 IStateSystemQuerier ssq
= ctfKernelTrace
.getStateSystem();
457 long startTime
= ssq
.getStartTime();
458 long endTime
= ssq
.getCurrentEndTime() + 1;
459 TraceEntry groupEntry
= new TraceEntry(ctfKernelTrace
, trace
.getName(), startTime
, endTime
);
460 entryList
.add(groupEntry
);
461 fStartTime
= Math
.min(fStartTime
, startTime
);
462 fEndTime
= Math
.max(fEndTime
, endTime
);
463 List
<Integer
> cpuQuarks
= ssq
.getQuarks(Attributes
.CPUS
, "*"); //$NON-NLS-1$
464 ResourcesEntry
[] cpuEntries
= new ResourcesEntry
[cpuQuarks
.size()];
465 for (int i
= 0; i
< cpuQuarks
.size(); i
++) {
466 int cpuQuark
= cpuQuarks
.get(i
);
467 int cpu
= Integer
.parseInt(ssq
.getAttributeName(cpuQuark
));
468 ResourcesEntry entry
= new ResourcesEntry(cpuQuark
, ctfKernelTrace
, Type
.CPU
, cpu
);
469 groupEntry
.addChild(entry
);
470 cpuEntries
[i
] = entry
;
472 List
<Integer
> irqQuarks
= ssq
.getQuarks(Attributes
.RESOURCES
, Attributes
.IRQS
, "*"); //$NON-NLS-1$
473 ResourcesEntry
[] irqEntries
= new ResourcesEntry
[irqQuarks
.size()];
474 for (int i
= 0; i
< irqQuarks
.size(); i
++) {
475 int irqQuark
= irqQuarks
.get(i
);
476 int irq
= Integer
.parseInt(ssq
.getAttributeName(irqQuark
));
477 ResourcesEntry entry
= new ResourcesEntry(irqQuark
, ctfKernelTrace
, Type
.IRQ
, irq
);
478 groupEntry
.addChild(entry
);
479 irqEntries
[i
] = entry
;
481 List
<Integer
> softIrqQuarks
= ssq
.getQuarks(Attributes
.RESOURCES
, Attributes
.SOFT_IRQS
, "*"); //$NON-NLS-1$
482 ResourcesEntry
[] softIrqEntries
= new ResourcesEntry
[softIrqQuarks
.size()];
483 for (int i
= 0; i
< softIrqQuarks
.size(); i
++) {
484 int softIrqQuark
= softIrqQuarks
.get(i
);
485 int softIrq
= Integer
.parseInt(ssq
.getAttributeName(softIrqQuark
));
486 ResourcesEntry entry
= new ResourcesEntry(softIrqQuark
, ctfKernelTrace
, Type
.SOFT_IRQ
, softIrq
);
487 groupEntry
.addChild(entry
);
488 softIrqEntries
[i
] = entry
;
492 synchronized (fEntryListSyncObj
) {
493 fEntryList
= (ArrayList
<TraceEntry
>) entryList
.clone();
495 refresh(INITIAL_WINDOW_OFFSET
);
496 for (TraceEntry traceEntry
: entryList
) {
497 CtfKernelTrace ctfKernelTrace
= traceEntry
.getTrace();
498 IStateSystemQuerier ssq
= ctfKernelTrace
.getStateSystem();
499 long startTime
= ssq
.getStartTime();
500 long endTime
= ssq
.getCurrentEndTime() + 1;
501 long resolution
= (endTime
- startTime
) / fDisplayWidth
;
502 for (ResourcesEntry entry
: traceEntry
.getChildren()) {
503 List
<ITimeEvent
> eventList
= getEventList(entry
, startTime
, endTime
, resolution
, false, new NullProgressMonitor());
504 entry
.setEventList(eventList
);
510 private static List
<ITimeEvent
> getEventList(ResourcesEntry entry
,
511 long startTime
, long endTime
, long resolution
, boolean includeNull
,
512 IProgressMonitor monitor
) {
513 IStateSystemQuerier2 ssq
= (IStateSystemQuerier2
) entry
.getTrace().getStateSystem();
514 startTime
= Math
.max(startTime
, ssq
.getStartTime());
515 endTime
= Math
.min(endTime
, ssq
.getCurrentEndTime() + 1);
516 if (endTime
<= startTime
) {
519 List
<ITimeEvent
> eventList
= null;
520 int quark
= entry
.getQuark();
522 if (entry
.getType().equals(Type
.CPU
)) {
523 int statusQuark
= ssq
.getQuarkRelative(quark
, Attributes
.STATUS
);
524 List
<ITmfStateInterval
> statusIntervals
= ssq
.queryHistoryRange(statusQuark
, startTime
, endTime
- 1, resolution
, monitor
);
525 eventList
= new ArrayList
<ITimeEvent
>(statusIntervals
.size());
526 long lastEndTime
= -1;
527 for (ITmfStateInterval statusInterval
: statusIntervals
) {
528 if (monitor
.isCanceled()) {
531 int status
= statusInterval
.getStateValue().unboxInt();
532 long time
= statusInterval
.getStartTime();
533 long duration
= statusInterval
.getEndTime() - time
+ 1;
534 if (!statusInterval
.getStateValue().isNull()) {
535 if (lastEndTime
!= time
&& lastEndTime
!= -1) {
536 eventList
.add(new TimeEvent(entry
, lastEndTime
, time
- lastEndTime
));
538 eventList
.add(new ResourcesEvent(entry
, time
, duration
, status
));
539 lastEndTime
= time
+ duration
;
542 eventList
.add(new ResourcesEvent(entry
, time
, duration
));
546 } else if (entry
.getType().equals(Type
.IRQ
)) {
547 List
<ITmfStateInterval
> irqIntervals
= ssq
.queryHistoryRange(quark
, startTime
, endTime
- 1, resolution
, monitor
);
548 eventList
= new ArrayList
<ITimeEvent
>(irqIntervals
.size());
549 long lastEndTime
= -1;
550 boolean lastIsNull
= true;
551 for (ITmfStateInterval irqInterval
: irqIntervals
) {
552 if (monitor
.isCanceled()) {
555 long time
= irqInterval
.getStartTime();
556 long duration
= irqInterval
.getEndTime() - time
+ 1;
557 if (!irqInterval
.getStateValue().isNull()) {
558 int cpu
= irqInterval
.getStateValue().unboxInt();
559 eventList
.add(new ResourcesEvent(entry
, time
, duration
, cpu
));
562 if (lastEndTime
!= time
&& lastEndTime
!= -1 && lastIsNull
) {
563 eventList
.add(new ResourcesEvent(entry
, lastEndTime
, time
- lastEndTime
, -1));
566 eventList
.add(new ResourcesEvent(entry
, time
, duration
));
570 lastEndTime
= time
+ duration
;
572 } else if (entry
.getType().equals(Type
.SOFT_IRQ
)) {
573 List
<ITmfStateInterval
> softIrqIntervals
= ssq
.queryHistoryRange(quark
, startTime
, endTime
- 1, resolution
, monitor
);
574 eventList
= new ArrayList
<ITimeEvent
>(softIrqIntervals
.size());
575 long lastEndTime
= -1;
576 boolean lastIsNull
= true;
577 for (ITmfStateInterval softIrqInterval
: softIrqIntervals
) {
578 if (monitor
.isCanceled()) {
581 long time
= softIrqInterval
.getStartTime();
582 long duration
= softIrqInterval
.getEndTime() - time
+ 1;
583 if (!softIrqInterval
.getStateValue().isNull()) {
584 int cpu
= softIrqInterval
.getStateValue().unboxInt();
585 eventList
.add(new ResourcesEvent(entry
, time
, duration
, cpu
));
587 if (lastEndTime
!= time
&& lastEndTime
!= -1 && lastIsNull
) {
588 eventList
.add(new ResourcesEvent(entry
, lastEndTime
, time
- lastEndTime
, -1));
591 eventList
.add(new ResourcesEvent(entry
, time
, duration
));
595 lastEndTime
= time
+ duration
;
598 } catch (AttributeNotFoundException e
) {
600 } catch (TimeRangeException e
) {
602 } catch (StateValueTypeException e
) {
608 private void refresh(final long windowRange
) {
609 Display
.getDefault().asyncExec(new Runnable() {
612 if (fTimeGraphViewer
.getControl().isDisposed()) {
615 ITimeGraphEntry
[] entries
= null;
616 synchronized (fEntryListSyncObj
) {
617 entries
= fEntryList
.toArray(new ITimeGraphEntry
[0]);
619 Arrays
.sort(entries
, new TraceEntryComparator());
620 fTimeGraphViewer
.setInput(entries
);
621 fTimeGraphViewer
.setTimeBounds(fStartTime
, fEndTime
);
623 long endTime
= fStartTime
+ windowRange
;
625 if (fEndTime
< endTime
) {
628 fTimeGraphViewer
.setStartFinishTime(fStartTime
, endTime
);
630 startZoomThread(fStartTime
, endTime
);
636 private void redraw() {
637 synchronized (fSyncObj
) {
638 if (fRedrawState
== State
.IDLE
) {
639 fRedrawState
= State
.BUSY
;
641 fRedrawState
= State
.PENDING
;
645 Display
.getDefault().asyncExec(new Runnable() {
648 if (fTimeGraphViewer
.getControl().isDisposed()) {
651 fTimeGraphViewer
.getControl().redraw();
652 fTimeGraphViewer
.getControl().update();
653 synchronized (fSyncObj
) {
654 if (fRedrawState
== State
.PENDING
) {
655 fRedrawState
= State
.IDLE
;
658 fRedrawState
= State
.IDLE
;
665 private void startZoomThread(long startTime
, long endTime
) {
666 if (fZoomThread
!= null) {
667 fZoomThread
.cancel();
669 fZoomThread
= new ZoomThread(startTime
, endTime
);
673 private void makeActions() {
674 fPreviousResourceAction
= fTimeGraphViewer
.getPreviousItemAction();
675 fPreviousResourceAction
.setText(Messages
.ResourcesView_previousResourceActionNameText
);
676 fPreviousResourceAction
.setToolTipText(Messages
.ResourcesView_previousResourceActionToolTipText
);
677 fNextResourceAction
= fTimeGraphViewer
.getNextItemAction();
678 fNextResourceAction
.setText(Messages
.ResourcesView_nextResourceActionNameText
);
679 fNextResourceAction
.setToolTipText(Messages
.ResourcesView_previousResourceActionToolTipText
);
682 private void contributeToActionBars() {
683 IActionBars bars
= getViewSite().getActionBars();
684 fillLocalToolBar(bars
.getToolBarManager());
687 private void fillLocalToolBar(IToolBarManager manager
) {
688 manager
.add(fTimeGraphViewer
.getShowLegendAction());
689 manager
.add(new Separator());
690 manager
.add(fTimeGraphViewer
.getResetScaleAction());
691 manager
.add(fTimeGraphViewer
.getPreviousEventAction());
692 manager
.add(fTimeGraphViewer
.getNextEventAction());
693 manager
.add(fPreviousResourceAction
);
694 manager
.add(fNextResourceAction
);
695 manager
.add(fTimeGraphViewer
.getZoomInAction());
696 manager
.add(fTimeGraphViewer
.getZoomOutAction());
697 manager
.add(new Separator());