1 /**********************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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
10 * Bernd Hufmann - Initial API and implementation
11 * Marc-Andre Laperle - Add filtering textbox
12 **********************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.dialogs
;
15 import java
.util
.ArrayList
;
16 import java
.util
.Arrays
;
17 import java
.util
.List
;
18 import java
.util
.stream
.Collectors
;
20 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
21 import org
.eclipse
.jface
.viewers
.CheckStateChangedEvent
;
22 import org
.eclipse
.jface
.viewers
.CheckboxTreeViewer
;
23 import org
.eclipse
.jface
.viewers
.ICheckStateListener
;
24 import org
.eclipse
.jface
.viewers
.TreeViewer
;
25 import org
.eclipse
.swt
.SWT
;
26 import org
.eclipse
.swt
.events
.SelectionAdapter
;
27 import org
.eclipse
.swt
.events
.SelectionEvent
;
28 import org
.eclipse
.swt
.graphics
.Image
;
29 import org
.eclipse
.swt
.layout
.GridData
;
30 import org
.eclipse
.swt
.layout
.GridLayout
;
31 import org
.eclipse
.swt
.widgets
.Button
;
32 import org
.eclipse
.swt
.widgets
.Composite
;
33 import org
.eclipse
.swt
.widgets
.Group
;
34 import org
.eclipse
.swt
.widgets
.Label
;
35 import org
.eclipse
.swt
.widgets
.Text
;
36 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.messages
.Messages
;
37 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.ITraceControlComponent
;
38 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.BaseEventComponent
;
39 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.KernelProviderComponent
;
40 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.TraceControlContentProvider
;
41 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.TraceControlLabelProvider
;
42 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.TraceProviderGroup
;
43 import org
.eclipse
.ui
.dialogs
.FilteredTree
;
44 import org
.eclipse
.ui
.dialogs
.PatternFilter
;
48 * A composite for collecting information about kernel events to be enabled.
51 * @author Bernd Hufmann
53 public class EnableKernelEventComposite
extends Composite
implements IEnableKernelEvents
{
55 // ------------------------------------------------------------------------
57 // ------------------------------------------------------------------------
58 private enum KernelGroupEnum
{ ALL
, TRACEPOINTS
, SYSCALLS
, PROBE
, FUNCTION
}
60 // ------------------------------------------------------------------------
62 // ------------------------------------------------------------------------
65 * A button to enable/disable the all tracepoints&sycalls group
67 private Button fAllActivateButton
;
69 * A button to enable/disable the tracepoints group
71 private Button fTracepointsActivateButton
;
73 * A tree viewer for displaying and selection of available tracepoints.
75 private CheckboxTreeViewer fTracepointsViewer
;
77 * A button to enable/disable the syscalls group
79 private Button fSysCallsActivateButton
;
81 * A Text field for the specific event name.
83 private Text fSpecificEventText
;
85 * A button to enable or disable the dynamic probe group.
87 private Button fProbeActivateButton
;
89 * The text field for the event name for the dynamic probe.
91 private Text fProbeEventNameText
;
93 * The text field for the dynamic probe.
95 private Text fProbeText
;
97 * A button to enable or disable the dynamic function probe group.
99 private Button fFunctionActivateButton
;
101 * The text field for the event name for the dynamic probe.
103 private Text fFunctionEventNameText
;
105 * The text field for the dynamic function entry/return probe.
107 private Text fFunctionText
;
111 private Text fFilterText
;
113 * The referenced trace provider group containing the kernel provider
114 * component which contains a list of available tracepoints.
116 private final TraceProviderGroup fProviderGroup
;
118 * The flag indicating that all tracepoints/syscalls are selected.
120 private boolean fIsAllTracepointsAndSyscalls
;
122 * The flag indicating that tracepoints are selected.
124 private boolean fIsTracepoints
;
126 * The flag indicating that all tracepoints are selected.
128 private boolean fIsAllTracepoints
;
130 * The flag indicating that syscalls are selected.
132 private boolean fIsSysCalls
;
134 * The list of tracepoints to be enabled.
136 private List
<String
> fSelectedEvents
;
138 * The flag indicating that dynamic probe is selected.
140 private boolean fIsDynamicProbe
;
142 * The event name of the dynamic probe.
144 private String fProbeEventName
;
148 private String fProbeString
;
150 * The flag indicating that the dynamic function probe is selected.
152 private boolean fIsDynamicFunctionProbe
;
154 * The event name of the dynamic function entry/return probe.
156 private String fFunctionEventName
;
158 * The dynamic function entry/return probe.
160 private String fFunctionString
;
162 * The filter expression
164 private String fFilterExpression
;
166 // ------------------------------------------------------------------------
168 // ------------------------------------------------------------------------
174 * The parent composite
176 * The index of the style for this event composite
177 * @param providerGroup
178 * The trace provider group
180 public EnableKernelEventComposite(Composite parent
, int style
, TraceProviderGroup providerGroup
) {
181 super(parent
, style
);
182 fProviderGroup
= providerGroup
;
185 // ------------------------------------------------------------------------
187 // ------------------------------------------------------------------------
189 public boolean isAllEvents() {
190 return fIsAllTracepointsAndSyscalls
;
193 public boolean isTracepoints() {
194 return fIsTracepoints
;
198 public boolean isAllTracePoints() {
199 return fIsAllTracepoints
;
203 public boolean isSysCalls() {
208 public boolean isAllSysCalls() {
213 public List
<String
> getEventNames() {
214 return new ArrayList
<>(fSelectedEvents
);
218 public boolean isDynamicProbe() {
219 return fIsDynamicProbe
;
223 public String
getProbeName() {
228 public String
getProbeEventName() {
229 return fProbeEventName
;
233 public boolean isDynamicFunctionProbe() {
234 return fIsDynamicFunctionProbe
;
238 public String
getFunctionEventName() {
239 return fFunctionEventName
;
243 public String
getFunction() {
244 return fFunctionString
;
248 public String
getFilterExpression() {
249 return fFilterExpression
;
252 // ------------------------------------------------------------------------
254 // ------------------------------------------------------------------------
257 * Creates the composite content
259 public void createContent() {
261 // All Tracepoints/syscalls Group
262 createAllTracepointsSyscallGroup();
265 createTracepointsGroup();
268 createSysCallsGroup();
270 // Dynamic Probe Group
271 createDynamicProbeGroup();
273 // Dynamic Function Probe Group
274 createDynamicFunctionPropeGroup();
279 // Set default enablements
280 setKernelEnablements(KernelGroupEnum
.ALL
);
284 * Validates the kernel composite input data.
285 * @return true if configured data is valid and can be retrieved.
287 public boolean isValid() {
288 fIsAllTracepointsAndSyscalls
= fAllActivateButton
.getSelection();
289 fIsTracepoints
= fTracepointsActivateButton
.getSelection();
290 fIsSysCalls
= fSysCallsActivateButton
.getSelection();
291 fIsDynamicProbe
= fProbeActivateButton
.getSelection();
292 fIsDynamicFunctionProbe
= fFunctionActivateButton
.getSelection();
294 // initialize tracepoint fields
295 fIsAllTracepoints
= false;
296 fSelectedEvents
= new ArrayList
<>();
298 if (fIsTracepoints
) {
299 Object
[] checkedElements
= fTracepointsViewer
.getCheckedElements();
300 for (int i
= 0; i
< checkedElements
.length
; i
++) {
301 ITraceControlComponent component
= (ITraceControlComponent
)checkedElements
[i
];
302 if (component
instanceof BaseEventComponent
) {
303 fSelectedEvents
.add(component
.getName());
306 // verify if all events are selected
308 List
<ITraceControlComponent
> comps
= fProviderGroup
.getChildren(KernelProviderComponent
.class);
309 for (ITraceControlComponent comp
: comps
) {
310 nbEvents
+= comp
.getChildren().length
;
312 fIsAllTracepoints
= (nbEvents
== fSelectedEvents
.size());
313 String tmpSpecificEvent
= fSpecificEventText
.getText();
314 if (!fIsAllTracepoints
&& !tmpSpecificEvent
.trim().isEmpty()) {
315 // Format the text to a List<String>
316 // Removing all non visible characters
317 tmpSpecificEvent
= tmpSpecificEvent
.replaceAll("\\s", ""); //$NON-NLS-1$ //$NON-NLS-2$
318 // Splitting the different events that are separated by commas
319 List
<String
> list
= Arrays
.asList(tmpSpecificEvent
.split(",")); //$NON-NLS-1$
320 fSelectedEvents
.addAll(list
);
321 fSelectedEvents
= fSelectedEvents
.stream().distinct().collect(Collectors
.toList());
325 if (fIsDynamicProbe
) {
326 String temp
= fProbeEventNameText
.getText();
327 if (temp
.trim().isEmpty() ||
328 (!temp
.matches("^[\\s]{0,}$") && !temp
.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
329 MessageDialog
.openError(getShell(),
330 Messages
.TraceControl_EnableEventsDialogTitle
,
331 Messages
.TraceControl_InvalidProbeNameError
+ " (" + temp
+ ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
336 fProbeEventName
= temp
;
337 // fProbeString will be validated by lttng-tools
338 fProbeString
= fProbeText
.getText();
341 // initialize function string
342 fFunctionEventName
= null;
343 fFunctionString
= null;
344 if (fIsDynamicFunctionProbe
) {
345 String functionTemp
= fFunctionEventNameText
.getText();
346 if (functionTemp
.trim().isEmpty() ||
347 (!functionTemp
.matches("^[\\s]{0,}$") && !functionTemp
.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
348 MessageDialog
.openError(getShell(),
349 Messages
.TraceControl_EnableEventsDialogTitle
,
350 Messages
.TraceControl_InvalidProbeNameError
+ " (" + functionTemp
+ ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
355 fFunctionEventName
= functionTemp
;
356 // fFunctionString will be validated by lttng-tools
357 fFunctionString
= fFunctionText
.getText();
360 // initialize filter with null
361 fFilterExpression
= null;
362 if (fProviderGroup
.isEventFilteringSupported(true)) {
363 String tempFilter
= fFilterText
.getText();
365 if(!tempFilter
.trim().isEmpty()) {
366 fFilterExpression
= tempFilter
;
374 * Creates all tracepoints/syscalls group.
376 private void createAllTracepointsSyscallGroup() {
380 Group tpMainGroup
= new Group(this, SWT
.SHADOW_NONE
);
381 tpMainGroup
.setText(Messages
.TraceControl_EnableEventsAllEventsLabel
);
382 layout
= new GridLayout(2, false);
383 tpMainGroup
.setLayout(layout
);
384 data
= new GridData(GridData
.FILL_HORIZONTAL
);
385 tpMainGroup
.setLayoutData(data
);
387 Composite buttonComposite
= new Composite(tpMainGroup
, SWT
.NONE
);
388 layout
= new GridLayout(1, true);
389 buttonComposite
.setLayout(layout
);
390 data
= new GridData(SWT
.BEGINNING
, SWT
.CENTER
, false, true);
391 buttonComposite
.setLayoutData(data
);
393 fAllActivateButton
= new Button(buttonComposite
, SWT
.RADIO
);
394 fAllActivateButton
.setText(Messages
.TraceControl_EnableGroupSelectionName
);
395 fAllActivateButton
.setToolTipText(Messages
.TraceControl_EnableEventsAllEventsTooltip
);
396 data
= new GridData(GridData
.FILL_HORIZONTAL
);
397 fAllActivateButton
.setLayoutData(data
);
398 fAllActivateButton
.addSelectionListener(new SelectionAdapter() {
400 public void widgetSelected(SelectionEvent e
) {
401 setKernelEnablements(KernelGroupEnum
.ALL
);
407 * Creates tracepoints group.
409 private void createTracepointsGroup() {
413 Group tpMainGroup
= new Group(this, SWT
.SHADOW_NONE
);
414 tpMainGroup
.setText(Messages
.TraceControl_EnableEventsTracepointGroupName
);
415 layout
= new GridLayout(2, false);
416 tpMainGroup
.setLayout(layout
);
417 data
= new GridData(GridData
.FILL_BOTH
);
418 tpMainGroup
.setLayoutData(data
);
420 Composite buttonComposite
= new Composite(tpMainGroup
, SWT
.NONE
);
421 layout
= new GridLayout(1, true);
422 buttonComposite
.setLayout(layout
);
423 data
= new GridData(SWT
.BEGINNING
, SWT
.CENTER
, false, true);
424 buttonComposite
.setLayoutData(data
);
426 fTracepointsActivateButton
= new Button(buttonComposite
, SWT
.RADIO
);
427 fTracepointsActivateButton
.setText(Messages
.TraceControl_EnableGroupSelectionName
);
428 data
= new GridData(GridData
.FILL_HORIZONTAL
);
429 fTracepointsActivateButton
.setLayoutData(data
);
430 fTracepointsActivateButton
.addSelectionListener(new SelectionAdapter() {
432 public void widgetSelected(SelectionEvent e
) {
433 setKernelEnablements(KernelGroupEnum
.TRACEPOINTS
);
437 Group tracepointsGroup
= new Group(tpMainGroup
, SWT
.SHADOW_NONE
);
438 layout
= new GridLayout(1, true);
439 tracepointsGroup
.setLayout(layout
);
440 data
= new GridData(GridData
.FILL_BOTH
);
441 tracepointsGroup
.setLayoutData(data
);
443 new FilteredTree(tracepointsGroup
, SWT
.MULTI
| SWT
.H_SCROLL
| SWT
.V_SCROLL
| SWT
.BORDER
, new PatternFilter(), true) {
445 protected TreeViewer
doCreateTreeViewer(Composite aparent
, int style
) {
446 fTracepointsViewer
= new CheckboxTreeViewer(aparent
, SWT
.MULTI
| SWT
.H_SCROLL
| SWT
.V_SCROLL
);
447 fTracepointsViewer
.getTree().setToolTipText(Messages
.TraceControl_EnableEventsTracepointTreeTooltip
);
449 fTracepointsViewer
.setContentProvider(new KernelContentProvider());
450 fTracepointsViewer
.setLabelProvider(new KernelLabelProvider());
451 fTracepointsViewer
.addCheckStateListener(new KernelCheckListener());
452 fTracepointsViewer
.setInput(fProviderGroup
);
454 fTracepointsViewer
.getTree().setLayoutData(new GridData(GridData
.FILL_BOTH
));
455 return fTracepointsViewer
;
459 protected void updateToolbar(boolean visible
) {
460 super.updateToolbar(visible
);
461 treeViewer
.expandAll();
465 Group specificEventGroup
= new Group(tracepointsGroup
, SWT
.SHADOW_NONE
);
466 specificEventGroup
.setText(Messages
.TraceControl_EnableEventsSpecificEventGroupName
);
467 layout
= new GridLayout(4, true);
468 specificEventGroup
.setLayout(layout
);
469 specificEventGroup
.setLayoutData(new GridData(GridData
.FILL_HORIZONTAL
));
471 Label specificEventLabel
= new Label(specificEventGroup
, SWT
.LEFT
);
472 specificEventLabel
.setText(Messages
.TraceControl_EnableEventsEventNameLabel
);
473 data
= new GridData(GridData
.FILL_HORIZONTAL
);
474 data
.horizontalSpan
= 1;
475 specificEventLabel
.setLayoutData(data
);
477 fSpecificEventText
= new Text(specificEventGroup
, SWT
.LEFT
);
478 fSpecificEventText
.setToolTipText(Messages
.TraceControl_EnableEventsSpecificEventTooltip
);
479 data
= new GridData(GridData
.FILL_HORIZONTAL
);
480 data
.horizontalSpan
= 3;
481 fSpecificEventText
.setLayoutData(data
);
485 * Creates syscalls group.
487 private void createSysCallsGroup() {
490 Group sysCallsMainGroup
= new Group(this, SWT
.SHADOW_NONE
);
491 sysCallsMainGroup
.setText(Messages
.TraceControl_EnableEventsSyscallName
);
492 sysCallsMainGroup
.setToolTipText(Messages
.TraceControl_EnableEventsSyscallTooltip
);
493 layout
= new GridLayout(2, false);
494 sysCallsMainGroup
.setLayout(layout
);
495 data
= new GridData(GridData
.FILL_HORIZONTAL
);
496 sysCallsMainGroup
.setLayoutData(data
);
498 Composite buttonComposite
= new Composite(sysCallsMainGroup
, SWT
.NONE
);
499 layout
= new GridLayout(1, false);
500 buttonComposite
.setLayout(layout
);
501 data
= new GridData(SWT
.BEGINNING
, SWT
.CENTER
, false, true);
502 buttonComposite
.setLayoutData(data
);
504 fSysCallsActivateButton
= new Button(buttonComposite
, SWT
.RADIO
);
505 fSysCallsActivateButton
.setText(Messages
.TraceControl_EnableGroupSelectionName
);
506 fSysCallsActivateButton
.setToolTipText(Messages
.TraceControl_EnableEventsSyscallTooltip
);
507 fSysCallsActivateButton
.setSelection(false);
508 data
= new GridData(GridData
.FILL_HORIZONTAL
);
509 fSysCallsActivateButton
.setLayoutData(data
);
510 fSysCallsActivateButton
.addSelectionListener(new SelectionAdapter() {
512 public void widgetSelected(SelectionEvent e
) {
513 setKernelEnablements(KernelGroupEnum
.SYSCALLS
);
519 * Creates dynamic probe group.
521 private void createDynamicProbeGroup() {
524 Group probeMainGroup
= new Group(this, SWT
.SHADOW_NONE
);
525 probeMainGroup
.setText(Messages
.TraceControl_EnableEventsProbeGroupName
);
526 layout
= new GridLayout(2, false);
527 probeMainGroup
.setLayout(layout
);
528 data
= new GridData(GridData
.FILL_HORIZONTAL
);
529 probeMainGroup
.setLayoutData(data
);
531 Composite buttonComposite
= new Composite(probeMainGroup
, SWT
.NONE
);
532 layout
= new GridLayout(1, false);
533 buttonComposite
.setLayout(layout
);
534 data
= new GridData(SWT
.BEGINNING
, SWT
.CENTER
, false, true);
535 buttonComposite
.setLayoutData(data
);
537 fProbeActivateButton
= new Button(buttonComposite
, SWT
.RADIO
);
538 fProbeActivateButton
.setText(Messages
.TraceControl_EnableGroupSelectionName
);
539 fProbeActivateButton
.setSelection(false);
540 data
= new GridData(GridData
.FILL_HORIZONTAL
);
541 fProbeActivateButton
.setLayoutData(data
);
542 fProbeActivateButton
.addSelectionListener(new SelectionAdapter() {
544 public void widgetSelected(SelectionEvent e
) {
545 setKernelEnablements(KernelGroupEnum
.PROBE
);
549 Group probeGroup
= new Group(probeMainGroup
, SWT
.SHADOW_NONE
);
550 layout
= new GridLayout(4, true);
551 probeGroup
.setLayout(layout
);
552 probeGroup
.setLayoutData(new GridData(GridData
.FILL_HORIZONTAL
));
554 Label probeNameLabel
= new Label(probeGroup
, SWT
.LEFT
);
555 probeNameLabel
.setText(Messages
.TraceControl_EnableEventsEventNameLabel
);
556 data
= new GridData(GridData
.FILL_BOTH
);
557 data
.horizontalSpan
= 1;
558 probeNameLabel
.setLayoutData(data
);
560 fProbeEventNameText
= new Text(probeGroup
, SWT
.LEFT
);
561 fProbeEventNameText
.setToolTipText(Messages
.TraceControl_EnableEventsProbeEventNameTooltip
);
563 data
= new GridData(GridData
.FILL_BOTH
);
564 data
.horizontalSpan
= 3;
565 fProbeEventNameText
.setLayoutData(data
);
567 Label probeLabel
= new Label(probeGroup
, SWT
.LEFT
);
568 probeLabel
.setText(Messages
.TraceControl_EnableEventsProbeNameLabel
);
569 data
= new GridData(GridData
.FILL_BOTH
);
570 data
.horizontalSpan
= 1;
571 probeLabel
.setLayoutData(data
);
573 fProbeText
= new Text(probeGroup
, SWT
.LEFT
);
574 fProbeText
.setToolTipText(Messages
.TraceControl_EnableEventsProbeNameTooltip
);
575 data
= new GridData(GridData
.FILL_BOTH
);
576 data
.horizontalSpan
= 3;
577 fProbeText
.setLayoutData(data
);
581 * Creates dynamic function entry/return probe group.
583 private void createDynamicFunctionPropeGroup() {
586 Group functionMainGroup
= new Group(this, SWT
.SHADOW_NONE
);
587 functionMainGroup
.setText(Messages
.TraceControl_EnableEventsFucntionGroupName
);
588 layout
= new GridLayout(2, false);
589 functionMainGroup
.setLayout(layout
);
590 data
= new GridData(GridData
.FILL_HORIZONTAL
);
591 functionMainGroup
.setLayoutData(data
);
593 Composite buttonComposite
= new Composite(functionMainGroup
, SWT
.NONE
);
594 layout
= new GridLayout(1, false);
595 buttonComposite
.setLayout(layout
);
596 data
= new GridData(SWT
.BEGINNING
, SWT
.CENTER
, false, true);
597 buttonComposite
.setLayoutData(data
);
599 fFunctionActivateButton
= new Button(buttonComposite
, SWT
.RADIO
);
600 fFunctionActivateButton
.setText(Messages
.TraceControl_EnableGroupSelectionName
);
601 fFunctionActivateButton
.setSelection(false);
602 data
= new GridData(GridData
.FILL_HORIZONTAL
);
603 fFunctionActivateButton
.setLayoutData(data
);
604 fFunctionActivateButton
.addSelectionListener(new SelectionAdapter() {
606 public void widgetSelected(SelectionEvent e
) {
607 setKernelEnablements(KernelGroupEnum
.FUNCTION
);
611 Group functionGroup
= new Group(functionMainGroup
, SWT
.SHADOW_NONE
);
612 layout
= new GridLayout(4, true);
613 functionGroup
.setLayout(layout
);
614 functionGroup
.setLayoutData(new GridData(GridData
.FILL_HORIZONTAL
));
616 Label functionNameLabel
= new Label(functionGroup
, SWT
.LEFT
);
617 functionNameLabel
.setText(Messages
.TraceControl_EnableEventsEventNameLabel
);
618 data
= new GridData(GridData
.FILL_BOTH
);
619 data
.horizontalSpan
= 1;
620 functionNameLabel
.setLayoutData(data
);
622 fFunctionEventNameText
= new Text(functionGroup
, SWT
.LEFT
);
623 fFunctionEventNameText
.setToolTipText(Messages
.TraceControl_EnableEventsFunctionEventNameTooltip
);
624 data
= new GridData(GridData
.FILL_BOTH
);
625 data
.horizontalSpan
= 3;
626 fFunctionEventNameText
.setLayoutData(data
);
628 Label functionLabel
= new Label(functionGroup
, SWT
.LEFT
);
629 functionLabel
.setText(Messages
.TraceControl_EnableEventsFunctionNameLabel
);
630 data
= new GridData(GridData
.FILL_BOTH
);
631 data
.horizontalSpan
= 1;
632 functionLabel
.setLayoutData(data
);
634 fFunctionText
= new Text(functionGroup
, SWT
.LEFT
);
635 fFunctionText
.setToolTipText(Messages
.TraceControl_EnableEventsProbeNameTooltip
);
636 data
= new GridData(GridData
.FILL_BOTH
);
637 data
.horizontalSpan
= 3;
638 fFunctionText
.setLayoutData(data
);
642 * Enable/selects widgets depending on the group specified.
643 * @param group - group to enable.
645 private void setKernelEnablements(KernelGroupEnum group
) {
646 fAllActivateButton
.setSelection(group
== KernelGroupEnum
.ALL
);
647 fTracepointsActivateButton
.setSelection(group
== KernelGroupEnum
.TRACEPOINTS
);
648 fTracepointsViewer
.getTree().setEnabled(group
== KernelGroupEnum
.TRACEPOINTS
);
649 fSpecificEventText
.setEnabled(group
== KernelGroupEnum
.TRACEPOINTS
);
651 fSysCallsActivateButton
.setSelection(group
== KernelGroupEnum
.SYSCALLS
);
653 fProbeActivateButton
.setSelection(group
== KernelGroupEnum
.PROBE
);
654 fProbeEventNameText
.setEnabled(group
== KernelGroupEnum
.PROBE
);
655 fProbeText
.setEnabled(group
== KernelGroupEnum
.PROBE
);
657 fFunctionActivateButton
.setSelection(group
== KernelGroupEnum
.FUNCTION
);
658 fFunctionEventNameText
.setEnabled(group
== KernelGroupEnum
.FUNCTION
);
659 fFunctionText
.setEnabled(group
== KernelGroupEnum
.FUNCTION
);
662 private void createFilterGroup() {
663 if (fProviderGroup
.isEventFilteringSupported(true)) {
664 Group filterMainGroup
= new Group(this, SWT
.SHADOW_NONE
);
665 filterMainGroup
.setText(Messages
.TraceControl_EnableEventsFilterGroupName
);
666 GridLayout layout
= new GridLayout(3, false);
667 filterMainGroup
.setLayout(layout
);
668 GridData data
= new GridData(GridData
.FILL_HORIZONTAL
);
669 filterMainGroup
.setLayoutData(data
);
671 fFilterText
= new Text(filterMainGroup
, SWT
.LEFT
);
672 fFilterText
.setToolTipText(Messages
.TraceControl_EnableEventsFilterTooltip
);
673 data
= new GridData(GridData
.FILL_HORIZONTAL
);
674 fFilterText
.setLayoutData(data
);
678 // ------------------------------------------------------------------------
680 // ------------------------------------------------------------------------
682 * Content provider for the tracepoints tree.
684 public static final class KernelContentProvider
extends TraceControlContentProvider
{
686 public Object
[] getChildren(Object parentElement
) {
687 if (parentElement
instanceof TraceProviderGroup
) {
688 List
<ITraceControlComponent
> children
= ((ITraceControlComponent
)parentElement
).getChildren(KernelProviderComponent
.class);
689 return children
.toArray(new ITraceControlComponent
[children
.size()]);
691 if (parentElement
instanceof ITraceControlComponent
) {
692 return ((ITraceControlComponent
)parentElement
).getChildren();
694 return new Object
[0];
699 * Content label for the tracepoints tree.
701 public static final class KernelLabelProvider
extends TraceControlLabelProvider
{
703 public Image
getImage(Object element
) {
707 public String
getText(Object element
) {
708 if ((element
!= null) && (element
instanceof KernelProviderComponent
)) {
709 return Messages
.TraceControl_EnableEventsTracepointTreeAllLabel
;
711 return super.getText(element
);
716 * Check state listener for the tracepoints tree.
718 public final class KernelCheckListener
implements ICheckStateListener
{
720 public void checkStateChanged(CheckStateChangedEvent event
) {
721 if (event
.getChecked()) {
722 if (event
.getElement() instanceof KernelProviderComponent
) {
723 fTracepointsViewer
.setSubtreeChecked(event
.getElement(), true);
726 if (event
.getElement() instanceof KernelProviderComponent
) {
727 fTracepointsViewer
.setSubtreeChecked(event
.getElement(), false);
729 ITraceControlComponent component
= (ITraceControlComponent
) event
.getElement();
730 fTracepointsViewer
.setChecked(component
.getParent(), false);