Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2010-01-07 14:18:05 +0000
committerAnton Leherbauer2010-01-07 14:18:05 +0000
commit356c85181635285fe112f1f4f0e2cafeba83badd (patch)
tree0fec82dccf19bbb3d4d6e37c3c61947f2b89da11
parent4aa54bd7e5a0399b31ba8b9318674cbfcad4ad28 (diff)
downloadorg.eclipse.cdt-356c85181635285fe112f1f4f0e2cafeba83badd.tar.gz
org.eclipse.cdt-356c85181635285fe112f1f4f0e2cafeba83badd.tar.xz
org.eclipse.cdt-356c85181635285fe112f1f4f0e2cafeba83badd.zip
Bug 233390 - [outline view] Group Defines
Patch by Marc-Andre Laperle
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java42
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/MacrosGrouping.java65
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AppearancePreferencePage.java18
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementGrouping.java10
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementSorter.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java19
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties3
13 files changed, 198 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java
index 685a21da19a..4794c2e4306 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java
@@ -38,6 +38,7 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IInclude;
+import org.eclipse.cdt.core.model.IMacro;
import org.eclipse.cdt.core.model.IMember;
import org.eclipse.cdt.core.model.INamespace;
import org.eclipse.cdt.core.model.IParent;
@@ -79,6 +80,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
protected boolean fIncludesGrouping= false;
protected boolean fNamespacesGrouping= false;
protected boolean fMemberGrouping= false;
+ protected boolean fMacroGrouping= false;
public BaseCElementContentProvider() {
this(false, false);
@@ -165,6 +167,21 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
public void setMemberGrouping(boolean enable) {
fMemberGrouping = enable;
}
+
+ /**
+ * @return whether grouping of macros is enabled
+ */
+ public boolean isMacroGroupingEnabled() {
+ return fMacroGrouping;
+ }
+
+ /**
+ * Enable/disable marco grouping
+ * @param enable
+ */
+ public void setMacroGrouping(boolean enable) {
+ fMacroGrouping = enable;
+ }
/* (non-Cdoc)
* Method declared on IContentProvider.
@@ -367,6 +384,9 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
if (element instanceof IInclude && fIncludesGrouping) {
parent = new IncludesGrouping(((IInclude)element).getTranslationUnit());
}
+ if (element instanceof IMacro && fMacroGrouping) {
+ parent = new MacrosGrouping(((IMacro)element).getTranslationUnit());
+ }
return parent;
}
@@ -473,6 +493,28 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
}
children = list.toArray();
}
+ if (fMacroGrouping) {
+ ArrayList<Object> list = new ArrayList<Object>(children.length);
+ boolean hasMacros = false;
+ for (int i = 0; i < children.length; i++) {
+ if (!(children[i] instanceof IMacro))
+ list.add(children[i]);
+ else
+ hasMacros = true;
+ }
+ if (hasMacros) {
+ //Check if include gouping is there. If so, put macros after
+ if(!list.isEmpty()){
+ if(list.get(0) instanceof IncludesGrouping)
+ list.add (1, new MacrosGrouping(unit));
+ else
+ list.add (0, new MacrosGrouping(unit));
+ }
+ else
+ list.add (0, new MacrosGrouping(unit));
+ }
+ children = list.toArray();
+ }
return children;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/MacrosGrouping.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/MacrosGrouping.java
new file mode 100644
index 00000000000..160090ff5cb
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/MacrosGrouping.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ * Marc-Andre Laperle - Bug 233390 (adapted from IncludesGrouping)
+ *******************************************************************************/
+package org.eclipse.cdt.internal.ui;
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.ui.CElementGrouping;
+
+/**
+ * Grouping for macro definitions.
+ *
+ * @since 5.2
+ */
+public class MacrosGrouping extends CElementGrouping {
+ ITranslationUnit tu;
+
+ public MacrosGrouping(ITranslationUnit unit) {
+ super(CElementGrouping.MACROS_GROUPING);
+ tu = unit;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object object) {
+ try {
+ return tu.getChildrenOfType(ICElement.C_MACRO).toArray();
+ } catch (CModelException e) {
+ }
+ return super.getChildren(object);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object object) {
+ return tu;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof MacrosGrouping) {
+ return tu.equals(((MacrosGrouping)obj).tu) ;
+ }
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java
index 3d1575f3582..f34f9b1f3ee 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 QNX Software Systems and others.
+ * Copyright (c) 2000, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -578,8 +578,10 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
protected IContentProvider createContentProvider() {
boolean showCUChildren = PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.PREF_SHOW_CU_CHILDREN);
boolean groupIncludes = PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CVIEW_GROUP_INCLUDES);
+ boolean groupMacros = PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CVIEW_GROUP_MACROS);
CViewContentProvider provider = new CViewContentProvider(viewer, getSite(), showCUChildren, true);
provider.setIncludesGrouping(groupIncludes);
+ provider.setMacroGrouping(groupMacros);
return provider;
}
@@ -851,6 +853,13 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
((CElementContentProvider) provider).setIncludesGrouping(groupIncludes);
}
refreshViewer = true;
+ } else if (property.equals(PreferenceConstants.CVIEW_GROUP_MACROS)) {
+ boolean groupMacros = PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CVIEW_GROUP_MACROS);
+ IContentProvider provider = viewer.getContentProvider();
+ if (provider instanceof CElementContentProvider) {
+ ((CElementContentProvider) provider).setMacroGrouping(groupMacros);
+ }
+ refreshViewer = true;
}
if (refreshViewer) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
index 256f632e02b..d75c85e71d6 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinerProvider.java
@@ -77,6 +77,7 @@ public class CContentOutlinerProvider extends BaseCElementContentProvider {
setIncludesGrouping(store.getBoolean(PreferenceConstants.OUTLINE_GROUP_INCLUDES));
setNamespacesGrouping(store.getBoolean(PreferenceConstants.OUTLINE_GROUP_NAMESPACES));
setMemberGrouping(store.getBoolean(PreferenceConstants.OUTLINE_GROUP_MEMBERS));
+ setMacroGrouping(store.getBoolean(PreferenceConstants.OUTLINE_GROUP_MACROS));
}
/**
@@ -362,7 +363,17 @@ public class CContentOutlinerProvider extends BaseCElementContentProvider {
contentUpdated();
}
}
+ }else if (prop.equals(PreferenceConstants.OUTLINE_GROUP_MACROS)) {
+ Object newValue = event.getNewValue();
+ if (newValue instanceof Boolean) {
+ boolean value = ((Boolean) newValue).booleanValue();
+ if (isMacroGroupingEnabled() != value) {
+ setMacroGrouping(value);
+ contentUpdated();
+ }
+ }
}
+
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java
index 34cec28574f..197bbd3e742 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -93,6 +93,10 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
boolean groupIncludes= newValue instanceof Boolean ? ((Boolean)newValue).booleanValue() : false;
setIncludesGrouping(groupIncludes);
refreshViewer= true;
+ } else if (property.equals(PreferenceConstants.CVIEW_GROUP_MACROS)) {
+ boolean groupMacros = newValue instanceof Boolean ? ((Boolean)newValue).booleanValue() : false;
+ setMacroGrouping(groupMacros);
+ refreshViewer= true;
}
if (refreshViewer && getViewer() != null) {
@@ -123,6 +127,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
IPreferenceStore store= PreferenceConstants.getPreferenceStore();
boolean showCUChildren= store.getBoolean(PreferenceConstants.PREF_SHOW_CU_CHILDREN);
boolean groupIncludes= store.getBoolean(PreferenceConstants.CVIEW_GROUP_INCLUDES);
+ boolean groupMacros= store.getBoolean(PreferenceConstants.CVIEW_GROUP_MACROS);
if (memento != null) {
// options controlled by preference only
// String mementoValue= memento.getString(PreferenceConstants.PREF_SHOW_CU_CHILDREN);
@@ -139,6 +144,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
}
setProvideMembers(showCUChildren);
setIncludesGrouping(groupIncludes);
+ setMacroGrouping(groupMacros);
setProvideWorkingCopy(true);
}
@@ -149,6 +155,7 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
if (memento != null) {
memento.putString(PreferenceConstants.PREF_SHOW_CU_CHILDREN, String.valueOf(getProvideMembers()));
memento.putString(PreferenceConstants.CVIEW_GROUP_INCLUDES, String.valueOf(areIncludesGroup()));
+ memento.putString(PreferenceConstants.CVIEW_GROUP_MACROS, String.valueOf(isMacroGroupingEnabled()));
// clear obsolete flag
memento.putInteger(LINKING_ENABLED_DELAYED, 0);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AppearancePreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AppearancePreferencePage.java
index 9c2018192e9..b42a6518aa1 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AppearancePreferencePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/AppearancePreferencePage.java
@@ -46,7 +46,9 @@ public class AppearancePreferencePage extends PreferencePage implements IWorkben
private SelectionButtonDialogField fOutlineGroupNamespaces;
private SelectionButtonDialogField fCViewGroupIncludes;
private SelectionButtonDialogField fCViewSeparateHeaderAndSource;
+ private SelectionButtonDialogField fCViewGroupMacros;
private SelectionButtonDialogField fOutlineGroupMembers;
+ private SelectionButtonDialogField fOutlineGroupMacros;
public AppearancePreferencePage() {
setPreferenceStore(PreferenceConstants.getPreferenceStore());
@@ -81,6 +83,14 @@ public class AppearancePreferencePage extends PreferencePage implements IWorkben
fCViewSeparateHeaderAndSource= new SelectionButtonDialogField(SWT.CHECK);
fCViewSeparateHeaderAndSource.setDialogFieldListener(listener);
fCViewSeparateHeaderAndSource.setLabelText(PreferencesMessages.AppearancePreferencePage_cviewSeparateHeaderAndSource_label);
+
+ fOutlineGroupMacros= new SelectionButtonDialogField(SWT.CHECK);
+ fOutlineGroupMacros.setDialogFieldListener(listener);
+ fOutlineGroupMacros.setLabelText(PreferencesMessages.AppearancePreferencePage_outlineGroupMacros_label);
+
+ fCViewGroupMacros= new SelectionButtonDialogField(SWT.CHECK);
+ fCViewGroupMacros.setDialogFieldListener(listener);
+ fCViewGroupMacros.setLabelText(PreferencesMessages.AppearancePreferencePage_cviewGroupMacros_label);
}
private void initFields() {
@@ -88,9 +98,11 @@ public class AppearancePreferencePage extends PreferencePage implements IWorkben
fShowTUChildren.setSelection(prefs.getBoolean(PreferenceConstants.PREF_SHOW_CU_CHILDREN));
fCViewGroupIncludes.setSelection(prefs.getBoolean(PreferenceConstants.CVIEW_GROUP_INCLUDES));
fCViewSeparateHeaderAndSource.setSelection(prefs.getBoolean(PreferenceConstants.CVIEW_SEPARATE_HEADER_AND_SOURCE));
+ fCViewGroupMacros.setSelection(prefs.getBoolean(PreferenceConstants.CVIEW_GROUP_MACROS));
fOutlineGroupIncludes.setSelection(prefs.getBoolean(PreferenceConstants.OUTLINE_GROUP_INCLUDES));
fOutlineGroupNamespaces.setSelection(prefs.getBoolean(PreferenceConstants.OUTLINE_GROUP_NAMESPACES));
fOutlineGroupMembers.setSelection(prefs.getBoolean(PreferenceConstants.OUTLINE_GROUP_MEMBERS));
+ fOutlineGroupMacros.setSelection(prefs.getBoolean(PreferenceConstants.OUTLINE_GROUP_MACROS));
}
/*
@@ -122,6 +134,8 @@ public class AppearancePreferencePage extends PreferencePage implements IWorkben
fOutlineGroupIncludes.doFillIntoGrid(result, nColumns);
fOutlineGroupNamespaces.doFillIntoGrid(result, nColumns);
fOutlineGroupMembers.doFillIntoGrid(result, nColumns);
+ fCViewGroupMacros.doFillIntoGrid(result, nColumns);
+ fOutlineGroupMacros.doFillIntoGrid(result, nColumns);
new Separator().doFillIntoGrid(result, nColumns);
@@ -168,9 +182,11 @@ public class AppearancePreferencePage extends PreferencePage implements IWorkben
prefs.setValue(PreferenceConstants.PREF_SHOW_CU_CHILDREN, fShowTUChildren.isSelected());
prefs.setValue(PreferenceConstants.CVIEW_GROUP_INCLUDES, fCViewGroupIncludes.isSelected());
prefs.setValue(PreferenceConstants.CVIEW_SEPARATE_HEADER_AND_SOURCE, fCViewSeparateHeaderAndSource.isSelected());
+ prefs.setValue(PreferenceConstants.CVIEW_GROUP_MACROS, fCViewGroupMacros.isSelected());
prefs.setValue(PreferenceConstants.OUTLINE_GROUP_INCLUDES, fOutlineGroupIncludes.isSelected());
prefs.setValue(PreferenceConstants.OUTLINE_GROUP_NAMESPACES, fOutlineGroupNamespaces.isSelected());
prefs.setValue(PreferenceConstants.OUTLINE_GROUP_MEMBERS, fOutlineGroupMembers.isSelected());
+ prefs.setValue(PreferenceConstants.OUTLINE_GROUP_MACROS, fOutlineGroupMacros.isSelected());
try {
new InstanceScope().getNode(CUIPlugin.PLUGIN_ID).flush();
} catch (BackingStoreException exc) {
@@ -188,9 +204,11 @@ public class AppearancePreferencePage extends PreferencePage implements IWorkben
fShowTUChildren.setSelection(prefs.getDefaultBoolean(PreferenceConstants.PREF_SHOW_CU_CHILDREN));
fCViewGroupIncludes.setSelection(prefs.getDefaultBoolean(PreferenceConstants.CVIEW_GROUP_INCLUDES));
fCViewSeparateHeaderAndSource.setSelection(prefs.getDefaultBoolean(PreferenceConstants.CVIEW_SEPARATE_HEADER_AND_SOURCE));
+ fCViewGroupMacros.setSelection(prefs.getDefaultBoolean(PreferenceConstants.CVIEW_GROUP_MACROS));
fOutlineGroupIncludes.setSelection(prefs.getDefaultBoolean(PreferenceConstants.OUTLINE_GROUP_INCLUDES));
fOutlineGroupNamespaces.setSelection(prefs.getDefaultBoolean(PreferenceConstants.OUTLINE_GROUP_NAMESPACES));
fOutlineGroupMembers.setSelection(prefs.getDefaultBoolean(PreferenceConstants.OUTLINE_GROUP_MEMBERS));
+ fOutlineGroupMacros.setSelection(prefs.getDefaultBoolean(PreferenceConstants.OUTLINE_GROUP_MACROS));
super.performDefaults();
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
index c6d3438c1df..00bd5a558bf 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
@@ -133,9 +133,11 @@ public final class PreferencesMessages extends NLS {
public static String AppearancePreferencePage_showTUChildren_label;
public static String AppearancePreferencePage_cviewGroupIncludes_label;
public static String AppearancePreferencePage_cviewSeparateHeaderAndSource_label;
+ public static String AppearancePreferencePage_cviewGroupMacros_label;
public static String AppearancePreferencePage_outlineGroupIncludes_label;
public static String AppearancePreferencePage_outlineGroupMethods_label;
public static String AppearancePreferencePage_outlineGroupNamespaces_label;
+ public static String AppearancePreferencePage_outlineGroupMacros_label;
public static String AppearancePreferencePage_note;
public static String AppearancePreferencePage_preferenceOnlyForNewViews;
public static String CEditorPreferencePage_folding_title;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
index e6a30fd23d1..cd1399f001d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
@@ -152,11 +152,13 @@ AppearancePreferencePage_description= Appearance of C/C++ elements in viewers:
AppearancePreferencePage_showTUChildren_label= Show translation unit members
AppearancePreferencePage_cviewGroupIncludes_label= Group include directives in Project Explorer and C/C++ Projects view
AppearancePreferencePage_cviewSeparateHeaderAndSource_label= Sort header files before source files in Project Explorer and C/C++ Projects view
+AppearancePreferencePage_cviewGroupMacros_label= Group macro definitions in Project Explorer and C/C++ Projects view
AppearancePreferencePage_outlineGroupIncludes_label= Group include directives in the Outline view
AppearancePreferencePage_outlineGroupMethods_label=Group method definitions in the Outline view
AppearancePreferencePage_outlineGroupNamespaces_label= Group namespaces in the Outline view
AppearancePreferencePage_note=Note:
AppearancePreferencePage_preferenceOnlyForNewViews=This preference does not affect open views
+AppearancePreferencePage_outlineGroupMacros_label=Group macro definitions in the Outline view
#Folding
CEditorPreferencePage_folding_title= &Folding
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementGrouping.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementGrouping.java
index 58c224a20ea..777799392e2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementGrouping.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementGrouping.java
@@ -23,6 +23,12 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
public abstract class CElementGrouping extends WorkbenchAdapter implements IAdaptable {
public final static int INCLUDES_GROUPING = 0x00001;
+
+ /**
+ * @since 5.2
+ */
+ public final static int MACROS_GROUPING = 0x00011;
+
public final static int NAMESPACE_GROUPING = 0x00010;
public final static int CLASS_GROUPING = 0x00100;
public final static int LIBRARY_REF_CONTAINER = 0x01000;
@@ -46,6 +52,8 @@ public abstract class CElementGrouping extends WorkbenchAdapter implements IAdap
switch (type) {
case INCLUDES_GROUPING:
return Messages.CElementGrouping_includeGroupingLabel;
+ case MACROS_GROUPING:
+ return Messages.CElementGrouping_macroGroupingLabel;
}
return super.getLabel(object);
}
@@ -62,6 +70,8 @@ public abstract class CElementGrouping extends WorkbenchAdapter implements IAdap
return CPluginImages.DESC_OBJS_NAMESPACE;
case CLASS_GROUPING:
return CPluginImages.DESC_OBJS_CLASS;
+ case MACROS_GROUPING:
+ return CPluginImages.DESC_OBJS_MACRO;
}
return super.getImageDescriptor(object);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementSorter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementSorter.java
index aff59bf3d7a..2c918fc6b34 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementSorter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementSorter.java
@@ -227,6 +227,8 @@ public class CElementSorter extends ViewerSorter {
switch (type) {
case CElementGrouping.INCLUDES_GROUPING:
return INCLUDES;
+ case CElementGrouping.MACROS_GROUPING:
+ return MACROS;
case CElementGrouping.CLASS_GROUPING:
return TYPES;
case CElementGrouping.NAMESPACE_GROUPING:
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java
index eb4f0838b9d..7f732eb3652 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,12 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.ui.messages"; //$NON-NLS-1$
public static String CElementGrouping_includeGroupingLabel;
+
+ /**
+ * @since 5.2
+ */
+ public static String CElementGrouping_macroGroupingLabel;
+
public static String CUIPlugin_jobStartMakeUI;
static {
// initialize resource bundle
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
index 6ac61779202..0683c2ba1f8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
@@ -755,6 +755,15 @@ public class PreferenceConstants {
* @since 5.1
*/
public static final String OUTLINE_GROUP_MEMBERS= "org.eclipse.cdt.ui.outline.groupmembers"; //$NON-NLS-1$
+
+ /**
+ * A named preference that controls whether the Outline view should group macro definitions.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ * @since 5.2
+ */
+ public static final String OUTLINE_GROUP_MACROS= "org.eclipse.cdt.ui.outline.groupmacros"; //$NON-NLS-1$
/**
* A named preference that controls whether the Outline view
@@ -773,6 +782,16 @@ public class PreferenceConstants {
* </p>
*/
public static final String CVIEW_GROUP_INCLUDES= "org.eclipse.cdt.ui.cview.groupincludes"; //$NON-NLS-1$
+
+ /**
+ * A named preference that controls whether macro defintions should be grouped in the
+ * C/C++ Projects view and the Project Explorer view.
+ * <p>
+ * Value is of type <code>Boolean</code>.
+ * </p>
+ * @since 5.2
+ */
+ public static final String CVIEW_GROUP_MACROS= "org.eclipse.cdt.ui.cview.groupmacros"; //$NON-NLS-1$
/**
* A named preference that controls whether header and source files should be separated in the
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties
index dc49459c7e5..0759015cc47 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2007 IBM Corporation and others.
+# Copyright (c) 2007, 2009 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -14,3 +14,4 @@
CElementGrouping_includeGroupingLabel=include directives
CUIPlugin_jobStartMakeUI=Starting plugin org.eclipse.cdt.make.ui
+CElementGrouping_macroGroupingLabel=macro definitions \ No newline at end of file

Back to the top