~ubuntu-branches/ubuntu/vivid/eclipse-linuxtools/vivid-proposed

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/TraceControlDialogFactory.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
 * Copyright (c) 2012, 2013 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
 **********************************************************************/
 
12
package org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs;
 
13
 
 
14
import org.eclipse.ui.PlatformUI;
 
15
 
 
16
/**
 
17
 * <p>
 
18
 * Factory for generating dialog boxes. It allows to overwrite the dialog implementation.
 
19
 * Useful also for testing purposes.
 
20
 * </p>
 
21
 *
 
22
 * @author Bernd Hufmann
 
23
 *
 
24
 */
 
25
public final class TraceControlDialogFactory {
 
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;
 
40
 
 
41
    /**
 
42
     * The enable channel dialog
 
43
     */
 
44
    private IEnableChannelDialog fEnableChannelDialog;
 
45
 
 
46
    /**
 
47
     * The create session dialog.
 
48
     */
 
49
    private ICreateSessionDialog fCreateSessionDialog;
 
50
 
 
51
    /**
 
52
     * The command script selection dialog.
 
53
     */
 
54
    private ISelectCommandScriptDialog fCommandScriptDialog;
 
55
 
 
56
    /**
 
57
     * The enable events dialog.
 
58
     */
 
59
    private IEnableEventsDialog fEnableEventsDialog;
 
60
 
 
61
    /**
 
62
     * The get event info dialog.
 
63
     */
 
64
    private IGetEventInfoDialog fGetEventInfoDialog;
 
65
 
 
66
    /**
 
67
     * The confirmation dialog implementation.
 
68
     */
 
69
    private IConfirmDialog fConfirmDialog;
 
70
 
 
71
    /**
 
72
     * The add context dialog implementation.
 
73
     */
 
74
    private IAddContextDialog fAddContextDialog;
 
75
 
 
76
    /**
 
77
     * The import dialog implementation.
 
78
     */
 
79
    private IImportDialog fImportDialog;
 
80
 
 
81
    /**
 
82
     * The import confirmation dialog.
 
83
     */
 
84
    private IImportConfirmationDialog fImportConfirmationDialog;
 
85
 
 
86
    // ------------------------------------------------------------------------
 
87
    // Constructors
 
88
    // ------------------------------------------------------------------------
 
89
 
 
90
    /**
 
91
     * Constructor for R4EUIDialogFactory.
 
92
     */
 
93
    private TraceControlDialogFactory() {
 
94
    }
 
95
 
 
96
    // ------------------------------------------------------------------------
 
97
    // Operations
 
98
    // ------------------------------------------------------------------------
 
99
 
 
100
    /**
 
101
     * @return TraceControlDialogFactory instance
 
102
     */
 
103
    public static synchronized TraceControlDialogFactory getInstance() {
 
104
        if (fInstance == null) {
 
105
            fInstance = new TraceControlDialogFactory();
 
106
        }
 
107
        return fInstance;
 
108
    }
 
109
 
 
110
    /**
 
111
     * @return new connection dialog
 
112
     */
 
113
    public INewConnectionDialog getNewConnectionDialog() {
 
114
        if (fNewConnectionDialog == null) {
 
115
            fNewConnectionDialog = new NewConnectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
116
        }
 
117
        return fNewConnectionDialog;
 
118
    }
 
119
 
 
120
    /**
 
121
     * Sets a new connection dialog implementation.
 
122
     * @param newConnectionDialog - new connection dialog implementation
 
123
     */
 
124
    public void setNewConnectionDialog(INewConnectionDialog newConnectionDialog) {
 
125
        fNewConnectionDialog = newConnectionDialog;
 
126
    }
 
127
 
 
128
    /**
 
129
     * @return enable channel dialog
 
130
     */
 
131
    public IEnableChannelDialog getEnableChannelDialog() {
 
132
        if (fEnableChannelDialog == null) {
 
133
            fEnableChannelDialog = new EnableChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
134
        }
 
135
        return fEnableChannelDialog;
 
136
    }
 
137
 
 
138
    /**
 
139
     * Sets a enable channel dialog implementation.
 
140
     * @param createEnableDialog - a create channel dialog implementation
 
141
     */
 
142
    public void setEnableChannelDialog(IEnableChannelDialog createEnableDialog) {
 
143
        fEnableChannelDialog = createEnableDialog;
 
144
    }
 
145
 
 
146
    /**
 
147
     * @return create session dialog implementation
 
148
     */
 
149
    public ICreateSessionDialog getCreateSessionDialog() {
 
150
        if (fCreateSessionDialog == null) {
 
151
            fCreateSessionDialog = new CreateSessionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
152
        }
 
153
        return fCreateSessionDialog;
 
154
    }
 
155
 
 
156
    /**
 
157
     * @return command script selection dialog implementation
 
158
     */
 
159
    public ISelectCommandScriptDialog getCommandScriptDialog() {
 
160
        if (fCommandScriptDialog == null) {
 
161
            fCommandScriptDialog = new OpenCommandScriptDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
162
        }
 
163
        return fCommandScriptDialog;
 
164
    }
 
165
 
 
166
    /**
 
167
     * Sets a create session dialog implementation.
 
168
     * @param createSessionDialog - a create session implementation.
 
169
     */
 
170
    public void setCreateSessionDialog(ICreateSessionDialog createSessionDialog) {
 
171
        fCreateSessionDialog = createSessionDialog;
 
172
    }
 
173
 
 
174
    /**
 
175
     * @return enable events dialog implementation.
 
176
     */
 
177
    public IEnableEventsDialog getEnableEventsDialog() {
 
178
        if (fEnableEventsDialog == null) {
 
179
            fEnableEventsDialog = new EnableEventsDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
180
        }
 
181
        return fEnableEventsDialog;
 
182
    }
 
183
 
 
184
    /**
 
185
     * Sets a enable events dialog implementation.
 
186
     * @param enableEventsDialog - a enable events dialog implementation.
 
187
     */
 
188
    public void setEnableEventsDialog(IEnableEventsDialog enableEventsDialog) {
 
189
        fEnableEventsDialog = enableEventsDialog;
 
190
    }
 
191
 
 
192
    /**
 
193
     * @return get events info dialog implementation.
 
194
     */
 
195
    public IGetEventInfoDialog getGetEventInfoDialog() {
 
196
        if (fGetEventInfoDialog == null) {
 
197
            fGetEventInfoDialog = new GetEventInfoDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
198
        }
 
199
        return fGetEventInfoDialog;
 
200
    }
 
201
 
 
202
    /**
 
203
     * Sets a get events info dialog implementation.
 
204
     * @param getEventInfoDialog - a get events info dialog implementation
 
205
     */
 
206
    public void setGetEventInfoDialog(IGetEventInfoDialog getEventInfoDialog) {
 
207
        fGetEventInfoDialog = getEventInfoDialog;
 
208
    }
 
209
 
 
210
    /**
 
211
     * @return the confirmation dialog implementation
 
212
     */
 
213
    public IConfirmDialog getConfirmDialog() {
 
214
        if (fConfirmDialog == null) {
 
215
            fConfirmDialog = new ConfirmDialog();
 
216
        }
 
217
        return fConfirmDialog;
 
218
    }
 
219
 
 
220
    /**
 
221
     * Sets the confirmation dialog implementation
 
222
     * @param confirmDialog - a confirmation dialog implementation
 
223
     */
 
224
    public void setConfirmDialog(IConfirmDialog confirmDialog) {
 
225
        fConfirmDialog = confirmDialog;
 
226
    }
 
227
 
 
228
    /**
 
229
     * @return the add context dialog implementation
 
230
     */
 
231
    public IAddContextDialog getAddContextDialog() {
 
232
        if (fAddContextDialog == null) {
 
233
            fAddContextDialog = new AddContextDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
234
        }
 
235
        return fAddContextDialog;
 
236
    }
 
237
 
 
238
    /**
 
239
     * Sets the add context dialog information
 
240
     * @param addContextDialog - a add context dialog implementation
 
241
     */
 
242
    public void setAddContextDialog(IAddContextDialog addContextDialog) {
 
243
        fAddContextDialog = addContextDialog;
 
244
    }
 
245
 
 
246
    /**
 
247
     * @return the import dialog implementation
 
248
     */
 
249
    public IImportDialog getImportDialog() {
 
250
        if (fImportDialog == null) {
 
251
            fImportDialog = new ImportDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
252
        }
 
253
        return fImportDialog;
 
254
    }
 
255
 
 
256
    /**
 
257
     * Sets the import dialog implementation.
 
258
     * @param importDialog - a import dialog implementation
 
259
     */
 
260
    public void setImportDialog(IImportDialog importDialog) {
 
261
        fImportDialog = importDialog;
 
262
    }
 
263
 
 
264
    /**
 
265
     * @return the import confirmation dialog implementation.
 
266
     */
 
267
    public IImportConfirmationDialog getImportConfirmationDialog() {
 
268
        if (fImportConfirmationDialog == null) {
 
269
            fImportConfirmationDialog = new ImportConfirmationDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
 
270
        }
 
271
        return fImportConfirmationDialog;
 
272
    }
 
273
 
 
274
    /**
 
275
     * Sets the import confirmation dialog implementation.
 
276
     * @param confirmDialog - a import confirmation dialog implementation.
 
277
     */
 
278
    public void setImportConfirmationDialog(IImportConfirmationDialog confirmDialog) {
 
279
        fImportConfirmationDialog = confirmDialog;
 
280
    }
 
281
}
 
282