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