Update internal packages export in LTTng 2.0 control + update java doc
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / dialogs / EnableKernelEventComposite.java
index b448ab6a861ab39fcfa921d0e141a9c027719b95..ee808066264ffcbda7ae989cc000834fea62c8ec 100644 (file)
@@ -18,12 +18,12 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.CheckStateChangedEvent;
 import org.eclipse.jface.viewers.CheckboxTreeViewer;
 import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.TraceControlContentProvider;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.TraceControlLabelProvider;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.KernelProviderComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlContentProvider;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlLabelProvider;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -38,10 +38,11 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
 /**
- * <b><u>EnableKernelEventsComposite</u></b>
  * <p>
  * A composite for collecting information about kernel events to be enabled.
  * </p>
+ * 
+ * @author Bernd Hufmann
  */
 public class EnableKernelEventComposite extends Composite implements IEnableKernelEvents {
 
@@ -273,53 +274,58 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern
         fIsDynamicProbe = fProbeActivateButton.getSelection();
         fIsDynamicFunctionProbe = fFunctionActivateButton.getSelection();
 
-        List<ITraceControlComponent> comps = fProviderGroup.getChildren(KernelProviderComponent.class);
-        fIsAllTracepoints = fTracepointsViewer.getChecked(comps.get(0));
-
-        Object[] checkedElements = fTracepointsViewer.getCheckedElements();
+        // initialize tracepoint fields
+        fIsAllTracepoints = false;
         fSelectedEvents = new ArrayList<String>();
-        for (int i = 0; i < checkedElements.length; i++) {
-            ITraceControlComponent component = (ITraceControlComponent)checkedElements[i];
-            if (component instanceof BaseEventComponent) {
-                fSelectedEvents.add(component.getName());
+
+        if (fIsTracepoints) {
+            List<ITraceControlComponent> comps = fProviderGroup.getChildren(KernelProviderComponent.class);
+            fIsAllTracepoints = fTracepointsViewer.getChecked(comps.get(0));
+
+            Object[] checkedElements = fTracepointsViewer.getCheckedElements();
+            for (int i = 0; i < checkedElements.length; i++) {
+                ITraceControlComponent component = (ITraceControlComponent)checkedElements[i];
+                if (component instanceof BaseEventComponent) {
+                    fSelectedEvents.add(component.getName());
+                }
             }
         }
-        
-        // initialize probe string
-        fProbeEventName = null;
-        fProbeString = null;
-        String temp = fProbeEventNameText.getText();
-        if (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
-            MessageDialog.openError(getShell(),
-                  Messages.TraceControl_EnableEventsDialogTitle,
-                  Messages.TraceControl_InvalidProbeNameError + " (" + temp + ") \n");  //$NON-NLS-1$ //$NON-NLS-2$
-            
-            return false;
+
+        if (fIsDynamicProbe) {
+            String temp = fProbeEventNameText.getText();
+            if (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
+                MessageDialog.openError(getShell(),
+                        Messages.TraceControl_EnableEventsDialogTitle,
+                        Messages.TraceControl_InvalidProbeNameError + " (" + temp + ") \n");  //$NON-NLS-1$ //$NON-NLS-2$
+
+                return false;
+            }
+
+            if(!fProbeText.getText().matches("\\s*")) { //$NON-NLS-1$
+                fProbeEventName = temp;
+                // fProbeString will be validated by lttng-tools
+                fProbeString = fProbeText.getText();
+            } 
         }
-        
-        if(!fProbeText.getText().matches("\\s*")) { //$NON-NLS-1$
-            fProbeEventName = temp;
-            // fProbeString will be validated by lttng-tools
-            fProbeString = fProbeText.getText();
-        } 
 
         // initialize function string
         fFunctionEventName = null;
         fFunctionString = null;
+        if (fIsDynamicFunctionProbe) {
+            String functionTemp = fFunctionEventNameText.getText();
+            if (!functionTemp.matches("^[\\s]{0,}$") && !functionTemp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
+                MessageDialog.openError(getShell(),
+                        Messages.TraceControl_EnableEventsDialogTitle,
+                        Messages.TraceControl_InvalidProbeNameError + " (" + functionTemp + ") \n");  //$NON-NLS-1$ //$NON-NLS-2$
+
+                return false;
+            }
 
-        temp = fFunctionEventNameText.getText();
-        if (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
-            MessageDialog.openError(getShell(),
-                  Messages.TraceControl_EnableEventsDialogTitle,
-                  Messages.TraceControl_InvalidProbeNameError + " (" + temp + ") \n");  //$NON-NLS-1$ //$NON-NLS-2$
-            
-            return false;
-        }
-
-        if(!fFunctionText.getText().matches("\\s*")) { //$NON-NLS-1$
-            fFunctionEventName = temp;
-            // fFunctionString will be validated by lttng-tools
-            fFunctionString = fFunctionText.getText();
+            if(!fFunctionText.getText().matches("\\s*")) { //$NON-NLS-1$
+                fFunctionEventName = functionTemp;
+                // fFunctionString will be validated by lttng-tools
+                fFunctionString = fFunctionText.getText();
+            }
         }
 
         return true;
This page took 0.024843 seconds and 5 git commands to generate.