| 1 | package org.eclipse.linuxtools.internal.lttng.ui.views.control.dialogs; |
| 2 | |
| 3 | import org.eclipse.ui.PlatformUI; |
| 4 | |
| 5 | |
| 6 | 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 channel dialog (on session level) |
| 29 | */ |
| 30 | private ICreateChannelOnSessionDialog fCreateChannelOnSessionDialog; |
| 31 | |
| 32 | /** |
| 33 | * The create session dialog. |
| 34 | */ |
| 35 | private ICreateSessionDialog fCreateSessionDialog; |
| 36 | |
| 37 | /** |
| 38 | * The enable events dialog. |
| 39 | */ |
| 40 | private IEnableEventsDialog fEnableEventsDialog; |
| 41 | |
| 42 | /** |
| 43 | * The get event info dialog. |
| 44 | */ |
| 45 | private IGetEventInfoDialog fGetEventInfoDialog; |
| 46 | |
| 47 | /** |
| 48 | * The confirmation dialog implementation |
| 49 | */ |
| 50 | private IConfirmDialog fConfirmDialog; |
| 51 | |
| 52 | // ------------------------------------------------------------------------ |
| 53 | // Constructors |
| 54 | // ------------------------------------------------------------------------ |
| 55 | |
| 56 | /** |
| 57 | * Constructor for R4EUIDialogFactory. |
| 58 | */ |
| 59 | private TraceControlDialogFactory() { |
| 60 | } |
| 61 | |
| 62 | // ------------------------------------------------------------------------ |
| 63 | // Operations |
| 64 | // ------------------------------------------------------------------------ |
| 65 | |
| 66 | /** |
| 67 | * @return TraceControlDialogFactory instance |
| 68 | */ |
| 69 | public static TraceControlDialogFactory getInstance() { |
| 70 | if (null == fInstance) { |
| 71 | fInstance = new TraceControlDialogFactory(); |
| 72 | } |
| 73 | return fInstance; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @return new connection dialog |
| 78 | */ |
| 79 | public INewConnectionDialog getNewConnectionDialog() { |
| 80 | if (null == fNewConnectionDialog) { |
| 81 | fNewConnectionDialog = new NewConnectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
| 82 | } |
| 83 | return fNewConnectionDialog; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Sets a new connection dialog implementation. |
| 88 | * @param newConnectionDialog - new connection dialog implementation |
| 89 | */ |
| 90 | public void setNewConnectionDialog(INewConnectionDialog newConnectionDialog) { |
| 91 | fNewConnectionDialog = newConnectionDialog; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @return create channel dialog (on domain level) |
| 96 | */ |
| 97 | public ICreateChannelDialog getCreateChannelDialog() { |
| 98 | if (null == fCreateChannelDialog) { |
| 99 | fCreateChannelDialog = new CreateChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
| 100 | } |
| 101 | return fCreateChannelDialog; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Sets a create channel dialog implementation (on domain level). |
| 106 | * @param createChannelDialog - a create channel dialog implementation |
| 107 | */ |
| 108 | public void setCreateChannelDialog(ICreateChannelDialog createChannelDialog) { |
| 109 | fCreateChannelDialog = createChannelDialog; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * @return create channel dialog (on session level) |
| 114 | */ |
| 115 | public ICreateChannelOnSessionDialog getCreateChannelOnSessionDialog() { |
| 116 | if (null == fCreateChannelOnSessionDialog) { |
| 117 | fCreateChannelOnSessionDialog = new CreateChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
| 118 | } |
| 119 | return fCreateChannelOnSessionDialog; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Sets a create channel dialog implementation (on domain level). |
| 124 | * @param createChannelDialog - a create channel dialog implementation |
| 125 | */ |
| 126 | public void setCreateChannelOnSessionDialog(ICreateChannelOnSessionDialog createChannelDialog) { |
| 127 | fCreateChannelOnSessionDialog = createChannelDialog; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * @return create session dialog implementation |
| 132 | */ |
| 133 | public ICreateSessionDialog getCreateSessionDialog() { |
| 134 | if (null == fCreateSessionDialog) { |
| 135 | fCreateSessionDialog = new CreateSessionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
| 136 | } |
| 137 | return fCreateSessionDialog; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Sets a create session dialog implementation. |
| 142 | * @param createSessionDialog - a create session implementation. |
| 143 | */ |
| 144 | public void setCreateSessionDialog(ICreateSessionDialog createSessionDialog) { |
| 145 | fCreateSessionDialog = createSessionDialog; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * @return enable events dialog implementation. |
| 150 | */ |
| 151 | public IEnableEventsDialog getEnableEventsDialog() { |
| 152 | if (null == fEnableEventsDialog) { |
| 153 | fEnableEventsDialog = new EnableEventsDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
| 154 | } |
| 155 | return fEnableEventsDialog; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Sets a enable events dialog implementation. |
| 160 | * @param enableEventsDialog - a enable events dialog implementation. |
| 161 | */ |
| 162 | public void setEnableEventsDialog(IEnableEventsDialog enableEventsDialog) { |
| 163 | fEnableEventsDialog = enableEventsDialog; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * @return get events info dialog implementation. |
| 168 | */ |
| 169 | public IGetEventInfoDialog getGetEventInfoDialog() { |
| 170 | if (null == fGetEventInfoDialog) { |
| 171 | fGetEventInfoDialog = new GetEventInfoDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
| 172 | } |
| 173 | return fGetEventInfoDialog; |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Sets a get events info dialog implementation. |
| 178 | * @param getEventInfoDialog - a get events info dialog implementation |
| 179 | */ |
| 180 | public void setGetEventInfoDialog(IGetEventInfoDialog getEventInfoDialog) { |
| 181 | fGetEventInfoDialog = getEventInfoDialog; |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * @return the confirmation dialog implementation |
| 186 | */ |
| 187 | public IConfirmDialog getConfirmDialog() { |
| 188 | if (null == fConfirmDialog) { |
| 189 | fConfirmDialog = new ConfirmDialog(); |
| 190 | } |
| 191 | return fConfirmDialog; |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Sets the confirmation dialog implementation |
| 196 | * @param confirmDialog |
| 197 | */ |
| 198 | public void setConfirmDialog(IConfirmDialog confirmDialog) { |
| 199 | fConfirmDialog = confirmDialog; |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | |