Commit | Line | Data |
---|---|---|
b0d3496e | 1 | /******************************************************************************* |
2f2265e2 | 2 | * Copyright (c) 2009, 2010, 2012 Ericsson |
b0d3496e ASL |
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 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.ui.views; | |
14 | ||
6c13869b FC |
15 | import org.eclipse.linuxtools.tmf.core.component.ITmfComponent; |
16 | import org.eclipse.linuxtools.tmf.core.signal.TmfSignal; | |
17 | import org.eclipse.linuxtools.tmf.core.signal.TmfSignalManager; | |
b0d3496e ASL |
18 | import org.eclipse.ui.part.ViewPart; |
19 | ||
20 | /** | |
2f2265e2 BH |
21 | * Basic abstract TMF view class implementation. |
22 | * | |
23 | * It registers any sub class to the signal manager for receiving and sending | |
24 | * TMF signals. | |
25 | * | |
26 | * @version 1.0 | |
27 | * @author Francois Chouinard | |
b0d3496e ASL |
28 | */ |
29 | public abstract class TmfView extends ViewPart implements ITmfComponent { | |
30 | ||
fc6ccf6f FC |
31 | private final String fName; |
32 | ||
e31e01e8 FC |
33 | // ------------------------------------------------------------------------ |
34 | // Constructor | |
35 | // ------------------------------------------------------------------------ | |
36 | ||
2f2265e2 BH |
37 | /** |
38 | * Constructor. Creates a TMF view and registers to the signal manager. | |
39 | * | |
40 | * @param viewName A view name | |
41 | */ | |
fc6ccf6f | 42 | public TmfView(String viewName) { |
e31e01e8 | 43 | super(); |
fc6ccf6f | 44 | fName = viewName; |
2fb2eb37 | 45 | TmfSignalManager.register(this); |
b0d3496e ASL |
46 | } |
47 | ||
2f2265e2 BH |
48 | /** |
49 | * Disposes this view and deregisters itself from the signal manager | |
50 | * @see org.eclipse.ui.part.WorkbenchPart#dispose() | |
51 | */ | |
8f50c396 FC |
52 | @Override |
53 | public void dispose() { | |
2fb2eb37 | 54 | TmfSignalManager.deregister(this); |
8f50c396 FC |
55 | super.dispose(); |
56 | } | |
57 | ||
e31e01e8 FC |
58 | // ------------------------------------------------------------------------ |
59 | // ITmfComponent | |
60 | // ------------------------------------------------------------------------ | |
61 | ||
2f2265e2 BH |
62 | /* |
63 | * (non-Javadoc) | |
64 | * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#getName() | |
65 | */ | |
d4011df2 | 66 | @Override |
fc6ccf6f FC |
67 | public String getName() { |
68 | return fName; | |
69 | } | |
70 | ||
2f2265e2 BH |
71 | /* |
72 | * (non-Javadoc) | |
73 | * @see org.eclipse.linuxtools.tmf.core.component.ITmfComponent#broadcast(org.eclipse.linuxtools.tmf.core.signal.TmfSignal) | |
74 | */ | |
d4011df2 | 75 | @Override |
e31e01e8 | 76 | public void broadcast(TmfSignal signal) { |
8d2e2848 FC |
77 | TmfSignalManager.dispatchSignal(signal); |
78 | } | |
79 | ||
e31e01e8 | 80 | } |