1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
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
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.ui
.project
.model
;
15 import org
.eclipse
.jface
.viewers
.ViewerSorter
;
18 * Viewer sorter for TMF project model elements
20 // TODO: Follow-up with Bug 484248
21 public class TmfViewerSorter
extends ViewerSorter
{
23 private static int UNSET_PRIO
= Integer
.MAX_VALUE
;
24 private static int EXPERIMENT_FOLDER_PRIO
= 0;
25 private static int TRACE_FOLDER_PRIO
= 1;
26 private static int EXPERIMENT_ELEMENT_PRIO
= 2;
27 private static int TRACE_ELEMENT_PRIO
= 3;
28 private static int VIEWS_PRIO
= 4;
29 private static int ON_DEMAND_ANALYSIS_PRIO
= 5;
30 private static int REPORTS_PRIO
= 6;
33 public int category(Object element
) {
34 int prio
= UNSET_PRIO
;
35 if (element
instanceof TmfExperimentFolder
) {
36 prio
= EXPERIMENT_FOLDER_PRIO
;
37 } else if (element
instanceof TmfTraceFolder
) {
38 prio
= TRACE_FOLDER_PRIO
;
39 } else if (element
instanceof TmfTraceElement
) {
40 prio
= TRACE_ELEMENT_PRIO
;
41 } else if (element
instanceof TmfExperimentElement
) {
42 prio
= EXPERIMENT_ELEMENT_PRIO
;
43 } else if (element
instanceof TmfViewsElement
) {
45 } else if (element
instanceof TmfOnDemandAnalysesElement
) {
46 prio
= ON_DEMAND_ANALYSIS_PRIO
;
47 } else if (element
instanceof TmfReportsElement
) {