Commit | Line | Data |
---|---|---|
eb1bab5b BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 Ericsson | |
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 | * Bernd Hufmann - Initial API and implementation | |
11 | **********************************************************************/ | |
9315aeee | 12 | package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component; |
eb1bab5b | 13 | |
115b4a01 BH |
14 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent; |
15 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponentChangedListener; | |
eb1bab5b BH |
16 | |
17 | /** | |
18 | * The class can be used to validate the listener interface. | |
19 | * | |
20 | */ | |
21 | public class ListenerValidator implements ITraceControlComponentChangedListener { | |
22 | ||
23 | // ------------------------------------------------------------------------ | |
24 | // Attributes | |
25 | // ------------------------------------------------------------------------ | |
26 | private boolean fisAddedCalled = false; | |
27 | private boolean fisRemoveCalled = false; | |
28 | private boolean fisChangedCalled = false; | |
29 | ||
30 | private ITraceControlComponent fParent = null; | |
31 | private ITraceControlComponent fChild = null; | |
32 | private ITraceControlComponent fChangedComponent = null; | |
33 | ||
34 | // ------------------------------------------------------------------------ | |
35 | // Accessors | |
36 | // ------------------------------------------------------------------------ | |
37 | public boolean isAddedCalled() { | |
38 | return fisAddedCalled; | |
39 | } | |
40 | ||
41 | public boolean isRemovedCalled() { | |
42 | return fisRemoveCalled; | |
43 | } | |
44 | ||
45 | public boolean isChangedCalled() { | |
46 | return fisChangedCalled; | |
47 | } | |
48 | ||
49 | public ITraceControlComponent getSavedParent() { | |
50 | return fParent; | |
51 | } | |
52 | ||
53 | public ITraceControlComponent getSavedChild() { | |
54 | return fChild; | |
55 | } | |
56 | ||
57 | public ITraceControlComponent getSavedComponent() { | |
58 | return fChangedComponent; | |
59 | } | |
60 | ||
61 | // ------------------------------------------------------------------------ | |
62 | // Operations | |
63 | // ------------------------------------------------------------------------ | |
64 | public void initialize() { | |
65 | fisAddedCalled = false; | |
66 | fisRemoveCalled = false; | |
67 | fisChangedCalled = false; | |
68 | fParent = null; | |
69 | fChild = null; | |
70 | fChangedComponent = null; | |
71 | } | |
72 | ||
73 | @Override | |
74 | public void componentAdded(ITraceControlComponent parent, ITraceControlComponent component) { | |
75 | fisAddedCalled = true; | |
76 | fParent = parent; | |
77 | fChild = component; | |
78 | } | |
79 | ||
80 | @Override | |
81 | public void componentRemoved(ITraceControlComponent parent, ITraceControlComponent component) { | |
82 | fisRemoveCalled = true; | |
83 | fParent = parent; | |
84 | fChild = component; | |
85 | } | |
86 | ||
87 | @Override | |
88 | public void componentChanged(ITraceControlComponent component) { | |
89 | fisChangedCalled = true; | |
90 | fParent = null; | |
91 | fChangedComponent = component; | |
92 | } | |
93 | ||
94 | } |