Commit | Line | Data |
---|---|---|
ccc66d01 | 1 | /********************************************************************** |
ed902a2b | 2 | * Copyright (c) 2012, 2014 Ericsson |
cfdb727a | 3 | * |
ccc66d01 BH |
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 | |
cfdb727a AM |
8 | * |
9 | * Contributors: | |
ccc66d01 | 10 | * Bernd Hufmann - Initial API and implementation |
ba3a9bd2 | 11 | * Bernd Hufmann - Updated for support of LTTng Tools 2.1 |
ccc66d01 | 12 | **********************************************************************/ |
9bc60be7 | 13 | package org.eclipse.tracecompass.internal.lttng2.control.ui.views.dialogs; |
ccc66d01 BH |
14 | |
15 | import java.util.List; | |
16 | ||
17 | import org.eclipse.jface.dialogs.Dialog; | |
18 | import org.eclipse.jface.dialogs.IDialogConstants; | |
ccc66d01 BH |
19 | import org.eclipse.swt.SWT; |
20 | import org.eclipse.swt.events.SelectionAdapter; | |
21 | import org.eclipse.swt.events.SelectionEvent; | |
22 | import org.eclipse.swt.graphics.Point; | |
23 | import org.eclipse.swt.layout.GridData; | |
24 | import org.eclipse.swt.layout.GridLayout; | |
25 | import org.eclipse.swt.widgets.Button; | |
26 | import org.eclipse.swt.widgets.Composite; | |
27 | import org.eclipse.swt.widgets.Control; | |
28 | import org.eclipse.swt.widgets.Group; | |
29 | import org.eclipse.swt.widgets.Shell; | |
a20452b1 | 30 | import org.eclipse.tracecompass.internal.lttng2.control.core.model.ITraceLogLevel; |
9bc60be7 | 31 | import org.eclipse.tracecompass.internal.lttng2.control.core.model.LogLevelType; |
74fe9bdd | 32 | import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceDomainType; |
9bc60be7 AM |
33 | import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator; |
34 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages; | |
35 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceDomainComponent; | |
36 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceProviderGroup; | |
ccc66d01 BH |
37 | |
38 | /** | |
ccc66d01 BH |
39 | * <p> |
40 | * Dialog box for collecting information events to be enabled. | |
41 | * </p> | |
cfdb727a | 42 | * |
dbd4432d | 43 | * @author Bernd Hufmann |
ccc66d01 BH |
44 | */ |
45 | public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { | |
46 | ||
47 | // ------------------------------------------------------------------------ | |
48 | // Constants | |
49 | // ------------------------------------------------------------------------ | |
cfdb727a | 50 | |
ccc66d01 BH |
51 | /** |
52 | * The icon file for this dialog box. | |
53 | */ | |
cfdb727a | 54 | public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/enable_event.gif"; //$NON-NLS-1$ |
ccc66d01 BH |
55 | |
56 | // ------------------------------------------------------------------------ | |
57 | // Attributes | |
58 | // ------------------------------------------------------------------------ | |
59 | /** | |
60 | * The dialog composite. | |
61 | */ | |
62 | private Composite fDialogComposite; | |
63 | /** | |
64 | * The composite with widgets for collecting information about kernel events. | |
65 | */ | |
66 | private EnableKernelEventComposite fKernelComposite; | |
67 | /** | |
cfdb727a | 68 | * The composite with widgets for collecting information about UST events. |
ccc66d01 BH |
69 | */ |
70 | private EnableUstEventsComposite fUstComposite; | |
a20452b1 BR |
71 | /** |
72 | * The composite with widgets for collecting information about JUL events. | |
73 | */ | |
74fe9bdd BR |
74 | private EnableLoggersComposite fJulComposite; |
75 | /** | |
76 | * The composite with widgets for collecting information about LOG4J events. | |
77 | */ | |
78 | private EnableLoggersComposite fLog4jComposite; | |
3d2d8c9f BR |
79 | /** |
80 | * The composite with widgets for collecting information about Python events. | |
81 | */ | |
82 | private EnableLoggersComposite fPythonComposite; | |
ccc66d01 BH |
83 | /** |
84 | * Radio button for selecting kernel domain. | |
85 | */ | |
86 | private Button fKernelButton; | |
87 | /** | |
88 | * Radio button for selecting UST domain. | |
89 | */ | |
90 | private Button fUstButton; | |
a20452b1 BR |
91 | /** |
92 | * Radio button for selecting JUL domain. | |
93 | */ | |
94 | private Button fJulButton; | |
74fe9bdd BR |
95 | /** |
96 | * Radio button for selecting LOG4J domain. | |
97 | */ | |
98 | private Button fLog4jButton; | |
3d2d8c9f BR |
99 | /** |
100 | * Radio button for selecting Python domain. | |
101 | */ | |
102 | private Button fPythonButton; | |
ccc66d01 | 103 | /** |
cfdb727a | 104 | * The referenced trace provider group containing the kernel provider and UST |
ccc66d01 BH |
105 | * provider component which contains a list of available tracepoints. |
106 | */ | |
107 | private TraceProviderGroup fProviderGroup; | |
108 | /** | |
cfdb727a | 109 | * The parent domain component where the channel node should be added. |
ccc66d01 BH |
110 | * Null in case the domain is not known (i.e. on session level). |
111 | */ | |
1bc37054 | 112 | private TraceDomainComponent fDomainComponent; |
ccc66d01 | 113 | /** |
1bc37054 | 114 | * The domain type ({@link TraceDomainType}) |
ccc66d01 | 115 | */ |
1bc37054 BR |
116 | private TraceDomainType fDomain; |
117 | ||
ccc66d01 BH |
118 | |
119 | // ------------------------------------------------------------------------ | |
120 | // Constructors | |
121 | // ------------------------------------------------------------------------ | |
122 | /** | |
123 | * Constructor | |
124 | * @param shell - a shell for the display of the dialog | |
ccc66d01 | 125 | */ |
d132bcc7 | 126 | public EnableEventsDialog(Shell shell) { |
ccc66d01 | 127 | super(shell); |
8a396998 | 128 | setShellStyle(SWT.RESIZE | getShellStyle()); |
ccc66d01 | 129 | } |
cfdb727a | 130 | |
ccc66d01 BH |
131 | // ------------------------------------------------------------------------ |
132 | // Accessors | |
133 | // ------------------------------------------------------------------------ | |
9ee91a86 BH |
134 | @Override |
135 | public boolean isAllEvents() { | |
a20452b1 BR |
136 | switch (fDomain) { |
137 | case KERNEL: | |
9ee91a86 | 138 | return fKernelComposite.isAllEvents(); |
a20452b1 BR |
139 | case JUL: |
140 | return fJulComposite.isAllTracePoints(); | |
141 | case UST: | |
142 | return fUstComposite.isAllTracePoints(); | |
143 | case LOG4J: | |
74fe9bdd | 144 | return fLog4jComposite.isAllTracePoints(); |
a20452b1 | 145 | case PYTHON: |
3d2d8c9f | 146 | return fPythonComposite.isAllTracePoints(); |
a20452b1 BR |
147 | case UNKNOWN: |
148 | default: | |
149 | return false; | |
9ee91a86 | 150 | } |
9ee91a86 | 151 | } |
cfdb727a | 152 | |
ccc66d01 BH |
153 | @Override |
154 | public boolean isTracepoints() { | |
a20452b1 BR |
155 | switch (fDomain) { |
156 | case JUL: | |
74fe9bdd BR |
157 | case LOG4J: |
158 | case PYTHON: | |
a20452b1 BR |
159 | // Loggers are always TRACEPOINT |
160 | return true; | |
161 | case KERNEL: | |
ccc66d01 | 162 | return fKernelComposite.isTracepoints(); |
a20452b1 BR |
163 | case UST: |
164 | return fUstComposite.isTracepoints(); | |
a20452b1 BR |
165 | case UNKNOWN: |
166 | default: | |
167 | return false; | |
ccc66d01 | 168 | } |
ccc66d01 | 169 | } |
cfdb727a | 170 | |
ccc66d01 BH |
171 | @Override |
172 | public boolean isAllTracePoints() { | |
a20452b1 BR |
173 | switch (fDomain) { |
174 | case KERNEL: | |
ccc66d01 | 175 | return fKernelComposite.isAllTracePoints(); |
a20452b1 BR |
176 | case UST: |
177 | return fUstComposite.isAllTracePoints(); | |
178 | case JUL: | |
179 | return fJulComposite.isAllTracePoints(); | |
180 | case LOG4J: | |
74fe9bdd | 181 | return fLog4jComposite.isAllTracePoints(); |
a20452b1 | 182 | case PYTHON: |
3d2d8c9f | 183 | return fPythonComposite.isAllTracePoints(); |
a20452b1 BR |
184 | case UNKNOWN: |
185 | default: | |
186 | return false; | |
ccc66d01 | 187 | } |
ccc66d01 | 188 | } |
cfdb727a | 189 | |
ccc66d01 | 190 | @Override |
207ff523 | 191 | public boolean isSyscalls() { |
1bc37054 | 192 | if (fDomain.equals(TraceDomainType.KERNEL)) { |
207ff523 | 193 | return fKernelComposite.isSyscalls(); |
ccc66d01 BH |
194 | } |
195 | return false; | |
196 | } | |
cfdb727a | 197 | |
ccc66d01 | 198 | @Override |
207ff523 | 199 | public boolean isAllSyscalls() { |
1bc37054 | 200 | if (fDomain.equals(TraceDomainType.KERNEL)) { |
207ff523 | 201 | return fKernelComposite.isAllSyscalls(); |
ccc66d01 BH |
202 | } |
203 | return false; | |
204 | } | |
cfdb727a | 205 | |
ccc66d01 BH |
206 | @Override |
207 | public List<String> getEventNames() { | |
a20452b1 BR |
208 | switch (fDomain) { |
209 | case JUL: | |
210 | return fJulComposite.getEventNames(); | |
211 | case KERNEL: | |
ccc66d01 | 212 | return fKernelComposite.getEventNames(); |
a20452b1 BR |
213 | case UST: |
214 | return fUstComposite.getEventNames(); | |
215 | case LOG4J: | |
74fe9bdd | 216 | return fLog4jComposite.getEventNames(); |
a20452b1 | 217 | case PYTHON: |
3d2d8c9f | 218 | return fPythonComposite.getEventNames(); |
a20452b1 BR |
219 | case UNKNOWN: |
220 | default: | |
221 | return null; | |
ccc66d01 | 222 | } |
ccc66d01 | 223 | } |
11252342 | 224 | |
ccc66d01 BH |
225 | @Override |
226 | public boolean isDynamicProbe() { | |
1bc37054 | 227 | if (fDomain.equals(TraceDomainType.KERNEL)) { |
ccc66d01 BH |
228 | return fKernelComposite.isDynamicProbe(); |
229 | } | |
230 | return false; | |
231 | } | |
cfdb727a | 232 | |
ccc66d01 BH |
233 | @Override |
234 | public String getProbeName() { | |
1bc37054 | 235 | if (fDomain.equals(TraceDomainType.KERNEL)) { |
ccc66d01 BH |
236 | return fKernelComposite.getProbeName(); |
237 | } | |
238 | return null; | |
239 | } | |
cfdb727a | 240 | |
ccc66d01 BH |
241 | @Override |
242 | public String getProbeEventName() { | |
1bc37054 | 243 | if (fDomain.equals(TraceDomainType.KERNEL)) { |
ccc66d01 BH |
244 | return fKernelComposite.getProbeEventName(); |
245 | } | |
246 | return null; | |
247 | } | |
cfdb727a | 248 | |
ccc66d01 BH |
249 | @Override |
250 | public boolean isDynamicFunctionProbe() { | |
1bc37054 | 251 | if (fDomain.equals(TraceDomainType.KERNEL)) { |
ccc66d01 BH |
252 | return fKernelComposite.isDynamicFunctionProbe(); |
253 | } | |
254 | return false; | |
255 | } | |
cfdb727a | 256 | |
ccc66d01 BH |
257 | @Override |
258 | public String getFunctionEventName() { | |
1bc37054 | 259 | if (fDomain.equals(TraceDomainType.KERNEL)) { |
ccc66d01 BH |
260 | return fKernelComposite.getFunctionEventName(); |
261 | } | |
262 | return null; | |
263 | } | |
cfdb727a | 264 | |
ccc66d01 BH |
265 | @Override |
266 | public String getFunction() { | |
1bc37054 | 267 | if (fDomain.equals(TraceDomainType.KERNEL)) { |
ccc66d01 BH |
268 | return fKernelComposite.getFunction(); |
269 | } | |
270 | return null; | |
271 | } | |
cfdb727a | 272 | |
ccc66d01 BH |
273 | @Override |
274 | public boolean isWildcard() { | |
1bc37054 | 275 | if (fDomain.equals(TraceDomainType.UST)) { |
ccc66d01 BH |
276 | return fUstComposite.isWildcard(); |
277 | } | |
278 | return false; | |
279 | } | |
280 | ||
ccc66d01 BH |
281 | @Override |
282 | public String getWildcard() { | |
1bc37054 | 283 | if (fDomain.equals(TraceDomainType.UST)) { |
ccc66d01 BH |
284 | return fUstComposite.getWildcard(); |
285 | } | |
286 | return null; | |
ccc66d01 BH |
287 | } |
288 | ||
ccc66d01 BH |
289 | @Override |
290 | public boolean isLogLevel() { | |
a20452b1 BR |
291 | switch (fDomain) { |
292 | case JUL: | |
293 | return fJulComposite.isLogLevel(); | |
294 | case KERNEL: | |
295 | return false; | |
296 | case UST: | |
ccc66d01 | 297 | return fUstComposite.isLogLevel(); |
a20452b1 | 298 | case LOG4J: |
74fe9bdd | 299 | return fLog4jComposite.isLogLevel(); |
a20452b1 | 300 | case PYTHON: |
3d2d8c9f | 301 | return fPythonComposite.isLogLevel(); |
a20452b1 BR |
302 | case UNKNOWN: |
303 | default: | |
304 | return false; | |
ccc66d01 | 305 | } |
ccc66d01 BH |
306 | } |
307 | ||
ccc66d01 BH |
308 | @Override |
309 | public LogLevelType getLogLevelType() { | |
a20452b1 BR |
310 | switch (fDomain) { |
311 | case JUL: | |
312 | return fJulComposite.getLogLevelType(); | |
313 | case KERNEL: | |
314 | return null; | |
315 | case UST: | |
ccc66d01 | 316 | return fUstComposite.getLogLevelType(); |
a20452b1 | 317 | case LOG4J: |
74fe9bdd | 318 | return fLog4jComposite.getLogLevelType(); |
a20452b1 | 319 | case PYTHON: |
3d2d8c9f | 320 | return fPythonComposite.getLogLevelType(); |
a20452b1 BR |
321 | case UNKNOWN: |
322 | default: | |
323 | return null; | |
ccc66d01 | 324 | } |
ccc66d01 | 325 | } |
cfdb727a | 326 | |
ccc66d01 | 327 | @Override |
a20452b1 BR |
328 | public ITraceLogLevel getLogLevel() { |
329 | switch (fDomain) { | |
330 | case JUL: | |
331 | return fJulComposite.getLogLevel(); | |
332 | case KERNEL: | |
333 | return null; | |
334 | case UST: | |
ccc66d01 | 335 | return fUstComposite.getLogLevel(); |
a20452b1 | 336 | case LOG4J: |
74fe9bdd | 337 | return fLog4jComposite.getLogLevel(); |
a20452b1 | 338 | case PYTHON: |
3d2d8c9f | 339 | return fPythonComposite.getLogLevel(); |
a20452b1 BR |
340 | case UNKNOWN: |
341 | default: | |
342 | return null; | |
ccc66d01 | 343 | } |
ccc66d01 | 344 | } |
cfdb727a | 345 | |
ccc66d01 | 346 | @Override |
1bc37054 BR |
347 | public TraceDomainType getDomain() { |
348 | return fDomain; | |
ccc66d01 | 349 | } |
cfdb727a | 350 | |
d132bcc7 BH |
351 | @Override |
352 | public void setTraceProviderGroup(TraceProviderGroup providerGroup) { | |
353 | fProviderGroup = providerGroup; | |
354 | } | |
355 | ||
d132bcc7 BH |
356 | @Override |
357 | public void setTraceDomainComponent(TraceDomainComponent domain) { | |
1bc37054 BR |
358 | fDomainComponent = domain; |
359 | if (fDomainComponent != null) { | |
360 | fDomain = fDomainComponent.getDomain(); | |
d132bcc7 | 361 | } else { |
1bc37054 BR |
362 | if (fProviderGroup != null) { |
363 | fDomain = fProviderGroup.hasKernelProvider() ? TraceDomainType.KERNEL : TraceDomainType.UST; | |
364 | } | |
d132bcc7 BH |
365 | } |
366 | } | |
ccc66d01 | 367 | |
d4514365 BH |
368 | @Override |
369 | public String getFilterExpression() { | |
1bc37054 BR |
370 | |
371 | switch (fDomain) { | |
372 | case KERNEL: | |
f0584d20 | 373 | return fKernelComposite.getFilterExpression(); |
1bc37054 BR |
374 | case UST: |
375 | return fUstComposite.getFilterExpression(); | |
376 | case JUL: | |
377 | case LOG4J: | |
378 | case PYTHON: | |
379 | case UNKNOWN: | |
380 | default: | |
381 | return null; | |
d4514365 | 382 | } |
d4514365 BH |
383 | } |
384 | ||
91dc1c3e BR |
385 | @Override |
386 | public List<String> getExcludedEvents() { | |
1bc37054 | 387 | if (fDomain.equals(TraceDomainType.UST)) { |
91dc1c3e BR |
388 | return fUstComposite.getExcludedEvents(); |
389 | } | |
390 | return null; | |
391 | } | |
392 | ||
ccc66d01 BH |
393 | // ------------------------------------------------------------------------ |
394 | // Operations | |
395 | // ------------------------------------------------------------------------ | |
11252342 | 396 | |
ccc66d01 BH |
397 | @Override |
398 | protected void configureShell(Shell newShell) { | |
399 | super.configureShell(newShell); | |
400 | newShell.setText(Messages.TraceControl_EnableEventsDialogTitle); | |
31a6a4e4 | 401 | newShell.setImage(Activator.getDefault().loadIcon(ENABLE_EVENT_ICON_FILE)); |
ccc66d01 BH |
402 | } |
403 | ||
ccc66d01 BH |
404 | @Override |
405 | protected Control createDialogArea(Composite parent) { | |
cfdb727a | 406 | |
ccc66d01 BH |
407 | // Main dialog panel |
408 | fDialogComposite = new Composite(parent, SWT.NONE); | |
409 | GridLayout layout = new GridLayout(1, true); | |
410 | fDialogComposite.setLayout(layout); | |
411 | fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); | |
412 | ||
413 | // ------------------------------------------------------------------------ | |
cfdb727a | 414 | // Domain Group |
ccc66d01 BH |
415 | // ------------------------------------------------------------------------ |
416 | Group domainGroup = new Group(fDialogComposite, SWT.SHADOW_NONE); | |
417 | domainGroup.setText(Messages.TraceControl_DomainDisplayName); | |
cfdb727a | 418 | |
ccc66d01 BH |
419 | fKernelButton = new Button(domainGroup, SWT.RADIO); |
420 | fKernelButton.setText(Messages.TraceControl_KernelDomainDisplayName); | |
ccc66d01 BH |
421 | fUstButton = new Button(domainGroup, SWT.RADIO); |
422 | fUstButton.setText(Messages.TraceControl_UstDisplayName); | |
21c9f630 BR |
423 | int nbColumns = 2; |
424 | ||
425 | fKernelButton.addSelectionListener(new SelectionAdapter() { | |
426 | @Override | |
427 | public void widgetSelected(SelectionEvent e) { | |
428 | if (fKernelButton.getSelection()) { | |
429 | disposeAllComposite(); | |
430 | createKernelComposite(); | |
431 | fDialogComposite.layout(); | |
432 | } | |
433 | } | |
434 | }); | |
435 | ||
436 | fUstButton.addSelectionListener(new SelectionAdapter() { | |
437 | @Override | |
438 | public void widgetSelected(SelectionEvent e) { | |
439 | if (fUstButton.getSelection()) { | |
440 | disposeAllComposite(); | |
441 | createUstComposite(); | |
442 | fDialogComposite.layout(); | |
443 | } | |
444 | } | |
445 | }); | |
446 | ||
447 | if (fProviderGroup.isJulLoggingSupported()) { | |
448 | fJulButton = new Button(domainGroup, SWT.RADIO); | |
449 | fJulButton.setText(Messages.TraceControl_JULDomainDisplayName); | |
450 | nbColumns++; | |
451 | fJulButton.addSelectionListener(new SelectionAdapter() { | |
452 | @Override | |
453 | public void widgetSelected(SelectionEvent e) { | |
454 | if (fJulButton.getSelection()) { | |
455 | disposeAllComposite(); | |
456 | createJulComposite(); | |
457 | fDialogComposite.layout(); | |
458 | } | |
459 | } | |
460 | }); | |
461 | } | |
462 | ||
463 | if (fProviderGroup.isLog4jLoggingSupported()) { | |
464 | fLog4jButton = new Button(domainGroup, SWT.RADIO); | |
465 | fLog4jButton.setText(Messages.TraceControl_LOG4JDomainDisplayName); | |
466 | nbColumns++; | |
467 | fLog4jButton.addSelectionListener(new SelectionAdapter() { | |
468 | @Override | |
469 | public void widgetSelected(SelectionEvent e) { | |
470 | if (fLog4jButton.getSelection()) { | |
471 | disposeAllComposite(); | |
472 | createLog4jComposite(); | |
473 | fDialogComposite.layout(); | |
474 | } | |
475 | } | |
476 | }); | |
477 | } | |
478 | ||
479 | if (fProviderGroup.isPythonLoggingSupported()) { | |
480 | fPythonButton = new Button(domainGroup, SWT.RADIO); | |
481 | fPythonButton.setText(Messages.TraceControl_PythonDomainDisplayName); | |
482 | nbColumns++; | |
483 | fPythonButton.addSelectionListener(new SelectionAdapter() { | |
484 | @Override | |
485 | public void widgetSelected(SelectionEvent e) { | |
486 | if (fPythonButton.getSelection()) { | |
487 | disposeAllComposite(); | |
488 | createPythonComposite(); | |
489 | fDialogComposite.layout(); | |
490 | } | |
491 | } | |
492 | }); | |
493 | } | |
494 | ||
495 | layout = new GridLayout(nbColumns, true); | |
496 | domainGroup.setLayout(layout); | |
ccc66d01 | 497 | |
1bc37054 BR |
498 | switch (fDomain) { |
499 | case KERNEL: | |
500 | fKernelButton.setSelection(true); | |
501 | break; | |
502 | case UST: | |
503 | fUstButton.setSelection(true); | |
504 | break; | |
505 | case JUL: | |
a20452b1 BR |
506 | fJulButton.setSelection(true); |
507 | break; | |
1bc37054 | 508 | case LOG4J: |
74fe9bdd BR |
509 | fLog4jButton.setSelection(true); |
510 | break; | |
1bc37054 | 511 | case PYTHON: |
3d2d8c9f BR |
512 | fPythonButton.setSelection(true); |
513 | break; | |
1bc37054 BR |
514 | case UNKNOWN: |
515 | default: | |
516 | break; | |
517 | } | |
518 | ||
ccc66d01 BH |
519 | // layout widgets |
520 | GridData data = new GridData(GridData.FILL_HORIZONTAL); | |
521 | domainGroup.setLayoutData(data); | |
522 | ||
523 | data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true); | |
524 | fKernelButton.setLayoutData(data); | |
525 | data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true); | |
526 | fUstButton.setLayoutData(data); | |
527 | ||
528 | // ------------------------------------------------------------------------ | |
a20452b1 | 529 | // Domain data group |
ccc66d01 | 530 | // ------------------------------------------------------------------------ |
d132bcc7 BH |
531 | fUstComposite = null; |
532 | fKernelComposite = null; | |
a20452b1 | 533 | fJulComposite = null; |
74fe9bdd | 534 | fLog4jComposite = null; |
3d2d8c9f | 535 | fPythonComposite= null; |
1bc37054 BR |
536 | |
537 | switch (fDomain) { | |
1bc37054 | 538 | case KERNEL: |
ccc66d01 | 539 | createKernelComposite(); |
1bc37054 BR |
540 | break; |
541 | case UST: | |
ccc66d01 | 542 | createUstComposite(); |
1bc37054 BR |
543 | break; |
544 | case JUL: | |
a20452b1 BR |
545 | createJulComposite(); |
546 | break; | |
1bc37054 | 547 | case LOG4J: |
74fe9bdd BR |
548 | createLog4jComposite(); |
549 | break; | |
1bc37054 | 550 | case PYTHON: |
3d2d8c9f BR |
551 | createPythonComposite(); |
552 | break; | |
1bc37054 BR |
553 | case UNKNOWN: |
554 | default: | |
555 | break; | |
ccc66d01 | 556 | } |
cfdb727a | 557 | |
21c9f630 BR |
558 | if (fDomainComponent != null) { |
559 | fKernelButton.setEnabled(false); | |
560 | fUstButton.setEnabled(false); | |
561 | if (fProviderGroup.isJulLoggingSupported()) { | |
562 | fJulButton.setEnabled(false); | |
ccc66d01 | 563 | } |
21c9f630 BR |
564 | if (fProviderGroup.isLog4jLoggingSupported()) { |
565 | fLog4jButton.setEnabled(false); | |
ccc66d01 | 566 | } |
21c9f630 BR |
567 | if (fProviderGroup.isPythonLoggingSupported()) { |
568 | fPythonButton.setEnabled(false); | |
a20452b1 | 569 | } |
21c9f630 BR |
570 | } else if ((fProviderGroup != null) && (!fProviderGroup.hasKernelProvider())) { |
571 | fKernelButton.setEnabled(false); | |
572 | fUstButton.setEnabled(true); | |
573 | if (fProviderGroup.isJulLoggingSupported()) { | |
574 | fJulButton.setEnabled(true); | |
74fe9bdd | 575 | } |
21c9f630 BR |
576 | if (fProviderGroup.isLog4jLoggingSupported()) { |
577 | fLog4jButton.setEnabled(true); | |
3d2d8c9f | 578 | } |
21c9f630 BR |
579 | if (fProviderGroup.isPythonLoggingSupported()) { |
580 | fPythonButton.setEnabled(true); | |
581 | } | |
582 | } | |
3d2d8c9f BR |
583 | |
584 | getShell().setMinimumSize(new Point(550, 850)); | |
cfdb727a | 585 | |
ccc66d01 BH |
586 | return fDialogComposite; |
587 | } | |
cfdb727a | 588 | |
ccc66d01 BH |
589 | @Override |
590 | protected void createButtonsForButtonBar(Composite parent) { | |
79c3db85 | 591 | createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", true); //$NON-NLS-1$ |
ccc66d01 BH |
592 | createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$ |
593 | } | |
594 | ||
ccc66d01 BH |
595 | @Override |
596 | protected void okPressed() { | |
1bc37054 BR |
597 | |
598 | if (fKernelButton.getSelection()) { | |
599 | fDomain = TraceDomainType.KERNEL; | |
600 | } else if (fUstButton.getSelection()){ | |
601 | fDomain = TraceDomainType.UST; | |
a20452b1 BR |
602 | } else if (fJulButton.getSelection()) { |
603 | fDomain = TraceDomainType.JUL; | |
74fe9bdd BR |
604 | } else if (fLog4jButton.getSelection()) { |
605 | fDomain= TraceDomainType.LOG4J; | |
3d2d8c9f BR |
606 | } else if (fPythonButton.getSelection()) { |
607 | fDomain = TraceDomainType.PYTHON; | |
1bc37054 | 608 | } |
ccc66d01 BH |
609 | |
610 | // Validate kernel composite in case of kernel domain | |
611 | if (fKernelComposite != null && !fKernelComposite.isValid()) { | |
612 | return; | |
613 | } | |
cfdb727a | 614 | |
a20452b1 | 615 | // Validate UST composite in case of UST domain |
ccc66d01 BH |
616 | if (fUstComposite != null && !fUstComposite.isValid()) { |
617 | return; | |
618 | } | |
cfdb727a | 619 | |
a20452b1 BR |
620 | // Validate JUL composite in case of JUL domain |
621 | if (fJulComposite != null && !fJulComposite.isValid()) { | |
622 | return; | |
623 | } | |
624 | ||
3d2d8c9f | 625 | // Validate LOG4J composite in case of LOG4J domain |
74fe9bdd BR |
626 | if (fLog4jComposite != null && !fLog4jComposite.isValid()) { |
627 | return; | |
628 | } | |
629 | ||
3d2d8c9f BR |
630 | // Validate Python composite in case of Python domain |
631 | if (fPythonComposite != null && !fPythonComposite.isValid()) { | |
632 | return; | |
633 | } | |
634 | ||
ccc66d01 BH |
635 | // validation successful -> call super.okPressed() |
636 | super.okPressed(); | |
637 | } | |
cfdb727a | 638 | |
ccc66d01 BH |
639 | // ------------------------------------------------------------------------ |
640 | // Helper methods | |
641 | // ------------------------------------------------------------------------ | |
11252342 | 642 | |
a20452b1 BR |
643 | /** |
644 | * Disposes all composites (if existing) | |
645 | */ | |
646 | private void disposeAllComposite() { | |
647 | disposeKernelComposite(); | |
648 | disposeUstComposite(); | |
649 | disposeJulComposite(); | |
74fe9bdd | 650 | disposeLog4jComposite(); |
3d2d8c9f | 651 | disposePythonComposite(); |
a20452b1 BR |
652 | } |
653 | ||
ccc66d01 BH |
654 | /** |
655 | * Creates the kernel composite (if not existing) | |
656 | */ | |
657 | private void createKernelComposite() { | |
658 | if (fKernelComposite == null) { | |
659 | fKernelComposite = new EnableKernelEventComposite(fDialogComposite, SWT.NONE, fProviderGroup); | |
660 | GridLayout layout = new GridLayout(1, true); | |
661 | fKernelComposite.setLayout(layout); | |
662 | fKernelComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); | |
663 | ||
664 | fKernelComposite.createContent(); | |
665 | } | |
666 | } | |
667 | ||
668 | /** | |
669 | * Disposes the kernel composite (if existing) | |
670 | */ | |
671 | private void disposeKernelComposite() { | |
672 | if (fKernelComposite != null) { | |
673 | fKernelComposite.dispose(); | |
674 | fKernelComposite = null; | |
675 | } | |
676 | } | |
677 | ||
678 | /** | |
679 | * Creates the UST composite (if not existing) | |
680 | */ | |
681 | private void createUstComposite() { | |
cfdb727a | 682 | if (fUstComposite == null) { |
ccc66d01 BH |
683 | fUstComposite = new EnableUstEventsComposite(fDialogComposite, SWT.NONE, fProviderGroup); |
684 | GridLayout layout = new GridLayout(1, true); | |
685 | fUstComposite.setLayout(layout); | |
686 | fUstComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); | |
687 | ||
688 | fUstComposite.createContent(); | |
689 | } | |
3d2d8c9f | 690 | } |
ccc66d01 BH |
691 | |
692 | /** | |
693 | * Disposes the UST composite (if existing) | |
694 | */ | |
695 | private void disposeUstComposite() { | |
696 | if (fUstComposite != null) { | |
697 | fUstComposite.dispose(); | |
698 | fUstComposite = null; | |
699 | } | |
700 | } | |
a20452b1 | 701 | |
a20452b1 BR |
702 | /** |
703 | * Creates the JUL composite (if not existing) | |
704 | */ | |
705 | private void createJulComposite() { | |
706 | if (fJulComposite == null) { | |
74fe9bdd | 707 | fJulComposite = new EnableLoggersComposite(fDialogComposite, SWT.NONE, fProviderGroup, TraceDomainType.JUL); |
a20452b1 BR |
708 | GridLayout layout = new GridLayout(1, true); |
709 | fJulComposite.setLayout(layout); | |
710 | fJulComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); | |
711 | ||
712 | fJulComposite.createContent(); | |
713 | } | |
714 | } | |
715 | ||
716 | /** | |
717 | * Disposes the JUL composite (if existing) | |
718 | */ | |
719 | private void disposeJulComposite() { | |
720 | if (fJulComposite != null) { | |
721 | fJulComposite.dispose(); | |
722 | fJulComposite = null; | |
723 | } | |
724 | } | |
725 | ||
74fe9bdd BR |
726 | /** |
727 | * Creates the LOG4J composite (if not existing) | |
728 | */ | |
729 | private void createLog4jComposite() { | |
730 | if (fLog4jComposite == null) { | |
731 | fLog4jComposite = new EnableLoggersComposite(fDialogComposite, SWT.NONE, fProviderGroup, TraceDomainType.LOG4J); | |
732 | GridLayout layout = new GridLayout(1, true); | |
733 | fLog4jComposite.setLayout(layout); | |
734 | fLog4jComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); | |
735 | ||
736 | fLog4jComposite.createContent(); | |
737 | } | |
738 | } | |
739 | ||
740 | /** | |
741 | * Disposes the LOG4J composite (if existing) | |
742 | */ | |
743 | private void disposeLog4jComposite() { | |
744 | if (fLog4jComposite != null) { | |
745 | fLog4jComposite.dispose(); | |
746 | fLog4jComposite = null; | |
747 | } | |
748 | } | |
3d2d8c9f BR |
749 | |
750 | /** | |
751 | * Creates the Python composite (if not existing) | |
752 | */ | |
753 | private void createPythonComposite() { | |
754 | if (fPythonComposite == null) { | |
755 | fPythonComposite = new EnableLoggersComposite(fDialogComposite, SWT.NONE, fProviderGroup, TraceDomainType.PYTHON); | |
756 | GridLayout layout = new GridLayout(1, true); | |
757 | fPythonComposite.setLayout(layout); | |
758 | fPythonComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); | |
759 | ||
760 | fPythonComposite.createContent(); | |
761 | } | |
762 | } | |
763 | ||
764 | /** | |
765 | * Disposes the Python composite (if existing) | |
766 | */ | |
767 | private void disposePythonComposite() { | |
768 | if (fPythonComposite != null) { | |
769 | fPythonComposite.dispose(); | |
770 | fPythonComposite = null; | |
771 | } | |
772 | } | |
ccc66d01 | 773 | } |