]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/override/TreeExpandCollapseCommandHandler.java
Sync git svn branch with SVN repository r33144.
[simantics/platform.git] / bundles / org.simantics.browsing.ui.nattable / src / org / simantics / browsing / ui / nattable / override / TreeExpandCollapseCommandHandler.java
1 /*******************************************************************************
2  * Copyright (c) 2012 Original authors and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     Original authors and others - initial API and implementation
10  ******************************************************************************/
11 package org.simantics.browsing.ui.nattable.override;
12
13 import org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler;
14 import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandCollapseCommand;
15
16 public class TreeExpandCollapseCommandHandler extends
17         AbstractLayerCommandHandler<TreeExpandCollapseCommand> {
18
19     private final TreeLayer2 treeLayer;
20
21     public TreeExpandCollapseCommandHandler(TreeLayer2 treeLayer) {
22         this.treeLayer = treeLayer;
23     }
24
25     @Override
26     public Class<TreeExpandCollapseCommand> getCommandClass() {
27         return TreeExpandCollapseCommand.class;
28     }
29
30     @Override
31     protected boolean doCommand(TreeExpandCollapseCommand command) {
32         int parentIndex = command.getParentIndex();
33         this.treeLayer.expandOrCollapseIndex(parentIndex);
34         return true;
35     }
36
37 }