X-Git-Url: http://drtracing.org/?a=blobdiff_plain;ds=sidebyside;f=org.eclipse.linuxtools.lttng2.ui%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Finternal%2Flttng2%2Fui%2Fviews%2Fcontrol%2Fhandlers%2FBaseNodeHandler.java;h=e922fb203e50bef00133ec2fcec1eb6afb18cad7;hb=152ba1a7fabe7175ba1a6f267eda2b3891cbcb63;hp=b22ac58994c97776e2236e975bb0654d51f07923;hpb=115b4a011a6d454d317b035d616f649c75a9943c;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseNodeHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseNodeHandler.java index b22ac58994..e922fb203e 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseNodeHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseNodeHandler.java @@ -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; @@ -18,28 +18,26 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.Target import org.eclipse.ui.IWorkbenchPage; /** - * BaseNodeHandler *

* Command handler implementation to delete a target host. *

+ * + * @author Bernd Hufmann */ -abstract public class BaseNodeHandler extends BaseControlViewHandler { +public abstract class BaseNodeHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ /** - * The target node component the command is to be executed on. + * The target node component the command is to be executed on. */ protected TargetNodeComponent fTargetNode = null; - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - /* - * (non-Javadoc) - * @see org.eclipse.core.commands.AbstractHandler#isEnabled() - */ + @Override public boolean isEnabled() { @@ -49,16 +47,24 @@ abstract public class BaseNodeHandler extends BaseControlViewHandler { return false; } - fTargetNode = null; - + TargetNodeComponent node = null; // Check if the node component is selected ISelection selection = page.getSelection(ControlView.ID); if (selection instanceof StructuredSelection) { Object element = ((StructuredSelection) selection).getFirstElement(); - fTargetNode = (element instanceof TargetNodeComponent) ? (TargetNodeComponent) element : null; + node = (element instanceof TargetNodeComponent) ? (TargetNodeComponent) element : null; } - return fTargetNode != null; + boolean isEnabled = node != null; + fLock.lock(); + try { + if (isEnabled) { + fTargetNode = node; + } + } finally { + fLock.unlock(); + } + return isEnabled; } - + } \ No newline at end of file