Commit | Line | Data |
---|---|---|
339d539c PT |
1 | /******************************************************************************* |
2 | * Copyright (c) 2014 Ericsson | |
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 | * Patrick Tasse - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.ui.project.model; |
339d539c | 14 | |
e707a557 | 15 | import org.eclipse.jface.viewers.ViewerComparator; |
339d539c PT |
16 | |
17 | /** | |
18 | * Viewer sorter for TMF project model elements | |
339d539c | 19 | */ |
e707a557 | 20 | public class TmfViewerSorter extends ViewerComparator { |
339d539c PT |
21 | |
22 | @Override | |
23 | public int category(Object element) { | |
24 | if (element instanceof TmfExperimentFolder) { | |
25 | return 0; | |
26 | } | |
27 | if (element instanceof TmfTraceFolder) { | |
28 | return 0; | |
29 | } | |
30 | if (element instanceof TmfExperimentElement) { | |
31 | return 1; | |
32 | } | |
33 | if (element instanceof TmfTraceElement) { | |
34 | return 1; | |
35 | } | |
36 | return 2; | |
37 | } | |
38 | ||
39 | ||
40 | } |