lttng: Add a diagram showing the dependencies between plugins
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / handlers / DeleteHandler.java
CommitLineData
eb1bab5b 1/**********************************************************************
11252342
AM
2 * Copyright (c) 2012, 2013 Ericsson
3 *
eb1bab5b
BH
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
11252342
AM
8 *
9 * Contributors:
eb1bab5b
BH
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
115b4a01 12package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers;
eb1bab5b
BH
13
14import org.eclipse.core.commands.ExecutionEvent;
15import org.eclipse.core.commands.ExecutionException;
9315aeee 16import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
115b4a01 17import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
eb1bab5b
BH
18
19/**
eb1bab5b
BH
20 * <p>
21 * Command handler implementation to delete a target host.
22 * </p>
11252342 23 *
dbd4432d 24 * @author Bernd Hufmann
eb1bab5b
BH
25 */
26public class DeleteHandler extends BaseNodeHandler {
27
28 // ------------------------------------------------------------------------
29 // Operations
30 // ------------------------------------------------------------------------
11252342 31
eb1bab5b
BH
32 @Override
33 public Object execute(ExecutionEvent event) throws ExecutionException {
c56972bb
BH
34 fLock.lock();
35 try {
36 ITraceControlComponent root = fTargetNode.getParent();
37 fTargetNode.removeAllChildren();
8577ed1e 38 fTargetNode.deregister();
c56972bb
BH
39 root.removeChild(fTargetNode);
40 } finally {
41 fLock.unlock();
42 }
eb1bab5b
BH
43 return null;
44 }
45
eb1bab5b
BH
46 @Override
47 public boolean isEnabled() {
c56972bb
BH
48 boolean isEnabled = false;
49 fLock.lock();
50 try {
51 isEnabled = (super.isEnabled() && (fTargetNode.getTargetNodeState() == TargetNodeState.DISCONNECTED));
52 } finally {
53 fLock.unlock();
54 }
55 return isEnabled;
eb1bab5b
BH
56 }
57}
This page took 0.101362 seconds and 5 git commands to generate.