| 1 | package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs; |
| 2 | |
| 3 | import org.eclipse.ui.PlatformUI; |
| 4 | |
| 5 | |
| 6 | final public class TraceControlDialogFactory { |
| 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 | |
| 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 | * The add context dialog implementation. |
| 49 | */ |
| 50 | private IAddContextDialog fAddContextDialog; |
| 51 | |
| 52 | /** |
| 53 | * The import dialog implementation. |
| 54 | */ |
| 55 | private IImportDialog fImportDialog; |
| 56 | |
| 57 | /** |
| 58 | * The import confirmation dialog. |
| 59 | */ |
| 60 | private IImportConfirmationDialog fImportConfirmationDialog; |
| 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 | */ |
| 79 | public synchronized static TraceControlDialogFactory getInstance() { |
| 80 | if (fInstance == null) { |
| 81 | fInstance = new TraceControlDialogFactory(); |
| 82 | } |
| 83 | return fInstance; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @return new connection dialog |
| 88 | */ |
| 89 | public INewConnectionDialog getNewConnectionDialog() { |
| 90 | if (fNewConnectionDialog == null) { |
| 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 | /** |
| 105 | * @return create channel dialog (on domain level) |
| 106 | */ |
| 107 | public ICreateChannelDialog getCreateChannelDialog() { |
| 108 | if (fCreateChannelDialog == null) { |
| 109 | fCreateChannelDialog = new CreateChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
| 110 | } |
| 111 | return fCreateChannelDialog; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Sets a create channel dialog implementation (on domain level). |
| 116 | * @param createChannelDialog - a create channel dialog implementation |
| 117 | */ |
| 118 | public void setCreateChannelDialog(ICreateChannelDialog createChannelDialog) { |
| 119 | fCreateChannelDialog = createChannelDialog; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * @return create session dialog implementation |
| 124 | */ |
| 125 | public ICreateSessionDialog getCreateSessionDialog() { |
| 126 | if (fCreateSessionDialog == null) { |
| 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() { |
| 144 | if (fEnableEventsDialog == null) { |
| 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() { |
| 162 | if (fGetEventInfoDialog == null) { |
| 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() { |
| 180 | if (fConfirmDialog == null) { |
| 181 | fConfirmDialog = new ConfirmDialog(); |
| 182 | } |
| 183 | return fConfirmDialog; |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Sets the confirmation dialog implementation |
| 188 | * @param confirmDialog - a confirmation dialog implementation |
| 189 | */ |
| 190 | public void setConfirmDialog(IConfirmDialog confirmDialog) { |
| 191 | fConfirmDialog = confirmDialog; |
| 192 | } |
| 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 |
| 206 | * @param addContextDialog - a add context dialog implementation |
| 207 | */ |
| 208 | public void setAddContextDialog(IAddContextDialog addContextDialog) { |
| 209 | fAddContextDialog = addContextDialog; |
| 210 | } |
| 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 | } |
| 247 | } |
| 248 | |