tmf: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / filter / CutHandler.java
1 /*******************************************************************************
2 * Copyright (c) 2013 Kalray
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 * Xavier Raynaud - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.ui.views.filter;
14
15 import org.eclipse.jface.viewers.ISelection;
16 import org.eclipse.jface.viewers.IStructuredSelection;
17 import org.eclipse.jface.viewers.StructuredSelection;
18 import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;
19
20 /**
21 * Handler for cut command in filter view
22 * @author Xavier Raynaud <xavier.raynaud@kalray.eu>
23 * @since 3.0
24 */
25 public class CutHandler extends CopyHandler {
26
27 @Override
28 protected ISelection getSelection(FilterView tcv) {
29 ISelection sel = super.getSelection(tcv);
30 if (sel instanceof IStructuredSelection) {
31 IStructuredSelection selection = (IStructuredSelection) sel;
32 Object o = selection.getFirstElement();
33 if (o instanceof ITmfFilterTreeNode) {
34 ITmfFilterTreeNode node = (ITmfFilterTreeNode) o;
35 node = node.remove();
36 tcv.refresh();
37 return new StructuredSelection(node);
38 }
39 }
40 return sel;
41 }
42
43 }
This page took 0.04156 seconds and 5 git commands to generate.