Fix for bug 382684 (connection re-use)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / handlers / EnableChannelOnDomainHandler.java
index 3b925a0f740adc74aa8c77ffceb5f91f442bd080..7cb1f38cb760fa7981fbacc6a79c9e1bf07a9a71 100644 (file)
@@ -1,12 +1,12 @@
 /**********************************************************************
  * Copyright (c) 2012 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;
@@ -18,18 +18,19 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.ControlView;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
 import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
 import org.eclipse.ui.IWorkbenchPage;
 
 /**
- * <b><u>EnableChannelOnDomainHandler</u></b>
  * <p>
  * Command handler implementation to enable a trace channel for known domain.
  * </p>
+ *
+ * @author Bernd Hufmann
  */
 public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler {
 
@@ -50,7 +51,7 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler {
             ((DomainCommandParameter)param).getDomain().enableChannels(channelNames, info, monitor);
         }
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter)
@@ -69,26 +70,26 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler {
      */
     @Override
     public boolean isEnabled() {
-        
+
         // Get workbench page for the Control View
         IWorkbenchPage page = getWorkbenchPage();
         if (page == null) {
             return false;
         }
-        
+
         TraceDomainComponent domain = null;
         TraceSessionComponent session = null;
-        
+
         // Check if one domain is selected
         ISelection selection = page.getSelection(ControlView.ID);
         if (selection instanceof StructuredSelection) {
             StructuredSelection structered = ((StructuredSelection) selection);
             for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
-                Object element = (Object) iterator.next();
+                Object element = iterator.next();
                 if (element instanceof TraceDomainComponent) {
                     TraceDomainComponent tmpDomain = (TraceDomainComponent) element;
                     session = (TraceSessionComponent) tmpDomain.getParent();
-                    
+
                     // Add only TraceDomainComponent whose TraceSessionComponent parent is inactive and not destroyed
                     if ((session.getSessionState() == TraceSessionState.INACTIVE) && (!session.isDestroyed())) {
                         domain = tmpDomain;
@@ -96,9 +97,9 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler {
                 }
             }
         }
-        
+
         boolean isEnabled = domain != null;
-        
+
         fLock.lock();
         try {
             fParam = null;
@@ -108,8 +109,8 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler {
         } finally {
             fLock.unlock();
         }
-        
+
         return isEnabled;
     }
-    
+
 }
This page took 0.025242 seconds and 5 git commands to generate.