1 /**********************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
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
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.linuxtools
.internal
.lttng2
.control
.ui
.views
.handlers
;
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 import org
.eclipse
.linuxtools
.internal
.lttng2
.control
.ui
.views
.model
.ITraceControlComponent
;
21 * Command handler implementation to delete a target host.
24 * @author Bernd Hufmann
26 public class DeleteHandler
extends BaseNodeHandler
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
33 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
36 ITraceControlComponent root
= fTargetNode
.getParent();
37 fTargetNode
.removeAllChildren();
38 fTargetNode
.deregister();
39 root
.removeChild(fTargetNode
);
47 public boolean isEnabled() {
48 boolean isEnabled
= false;
51 isEnabled
= (super.isEnabled() && (fTargetNode
.getTargetNodeState() == TargetNodeState
.DISCONNECTED
));