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 | /** | |
23 | * The create channel dialog (on domain level) | |
24 | */ | |
25 | private ICreateChannelDialog fCreateChannelDialog; | |
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 | /** | |
43 | * The confirmation dialog implementation | |
44 | */ | |
45 | private IConfirmDialog fConfirmDialog; | |
46 | ||
47 | // ------------------------------------------------------------------------ | |
48 | // Constructors | |
49 | // ------------------------------------------------------------------------ | |
50 | ||
51 | /** | |
52 | * Constructor for R4EUIDialogFactory. | |
53 | */ | |
54 | private TraceControlDialogFactory() { | |
55 | } | |
56 | ||
57 | // ------------------------------------------------------------------------ | |
58 | // Operations | |
59 | // ------------------------------------------------------------------------ | |
60 | ||
61 | /** | |
62 | * @return TraceControlDialogFactory instance | |
63 | */ | |
c56972bb BH |
64 | public synchronized static TraceControlDialogFactory getInstance() { |
65 | if (fInstance == null) { | |
d132bcc7 BH |
66 | fInstance = new TraceControlDialogFactory(); |
67 | } | |
68 | return fInstance; | |
69 | } | |
70 | ||
71 | /** | |
72 | * @return new connection dialog | |
73 | */ | |
74 | public INewConnectionDialog getNewConnectionDialog() { | |
c56972bb | 75 | if (fNewConnectionDialog == null) { |
d132bcc7 BH |
76 | fNewConnectionDialog = new NewConnectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
77 | } | |
78 | return fNewConnectionDialog; | |
79 | } | |
80 | ||
81 | /** | |
82 | * Sets a new connection dialog implementation. | |
83 | * @param newConnectionDialog - new connection dialog implementation | |
84 | */ | |
85 | public void setNewConnectionDialog(INewConnectionDialog newConnectionDialog) { | |
86 | fNewConnectionDialog = newConnectionDialog; | |
87 | } | |
88 | ||
89 | /** | |
90 | * @return create channel dialog (on domain level) | |
91 | */ | |
92 | public ICreateChannelDialog getCreateChannelDialog() { | |
c56972bb | 93 | if (fCreateChannelDialog == null) { |
d132bcc7 BH |
94 | fCreateChannelDialog = new CreateChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
95 | } | |
96 | return fCreateChannelDialog; | |
97 | } | |
98 | ||
99 | /** | |
100 | * Sets a create channel dialog implementation (on domain level). | |
101 | * @param createChannelDialog - a create channel dialog implementation | |
102 | */ | |
103 | public void setCreateChannelDialog(ICreateChannelDialog createChannelDialog) { | |
104 | fCreateChannelDialog = createChannelDialog; | |
105 | } | |
106 | ||
d132bcc7 BH |
107 | /** |
108 | * @return create session dialog implementation | |
109 | */ | |
110 | public ICreateSessionDialog getCreateSessionDialog() { | |
c56972bb | 111 | if (fCreateSessionDialog == null) { |
d132bcc7 BH |
112 | fCreateSessionDialog = new CreateSessionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
113 | } | |
114 | return fCreateSessionDialog; | |
115 | } | |
116 | ||
117 | /** | |
118 | * Sets a create session dialog implementation. | |
119 | * @param createSessionDialog - a create session implementation. | |
120 | */ | |
121 | public void setCreateSessionDialog(ICreateSessionDialog createSessionDialog) { | |
122 | fCreateSessionDialog = createSessionDialog; | |
123 | } | |
124 | ||
125 | /** | |
126 | * @return enable events dialog implementation. | |
127 | */ | |
128 | public IEnableEventsDialog getEnableEventsDialog() { | |
c56972bb | 129 | if (fEnableEventsDialog == null) { |
d132bcc7 BH |
130 | fEnableEventsDialog = new EnableEventsDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
131 | } | |
132 | return fEnableEventsDialog; | |
133 | } | |
134 | ||
135 | /** | |
136 | * Sets a enable events dialog implementation. | |
137 | * @param enableEventsDialog - a enable events dialog implementation. | |
138 | */ | |
139 | public void setEnableEventsDialog(IEnableEventsDialog enableEventsDialog) { | |
140 | fEnableEventsDialog = enableEventsDialog; | |
141 | } | |
142 | ||
143 | /** | |
144 | * @return get events info dialog implementation. | |
145 | */ | |
146 | public IGetEventInfoDialog getGetEventInfoDialog() { | |
c56972bb | 147 | if (fGetEventInfoDialog == null) { |
d132bcc7 BH |
148 | fGetEventInfoDialog = new GetEventInfoDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
149 | } | |
150 | return fGetEventInfoDialog; | |
151 | } | |
152 | ||
153 | /** | |
154 | * Sets a get events info dialog implementation. | |
155 | * @param getEventInfoDialog - a get events info dialog implementation | |
156 | */ | |
157 | public void setGetEventInfoDialog(IGetEventInfoDialog getEventInfoDialog) { | |
158 | fGetEventInfoDialog = getEventInfoDialog; | |
159 | } | |
160 | ||
161 | /** | |
162 | * @return the confirmation dialog implementation | |
163 | */ | |
164 | public IConfirmDialog getConfirmDialog() { | |
c56972bb | 165 | if (fConfirmDialog == null) { |
d132bcc7 BH |
166 | fConfirmDialog = new ConfirmDialog(); |
167 | } | |
168 | return fConfirmDialog; | |
169 | } | |
170 | ||
171 | /** | |
172 | * Sets the confirmation dialog implementation | |
173 | * @param confirmDialog | |
174 | */ | |
175 | public void setConfirmDialog(IConfirmDialog confirmDialog) { | |
176 | fConfirmDialog = confirmDialog; | |
177 | } | |
178 | } | |
179 | ||
180 |