**********************************************************************/
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;
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;
+import org.eclipse.ui.views.properties.IPropertySource;
/**
* <b><u>TraceSessionComponent</u></b>
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.
public void setDestroyed(boolean destroyed) {
fIsDestroyed = destroyed;
}
-
+
/**
* @return the session state state (active or inactive).
*/
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.
fSessionInfo.setSessionPath(sessionPath);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ return new TraceSessionPropertySource(this);
+ }
+ 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
// ------------------------------------------------------------------------
* @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 isFunction - true for dynamic function entry/return probe else false
+ * @param probe - the actual probe
+ * @throws ExecutionException
+ */
+ public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException {
+ enableProbe(eventName, isFunction, probe, new NullProgressMonitor());
+ }
+
+ /**
+ * Enables a dynamic probe (for kernel domain)
+ * @param eventName - event name for probe
+ * @param isFunction - true for dynamic function entry/return probe else false
+ * @param probe - the actual probe
+ * @param monitor - a progress monitor
+ * @throws ExecutionException
+ */
+ public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+ getControlService().enableProbe(getName(), null, eventName, isFunction, 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);
+ }
}