| 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 | // 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 | */ |
| 64 | public synchronized static TraceControlDialogFactory getInstance() { |
| 65 | if (fInstance == null) { |
| 66 | fInstance = new TraceControlDialogFactory(); |
| 67 | } |
| 68 | return fInstance; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @return new connection dialog |
| 73 | */ |
| 74 | public INewConnectionDialog getNewConnectionDialog() { |
| 75 | if (fNewConnectionDialog == null) { |
| 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() { |
| 93 | if (fCreateChannelDialog == null) { |
| 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 | |
| 107 | /** |
| 108 | * @return create session dialog implementation |
| 109 | */ |
| 110 | public ICreateSessionDialog getCreateSessionDialog() { |
| 111 | if (fCreateSessionDialog == null) { |
| 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() { |
| 129 | if (fEnableEventsDialog == null) { |
| 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() { |
| 147 | if (fGetEventInfoDialog == null) { |
| 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() { |
| 165 | if (fConfirmDialog == null) { |
| 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 | |