// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
- private enum KernelGroupEnum { TRACEPOINTS, SYSCALLS, PROBE, FUNCTION }
+ private enum KernelGroupEnum { ALL, TRACEPOINTS, SYSCALLS, PROBE, FUNCTION }
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
+ /**
+ * A button to enable/disable the all tracepoints&sycalls group
+ */
+ private Button fAllActivateButton;
/**
* A button to enable/disable the tracepoints group
*/
* The text field for the dynamic function entry/return probe.
*/
private Text fFunctionText;
+ /**
+ * The filter text
+ */
+ private Text fFilterText;
/**
* The referenced trace provider group containing the kernel provider
* component which contains a list of available tracepoints.
*/
private final TraceProviderGroup fProviderGroup;
+ /**
+ * The flag indicating that all tracepoints/syscalls are selected.
+ */
+ private boolean fIsAllTracepointsAndSyscalls;
/**
* The flag indicating that tracepoints are selected.
*/
* The dynamic function entry/return probe.
*/
private String fFunctionString;
+ /**
+ * The filter expression
+ */
+ private String fFilterExpression;
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
// Acessors
// ------------------------------------------------------------------------
-
+ @Override
+ public boolean isAllEvents() {
+ return fIsAllTracepointsAndSyscalls;
+ }
@Override
public boolean isTracepoints() {
return fIsTracepoints;
return fFunctionString;
}
+ @Override
+ public String getFilterExpression() {
+ return fFilterExpression;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
*/
public void createContent() {
+ // All Tracepoints/syscalls Group
+ createAllTracepointsSyscallGroup();
+
// Tracepoints Group
createTracepointsGroup();
// Dynamic Function Probe Group
createDynamicFunctionPropeGroup();
+ // Filter Group
+ createFilterGroup();
+
// Set default enablements
- setKernelEnablements(KernelGroupEnum.TRACEPOINTS);
+ setKernelEnablements(KernelGroupEnum.ALL);
}
/**
* @return true if configured data is valid and can be retrieved.
*/
public boolean isValid() {
+ fIsAllTracepointsAndSyscalls = fAllActivateButton.getSelection();
fIsTracepoints = fTracepointsActivateButton.getSelection();
fIsSysCalls = fSysCallsActivateButton.getSelection();
fIsDynamicProbe = fProbeActivateButton.getSelection();
if (fIsDynamicProbe) {
String temp = fProbeEventNameText.getText();
- if (temp.isEmpty() ||
- fProbeText.getText().matches("\\s*") || //$NON-NLS-1$
+ if (temp.trim().isEmpty() ||
(!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableEventsDialogTitle,
fFunctionString = null;
if (fIsDynamicFunctionProbe) {
String functionTemp = fFunctionEventNameText.getText();
- if (functionTemp.isEmpty() ||
- functionTemp.matches("\\s*") || //$NON-NLS-1$
+ if (functionTemp.trim().isEmpty() ||
(!functionTemp.matches("^[\\s]{0,}$") && !functionTemp.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableEventsDialogTitle,
fFunctionString = fFunctionText.getText();
}
+ // initialize filter with null
+ fFilterExpression = null;
+ if (fProviderGroup.isEventFilteringSupported(true)) {
+ String tempFilter = fFilterText.getText();
+
+ if(!tempFilter.trim().isEmpty()) {
+ fFilterExpression = tempFilter;
+ }
+ }
+
return true;
}
+ /**
+ * Creates all tracepoints/syscalls group.
+ */
+ private void createAllTracepointsSyscallGroup() {
+
+ GridLayout layout;
+ GridData data;
+ Group tpMainGroup = new Group(this, SWT.SHADOW_NONE);
+ tpMainGroup.setText(Messages.TraceControl_EnableEventsAllEventsLabel);
+ layout = new GridLayout(2, false);
+ tpMainGroup.setLayout(layout);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ tpMainGroup.setLayoutData(data);
+
+ Composite buttonComposite = new Composite(tpMainGroup, SWT.NONE);
+ layout = new GridLayout(1, true);
+ buttonComposite.setLayout(layout);
+ data = new GridData(SWT.BEGINNING, SWT.CENTER, false, true);
+ buttonComposite.setLayoutData(data);
+
+ fAllActivateButton = new Button(buttonComposite, SWT.RADIO);
+ fAllActivateButton.setText(Messages.TraceControl_EnableGroupSelectionName);
+ fAllActivateButton.setToolTipText(Messages.TraceControl_EnableEventsAllEventsTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ fAllActivateButton.setLayoutData(data);
+ fAllActivateButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setKernelEnablements(KernelGroupEnum.ALL);
+ }
+ });
+ }
+
/**
* Creates tracepoints group.
*/
* @param group - group to enable.
*/
private void setKernelEnablements(KernelGroupEnum group) {
+ fAllActivateButton.setSelection(group == KernelGroupEnum.ALL);
fTracepointsActivateButton.setSelection(group == KernelGroupEnum.TRACEPOINTS);
fTracepointsViewer.getTree().setEnabled(group == KernelGroupEnum.TRACEPOINTS);
fFunctionText.setEnabled(group == KernelGroupEnum.FUNCTION);
}
+ private void createFilterGroup() {
+ if (fProviderGroup.isEventFilteringSupported(true)) {
+ Group filterMainGroup = new Group(this, SWT.SHADOW_NONE);
+ filterMainGroup.setText(Messages.TraceControl_EnableEventsFilterGroupName);
+ GridLayout layout = new GridLayout(3, false);
+ filterMainGroup.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ filterMainGroup.setLayoutData(data);
+
+ fFilterText = new Text(filterMainGroup, SWT.LEFT);
+ fFilterText.setToolTipText(Messages.TraceControl_EnableEventsFilterTooltip);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ fFilterText.setLayoutData(data);
+ }
+ }
+
// ------------------------------------------------------------------------
// Local classes
// ------------------------------------------------------------------------