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;
/**
super(name, parent);
setImage(TRACE_SESSIONS_ICON_FILE);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
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);
+ }
}