From 97a90e44999a1c9b5809e3210a5eef0a39db6859 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Tue, 12 Sep 2006 06:50:49 +0000 Subject: [PATCH] Types of variables in Outline View, bug 77138. --- .../ui/editor/CContentOutlinePage.java | 7 +++- .../ui/text/COutlineInformationControl.java | 33 +++++++++++-------- .../AppearanceAwareLabelProvider.java | 3 +- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java index 9a40618bdc2..675bc76b629 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CContentOutlinePage.java @@ -71,10 +71,15 @@ import org.eclipse.cdt.internal.ui.dnd.TransferDragSourceListener; import org.eclipse.cdt.internal.ui.dnd.TransferDropTargetListener; import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup; import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer; +import org.eclipse.cdt.internal.ui.viewsupport.AppearanceAwareLabelProvider; +import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels; import org.eclipse.cdt.internal.ui.viewsupport.DecoratingCLabelProvider; import org.eclipse.cdt.internal.ui.viewsupport.StandardCElementLabelProvider; public class CContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener { + private static final int TEXT_FLAGS = AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | CElementLabels.F_APP_TYPE_SIGNATURE | CElementLabels.M_APP_RETURNTYPE; + private static final int IMAGE_FLAGS = AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS; + private CEditor fEditor; private ITranslationUnit fInput; private ProblemTreeViewer fTreeViewer; @@ -261,7 +266,7 @@ public class CContentOutlinePage extends Page implements IContentOutlinePage, IS protected ProblemTreeViewer createTreeViewer(Composite parent) { fTreeViewer = new ProblemTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); fTreeViewer.setContentProvider(createContentProvider(fTreeViewer)); - fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(new StandardCElementLabelProvider(), true)); + fTreeViewer.setLabelProvider(new DecoratingCLabelProvider(new StandardCElementLabelProvider(TEXT_FLAGS, IMAGE_FLAGS), true)); fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); fTreeViewer.setUseHashlookup(true); fTreeViewer.addSelectionChangedListener(this); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/COutlineInformationControl.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/COutlineInformationControl.java index f34377e1d2a..d1fa35f2157 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/COutlineInformationControl.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/COutlineInformationControl.java @@ -11,23 +11,12 @@ /* * COutlineInformationControl.java 2004-12-14 / 08:17:41 - * $Revision: 1.4 $ $Date: 2005/01/24 17:24:14 $ + * $Revision: 1.5 $ $Date: 2005/06/23 16:01:24 $ * * @author P.Tomaszewski */ package org.eclipse.cdt.internal.ui.text; -import org.eclipse.cdt.internal.core.model.CElement; -import org.eclipse.cdt.internal.ui.CPluginImages; -import org.eclipse.cdt.internal.ui.actions.ActionMessages; -import org.eclipse.cdt.internal.ui.editor.CContentOutlinerProvider; -import org.eclipse.cdt.internal.ui.editor.CEditor; -import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer; -import org.eclipse.cdt.internal.ui.viewsupport.DecoratingCLabelProvider; -import org.eclipse.cdt.internal.ui.viewsupport.StandardCElementLabelProvider; -import org.eclipse.cdt.ui.CElementGrouping; -import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.ui.IWorkingCopyManager; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.MenuManager; @@ -86,6 +75,22 @@ import org.eclipse.swt.widgets.Tracker; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.cdt.ui.CElementGrouping; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.IWorkingCopyManager; + +import org.eclipse.cdt.internal.core.model.CElement; + +import org.eclipse.cdt.internal.ui.CPluginImages; +import org.eclipse.cdt.internal.ui.actions.ActionMessages; +import org.eclipse.cdt.internal.ui.editor.CContentOutlinerProvider; +import org.eclipse.cdt.internal.ui.editor.CEditor; +import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer; +import org.eclipse.cdt.internal.ui.viewsupport.AppearanceAwareLabelProvider; +import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels; +import org.eclipse.cdt.internal.ui.viewsupport.DecoratingCLabelProvider; +import org.eclipse.cdt.internal.ui.viewsupport.StandardCElementLabelProvider; + /** * Control which shows outline information in C/C++ editor. Based on * AbstracInformationContol/JavaOutlineInformationControl from JDT. @@ -110,6 +115,8 @@ public class COutlineInformationControl implements IInformationControl, private static final int RIGHT_MARGIN = 3; /** Minimum width set by setSizeConstrains to tree viewer. */ private static final int MIN_WIDTH = 300; + private static final int TEXT_FLAGS = AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | CElementLabels.F_APP_TYPE_SIGNATURE | CElementLabels.M_APP_RETURNTYPE; + private static final int IMAGE_FLAGS = AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS; /** Source viewer which shows this control. */ CEditor fEditor; @@ -427,7 +434,7 @@ public class COutlineInformationControl implements IInformationControl, fTreeViewer.setSorter(fSorter); } fTreeViewer.setLabelProvider(new DecoratingCLabelProvider( - new StandardCElementLabelProvider(), true)); + new StandardCElementLabelProvider(TEXT_FLAGS, IMAGE_FLAGS), true)); fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); fTreeViewer.setInput(manager.getWorkingCopy(fEditor.getEditorInput())); tree.addKeyListener(createKeyListenerForTreeViewer()); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AppearanceAwareLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AppearanceAwareLabelProvider.java index 363f1425cfa..92255835c38 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AppearanceAwareLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/AppearanceAwareLabelProvider.java @@ -21,8 +21,7 @@ import org.eclipse.jface.util.PropertyChangeEvent; */ public class AppearanceAwareLabelProvider extends CUILabelProvider implements IPropertyChangeListener { - public final static int DEFAULT_TEXTFLAGS= CElementLabels.ROOT_VARIABLE | CElementLabels.M_PARAMETER_TYPES | - CElementLabels.M_APP_RETURNTYPE | CElementLabels.REFERENCED_ROOT_POST_QUALIFIED; + public final static int DEFAULT_TEXTFLAGS= CElementLabels.ROOT_VARIABLE | CElementLabels.M_PARAMETER_TYPES | CElementLabels.REFERENCED_ROOT_POST_QUALIFIED; public final static int DEFAULT_IMAGEFLAGS= CElementImageProvider.OVERLAY_ICONS; private int fTextFlagMask;