lttng: Add snapshot support - LTTng Tools v2.3
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / model / impl / TraceSessionComponent.java
index 86de1fa590a9e2c00e565fe5211a2036ee22562b..471c60cc5af287c10c3e62075ef863d34a741724 100644 (file)
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IDomainInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
@@ -178,6 +179,22 @@ public class TraceSessionComponent extends TraceControlComponent {
         fSessionInfo.setStreamedTrace(isStreamedTrace);
     }
 
+    /**
+     * Returns whether the session is snapshot session or not
+     * @return <code>true</code> if it is snapshot session else <code>false</code>
+     */
+    public boolean isSnapshotSession() {
+        return fSessionInfo.isSnapshotSession();
+    }
+
+    /**
+     * Gets the snapshot information if available whether the session is a snapshot session or not
+     * @return the snapshot information or null if it is not a snapshot session
+     */
+    public ISnapshotInfo getSnapshotInfo() {
+        return fSessionInfo.getSnapshotInfo();
+    }
+
     @Override
     public Object getAdapter(Class adapter) {
         if (adapter == IPropertySource.class) {
@@ -218,6 +235,15 @@ public class TraceSessionComponent extends TraceControlComponent {
         return ((TargetNodeComponent)getParent().getParent()).isEventFilteringSupported();
     }
 
+    /**
+     * Returns if node supports snapshots or not
+     * @return <code>true</code> if it supports snapshots else <code>false</code>
+     *
+     */
+    public boolean isSnapshotSupported() {
+        return ((TargetNodeComponent)getParent().getParent()).isSnapshotSupported();
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
@@ -234,6 +260,7 @@ public class TraceSessionComponent extends TraceControlComponent {
             throws ExecutionException {
         removeAllChildren();
         fSessionInfo = getControlService().getSession(getName(), monitor);
+
         IDomainInfo[] domains = fSessionInfo.getDomains();
         for (int i = 0; i < domains.length; i++) {
             TraceDomainComponent domainComponent = new TraceDomainComponent(
@@ -381,4 +408,16 @@ public class TraceSessionComponent extends TraceControlComponent {
             throws ExecutionException {
         return getControlService().getContextList(monitor);
     }
+
+    /**
+     * Records a snapshot.
+     *
+     * @param monitor
+     *            - a progress monitor
+     * @throws ExecutionException
+     *             If the command fails
+     */
+    public void recordSnapshot(IProgressMonitor monitor) throws ExecutionException {
+        getControlService().recordSnapshot(getName(), monitor);
+    }
 }
This page took 0.026083 seconds and 5 git commands to generate.