control: Add enhanced support for loading of sessions
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / dialogs / TraceControlDialogFactory.java
CommitLineData
dbd4432d 1/**********************************************************************
ed902a2b 2 * Copyright (c) 2012, 2014 Ericsson
77735e82 3 *
dbd4432d
BH
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
77735e82
BH
8 *
9 * Contributors:
dbd4432d
BH
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
9bc60be7 12package org.eclipse.tracecompass.internal.lttng2.control.ui.views.dialogs;
d132bcc7
BH
13
14import org.eclipse.ui.PlatformUI;
15
dbd4432d
BH
16/**
17 * <p>
18 * Factory for generating dialog boxes. It allows to overwrite the dialog implementation.
77735e82 19 * Useful also for testing purposes.
dbd4432d 20 * </p>
77735e82 21 *
dbd4432d
BH
22 * @author Bernd Hufmann
23 *
24 */
77735e82 25public final class TraceControlDialogFactory {
d132bcc7
BH
26
27 // ------------------------------------------------------------------------
28 // Members
29 // ------------------------------------------------------------------------
30
31 /**
32 * The factory instance.
33 */
34 private static TraceControlDialogFactory fInstance;
35
36 /**
37 * The new connection dialog reference.
38 */
39 private INewConnectionDialog fNewConnectionDialog;
77735e82 40
d132bcc7 41 /**
d62bfa55 42 * The enable channel dialog
d132bcc7 43 */
d62bfa55 44 private IEnableChannelDialog fEnableChannelDialog;
77735e82 45
d132bcc7
BH
46 /**
47 * The create session dialog.
48 */
49 private ICreateSessionDialog fCreateSessionDialog;
77735e82 50
64a37b87
BH
51 /**
52 * The command script selection dialog.
53 */
54 private ISelectCommandScriptDialog fCommandScriptDialog;
55
f4da4c59
BH
56 /**
57 * The command script selection dialog.
58 */
59 private ILoadDialog fLoadDialog;
60
d132bcc7
BH
61 /**
62 * The enable events dialog.
63 */
64 private IEnableEventsDialog fEnableEventsDialog;
77735e82 65
d132bcc7
BH
66 /**
67 * The get event info dialog.
68 */
69 private IGetEventInfoDialog fGetEventInfoDialog;
77735e82 70
d132bcc7 71 /**
291cbdbf 72 * The confirmation dialog implementation.
d132bcc7
BH
73 */
74 private IConfirmDialog fConfirmDialog;
77735e82 75
b793fbe1 76 /**
291cbdbf 77 * The add context dialog implementation.
b793fbe1
BH
78 */
79 private IAddContextDialog fAddContextDialog;
77735e82 80
d132bcc7
BH
81 // ------------------------------------------------------------------------
82 // Constructors
83 // ------------------------------------------------------------------------
84
85 /**
86 * Constructor for R4EUIDialogFactory.
87 */
88 private TraceControlDialogFactory() {
89 }
90
91 // ------------------------------------------------------------------------
92 // Operations
93 // ------------------------------------------------------------------------
94
95 /**
96 * @return TraceControlDialogFactory instance
97 */
046b6849 98 public static synchronized TraceControlDialogFactory getInstance() {
c56972bb 99 if (fInstance == null) {
d132bcc7
BH
100 fInstance = new TraceControlDialogFactory();
101 }
102 return fInstance;
103 }
104
105 /**
106 * @return new connection dialog
107 */
108 public INewConnectionDialog getNewConnectionDialog() {
c56972bb 109 if (fNewConnectionDialog == null) {
d132bcc7
BH
110 fNewConnectionDialog = new NewConnectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
111 }
112 return fNewConnectionDialog;
113 }
114
115 /**
116 * Sets a new connection dialog implementation.
117 * @param newConnectionDialog - new connection dialog implementation
118 */
119 public void setNewConnectionDialog(INewConnectionDialog newConnectionDialog) {
120 fNewConnectionDialog = newConnectionDialog;
121 }
77735e82 122
d132bcc7 123 /**
d62bfa55 124 * @return enable channel dialog
d132bcc7 125 */
d62bfa55
BH
126 public IEnableChannelDialog getEnableChannelDialog() {
127 if (fEnableChannelDialog == null) {
128 fEnableChannelDialog = new EnableChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
d132bcc7 129 }
d62bfa55 130 return fEnableChannelDialog;
d132bcc7
BH
131 }
132
133 /**
d62bfa55
BH
134 * Sets a enable channel dialog implementation.
135 * @param createEnableDialog - a create channel dialog implementation
d132bcc7 136 */
d62bfa55
BH
137 public void setEnableChannelDialog(IEnableChannelDialog createEnableDialog) {
138 fEnableChannelDialog = createEnableDialog;
d132bcc7 139 }
77735e82 140
d132bcc7
BH
141 /**
142 * @return create session dialog implementation
143 */
144 public ICreateSessionDialog getCreateSessionDialog() {
c56972bb 145 if (fCreateSessionDialog == null) {
d132bcc7
BH
146 fCreateSessionDialog = new CreateSessionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
147 }
148 return fCreateSessionDialog;
149 }
150
64a37b87
BH
151 /**
152 * @return command script selection dialog implementation
153 */
154 public ISelectCommandScriptDialog getCommandScriptDialog() {
155 if (fCommandScriptDialog == null) {
156 fCommandScriptDialog = new OpenCommandScriptDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
157 }
158 return fCommandScriptDialog;
159 }
160
f4da4c59
BH
161 /**
162 * @return command script selection dialog implementation
163 */
164 public ILoadDialog getLoadDialog() {
165 if (fLoadDialog == null) {
166 fLoadDialog = new LoadDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
167 }
168 return fLoadDialog;
169 }
170
171 /**
172 * Sets a load dialog implementation
173 * @param loadDialog
174 * a load dialog implementation
175 */
176 public void setLoadDialog(ILoadDialog loadDialog) {
177 fLoadDialog = loadDialog;
178 }
179
d132bcc7
BH
180 /**
181 * Sets a create session dialog implementation.
182 * @param createSessionDialog - a create session implementation.
183 */
184 public void setCreateSessionDialog(ICreateSessionDialog createSessionDialog) {
185 fCreateSessionDialog = createSessionDialog;
186 }
187
188 /**
189 * @return enable events dialog implementation.
190 */
191 public IEnableEventsDialog getEnableEventsDialog() {
c56972bb 192 if (fEnableEventsDialog == null) {
d132bcc7
BH
193 fEnableEventsDialog = new EnableEventsDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
194 }
195 return fEnableEventsDialog;
196 }
197
198 /**
199 * Sets a enable events dialog implementation.
200 * @param enableEventsDialog - a enable events dialog implementation.
201 */
202 public void setEnableEventsDialog(IEnableEventsDialog enableEventsDialog) {
203 fEnableEventsDialog = enableEventsDialog;
204 }
205
206 /**
207 * @return get events info dialog implementation.
208 */
209 public IGetEventInfoDialog getGetEventInfoDialog() {
c56972bb 210 if (fGetEventInfoDialog == null) {
d132bcc7
BH
211 fGetEventInfoDialog = new GetEventInfoDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
212 }
213 return fGetEventInfoDialog;
214 }
215
216 /**
217 * Sets a get events info dialog implementation.
218 * @param getEventInfoDialog - a get events info dialog implementation
219 */
220 public void setGetEventInfoDialog(IGetEventInfoDialog getEventInfoDialog) {
221 fGetEventInfoDialog = getEventInfoDialog;
222 }
77735e82 223
d132bcc7
BH
224 /**
225 * @return the confirmation dialog implementation
226 */
227 public IConfirmDialog getConfirmDialog() {
c56972bb 228 if (fConfirmDialog == null) {
d132bcc7
BH
229 fConfirmDialog = new ConfirmDialog();
230 }
231 return fConfirmDialog;
232 }
77735e82 233
d132bcc7
BH
234 /**
235 * Sets the confirmation dialog implementation
291cbdbf 236 * @param confirmDialog - a confirmation dialog implementation
d132bcc7
BH
237 */
238 public void setConfirmDialog(IConfirmDialog confirmDialog) {
239 fConfirmDialog = confirmDialog;
240 }
77735e82 241
b793fbe1
BH
242 /**
243 * @return the add context dialog implementation
244 */
245 public IAddContextDialog getAddContextDialog() {
246 if (fAddContextDialog == null) {
247 fAddContextDialog = new AddContextDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
248 }
249 return fAddContextDialog;
250 }
77735e82 251
b793fbe1
BH
252 /**
253 * Sets the add context dialog information
291cbdbf 254 * @param addContextDialog - a add context dialog implementation
b793fbe1
BH
255 */
256 public void setAddContextDialog(IAddContextDialog addContextDialog) {
257 fAddContextDialog = addContextDialog;
258 }
77735e82 259
d132bcc7
BH
260}
261
This page took 0.089278 seconds and 5 git commands to generate.