tmf/lttng: Update 2014 copyrights
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / model / impl / TraceChannelComponent.java
index c82f08afcd67af2a54fcea5b06ea643817345bff..fe025c6722ba150006fbf4de7286126dc5ba4b18 100644 (file)
@@ -1,13 +1,14 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
- * 
+ * Copyright (c) 2012, 2014 Ericsson
+ *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
+ *
+ * Contributors:
  *   Bernd Hufmann - Initial API and implementation
+ *   Bernd Hufmann - Updated for support of LTTng Tools 2.1
  **********************************************************************/
 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl;
 
@@ -16,7 +17,6 @@ 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.internal.lttng2.core.control.model.IChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
@@ -36,13 +36,15 @@ import org.eclipse.ui.views.properties.IPropertySource;
  * <p>
  * Implementation of the trace channel component.
  * </p>
- * 
+ *
  * @author Bernd Hufmann
  */
 public class TraceChannelComponent extends TraceControlComponent {
+
     // ------------------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------------------
+
     /**
      * Path to icon file for this component (state enabled).
      */
@@ -51,10 +53,11 @@ public class TraceChannelComponent extends TraceControlComponent {
      * Path to icon file for this component (state disabled).
      */
     public static final String TRACE_CHANNEL_ICON_FILE_DISABLED = "icons/obj16/channel_disabled.gif"; //$NON-NLS-1$
-    
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
+
     /**
      * The channel information.
      */
@@ -63,12 +66,13 @@ public class TraceChannelComponent extends TraceControlComponent {
      * The image to be displayed in disabled state.
      */
     private Image fDisabledImage = null;
-    
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
+
     /**
-     * Constructor 
+     * Constructor
      * @param name - the name of the component.
      * @param parent - the parent of this component.
      */
@@ -79,14 +83,11 @@ public class TraceChannelComponent extends TraceControlComponent {
         fChannelInfo = new ChannelInfo(name);
         fDisabledImage = Activator.getDefault().loadIcon(TRACE_CHANNEL_ICON_FILE_DISABLED);
     }
-    
+
     // ------------------------------------------------------------------------
     // Accessors
     // ------------------------------------------------------------------------
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getImage()
-     */
+
     @Override
     public Image getImage() {
         if (fChannelInfo.getState() == TraceEnablement.DISABLED) {
@@ -97,12 +98,14 @@ public class TraceChannelComponent extends TraceControlComponent {
 
     /**
      * Sets the channel information.
+     *
      * @param channelInfo
+     *            The channel info to assign to this component
      */
     public void setChannelInfo(IChannelInfo channelInfo) {
         fChannelInfo = channelInfo;
         IEventInfo[] events = fChannelInfo.getEvents();
-        List<ITraceControlComponent> eventComponents = new ArrayList<ITraceControlComponent>();
+        List<ITraceControlComponent> eventComponents = new ArrayList<>();
         for (int i = 0; i < events.length; i++) {
             TraceEventComponent event = null;
             if (events[i].getClass() == ProbeEventInfo.class) {
@@ -113,7 +116,6 @@ public class TraceChannelComponent extends TraceControlComponent {
 
             eventComponents.add(event);
             event.setEventInfo(events[i]);
-//            addChild(event);
         }
         if (!eventComponents.isEmpty()) {
             setChildren(eventComponents);
@@ -176,7 +178,7 @@ public class TraceChannelComponent extends TraceControlComponent {
      * @return the read timer interval.
      */
     public long getReadTimer() {
-        return fChannelInfo.getReadTimer(); 
+        return fChannelInfo.getReadTimer();
     }
     /**
      * Sets the read timer interval to the given value.
@@ -218,31 +220,27 @@ public class TraceChannelComponent extends TraceControlComponent {
     public void setState(String stateName) {
         fChannelInfo.setState(stateName);
     }
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.internal.lttng2.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 ((TraceDomainComponent)getParent()).getSessionName();
     }
 
     /**
      * @return session from parent
      */
     public TraceSessionComponent getSession() {
-       return ((TraceDomainComponent)getParent()).getSession(); 
+       return ((TraceDomainComponent)getParent()).getSession();
     }
 
     /**
@@ -251,48 +249,55 @@ public class TraceChannelComponent extends TraceControlComponent {
     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
+     *
+     * @param eventNames
+     *            - a list of event names to enabled.
+     * @param monitor
+     *            - a progress monitor
      * @throws ExecutionException
+     *             If the command fails
      */
     public void enableEvents(List<String> eventNames, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().enableEvents(getSessionName(), getName(), eventNames, isKernel(), monitor);
+        enableEvents(eventNames, null,  monitor);
     }
-    
+
     /**
-     * Enables all syscalls (for kernel domain)
+     * Enables a list of events with no additional parameters.
+     *
+     * @param eventNames
+     *            - a list of event names to enabled.
+     * @param filterExpression
+     *            - a filter expression
+     * @param monitor
+     *            - a progress monitor
      * @throws ExecutionException
+     *             If the command fails
      */
-    public void enableSyscalls() throws ExecutionException {
-        enableSyscalls(new NullProgressMonitor());
+    public void enableEvents(List<String> eventNames, String filterExpression, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableEvents(getSessionName(), getName(), eventNames, isKernel(), filterExpression,  monitor);
     }
 
     /**
      * Enables all syscalls (for kernel domain)
-     * @param monitor - a progress monitor
+     *
+     * @param monitor
+     *            - a progress monitor
      * @throws ExecutionException
+     *             If the command fails
      */
     public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException {
         getControlService().enableSyscalls(getSessionName(), getName(), monitor);
@@ -300,85 +305,74 @@ public class TraceChannelComponent extends TraceControlComponent {
 
     /**
      * 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 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
+     *             If the command fails
      */
-    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 {
+    public void enableProbe(String eventName, boolean isFunction, String probe,
+            IProgressMonitor monitor) throws ExecutionException {
         getControlService().enableProbe(getSessionName(), getName(), 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  
+     *
+     * @param eventName
+     *            - a event name
+     * @param logLevelType
+     *            - a log level type
+     * @param level
+     *            - a log level
+     * @param filterExpression
+     *            - a filter expression
+     * @param monitor
+     *            - a progress monitor
      * @throws ExecutionException
+     *             If the command fails
      */
-    public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().enableLogLevel(getSessionName(), getName(), eventName, logLevelType, level, monitor);
+    public void enableLogLevel(String eventName, LogLevelType logLevelType,
+            TraceLogLevel level, String filterExpression, IProgressMonitor monitor)
+            throws ExecutionException {
+        getControlService().enableLogLevel(getSessionName(), getName(), eventName, logLevelType, level, filterExpression, 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);
-    }
-    
-    /**
-     * Add contexts to given channels and or events
-     * @param contexts - a list of contexts to add
+     *
+     * @param eventNames
+     *            - a list of event names to enabled.
+     * @param monitor
+     *            - a progress monitor
      * @throws ExecutionException
+     *             If the command fails
      */
-    public void addContexts(List<String> contexts) throws ExecutionException {
-        addContexts(contexts, new NullProgressMonitor());
+    public void disableEvent(List<String> eventNames, IProgressMonitor monitor)
+            throws ExecutionException {
+        getControlService().disableEvent(getParent().getParent().getName(),
+                getName(), eventNames, isKernel(), monitor);
     }
 
     /**
      * Add contexts to given channels and or events
-     * @param contexts - a list of contexts to add
-     * @param monitor - a progress monitor
+     *
+     * @param contexts
+     *            - a list of contexts to add
+     * @param monitor
+     *            - a progress monitor
      * @throws ExecutionException
+     *             If the command fails
      */
-    public void addContexts(List<String> contexts, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().addContexts(getSessionName(), getName(), null, isKernel(), contexts, monitor);
+    public void addContexts(List<String> contexts, IProgressMonitor monitor)
+            throws ExecutionException {
+        getControlService().addContexts(getSessionName(), getName(), null,
+                isKernel(), contexts, monitor);
     }
 }
This page took 0.03169 seconds and 5 git commands to generate.