Add capability to enable events with different parameters on session,
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / control / model / impl / TraceSessionComponent.java
index b7c29acaafa2d08b52d011077084f1f8c03e0a9a..d1f01fe97fd7e1029112f14128c248b8b096be5f 100644 (file)
@@ -11,6 +11,8 @@
  **********************************************************************/
 package org.eclipse.linuxtools.lttng.ui.views.control.model.impl;
 
+import java.util.List;
+
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
@@ -19,6 +21,8 @@ import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ISessionInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.LogLevelType;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
 import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceSessionPropertySource;
 import org.eclipse.swt.graphics.Image;
@@ -105,14 +109,13 @@ public class TraceSessionComponent extends TraceControlComponent {
         return fActiveImage;
     }
 
-    
     /**
      * @return the whether the session is destroyed or not.
      */
     public boolean isDestroyed() {
         return fIsDestroyed;
     }
-    
+
     /**
      * Sets the session destroyed state to the given value.
      * @param destroyed - value to set.
@@ -120,7 +123,7 @@ public class TraceSessionComponent extends TraceControlComponent {
     public void setDestroyed(boolean destroyed) {
         fIsDestroyed = destroyed;
     }
-    
+
     /**
      * @return the session state state (active or inactive).
      */
@@ -135,7 +138,7 @@ public class TraceSessionComponent extends TraceControlComponent {
     public void setSessionState(TraceSessionState state) {
         fSessionInfo.setSessionState(state);
     }
-    
+
     /**
      * Sets the event state to the value specified by the given name.
      * @param stateName - state to set.
@@ -171,6 +174,21 @@ public class TraceSessionComponent extends TraceControlComponent {
         }
         return null;
     } 
+
+    /**
+     * @return all available domains of this session.
+     */
+    public TraceDomainComponent[] getDomains() {
+        List<ITraceControlComponent> sessions = getChildren(TraceDomainComponent.class);
+        return (TraceDomainComponent[])sessions.toArray(new TraceDomainComponent[sessions.size()]);
+    }
+    
+    /**
+     * @return the parent target node
+     */
+    public TargetNodeComponent getTargetNode() {
+        return ((TraceSessionGroup)getParent()).getTargetNode();
+    }
     
     // ------------------------------------------------------------------------
     // Operations
@@ -189,12 +207,150 @@ public class TraceSessionComponent extends TraceControlComponent {
      * @throws ExecutionException
      */
     public void getConfigurationFromNode(IProgressMonitor monitor) throws ExecutionException {
+        removeAllChildren();
         fSessionInfo = getControlService().getSession(getName(), monitor);
         IDomainInfo[] domains = fSessionInfo.getDomains();
         for (int i = 0; i < domains.length; i++) {
-            TraceDomainComponent domainComponenent = new TraceDomainComponent(domains[i].getName(), this);
-            addChild(domainComponenent);
-            domainComponenent.setDomainInfo(domains[i]);
+            TraceDomainComponent domainComponent = new TraceDomainComponent(domains[i].getName(), this);
+            addChild(domainComponent);
+            domainComponent.setDomainInfo(domains[i]);
         }
     }
+    
+    /**
+     * Starts the session. 
+     * throws ExecutionExecption
+     */
+    public void startSession() throws ExecutionException {
+        startSession(new NullProgressMonitor());
+    }
+    
+    /**
+     * Starts the session.
+     * @param monitor - a progress monitor
+     * throws ExecutionExecption
+     */
+    public void startSession(IProgressMonitor monitor) throws ExecutionException {
+        getControlService().startSession(getName(), monitor);
+    }
+    
+    /**
+     * Starts the session. 
+     * throws ExecutionExecption
+     */
+    public void stopSession() throws ExecutionException {
+        startSession(new NullProgressMonitor());
+    }
+    
+    /**
+     * Starts the session.
+     * @param monitor - a progress monitor
+     * throws ExecutionExecption
+     */
+    public void stopSession(IProgressMonitor monitor) throws ExecutionException {
+        getControlService().stopSession(getName(), monitor);
+    }
+
+    /**
+     * Enables a list of events with no additional parameters.
+     * @param eventNames - a list of event names to enabled.
+     * @param isKernel -  a flag for indicating kernel or UST.
+     * @throws ExecutionException
+     */
+    public void enableEvent(List<String> eventNames, boolean isKernel) throws ExecutionException {
+        enableEvents(eventNames, isKernel, new NullProgressMonitor());
+    }
+
+    /**
+     * Enables a list of events with no additional parameters.
+     * @param eventNames - a list of event names to enabled.
+     * @param isKernel -  a flag for indicating kernel or UST.
+     * @param monitor - a progress monitor
+     * @throws ExecutionException
+     */
+    public void enableEvents(List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableEvents(getName(), null, eventNames, isKernel, monitor);
+    }
+
+    /**
+     * Enables all syscalls (for kernel domain)
+     * @throws ExecutionException
+     */
+    public void enableSyscalls() throws ExecutionException {
+        enableSyscalls(new NullProgressMonitor());
+    }
+
+    /**
+     * Enables all syscalls (for kernel domain)
+     * @param monitor - a progress monitor
+     * @throws ExecutionException
+     */
+    public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableSyscalls(getName(), null, monitor);
+    }
+
+    /**
+     * Enables a dynamic probe (for kernel domain)
+     * @param eventName - event name for probe
+     * @param probe - the actual probe
+     * @throws ExecutionException
+     */
+    public void enableProbe(String eventName, String probe) throws ExecutionException {
+        enableProbe(eventName, probe, new NullProgressMonitor());
+    }
+    
+    /**
+     * Enables a dynamic probe (for kernel domain)
+     * @param eventName - event name for probe
+     * @param probe - the actual probe
+     * @param monitor - a progress monitor
+     * @throws ExecutionException
+     */
+   public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableProbe(getName(), null, eventName, probe, monitor);
+    }
+
+   /**
+    * Enables a dynamic function entry/return probe (for kernel domain)
+    * @param eventName - event name for probe
+    * @param probe - the actual probe
+    * @throws ExecutionException
+    */
+    public void enableFunctionProbe(String eventName, String probe) throws ExecutionException {
+        enableFunctionProbe(eventName, probe, new NullProgressMonitor());
+    }
+    
+    /**
+     * Enables a dynamic function entry/return probe (for kernel domain)
+     * @param eventName - event name for probe
+     * @param probe - the actual probe
+     * @param monitor - a progress monitor
+     * @throws ExecutionException
+     */
+    public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableFunctionProbe(getName(), null, eventName, probe, monitor);
+    }
+    
+    /**
+     * Enables events using log level.
+     * @param eventName - a event name
+     * @param logLevelType - a log level type 
+     * @param level - a log level 
+     * @throws ExecutionException
+     */
+    public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level) throws ExecutionException {
+        enableLogLevel(eventName, logLevelType, level, new NullProgressMonitor());
+    }
+
+    /**
+     * Enables events using log level.
+     * @param eventName - a event name
+     * @param logLevelType - a log level type 
+     * @param level - a log level 
+     * @param monitor - a progress monitor  
+     * @throws ExecutionException
+     */
+    public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableLogLevel(getName(), null, eventName, logLevelType, level, monitor);
+    }
 }
This page took 0.026349 seconds and 5 git commands to generate.