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 | ||
13 | package org.eclipse.linuxtools.tmf.ui.project.model; | |
14 | ||
15 | import org.eclipse.jface.viewers.ViewerSorter; | |
16 | ||
17 | /** | |
18 | * Viewer sorter for TMF project model elements | |
19 | * | |
20 | * @since 3.0 | |
21 | */ | |
22 | public class TmfViewerSorter extends ViewerSorter { | |
23 | ||
24 | @Override | |
25 | public int category(Object element) { | |
26 | if (element instanceof TmfExperimentFolder) { | |
27 | return 0; | |
28 | } | |
29 | if (element instanceof TmfTraceFolder) { | |
30 | return 0; | |
31 | } | |
32 | if (element instanceof TmfExperimentElement) { | |
33 | return 1; | |
34 | } | |
35 | if (element instanceof TmfTraceElement) { | |
36 | return 1; | |
37 | } | |
38 | return 2; | |
39 | } | |
40 | ||
41 | ||
42 | } |