ctf: Move CTF plugins to Java 7 and fix warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / handlers / BaseEnableChannelHandler.java
index 7af1edea2b5870a1a360b9926ed78e0e98cad6d8..44406c63ef0ac6d24eddbf589d0e6e47b1825c26 100644 (file)
@@ -1,12 +1,12 @@
 /**********************************************************************
- * Copyright (c) 2012 Ericsson
- * 
+ * Copyright (c) 2012, 2013 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
  **********************************************************************/
 package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers;
@@ -30,9 +30,9 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceD
 
 /**
  * <p>
- * Base implementation of a command handler to enable a trace channel.  
+ * Base implementation of a command handler to enable a trace channel.
  * </p>
- * 
+ *
  * @author Bernd Hufmann
  */
 abstract class BaseEnableChannelHandler extends BaseControlViewHandler {
@@ -45,29 +45,36 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler {
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
+
     /**
-     * Enables channels with given names which are part of this domain. If a given channel 
-     * doesn't exists it creates a new channel with the given parameters (or default values 
-     * if given parameter is null). 
-     * @param - a parameter instance with data for the command execution
-     * @param channelNames - a list of channel names to enable on this domain
-     * @param info - channel information to set for the channel (use null for default)
-     * @param isKernel -  a flag for indicating kernel or UST.
-     * @param monitor - a progress monitor
+     * Enables channels with given names which are part of this domain. If a
+     * given channel doesn't exists it creates a new channel with the given
+     * parameters (or default values if given parameter is null).
+     *
+     * @param param
+     *            - a parameter instance with data for the command execution
+     * @param channelNames
+     *            - a list of channel names to enable on this domain
+     * @param info
+     *            - channel information to set for the channel (use null for
+     *            default)
+     * @param isKernel
+     *            - a flag for indicating kernel or UST.
+     * @param monitor
+     *            - a progress monitor
      * @throws ExecutionException
+     *             If something goes wrong when enabling the channel
      */
-    abstract public void enableChannel(CommandParameter param, List<String> channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException; 
-    
+    public abstract void enableChannel(CommandParameter param,
+            List<String> channelNames, IChannelInfo info, boolean isKernel,
+            IProgressMonitor monitor) throws ExecutionException;
+
     /**
-     * @param - a parameter instance with data for the command execution
+     * @param param - a parameter instance with data for the command execution
      * @return returns the relevant domain (null if domain is not known)
      */
-    abstract public TraceDomainComponent getDomain(CommandParameter param);
+    public abstract TraceDomainComponent getDomain(CommandParameter param);
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-     */
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
         fLock.lock();
@@ -75,7 +82,9 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler {
             final CommandParameter param = fParam.clone();
 
             final IEnableChannelDialog dialog =  TraceControlDialogFactory.getInstance().getEnableChannelDialog();
+            dialog.setTargetNodeComponent(param.getSession().getTargetNode());
             dialog.setDomainComponent(getDomain(param));
+            dialog.setHasKernel(param.getSession().hasKernelProvider());
 
             if (dialog.open() != Window.OK) {
                 return null;
@@ -86,7 +95,7 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler {
                 protected IStatus run(IProgressMonitor monitor) {
                     Exception error = null;
 
-                    List<String> channelNames = new ArrayList<String>();                    
+                    List<String> channelNames = new ArrayList<String>();
                     channelNames.add(dialog.getChannelInfo().getName());
 
                     try {
@@ -99,7 +108,7 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler {
                     refresh(param);
 
                     if (error != null) {
-                        return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateChannelStateFailure, error);
+                        return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateChannelStateFailure, error);
                     }
                     return Status.OK_STATUS;
                 }
This page took 0.025756 seconds and 5 git commands to generate.