requirements: Implement all level for event names and fields
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / trace / TmfTraceContext.java
CommitLineData
fc526aef 1/*******************************************************************************
deaae6e1 2 * Copyright (c) 2013, 2014 Ericsson
fc526aef
AM
3 *
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
8 *
9 * Contributors:
10 * Alexandre Montplaisir - Initial API and implementation
0fcf3b09 11 * Patrick Tasse - Support selection range
d3de0920 12 * Xavier Raynaud - Support filters tracking
fc526aef
AM
13 *******************************************************************************/
14
2bdf0193 15package org.eclipse.tracecompass.tmf.core.trace;
fc526aef 16
deaae6e1 17import org.eclipse.core.resources.IFile;
6cfc180e
GB
18import org.eclipse.jdt.annotation.NonNullByDefault;
19import org.eclipse.jdt.annotation.Nullable;
2bdf0193 20import org.eclipse.tracecompass.tmf.core.filter.ITmfFilter;
2bdf0193
AM
21import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
22import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
fc526aef
AM
23
24/**
25 * Context of a trace, which is the representation of the "view" the user
0fcf3b09 26 * currently has on this trace (window time range, selected time or time range).
fc526aef
AM
27 *
28 * TODO could be extended to support the notion of current location too.
29 *
21852dfa
AM
30 * FIXME Is this really the right place for the Editor File ?
31 *
fc526aef 32 * @author Alexandre Montplaisir
21852dfa 33 * @since 1.0
fc526aef 34 */
6cfc180e 35@NonNullByDefault
ccc49be1 36public class TmfTraceContext implements ITraceContextSignalHandler {
fc526aef 37
ccc49be1
MK
38 static final TmfTraceContext NULL_CONTEXT = new TmfTraceContext(new TmfTimeRange(TmfTimestamp.BIG_CRUNCH, TmfTimestamp.BIG_CRUNCH),
39 TmfTimeRange.NULL_RANGE, null, null);
fc526aef 40
0fcf3b09
PT
41 private final TmfTimeRange fSelection;
42 private final TmfTimeRange fWindowRange;
6cfc180e
GB
43 private final @Nullable IFile fEditorFile;
44 private final @Nullable ITmfFilter fFilter;
fc526aef 45
d3de0920 46 /**
21852dfa
AM
47 * Build a new trace context.
48 *
49 * @param selection
50 * The selected time range
51 * @param windowRange
52 * The visible window's time range
53 * @param editorFile
54 * The file representing the selected editor
d3de0920 55 * @param filter
21852dfa 56 * The currently applied filter. 'null' for none.
d3de0920 57 */
21852dfa
AM
58 public TmfTraceContext(TmfTimeRange selection, TmfTimeRange windowRange,
59 @Nullable IFile editorFile, @Nullable ITmfFilter filter) {
60 fSelection = selection;
61 fWindowRange = windowRange;
62 fEditorFile = editorFile;
d3de0920 63 fFilter = filter;
fc526aef
AM
64 }
65
21852dfa
AM
66 /**
67 * Return the time range representing the current active selection.
68 *
69 * @return The selected time range
70 */
71 public TmfTimeRange getSelectionRange() {
72 return fSelection;
0fcf3b09
PT
73 }
74
21852dfa
AM
75 /**
76 * Return the current window time range.
77 *
78 * @return The current window time range
79 */
0fcf3b09
PT
80 public TmfTimeRange getWindowRange() {
81 return fWindowRange;
fc526aef
AM
82 }
83
21852dfa
AM
84 /**
85 * Get the editor's file
86 *
87 * @return The editor file
88 */
6cfc180e 89 public @Nullable IFile getEditorFile() {
deaae6e1
PT
90 return fEditorFile;
91 }
92
d3de0920 93 /**
21852dfa
AM
94 * Gets the filter applied to the current trace
95 *
96 * @return The current filter, or <code>null</code> if there is none
d3de0920 97 */
6cfc180e 98 public @Nullable ITmfFilter getFilter() {
d3de0920
XR
99 return fFilter;
100 }
101
fc526aef
AM
102 @Override
103 public String toString() {
0fcf3b09
PT
104 return getClass().getSimpleName() + "[fSelection=" + fSelection + //$NON-NLS-1$
105 ", fWindowRange=" + fWindowRange + ']'; //$NON-NLS-1$
fc526aef 106 }
ccc49be1 107
fc526aef 108}
This page took 0.464768 seconds and 5 git commands to generate.