import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
/**
- * <b><u>DisconnectHandler</u></b>
* <p>
* Command handler implementation to disconnect from a target host.
* </p>
+ *
+ * @author Bernd Hufmann
*/
public class DisconnectHandler extends BaseNodeHandler {
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- fTargetNode.disconnect();
+ fLock.lock();
+ try {
+ fTargetNode.disconnect();
+ } finally {
+ fLock.unlock();
+ }
return null;
}
*/
@Override
public boolean isEnabled() {
- return super.isEnabled() && (fTargetNode.getTargetNodeState() == TargetNodeState.CONNECTED);
+ boolean isEnabled = false;
+ fLock.lock();
+ try {
+ isEnabled = super.isEnabled() && (fTargetNode.getTargetNodeState() == TargetNodeState.CONNECTED);
+ } finally {
+ fLock.unlock();
+ }
+ return isEnabled;
}
}