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
index 2c175f8adbf5daeafb79a2a69e6f7bfef0e674dc..4ae2cae64e6a99234fa4d1511d83e44ee0e0d0d9 100644 (file)
@@ -95,6 +95,10 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern
      * 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.
@@ -140,6 +144,10 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern
      * The dynamic function entry/return probe.
      */
     private String fFunctionString;
+    /**
+     * The filter expression
+     */
+    private String fFilterExpression;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -219,6 +227,11 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern
         return fFunctionString;
     }
 
+    @Override
+    public String getFilterExpression() {
+        return fFilterExpression;
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -240,6 +253,9 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern
         // Dynamic Function Probe Group
         createDynamicFunctionPropeGroup();
 
+        // Filter Group
+        createFilterGroup();
+
         // Set default enablements
         setKernelEnablements(KernelGroupEnum.TRACEPOINTS);
     }
@@ -312,6 +328,16 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern
             fFunctionString = fFunctionText.getText();
         }
 
+        // initialize filter with null
+        fFilterExpression = null;
+        if (fProviderGroup.isEventFilteringSupported(true)) {
+            String tempFilter = fFilterText.getText();
+
+            if(!tempFilter.isEmpty() && !tempFilter.matches("\\s*")) { //$NON-NLS-1$
+                fFilterExpression = tempFilter;
+            }
+        }
+
         return true;
     }
 
@@ -551,6 +577,22 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern
         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
     // ------------------------------------------------------------------------
This page took 0.026434 seconds and 5 git commands to generate.