gdbtrace: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.ui / src / org / eclipse / linuxtools / internal / lttng2 / control / ui / views / handlers / ConnectHandler.java
1 /**********************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org.eclipse.linuxtools.internal.lttng2.control.ui.views.handlers;
13
14 import org.eclipse.core.commands.ExecutionEvent;
15 import org.eclipse.core.commands.ExecutionException;
16 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
17
18 /**
19 * <p>
20 * Command handler implementation to connect to a target host.
21 * </p>
22 *
23 * @author Bernd Hufmann
24 */
25 public class ConnectHandler extends BaseNodeHandler {
26
27 // ------------------------------------------------------------------------
28 // Operations
29 // ------------------------------------------------------------------------
30
31 @Override
32 public Object execute(ExecutionEvent event) throws ExecutionException {
33 fLock.lock();
34 try {
35 fTargetNode.connect();
36 } finally {
37 fLock.unlock();
38 }
39 return null;
40 }
41
42 @Override
43 public boolean isEnabled() {
44 boolean isEnabled = false;
45 fLock.lock();
46 try {
47 isEnabled = (super.isEnabled() && (fTargetNode.getTargetNodeState() == TargetNodeState.DISCONNECTED));
48 } finally {
49 fLock.unlock();
50 }
51 return isEnabled;
52 }
53 }
This page took 0.041673 seconds and 5 git commands to generate.