org.eclipse.mylyn.commons.ui.TreeSorter.java Source code

Java tutorial

Introduction

Here is the source code for org.eclipse.mylyn.commons.ui.TreeSorter.java

Source

/*******************************************************************************
 * Copyright (c) 2010 Tasktop Technologies and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.commons.ui;

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.TreeColumn;

/**
 * @author Shawn Minto
 * @author Steffen Pingel
 * @since 3.7
 */
public abstract class TreeSorter extends AbstractColumnViewerSorter<TreeViewer, TreeColumn> {

    @Override
    int getColumnIndex(TreeViewer viewer, TreeColumn column) {
        return viewer.getTree().indexOf(column);
    }

    @Override
    TreeColumn getSortColumn(TreeViewer viewer) {
        return viewer.getTree().getSortColumn();
    }

    @Override
    protected int getSortDirection(TreeViewer viewer) {
        return viewer.getTree().getSortDirection();
    }

}