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 / TraceChannelComponent.java
index ec037c6e094973ec2276b81be87756ed7b831a37..7f4a08195bdebefb69fb1266e9fe8baa27c52757 100644 (file)
  **********************************************************************/
 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.LTTngUiPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IEventInfo;
 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.TraceEnablement;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceChannelPropertySource;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.views.properties.IPropertySource;
 
 
 /**
@@ -194,8 +203,167 @@ public class TraceChannelComponent extends TraceControlComponent {
     public void setState(String stateName) {
         fChannelInfo.setState(stateName);
     }
+    /*
+     * (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 TraceChannelPropertySource(this);
+        }
+        return null;
+    } 
+
+    /**
+     * @return session name from parent
+     */
+    public String getSessionName() {
+       return ((TraceDomainComponent)getParent()).getSessionName(); 
+    }
+
+    /**
+     * @return session from parent
+     */
+    public TraceSessionComponent getSession() {
+       return ((TraceDomainComponent)getParent()).getSession(); 
+    }
+
+    /**
+     * @return if domain is kernel or UST
+     */
+    public boolean isKernel() {
+        return ((TraceDomainComponent)getParent()).isKernel();
+    }
+    
+    /**
+     * @return the parent target node
+     */
+    public TargetNodeComponent getTargetNode() {
+        return ((TraceDomainComponent)getParent()).getTargetNode();
+    }
     
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
+    /**
+     * Enables a list of events with no additional parameters.
+     * @param eventNames - a list of event names to enabled.
+     * @throws ExecutionException
+     */
+    public void enableEvents(List<String> eventNames) throws ExecutionException {
+        enableEvents(eventNames, new NullProgressMonitor());
+    }
+
+    /**
+     * Enables a list of events with no additional parameters.
+     * @param eventNames - a list of event names to enabled.
+     * @param monitor - a progress monitor
+     * @throws ExecutionException
+     */
+    public void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableEvents(getSessionName(), getName(), 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(getSessionName(), getName(), 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(getSessionName(), getName(), 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(getSessionName(), getName(), 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(getSessionName(), getName(), eventName, logLevelType, level, monitor);
+    }
+
+    /**
+     * Enables a list of events with no additional parameters.
+     * @param eventNames - a list of event names to enabled.
+     * @throws ExecutionException
+     */
+    public void disableEvent(List<String> eventNames) throws ExecutionException {
+        disableEvent(eventNames, new NullProgressMonitor());
+    }
+
+    /**
+     * Enables a list of events with no additional parameters.
+     * @param eventNames - a list of event names to enabled.
+     * @param monitor - a progress monitor
+     * @throws ExecutionException
+     */
+    public void disableEvent(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().disableEvent(getParent().getParent().getName(), getName(), eventNames, isKernel(), monitor);
+    }
 }
This page took 0.025732 seconds and 5 git commands to generate.