Fix for custom parsers
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / util / TmfTraceType.java
CommitLineData
4bf17f4a 1/*******************************************************************************
2 * Copyright (c) 2011 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
13package org.eclipse.linuxtools.tmf.util;
14
15import java.util.LinkedList;
16import java.util.List;
17
18import org.eclipse.core.runtime.IConfigurationElement;
19import org.eclipse.core.runtime.Platform;
20
21public class TmfTraceType {
22
23 // Extension point ID
24 public static final String TMF_TRACE_TYPE_ID = "org.eclipse.linuxtools.tmf.tracetype"; //$NON-NLS-1$
25
26 // Extension point elements
27 public static final String CATEGORY_ELEM = "category"; //$NON-NLS-1$
28 public static final String TYPE_ELEM = "type"; //$NON-NLS-1$
29 public static final String DEFAULT_EDITOR_ELEM = "defaultEditor"; //$NON-NLS-1$
30 public static final String EVENTS_TABLE_TYPE_ELEM = "eventsTableType"; //$NON-NLS-1$
31
32 // Extension point attributes
33 public static final String ID_ATTR = "id"; //$NON-NLS-1$
34 public static final String NAME_ATTR = "name"; //$NON-NLS-1$
35 public static final String CATEGORY_ATTR = "category"; //$NON-NLS-1$
36 public static final String TRACE_TYPE_ATTR = "trace_type"; //$NON-NLS-1$
37 public static final String EVENT_TYPE_ATTR = "event_type"; //$NON-NLS-1$
38 public static final String ICON_ATTR = "icon"; //$NON-NLS-1$
39 public static final String CLASS_ATTR = "class"; //$NON-NLS-1$
40
41 public static String getCategoryName(String categoryId) {
42 IConfigurationElement[] elements = Platform.getExtensionRegistry()
43 .getConfigurationElementsFor(TMF_TRACE_TYPE_ID);
44 for (IConfigurationElement element : elements) {
45 if (element.getName().equals(CATEGORY_ELEM) && categoryId.equals(element.getAttribute(ID_ATTR))) {
46 return element.getAttribute(NAME_ATTR);
47 }
48 }
49 return ""; //$NON-NLS-1$
50 }
51
52 public static IConfigurationElement[] getTypeElements() {
53 IConfigurationElement[] elements = Platform.getExtensionRegistry()
54 .getConfigurationElementsFor(TMF_TRACE_TYPE_ID);
55 List<IConfigurationElement> typeElements = new LinkedList<IConfigurationElement>();
56 for (IConfigurationElement element : elements) {
57 if (element.getName().equals(TYPE_ELEM)) {
58 typeElements.add(element);
59 }
60 }
61 return typeElements.toArray(new IConfigurationElement[0]);
62 }
63}
This page took 0.025391 seconds and 5 git commands to generate.