control: Support for filtering of kernel events
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / dialogs / EnableKernelEventComposite.java
1 /**********************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
3 *
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
8 *
9 * Contributors:
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;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.eclipse.jface.dialogs.MessageDialog;
19 import org.eclipse.jface.viewers.CheckStateChangedEvent;
20 import org.eclipse.jface.viewers.CheckboxTreeViewer;
21 import org.eclipse.jface.viewers.ICheckStateListener;
22 import org.eclipse.jface.viewers.TreeViewer;
23 import org.eclipse.swt.SWT;
24 import org.eclipse.swt.events.SelectionAdapter;
25 import org.eclipse.swt.events.SelectionEvent;
26 import org.eclipse.swt.graphics.Image;
27 import org.eclipse.swt.layout.GridData;
28 import org.eclipse.swt.layout.GridLayout;
29 import org.eclipse.swt.widgets.Button;
30 import org.eclipse.swt.widgets.Composite;
31 import org.eclipse.swt.widgets.Group;
32 import org.eclipse.swt.widgets.Label;
33 import org.eclipse.swt.widgets.Text;
34 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages;
35 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponent;
36 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.BaseEventComponent;
37 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.KernelProviderComponent;
38 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceControlContentProvider;
39 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceControlLabelProvider;
40 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceProviderGroup;
41 import org.eclipse.ui.dialogs.FilteredTree;
42 import org.eclipse.ui.dialogs.PatternFilter;
43
44 /**
45 * <p>
46 * A composite for collecting information about kernel events to be enabled.
47 * </p>
48 *
49 * @author Bernd Hufmann
50 */
51 public class EnableKernelEventComposite extends Composite implements IEnableKernelEvents {
52
53 // ------------------------------------------------------------------------
54 // Constants
55 // ------------------------------------------------------------------------
56 private enum KernelGroupEnum { TRACEPOINTS, SYSCALLS, PROBE, FUNCTION }
57
58 // ------------------------------------------------------------------------
59 // Attributes
60 // ------------------------------------------------------------------------
61
62 /**
63 * A button to enable/disable the tracepoints group
64 */
65 private Button fTracepointsActivateButton;
66 /**
67 * A tree viewer for displaying and selection of available tracepoints.
68 */
69 private CheckboxTreeViewer fTracepointsViewer;
70 /**
71 * A button to enable/disable the syscalls group
72 */
73 private Button fSysCallsActivateButton;
74 /**
75 * A button to enable or disable the dynamic probe group.
76 */
77 private Button fProbeActivateButton;
78 /**
79 * The text field for the event name for the dynamic probe.
80 */
81 private Text fProbeEventNameText;
82 /**
83 * The text field for the dynamic probe.
84 */
85 private Text fProbeText;
86 /**
87 * A button to enable or disable the dynamic function probe group.
88 */
89 private Button fFunctionActivateButton;
90 /**
91 * The text field for the event name for the dynamic probe.
92 */
93 private Text fFunctionEventNameText;
94 /**
95 * The text field for the dynamic function entry/return probe.
96 */
97 private Text fFunctionText;
98 /**
99 * The filter text
100 */
101 private Text fFilterText;
102 /**
103 * The referenced trace provider group containing the kernel provider
104 * component which contains a list of available tracepoints.
105 */
106 private final TraceProviderGroup fProviderGroup;
107 /**
108 * The flag indicating that tracepoints are selected.
109 */
110 private boolean fIsTracepoints;
111 /**
112 * The flag indicating that all tracepoints are selected.
113 */
114 private boolean fIsAllTracepoints;
115 /**
116 * The flag indicating that syscalls are selected.
117 */
118 private boolean fIsSysCalls;
119 /**
120 * The list of tracepoints to be enabled.
121 */
122 private List<String> fSelectedEvents;
123 /**
124 * The flag indicating that dynamic probe is selected.
125 */
126 private boolean fIsDynamicProbe;
127 /**
128 * The event name of the dynamic probe.
129 */
130 private String fProbeEventName;
131 /**
132 * The dynamic probe.
133 */
134 private String fProbeString;
135 /**
136 * The flag indicating that the dynamic function probe is selected.
137 */
138 private boolean fIsDynamicFunctionProbe;
139 /**
140 * The event name of the dynamic function entry/return probe.
141 */
142 private String fFunctionEventName;
143 /**
144 * The dynamic function entry/return probe.
145 */
146 private String fFunctionString;
147 /**
148 * The filter expression
149 */
150 private String fFilterExpression;
151
152 // ------------------------------------------------------------------------
153 // Constructors
154 // ------------------------------------------------------------------------
155
156 /**
157 * Constructor
158 *
159 * @param parent
160 * The parent composite
161 * @param style
162 * The index of the style for this event composite
163 * @param providerGroup
164 * The trace provider group
165 */
166 public EnableKernelEventComposite(Composite parent, int style, TraceProviderGroup providerGroup) {
167 super(parent, style);
168 fProviderGroup = providerGroup;
169 }
170
171 // ------------------------------------------------------------------------
172 // Acessors
173 // ------------------------------------------------------------------------
174
175 @Override
176 public boolean isTracepoints() {
177 return fIsTracepoints;
178 }
179
180 @Override
181 public boolean isAllTracePoints() {
182 return fIsAllTracepoints;
183 }
184
185 @Override
186 public boolean isSysCalls() {
187 return fIsSysCalls;
188 }
189
190 @Override
191 public boolean isAllSysCalls() {
192 return fIsSysCalls;
193 }
194
195 @Override
196 public List<String> getEventNames() {
197 return new ArrayList<>(fSelectedEvents);
198 }
199
200 @Override
201 public boolean isDynamicProbe() {
202 return fIsDynamicProbe;
203 }
204
205 @Override
206 public String getProbeName() {
207 return fProbeString;
208 }
209
210 @Override
211 public String getProbeEventName() {
212 return fProbeEventName;
213 }
214
215 @Override
216 public boolean isDynamicFunctionProbe() {
217 return fIsDynamicFunctionProbe;
218 }
219
220 @Override
221 public String getFunctionEventName() {
222 return fFunctionEventName;
223 }
224
225 @Override
226 public String getFunction() {
227 return fFunctionString;
228 }
229
230 @Override
231 public String getFilterExpression() {
232 return fFilterExpression;
233 }
234
235 // ------------------------------------------------------------------------
236 // Operations
237 // ------------------------------------------------------------------------
238
239 /**
240 * Creates the composite content
241 */
242 public void createContent() {
243
244 // Tracepoints Group
245 createTracepointsGroup();
246
247 // Syscalls Group
248 createSysCallsGroup();
249
250 // Dynamic Probe Group
251 createDynamicProbeGroup();
252
253 // Dynamic Function Probe Group
254 createDynamicFunctionPropeGroup();
255
256 // Filter Group
257 createFilterGroup();
258
259 // Set default enablements
260 setKernelEnablements(KernelGroupEnum.TRACEPOINTS);
261 }
262
263 /**
264 * Validates the kernel composite input data.
265 * @return true if configured data is valid and can be retrieved.
266 */
267 public boolean isValid() {
268 fIsTracepoints = fTracepointsActivateButton.getSelection();
269 fIsSysCalls = fSysCallsActivateButton.getSelection();
270 fIsDynamicProbe = fProbeActivateButton.getSelection();
271 fIsDynamicFunctionProbe = fFunctionActivateButton.getSelection();
272
273 // initialize tracepoint fields
274 fIsAllTracepoints = false;
275 fSelectedEvents = new ArrayList<>();
276
277 if (fIsTracepoints) {
278 Object[] checkedElements = fTracepointsViewer.getCheckedElements();
279 for (int i = 0; i < checkedElements.length; i++) {
280 ITraceControlComponent component = (ITraceControlComponent)checkedElements[i];
281 if (component instanceof BaseEventComponent) {
282 fSelectedEvents.add(component.getName());
283 }
284 }
285 // verify if all events are selected
286 int nbEvents = 0;
287 List<ITraceControlComponent> comps = fProviderGroup.getChildren(KernelProviderComponent.class);
288 for (ITraceControlComponent comp : comps) {
289 nbEvents += comp.getChildren().length;
290 }
291 fIsAllTracepoints = (nbEvents == fSelectedEvents.size());
292 }
293
294 if (fIsDynamicProbe) {
295 String temp = fProbeEventNameText.getText();
296 if (temp.isEmpty() ||
297 fProbeText.getText().matches("\\s*") || //$NON-NLS-1$
298 (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
299 MessageDialog.openError(getShell(),
300 Messages.TraceControl_EnableEventsDialogTitle,
301 Messages.TraceControl_InvalidProbeNameError + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
302
303 return false;
304 }
305
306 fProbeEventName = temp;
307 // fProbeString will be validated by lttng-tools
308 fProbeString = fProbeText.getText();
309 }
310
311 // initialize function string
312 fFunctionEventName = null;
313 fFunctionString = null;
314 if (fIsDynamicFunctionProbe) {
315 String functionTemp = fFunctionEventNameText.getText();
316 if (functionTemp.isEmpty() ||
317 functionTemp.matches("\\s*") || //$NON-NLS-1$
318 (!functionTemp.matches("^[\\s]{0,}$") && !functionTemp.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
319 MessageDialog.openError(getShell(),
320 Messages.TraceControl_EnableEventsDialogTitle,
321 Messages.TraceControl_InvalidProbeNameError + " (" + functionTemp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
322
323 return false;
324 }
325
326 fFunctionEventName = functionTemp;
327 // fFunctionString will be validated by lttng-tools
328 fFunctionString = fFunctionText.getText();
329 }
330
331 // initialize filter with null
332 fFilterExpression = null;
333 if (fProviderGroup.isEventFilteringSupported(true)) {
334 String tempFilter = fFilterText.getText();
335
336 if(!tempFilter.isEmpty() && !tempFilter.matches("\\s*")) { //$NON-NLS-1$
337 fFilterExpression = tempFilter;
338 }
339 }
340
341 return true;
342 }
343
344 /**
345 * Creates tracepoints group.
346 */
347 private void createTracepointsGroup() {
348
349 GridLayout layout;
350 GridData data;
351 Group tpMainGroup = new Group(this, SWT.SHADOW_NONE);
352 tpMainGroup.setText(Messages.TraceControl_EnableEventsTracepointGroupName);
353 layout = new GridLayout(2, false);
354 tpMainGroup.setLayout(layout);
355 data = new GridData(GridData.FILL_BOTH);
356 tpMainGroup.setLayoutData(data);
357
358 Composite buttonComposite = new Composite(tpMainGroup, SWT.NONE);
359 layout = new GridLayout(1, true);
360 buttonComposite.setLayout(layout);
361 data = new GridData(SWT.BEGINNING, SWT.CENTER, false, true);
362 buttonComposite.setLayoutData(data);
363
364 fTracepointsActivateButton = new Button(buttonComposite, SWT.RADIO);
365 fTracepointsActivateButton.setText(Messages.TraceControl_EnableGroupSelectionName);
366 data = new GridData(GridData.FILL_HORIZONTAL);
367 fTracepointsActivateButton.setLayoutData(data);
368 fTracepointsActivateButton.addSelectionListener(new SelectionAdapter() {
369 @Override
370 public void widgetSelected(SelectionEvent e) {
371 setKernelEnablements(KernelGroupEnum.TRACEPOINTS);
372 }
373 });
374
375 Group tracepointsGroup = new Group(tpMainGroup, SWT.SHADOW_NONE);
376 layout = new GridLayout(1, true);
377 tracepointsGroup.setLayout(layout);
378 data = new GridData(GridData.FILL_BOTH);
379 tracepointsGroup.setLayoutData(data);
380
381 new FilteredTree(tracepointsGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, new PatternFilter(), true) {
382 @Override
383 protected TreeViewer doCreateTreeViewer(Composite aparent, int style) {
384 fTracepointsViewer = new CheckboxTreeViewer(aparent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
385 fTracepointsViewer.getTree().setToolTipText(Messages.TraceControl_EnableEventsTracepointTreeTooltip);
386
387 fTracepointsViewer.setContentProvider(new KernelContentProvider());
388 fTracepointsViewer.setLabelProvider(new KernelLabelProvider());
389 fTracepointsViewer.addCheckStateListener(new KernelCheckListener());
390 fTracepointsViewer.setInput(fProviderGroup);
391
392 fTracepointsViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
393 return fTracepointsViewer;
394 }
395
396 @Override
397 protected void updateToolbar(boolean visible) {
398 super.updateToolbar(visible);
399 treeViewer.expandAll();
400 }
401 };
402 }
403
404 /**
405 * Creates syscalls group.
406 */
407 private void createSysCallsGroup() {
408 GridLayout layout;
409 GridData data;
410 Group sysCallsMainGroup = new Group(this, SWT.SHADOW_NONE);
411 sysCallsMainGroup.setText(Messages.TraceControl_EnableEventsSyscallName);
412 sysCallsMainGroup.setToolTipText(Messages.TraceControl_EnableEventsSyscallTooltip);
413 layout = new GridLayout(2, false);
414 sysCallsMainGroup.setLayout(layout);
415 data = new GridData(GridData.FILL_HORIZONTAL);
416 sysCallsMainGroup.setLayoutData(data);
417
418 Composite buttonComposite = new Composite(sysCallsMainGroup, SWT.NONE);
419 layout = new GridLayout(1, false);
420 buttonComposite.setLayout(layout);
421 data = new GridData(SWT.BEGINNING, SWT.CENTER, false, true);
422 buttonComposite.setLayoutData(data);
423
424 fSysCallsActivateButton = new Button(buttonComposite, SWT.RADIO);
425 fSysCallsActivateButton.setText(Messages.TraceControl_EnableGroupSelectionName);
426 fSysCallsActivateButton.setToolTipText(Messages.TraceControl_EnableEventsSyscallTooltip);
427 fSysCallsActivateButton.setSelection(false);
428 data = new GridData(GridData.FILL_HORIZONTAL);
429 fSysCallsActivateButton.setLayoutData(data);
430 fSysCallsActivateButton.addSelectionListener(new SelectionAdapter() {
431 @Override
432 public void widgetSelected(SelectionEvent e) {
433 setKernelEnablements(KernelGroupEnum.SYSCALLS);
434 }
435 });
436 }
437
438 /**
439 * Creates dynamic probe group.
440 */
441 private void createDynamicProbeGroup() {
442 GridLayout layout;
443 GridData data;
444 Group probeMainGroup = new Group(this, SWT.SHADOW_NONE);
445 probeMainGroup.setText(Messages.TraceControl_EnableEventsProbeGroupName);
446 layout = new GridLayout(2, false);
447 probeMainGroup.setLayout(layout);
448 data = new GridData(GridData.FILL_HORIZONTAL);
449 probeMainGroup.setLayoutData(data);
450
451 Composite buttonComposite = new Composite(probeMainGroup, SWT.NONE);
452 layout = new GridLayout(1, false);
453 buttonComposite.setLayout(layout);
454 data = new GridData(SWT.BEGINNING, SWT.CENTER, false, true);
455 buttonComposite.setLayoutData(data);
456
457 fProbeActivateButton = new Button(buttonComposite, SWT.RADIO);
458 fProbeActivateButton.setText(Messages.TraceControl_EnableGroupSelectionName);
459 fProbeActivateButton.setSelection(false);
460 data = new GridData(GridData.FILL_HORIZONTAL);
461 fProbeActivateButton.setLayoutData(data);
462 fProbeActivateButton.addSelectionListener(new SelectionAdapter() {
463 @Override
464 public void widgetSelected(SelectionEvent e) {
465 setKernelEnablements(KernelGroupEnum.PROBE);
466 }
467 });
468
469 Group probeGroup = new Group(probeMainGroup, SWT.SHADOW_NONE);
470 layout = new GridLayout(4, true);
471 probeGroup.setLayout(layout);
472 probeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
473
474 Label probeNameLabel = new Label(probeGroup, SWT.LEFT);
475 probeNameLabel.setText(Messages.TraceControl_EnableEventsEventNameLabel);
476 data = new GridData(GridData.FILL_BOTH);
477 data.horizontalSpan = 1;
478 probeNameLabel.setLayoutData(data);
479
480 fProbeEventNameText = new Text(probeGroup, SWT.LEFT);
481 fProbeEventNameText.setToolTipText(Messages.TraceControl_EnableEventsProbeEventNameTooltip);
482
483 data = new GridData(GridData.FILL_BOTH);
484 data.horizontalSpan = 3;
485 fProbeEventNameText.setLayoutData(data);
486
487 Label probeLabel = new Label(probeGroup, SWT.LEFT);
488 probeLabel.setText(Messages.TraceControl_EnableEventsProbeNameLabel);
489 data = new GridData(GridData.FILL_BOTH);
490 data.horizontalSpan = 1;
491 probeLabel.setLayoutData(data);
492
493 fProbeText = new Text(probeGroup, SWT.LEFT);
494 fProbeText.setToolTipText(Messages.TraceControl_EnableEventsProbeNameTooltip);
495 data = new GridData(GridData.FILL_BOTH);
496 data.horizontalSpan = 3;
497 fProbeText.setLayoutData(data);
498 }
499
500 /**
501 * Creates dynamic function entry/return probe group.
502 */
503 private void createDynamicFunctionPropeGroup() {
504 GridLayout layout;
505 GridData data;
506 Group functionMainGroup = new Group(this, SWT.SHADOW_NONE);
507 functionMainGroup.setText(Messages.TraceControl_EnableEventsFucntionGroupName);
508 layout = new GridLayout(2, false);
509 functionMainGroup.setLayout(layout);
510 data = new GridData(GridData.FILL_HORIZONTAL);
511 functionMainGroup.setLayoutData(data);
512
513 Composite buttonComposite = new Composite(functionMainGroup, SWT.NONE);
514 layout = new GridLayout(1, false);
515 buttonComposite.setLayout(layout);
516 data = new GridData(SWT.BEGINNING, SWT.CENTER, false, true);
517 buttonComposite.setLayoutData(data);
518
519 fFunctionActivateButton = new Button(buttonComposite, SWT.RADIO);
520 fFunctionActivateButton.setText(Messages.TraceControl_EnableGroupSelectionName);
521 fFunctionActivateButton.setSelection(false);
522 data = new GridData(GridData.FILL_HORIZONTAL);
523 fFunctionActivateButton.setLayoutData(data);
524 fFunctionActivateButton.addSelectionListener(new SelectionAdapter() {
525 @Override
526 public void widgetSelected(SelectionEvent e) {
527 setKernelEnablements(KernelGroupEnum.FUNCTION);
528 }
529 });
530
531 Group functionGroup = new Group(functionMainGroup, SWT.SHADOW_NONE);
532 layout = new GridLayout(4, true);
533 functionGroup.setLayout(layout);
534 functionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
535
536 Label functionNameLabel = new Label(functionGroup, SWT.LEFT);
537 functionNameLabel.setText(Messages.TraceControl_EnableEventsEventNameLabel);
538 data = new GridData(GridData.FILL_BOTH);
539 data.horizontalSpan = 1;
540 functionNameLabel.setLayoutData(data);
541
542 fFunctionEventNameText = new Text(functionGroup, SWT.LEFT);
543 fFunctionEventNameText.setToolTipText(Messages.TraceControl_EnableEventsFunctionEventNameTooltip);
544 data = new GridData(GridData.FILL_BOTH);
545 data.horizontalSpan = 3;
546 fFunctionEventNameText.setLayoutData(data);
547
548 Label functionLabel = new Label(functionGroup, SWT.LEFT);
549 functionLabel.setText(Messages.TraceControl_EnableEventsFunctionNameLabel);
550 data = new GridData(GridData.FILL_BOTH);
551 data.horizontalSpan = 1;
552 functionLabel.setLayoutData(data);
553
554 fFunctionText = new Text(functionGroup, SWT.LEFT);
555 fFunctionText.setToolTipText(Messages.TraceControl_EnableEventsProbeNameTooltip);
556 data = new GridData(GridData.FILL_BOTH);
557 data.horizontalSpan = 3;
558 fFunctionText.setLayoutData(data);
559 }
560
561 /**
562 * Enable/selects widgets depending on the group specified.
563 * @param group - group to enable.
564 */
565 private void setKernelEnablements(KernelGroupEnum group) {
566 fTracepointsActivateButton.setSelection(group == KernelGroupEnum.TRACEPOINTS);
567 fTracepointsViewer.getTree().setEnabled(group == KernelGroupEnum.TRACEPOINTS);
568
569 fSysCallsActivateButton.setSelection(group == KernelGroupEnum.SYSCALLS);
570
571 fProbeActivateButton.setSelection(group == KernelGroupEnum.PROBE);
572 fProbeEventNameText.setEnabled(group == KernelGroupEnum.PROBE);
573 fProbeText.setEnabled(group == KernelGroupEnum.PROBE);
574
575 fFunctionActivateButton.setSelection(group == KernelGroupEnum.FUNCTION);
576 fFunctionEventNameText.setEnabled(group == KernelGroupEnum.FUNCTION);
577 fFunctionText.setEnabled(group == KernelGroupEnum.FUNCTION);
578 }
579
580 private void createFilterGroup() {
581 if (fProviderGroup.isEventFilteringSupported(true)) {
582 Group filterMainGroup = new Group(this, SWT.SHADOW_NONE);
583 filterMainGroup.setText(Messages.TraceControl_EnableEventsFilterGroupName);
584 GridLayout layout = new GridLayout(3, false);
585 filterMainGroup.setLayout(layout);
586 GridData data = new GridData(GridData.FILL_HORIZONTAL);
587 filterMainGroup.setLayoutData(data);
588
589 fFilterText = new Text(filterMainGroup, SWT.LEFT);
590 fFilterText.setToolTipText(Messages.TraceControl_EnableEventsFilterTooltip);
591 data = new GridData(GridData.FILL_HORIZONTAL);
592 fFilterText.setLayoutData(data);
593 }
594 }
595
596 // ------------------------------------------------------------------------
597 // Local classes
598 // ------------------------------------------------------------------------
599 /**
600 * Content provider for the tracepoints tree.
601 */
602 public static final class KernelContentProvider extends TraceControlContentProvider {
603 @Override
604 public Object[] getChildren(Object parentElement) {
605 if (parentElement instanceof TraceProviderGroup) {
606 List<ITraceControlComponent> children = ((ITraceControlComponent)parentElement).getChildren(KernelProviderComponent.class);
607 return children.toArray(new ITraceControlComponent[children.size()]);
608 }
609 if (parentElement instanceof ITraceControlComponent) {
610 return ((ITraceControlComponent)parentElement).getChildren();
611 }
612 return new Object[0];
613 }
614 }
615
616 /**
617 * Content label for the tracepoints tree.
618 */
619 public static final class KernelLabelProvider extends TraceControlLabelProvider {
620 @Override
621 public Image getImage(Object element) {
622 return null;
623 }
624 @Override
625 public String getText(Object element) {
626 if ((element != null) && (element instanceof KernelProviderComponent)) {
627 return Messages.TraceControl_EnableEventsTracepointTreeAllLabel;
628 }
629 return super.getText(element);
630 }
631 }
632
633 /**
634 * Check state listener for the tracepoints tree.
635 */
636 public final class KernelCheckListener implements ICheckStateListener {
637 @Override
638 public void checkStateChanged(CheckStateChangedEvent event) {
639 if (event.getChecked()) {
640 if (event.getElement() instanceof KernelProviderComponent) {
641 fTracepointsViewer.setSubtreeChecked(event.getElement(), true);
642 }
643 } else {
644 if (event.getElement() instanceof KernelProviderComponent) {
645 fTracepointsViewer.setSubtreeChecked(event.getElement(), false);
646 } else {
647 ITraceControlComponent component = (ITraceControlComponent) event.getElement();
648 fTracepointsViewer.setChecked(component.getParent(), false);
649 }
650 }
651 }
652 }
653 }
This page took 0.048511 seconds and 6 git commands to generate.