Commit | Line | Data |
---|---|---|
115b4a01 | 1 | package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs; |
d132bcc7 BH |
2 | |
3 | import org.eclipse.ui.PlatformUI; | |
4 | ||
5 | ||
c56972bb | 6 | final public class TraceControlDialogFactory { |
d132bcc7 BH |
7 | |
8 | // ------------------------------------------------------------------------ | |
9 | // Members | |
10 | // ------------------------------------------------------------------------ | |
11 | ||
12 | /** | |
13 | * The factory instance. | |
14 | */ | |
15 | private static TraceControlDialogFactory fInstance; | |
16 | ||
17 | /** | |
18 | * The new connection dialog reference. | |
19 | */ | |
20 | private INewConnectionDialog fNewConnectionDialog; | |
21 | ||
22 | /** | |
d62bfa55 | 23 | * The enable channel dialog |
d132bcc7 | 24 | */ |
d62bfa55 | 25 | private IEnableChannelDialog fEnableChannelDialog; |
d132bcc7 | 26 | |
d132bcc7 BH |
27 | /** |
28 | * The create session dialog. | |
29 | */ | |
30 | private ICreateSessionDialog fCreateSessionDialog; | |
31 | ||
32 | /** | |
33 | * The enable events dialog. | |
34 | */ | |
35 | private IEnableEventsDialog fEnableEventsDialog; | |
36 | ||
37 | /** | |
38 | * The get event info dialog. | |
39 | */ | |
40 | private IGetEventInfoDialog fGetEventInfoDialog; | |
41 | ||
42 | /** | |
291cbdbf | 43 | * The confirmation dialog implementation. |
d132bcc7 BH |
44 | */ |
45 | private IConfirmDialog fConfirmDialog; | |
b793fbe1 BH |
46 | |
47 | /** | |
291cbdbf | 48 | * The add context dialog implementation. |
b793fbe1 BH |
49 | */ |
50 | private IAddContextDialog fAddContextDialog; | |
291cbdbf BH |
51 | |
52 | /** | |
53 | * The import dialog implementation. | |
54 | */ | |
55 | private IImportDialog fImportDialog; | |
56 | ||
57 | /** | |
58 | * The import confirmation dialog. | |
59 | */ | |
60 | private IImportConfirmationDialog fImportConfirmationDialog; | |
d132bcc7 BH |
61 | |
62 | // ------------------------------------------------------------------------ | |
63 | // Constructors | |
64 | // ------------------------------------------------------------------------ | |
65 | ||
66 | /** | |
67 | * Constructor for R4EUIDialogFactory. | |
68 | */ | |
69 | private TraceControlDialogFactory() { | |
70 | } | |
71 | ||
72 | // ------------------------------------------------------------------------ | |
73 | // Operations | |
74 | // ------------------------------------------------------------------------ | |
75 | ||
76 | /** | |
77 | * @return TraceControlDialogFactory instance | |
78 | */ | |
c56972bb BH |
79 | public synchronized static TraceControlDialogFactory getInstance() { |
80 | if (fInstance == null) { | |
d132bcc7 BH |
81 | fInstance = new TraceControlDialogFactory(); |
82 | } | |
83 | return fInstance; | |
84 | } | |
85 | ||
86 | /** | |
87 | * @return new connection dialog | |
88 | */ | |
89 | public INewConnectionDialog getNewConnectionDialog() { | |
c56972bb | 90 | if (fNewConnectionDialog == null) { |
d132bcc7 BH |
91 | fNewConnectionDialog = new NewConnectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
92 | } | |
93 | return fNewConnectionDialog; | |
94 | } | |
95 | ||
96 | /** | |
97 | * Sets a new connection dialog implementation. | |
98 | * @param newConnectionDialog - new connection dialog implementation | |
99 | */ | |
100 | public void setNewConnectionDialog(INewConnectionDialog newConnectionDialog) { | |
101 | fNewConnectionDialog = newConnectionDialog; | |
102 | } | |
103 | ||
104 | /** | |
d62bfa55 | 105 | * @return enable channel dialog |
d132bcc7 | 106 | */ |
d62bfa55 BH |
107 | public IEnableChannelDialog getEnableChannelDialog() { |
108 | if (fEnableChannelDialog == null) { | |
109 | fEnableChannelDialog = new EnableChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); | |
d132bcc7 | 110 | } |
d62bfa55 | 111 | return fEnableChannelDialog; |
d132bcc7 BH |
112 | } |
113 | ||
114 | /** | |
d62bfa55 BH |
115 | * Sets a enable channel dialog implementation. |
116 | * @param createEnableDialog - a create channel dialog implementation | |
d132bcc7 | 117 | */ |
d62bfa55 BH |
118 | public void setEnableChannelDialog(IEnableChannelDialog createEnableDialog) { |
119 | fEnableChannelDialog = createEnableDialog; | |
d132bcc7 BH |
120 | } |
121 | ||
d132bcc7 BH |
122 | /** |
123 | * @return create session dialog implementation | |
124 | */ | |
125 | public ICreateSessionDialog getCreateSessionDialog() { | |
c56972bb | 126 | if (fCreateSessionDialog == null) { |
d132bcc7 BH |
127 | fCreateSessionDialog = new CreateSessionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
128 | } | |
129 | return fCreateSessionDialog; | |
130 | } | |
131 | ||
132 | /** | |
133 | * Sets a create session dialog implementation. | |
134 | * @param createSessionDialog - a create session implementation. | |
135 | */ | |
136 | public void setCreateSessionDialog(ICreateSessionDialog createSessionDialog) { | |
137 | fCreateSessionDialog = createSessionDialog; | |
138 | } | |
139 | ||
140 | /** | |
141 | * @return enable events dialog implementation. | |
142 | */ | |
143 | public IEnableEventsDialog getEnableEventsDialog() { | |
c56972bb | 144 | if (fEnableEventsDialog == null) { |
d132bcc7 BH |
145 | fEnableEventsDialog = new EnableEventsDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
146 | } | |
147 | return fEnableEventsDialog; | |
148 | } | |
149 | ||
150 | /** | |
151 | * Sets a enable events dialog implementation. | |
152 | * @param enableEventsDialog - a enable events dialog implementation. | |
153 | */ | |
154 | public void setEnableEventsDialog(IEnableEventsDialog enableEventsDialog) { | |
155 | fEnableEventsDialog = enableEventsDialog; | |
156 | } | |
157 | ||
158 | /** | |
159 | * @return get events info dialog implementation. | |
160 | */ | |
161 | public IGetEventInfoDialog getGetEventInfoDialog() { | |
c56972bb | 162 | if (fGetEventInfoDialog == null) { |
d132bcc7 BH |
163 | fGetEventInfoDialog = new GetEventInfoDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
164 | } | |
165 | return fGetEventInfoDialog; | |
166 | } | |
167 | ||
168 | /** | |
169 | * Sets a get events info dialog implementation. | |
170 | * @param getEventInfoDialog - a get events info dialog implementation | |
171 | */ | |
172 | public void setGetEventInfoDialog(IGetEventInfoDialog getEventInfoDialog) { | |
173 | fGetEventInfoDialog = getEventInfoDialog; | |
174 | } | |
175 | ||
176 | /** | |
177 | * @return the confirmation dialog implementation | |
178 | */ | |
179 | public IConfirmDialog getConfirmDialog() { | |
c56972bb | 180 | if (fConfirmDialog == null) { |
d132bcc7 BH |
181 | fConfirmDialog = new ConfirmDialog(); |
182 | } | |
183 | return fConfirmDialog; | |
184 | } | |
185 | ||
186 | /** | |
187 | * Sets the confirmation dialog implementation | |
291cbdbf | 188 | * @param confirmDialog - a confirmation dialog implementation |
d132bcc7 BH |
189 | */ |
190 | public void setConfirmDialog(IConfirmDialog confirmDialog) { | |
191 | fConfirmDialog = confirmDialog; | |
192 | } | |
b793fbe1 BH |
193 | |
194 | /** | |
195 | * @return the add context dialog implementation | |
196 | */ | |
197 | public IAddContextDialog getAddContextDialog() { | |
198 | if (fAddContextDialog == null) { | |
199 | fAddContextDialog = new AddContextDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); | |
200 | } | |
201 | return fAddContextDialog; | |
202 | } | |
203 | ||
204 | /** | |
205 | * Sets the add context dialog information | |
291cbdbf | 206 | * @param addContextDialog - a add context dialog implementation |
b793fbe1 BH |
207 | */ |
208 | public void setAddContextDialog(IAddContextDialog addContextDialog) { | |
209 | fAddContextDialog = addContextDialog; | |
210 | } | |
291cbdbf BH |
211 | |
212 | /** | |
213 | * @return the import dialog implementation | |
214 | */ | |
215 | public IImportDialog getImportDialog() { | |
216 | if (fImportDialog == null) { | |
217 | fImportDialog = new ImportDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); | |
218 | } | |
219 | return fImportDialog; | |
220 | } | |
221 | ||
222 | /** | |
223 | * Sets the import dialog implementation. | |
224 | * @param importDialog - a import dialog implementation | |
225 | */ | |
226 | public void setImportDialog(IImportDialog importDialog) { | |
227 | fImportDialog = importDialog; | |
228 | } | |
229 | ||
230 | /** | |
231 | * @return the import confirmation dialog implementation. | |
232 | */ | |
233 | public IImportConfirmationDialog getImportConfirmationDialog() { | |
234 | if (fImportConfirmationDialog == null) { | |
235 | fImportConfirmationDialog = new ImportConfirmationDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); | |
236 | } | |
237 | return fImportConfirmationDialog; | |
238 | } | |
239 | ||
240 | /** | |
241 | * Sets the import confirmation dialog implementation. | |
242 | * @param confirmDialog - a import confirmation dialog implementation. | |
243 | */ | |
244 | public void setImportConfirmationDialog(IImportConfirmationDialog confirmDialog) { | |
245 | fImportConfirmationDialog = confirmDialog; | |
246 | } | |
d132bcc7 BH |
247 | } |
248 |