1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Bug 329676: Open element for enumerators.

This commit is contained in:
Markus Schorn 2010-11-11 09:01:41 +00:00
parent 5fa5ff3a81
commit 4a66e70766
5 changed files with 27 additions and 4 deletions

View file

@ -85,6 +85,10 @@ public class IndexModelUtil {
if(binding instanceof IVariable) if(binding instanceof IVariable)
return true; return true;
break; break;
case ICElement.C_ENUMERATOR:
if (binding instanceof IEnumerator)
return true;
break;
} }
} }
return false; return false;

View file

@ -57,6 +57,7 @@ public class TypeInfoLabelProvider extends LabelProvider {
private static final Image FUNCTION_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_FUNCTION); private static final Image FUNCTION_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_FUNCTION);
private static final Image VARIABLE_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_VARIABLE); private static final Image VARIABLE_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_VARIABLE);
private static final Image VARIABLE_LOCAL_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_LOCAL_VARIABLE); private static final Image VARIABLE_LOCAL_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_LOCAL_VARIABLE);
private static final Image ENUMERATOR_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_ENUMERATOR);
private static final Image MACRO_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_MACRO); private static final Image MACRO_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_MACRO);
private static final Image UNKNOWN_TYPE_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_UNKNOWN_TYPE); private static final Image UNKNOWN_TYPE_ICON= CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_UNKNOWN_TYPE);
@ -228,6 +229,9 @@ public class TypeInfoLabelProvider extends LabelProvider {
case ICElement.C_VARIABLE: case ICElement.C_VARIABLE:
return VARIABLE_ICON; return VARIABLE_ICON;
case ICElement.C_ENUMERATOR:
return ENUMERATOR_ICON;
case ICElement.C_MACRO: case ICElement.C_MACRO:
return MACRO_ICON; return MACRO_ICON;

View file

@ -36,6 +36,8 @@ public final class TypeInfoMessages extends NLS {
public static String TypeSelectionDialog_filterUnions; public static String TypeSelectionDialog_filterUnions;
public static String TypeSelectionDialog_filterFunctions; public static String TypeSelectionDialog_filterFunctions;
public static String TypeSelectionDialog_filterVariables; public static String TypeSelectionDialog_filterVariables;
/** @since 5.3 */
public static String TypeSelectionDialog_filterEnumerators;
public static String TypeSelectionDialog_filterMacros; public static String TypeSelectionDialog_filterMacros;
public static String TypeSelectionDialog_filterLowLevelTypes; public static String TypeSelectionDialog_filterLowLevelTypes;
public static String TypeInfoLabelProvider_globalScope; public static String TypeInfoLabelProvider_globalScope;

View file

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright (c) 2000, 2008 QNX Software Systems and others. # Copyright (c) 2000, 2010 QNX Software Systems and others.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
@ -26,7 +26,8 @@ TypeSelectionDialog_filterEnums=&Enumeration
TypeSelectionDialog_filterUnions=&Union TypeSelectionDialog_filterUnions=&Union
TypeSelectionDialog_filterFunctions=&Function TypeSelectionDialog_filterFunctions=&Function
TypeSelectionDialog_filterVariables=&Variable TypeSelectionDialog_filterVariables=&Variable
TypeSelectionDialog_filterMacros=M&acros TypeSelectionDialog_filterEnumerators=Enume&rator
TypeSelectionDialog_filterMacros=M&acro
TypeSelectionDialog_filterLowLevelTypes=Show &low-level elements (names beginning with '_') TypeSelectionDialog_filterLowLevelTypes=Show &low-level elements (names beginning with '_')

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2009 IBM Corporation and others. * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -204,6 +204,7 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
private static final String SETTINGS_SHOW_UNIONS = "show_unions"; //$NON-NLS-1$ private static final String SETTINGS_SHOW_UNIONS = "show_unions"; //$NON-NLS-1$
private static final String SETTINGS_SHOW_FUNCTIONS = "show_functions"; //$NON-NLS-1$ private static final String SETTINGS_SHOW_FUNCTIONS = "show_functions"; //$NON-NLS-1$
private static final String SETTINGS_SHOW_VARIABLES = "show_variables"; //$NON-NLS-1$ private static final String SETTINGS_SHOW_VARIABLES = "show_variables"; //$NON-NLS-1$
private static final String SETTINGS_SHOW_ENUMERATORS = "show_enumerators"; //$NON-NLS-1$
private static final String SETTINGS_SHOW_MACROS = "show_macros"; //$NON-NLS-1$ private static final String SETTINGS_SHOW_MACROS = "show_macros"; //$NON-NLS-1$
private static final String SETTINGS_SHOW_LOWLEVEL = "show_lowlevel"; //$NON-NLS-1$ private static final String SETTINGS_SHOW_LOWLEVEL = "show_lowlevel"; //$NON-NLS-1$
@ -218,7 +219,8 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
private static final int[] ALL_TYPES = { ICElement.C_NAMESPACE, ICElement.C_CLASS, private static final int[] ALL_TYPES = { ICElement.C_NAMESPACE, ICElement.C_CLASS,
ICElement.C_STRUCT, ICElement.C_TYPEDEF, ICElement.C_ENUMERATION, ICElement.C_STRUCT, ICElement.C_TYPEDEF, ICElement.C_ENUMERATION,
ICElement.C_UNION, ICElement.C_FUNCTION, ICElement.C_VARIABLE, ICElement.C_MACRO }; ICElement.C_UNION, ICElement.C_FUNCTION, ICElement.C_VARIABLE,
ICElement.C_ENUMERATOR, ICElement.C_MACRO };
// the filter matcher contains state information, must not be static // the filter matcher contains state information, must not be static
private final TypeFilterMatcher fFilterMatcher = new TypeFilterMatcher(); private final TypeFilterMatcher fFilterMatcher = new TypeFilterMatcher();
@ -381,6 +383,9 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
case ICElement.C_VARIABLE: case ICElement.C_VARIABLE:
name = TypeInfoMessages.TypeSelectionDialog_filterVariables; name = TypeInfoMessages.TypeSelectionDialog_filterVariables;
break; break;
case ICElement.C_ENUMERATOR:
name = TypeInfoMessages.TypeSelectionDialog_filterEnumerators;
break;
case ICElement.C_MACRO: case ICElement.C_MACRO:
name = TypeInfoMessages.TypeSelectionDialog_filterMacros; name = TypeInfoMessages.TypeSelectionDialog_filterMacros;
break; break;
@ -517,6 +522,7 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
section.put(SETTINGS_SHOW_UNIONS, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_UNION))); section.put(SETTINGS_SHOW_UNIONS, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_UNION)));
section.put(SETTINGS_SHOW_FUNCTIONS, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_FUNCTION))); section.put(SETTINGS_SHOW_FUNCTIONS, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_FUNCTION)));
section.put(SETTINGS_SHOW_VARIABLES, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_VARIABLE))); section.put(SETTINGS_SHOW_VARIABLES, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_VARIABLE)));
section.put(SETTINGS_SHOW_ENUMERATORS, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_ENUMERATOR)));
section.put(SETTINGS_SHOW_MACROS, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_MACRO))); section.put(SETTINGS_SHOW_MACROS, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_MACRO)));
section.put(SETTINGS_SHOW_LOWLEVEL, fFilterMatcher.getShowLowLevelTypes()); section.put(SETTINGS_SHOW_LOWLEVEL, fFilterMatcher.getShowLowLevelTypes());
} }
@ -533,6 +539,7 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
section.put(SETTINGS_SHOW_UNIONS, true); section.put(SETTINGS_SHOW_UNIONS, true);
section.put(SETTINGS_SHOW_FUNCTIONS, true); section.put(SETTINGS_SHOW_FUNCTIONS, true);
section.put(SETTINGS_SHOW_VARIABLES, true); section.put(SETTINGS_SHOW_VARIABLES, true);
section.put(SETTINGS_SHOW_ENUMERATORS, true);
section.put(SETTINGS_SHOW_MACROS, true); section.put(SETTINGS_SHOW_MACROS, true);
section.put(SETTINGS_SHOW_LOWLEVEL, false); section.put(SETTINGS_SHOW_LOWLEVEL, false);
} }
@ -594,6 +601,11 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
if (fKnownTypes.contains(typeObject)) if (fKnownTypes.contains(typeObject))
fFilterMatcher.getVisibleTypes().add(typeObject); fFilterMatcher.getVisibleTypes().add(typeObject);
} }
if (section.getBoolean(SETTINGS_SHOW_ENUMERATORS)) {
Integer typeObject = new Integer(ICElement.C_ENUMERATOR);
if (fKnownTypes.contains(typeObject))
fFilterMatcher.getVisibleTypes().add(typeObject);
}
if (section.getBoolean(SETTINGS_SHOW_MACROS)) { if (section.getBoolean(SETTINGS_SHOW_MACROS)) {
Integer typeObject = new Integer(ICElement.C_MACRO); Integer typeObject = new Integer(ICElement.C_MACRO);
if (fKnownTypes.contains(typeObject)) if (fKnownTypes.contains(typeObject))