Added command support for enabling/disabling events (first part)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / control / model / impl / TraceSessionGroup.java
index 105f76a73855226dc8d9b4d0bef3cb461b2c2c3a..bce872311a7ff264c5ca24e54966d0e729d56de3 100644 (file)
@@ -14,6 +14,7 @@ package org.eclipse.linuxtools.lttng.ui.views.control.model.impl;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.ISessionInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
 
 /**
@@ -47,7 +48,7 @@ public class TraceSessionGroup extends TraceControlComponent {
         super(name, parent);
         setImage(TRACE_SESSIONS_ICON_FILE);
     }
-    
+
     // ------------------------------------------------------------------------
     // Accessors
     // ------------------------------------------------------------------------
@@ -76,4 +77,53 @@ public class TraceSessionGroup extends TraceControlComponent {
             session.getConfigurationFromNode(monitor);
         }
     }
+
+    /**
+     * Creates a session with given session name and location. 
+     * @param sessionName - a session name to create
+     * @param sessionPath - a path for storing the traces (use null for default)
+     * @return the session information
+     * throws ExecutionExecption
+     */
+    public void createSession(String sessionName, String sessionPath) throws ExecutionException {
+        createSession(sessionName, sessionPath, new NullProgressMonitor());
+    }
+    
+    /**
+     * Creates a session with given session name and location. 
+     * @param sessionName - a session name to create
+     * @param sessionPath - a path for storing the traces (use null for default)
+     * @Param monitor - a progress monitor 
+     * @return the session information
+     * throws ExecutionExecption
+     */
+    public void createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException {
+        ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, monitor);
+        if (sessionInfo != null) {
+            TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this);
+            addChild(session);
+            session.getConfigurationFromNode(monitor);
+        }
+    }
+
+    /**
+     * Destroys a session with given session name. 
+     * @param session - a session component to destroy
+     * throws ExecutionExecption
+     */
+    public void destroySession(TraceSessionComponent session) throws ExecutionException {
+        destroySession(session, new NullProgressMonitor());
+    }
+    
+    /**
+     * Destroys a session with given session name. 
+     * @param session - a session component to destroy
+     * @param monitor - a progress monitor
+     * throws ExecutionExecption
+     */
+    public void destroySession(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().destroySession(session.getName(), monitor);
+        session.removeAllChildren();
+        removeChild(session);
+    }
 }
This page took 0.024667 seconds and 5 git commands to generate.