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 | ||
14 | package org.eclipse.linuxtools.tmf.ui.editors; | |
15 | ||
16 | import org.eclipse.linuxtools.tmf.core.component.ITmfComponent; | |
17 | import org.eclipse.linuxtools.tmf.core.signal.TmfSignal; | |
18 | import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager; | |
19 | import org.eclipse.ui.part.EditorPart; | |
20 | ||
21 | /** | |
22 | * The main editor abstract class for use in TMF. | |
23 | * | |
24 | * @version 1.0 | |
25 | * @author Patrick Tasse | |
26 | */ | |
27 | public abstract class TmfEditor extends EditorPart implements ITmfComponent { | |
28 | ||
29 | private final String fName; | |
30 | ||
31 | // ------------------------------------------------------------------------ | |
32 | // Constructor | |
33 | // ------------------------------------------------------------------------ | |
34 | ||
35 | /** | |
36 | * Default constructor | |
37 | */ | |
38 | public TmfEditor() { | |
39 | super(); | |
40 | fName = "TmfEditor"; //$NON-NLS-1$ | |
41 | TmfSignalManager.register(this); | |
42 | } | |
43 | ||
44 | @Override | |
45 | public void dispose() { | |
46 | TmfSignalManager.deregister(this); | |
47 | super.dispose(); | |
48 | } | |
49 | ||
50 | // ------------------------------------------------------------------------ | |
51 | // ITmfComponent | |
52 | // ------------------------------------------------------------------------ | |
53 | ||
54 | @Override | |
55 | public String getName() { | |
56 | return fName; | |
57 | } | |
58 | ||
59 | @Override | |
60 | public void broadcast(TmfSignal signal) { | |
61 | TmfSignalManager.dispatchSignal(signal); | |
62 | } | |
d91063d0 BH |
63 | |
64 | /** | |
65 | * @since 3.0 | |
66 | */ | |
67 | @Override | |
68 | public void broadcastAsync(TmfSignal signal) { | |
69 | TmfSignalManager.dispatchSignalAsync(signal); | |
70 | } | |
be222f56 | 71 | } |