From d7a7bd48f536975deebb19424135cff4862adeb3 Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Fri, 15 Aug 2014 07:54:03 -0400 Subject: [PATCH] tmf: Use custom parser constants of TmfTraceType evereywhere Change-Id: I165c289d5fa3394deee47b631dec45a202987bdc Signed-off-by: Bernd Hufmann Reviewed-on: https://git.eclipse.org/r/31748 Tested-by: Hudson CI Reviewed-by: Patrick Tasse Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- .../SelectElementTypeContributionItem.java | 14 ++++++-------- .../tmf/ui/views/filter/FilterViewer.java | 11 ++++------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectElementTypeContributionItem.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectElementTypeContributionItem.java index febf142571..c1d3c2324a 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectElementTypeContributionItem.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SelectElementTypeContributionItem.java @@ -56,8 +56,6 @@ public class SelectElementTypeContributionItem extends CompoundContributionItem private static final String TYPE_PARAMETER = "org.eclipse.linuxtools.tmf.ui.commandparameter.select_trace_type.type"; //$NON-NLS-1$ private static final String ICON_PARAMETER = "org.eclipse.linuxtools.tmf.ui.commandparameter.select_trace_type.icon"; //$NON-NLS-1$ private static final String SELECT_TRACE_TYPE_COMMAND_ID = "org.eclipse.linuxtools.tmf.ui.command.select_trace_type"; //$NON-NLS-1$ - private static final String CUSTOM_TXT_CATEGORY = "Custom Text"; //$NON-NLS-1$ - private static final String CUSTOM_XML_CATEGORY = "Custom XML"; //$NON-NLS-1$ private static final String DEFAULT_TRACE_ICON_PATH = "icons/elcl16/trace.gif"; //$NON-NLS-1$ @Override @@ -155,15 +153,15 @@ public class SelectElementTypeContributionItem extends CompoundContributionItem CustomTxtTraceDefinition[] customTxtTraceDefinitions = CustomTxtTraceDefinition.loadAll(); if (customTxtTraceDefinitions.length > 0) { ImageDescriptor icon = isSelectedCategory(customTxtTraceDefinitions, selectedTraceTypes) ? SELECTED_ICON : null; - MenuManager subMenu = new MenuManager(CUSTOM_TXT_CATEGORY, icon, null); - categoriesMap.put(CUSTOM_TXT_CATEGORY, subMenu); + MenuManager subMenu = new MenuManager(TmfTraceType.CUSTOM_TXT_CATEGORY, icon, null); + categoriesMap.put(TmfTraceType.CUSTOM_TXT_CATEGORY, subMenu); list.add(subMenu); } CustomXmlTraceDefinition[] customXmlTraceDefinitions = CustomXmlTraceDefinition.loadAll(); if (customXmlTraceDefinitions.length > 0) { ImageDescriptor icon = isSelectedCategory(customXmlTraceDefinitions, selectedTraceTypes) ? SELECTED_ICON : null; - MenuManager subMenu = new MenuManager(CUSTOM_XML_CATEGORY, icon, null); - categoriesMap.put(CUSTOM_XML_CATEGORY, subMenu); + MenuManager subMenu = new MenuManager(TmfTraceType.CUSTOM_XML_CATEGORY, icon, null); + categoriesMap.put(TmfTraceType.CUSTOM_XML_CATEGORY, subMenu); list.add(subMenu); } @@ -174,7 +172,7 @@ public class SelectElementTypeContributionItem extends CompoundContributionItem String traceIcon = DEFAULT_TRACE_ICON_PATH; String label = def.definitionName; boolean selected = selectedTraceTypes.contains(traceTypeId); - MenuManager subMenu = categoriesMap.get(CUSTOM_TXT_CATEGORY); + MenuManager subMenu = categoriesMap.get(TmfTraceType.CUSTOM_TXT_CATEGORY); addContributionItem(list, traceBundle, traceTypeId, traceIcon, label, selected, subMenu); } @@ -184,7 +182,7 @@ public class SelectElementTypeContributionItem extends CompoundContributionItem String traceIcon = DEFAULT_TRACE_ICON_PATH; String label = def.definitionName; boolean selected = selectedTraceTypes.contains(traceTypeId); - MenuManager subMenu = categoriesMap.get(CUSTOM_XML_CATEGORY); + MenuManager subMenu = categoriesMap.get(TmfTraceType.CUSTOM_XML_CATEGORY); addContributionItem(list, traceBundle, traceTypeId, traceIcon, label, selected, subMenu); } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java index 836505ead8..faacf6977a 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java @@ -83,9 +83,6 @@ import org.eclipse.swt.widgets.TreeItem; class FilterViewer extends Composite { - private static final String CUSTOM_TXT_CATEGORY = "Custom Text"; //$NON-NLS-1$ - private static final String CUSTOM_XML_CATEGORY = "Custom XML"; //$NON-NLS-1$ - private TreeViewer fViewer; private Composite fComposite; @@ -447,7 +444,7 @@ class FilterViewer extends Composite { } for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) { if (def.outputs.size() > 0) { - fieldsList.add("[" + CUSTOM_TXT_CATEGORY + //$NON-NLS-1$ + fieldsList.add("[" + TmfTraceType.CUSTOM_TXT_CATEGORY + //$NON-NLS-1$ " : " + def.definitionName + "]"); //$NON-NLS-1$ //$NON-NLS-2$ for (OutputColumn output : def.outputs) { fieldsList.add(output.name); @@ -457,7 +454,7 @@ class FilterViewer extends Composite { } for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) { if (def.outputs.size() > 0) { - fieldsList.add("[" + CUSTOM_XML_CATEGORY + //$NON-NLS-1$ + fieldsList.add("[" + TmfTraceType.CUSTOM_XML_CATEGORY + //$NON-NLS-1$ " : " + def.definitionName + "]"); //$NON-NLS-1$ //$NON-NLS-2$ for (OutputColumn output : def.outputs) { fieldsList.add(output.name); @@ -597,11 +594,11 @@ class FilterViewer extends Composite { eventsTypeMap.put(text, ce); } for (CustomTxtTraceDefinition def : CustomTxtTraceDefinition.loadAll()) { - String text = CUSTOM_TXT_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$ + String text = TmfTraceType.CUSTOM_TXT_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$ eventsTypeMap.put(text, def); } for (CustomXmlTraceDefinition def : CustomXmlTraceDefinition.loadAll()) { - String text = CUSTOM_XML_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$ + String text = TmfTraceType.CUSTOM_XML_CATEGORY + " : " + def.definitionName; //$NON-NLS-1$ eventsTypeMap.put(text, def); } return eventsTypeMap; -- 2.34.1