Commit | Line | Data |
---|---|---|
be222f56 | 1 | /******************************************************************************* |
d91063d0 | 2 | * Copyright (c) 2010, 2014 Ericsson |
be222f56 PT |
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 | * Patrick Tasse - Initial API and implementation | |
d91063d0 | 11 | * Bernd Hufmann - Add interface for broadcasting signals asynchronously |
be222f56 PT |
12 | *******************************************************************************/ |
13 | ||
2bdf0193 | 14 | package org.eclipse.tracecompass.tmf.ui.editors; |
be222f56 | 15 | |
2bdf0193 AM |
16 | import org.eclipse.tracecompass.tmf.core.component.ITmfComponent; |
17 | import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; | |
18 | import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; | |
be222f56 PT |
19 | import org.eclipse.ui.part.EditorPart; |
20 | ||
21 | /** | |
22 | * The main editor abstract class for use in TMF. | |
23 | * | |
be222f56 PT |
24 | * @author Patrick Tasse |
25 | */ | |
26 | public abstract class TmfEditor extends EditorPart implements ITmfComponent { | |
27 | ||
28 | private final String fName; | |
29 | ||
30 | // ------------------------------------------------------------------------ | |
31 | // Constructor | |
32 | // ------------------------------------------------------------------------ | |
33 | ||
34 | /** | |
35 | * Default constructor | |
36 | */ | |
37 | public TmfEditor() { | |
38 | super(); | |
39 | fName = "TmfEditor"; //$NON-NLS-1$ | |
40 | TmfSignalManager.register(this); | |
41 | } | |
42 | ||
43 | @Override | |
44 | public void dispose() { | |
45 | TmfSignalManager.deregister(this); | |
46 | super.dispose(); | |
47 | } | |
48 | ||
49 | // ------------------------------------------------------------------------ | |
50 | // ITmfComponent | |
51 | // ------------------------------------------------------------------------ | |
52 | ||
53 | @Override | |
d5efe032 | 54 | public String getName() { |
be222f56 PT |
55 | return fName; |
56 | } | |
57 | ||
58 | @Override | |
d5efe032 | 59 | public void broadcast(TmfSignal signal) { |
be222f56 PT |
60 | TmfSignalManager.dispatchSignal(signal); |
61 | } | |
d91063d0 | 62 | |
d91063d0 BH |
63 | @Override |
64 | public void broadcastAsync(TmfSignal signal) { | |
65 | TmfSignalManager.dispatchSignalAsync(signal); | |
66 | } | |
be222f56 | 67 | } |