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