| Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartOutlinePage.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartOutlinePage.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartOutlinePage.java
|
| index a137d47c4d15d7dc7c3565c23a7d9780bb52f3af..fd4d0c1e9ac7909dfea2239468bc57835d15ff05 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartOutlinePage.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartOutlinePage.java
|
| @@ -28,6 +28,7 @@ import com.google.dart.tools.ui.DartElementComparator;
|
| import com.google.dart.tools.ui.DartElementLabelProvider;
|
| import com.google.dart.tools.ui.DartPluginImages;
|
| import com.google.dart.tools.ui.DartToolsPlugin;
|
| +import com.google.dart.tools.ui.DartUI;
|
| import com.google.dart.tools.ui.DartX;
|
| import com.google.dart.tools.ui.PreferenceConstants;
|
| import com.google.dart.tools.ui.ProblemsLabelDecorator.ProblemsLabelChangedEvent;
|
| @@ -56,6 +57,8 @@ import org.eclipse.jface.action.IMenuManager;
|
| import org.eclipse.jface.action.IStatusLineManager;
|
| import org.eclipse.jface.action.IToolBarManager;
|
| import org.eclipse.jface.action.MenuManager;
|
| +import org.eclipse.jface.preference.IPreferenceStore;
|
| +import org.eclipse.jface.preference.PreferenceConverter;
|
| import org.eclipse.jface.resource.JFaceResources;
|
| import org.eclipse.jface.text.ITextSelection;
|
| import org.eclipse.jface.util.IPropertyChangeListener;
|
| @@ -73,11 +76,16 @@ import org.eclipse.jface.viewers.TreeViewer;
|
| import org.eclipse.jface.viewers.ViewerFilter;
|
| import org.eclipse.swt.SWT;
|
| import org.eclipse.swt.custom.BusyIndicator;
|
| +import org.eclipse.swt.graphics.Color;
|
| import org.eclipse.swt.graphics.Font;
|
| +import org.eclipse.swt.graphics.GC;
|
| +import org.eclipse.swt.graphics.RGB;
|
| import org.eclipse.swt.widgets.Composite;
|
| import org.eclipse.swt.widgets.Control;
|
| import org.eclipse.swt.widgets.Display;
|
| +import org.eclipse.swt.widgets.Event;
|
| import org.eclipse.swt.widgets.Item;
|
| +import org.eclipse.swt.widgets.Listener;
|
| import org.eclipse.swt.widgets.Menu;
|
| import org.eclipse.swt.widgets.Tree;
|
| import org.eclipse.swt.widgets.Widget;
|
| @@ -95,6 +103,7 @@ import org.eclipse.ui.part.IShowInTarget;
|
| import org.eclipse.ui.part.IShowInTargetList;
|
| import org.eclipse.ui.part.Page;
|
| import org.eclipse.ui.part.ShowInContext;
|
| +import org.eclipse.ui.texteditor.AbstractTextEditor;
|
| import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
| import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
|
| import org.eclipse.ui.texteditor.IUpdate;
|
| @@ -160,10 +169,40 @@ public class DartOutlinePage extends Page implements IContentOutlinePage, IAdapt
|
| private boolean fReorderedMembers;
|
| private boolean fForceFireSelectionChanged;
|
|
|
| - public DartOutlineViewer(Tree tree) {
|
| + public DartOutlineViewer(final Tree tree) {
|
| super(tree);
|
| setAutoExpandLevel(ALL_LEVELS);
|
| setUseHashlookup(true);
|
| + final Display display = tree.getDisplay();
|
| + tree.setBackgroundMode(SWT.INHERIT_FORCE);
|
| + tree.addListener(SWT.EraseItem, new Listener() {
|
| + @Override
|
| + public void handleEvent(Event event) {
|
| + event.detail &= ~SWT.HOT; // do not draw hover background natively
|
| + if ((event.detail & SWT.SELECTED) == 0) {
|
| + return; // item not selected
|
| + }
|
| + int clientWidth = tree.getClientArea().width;
|
| + GC gc = event.gc;
|
| + Color oldFG = gc.getForeground();
|
| + Color oldBG = gc.getBackground();
|
| + // TODO(messick) Cache preferences and update cache when preferences change.
|
| + IPreferenceStore prefs = fEditor.getPreferences();
|
| + Color fgColor = DartUI.getViewerSelectionForeground(prefs, display);
|
| + if (fgColor != null) {
|
| + gc.setForeground(fgColor);
|
| + }
|
| + Color bgColor = DartUI.getViewerSelectionBackground(prefs, display);
|
| + if (bgColor != null) {
|
| + gc.setBackground(bgColor);
|
| + }
|
| + gc.fillRectangle(0, event.y, clientWidth, event.height);
|
| + gc.setForeground(oldFG);
|
| + gc.setBackground(oldBG);
|
| + event.detail &= ~SWT.SELECTED;
|
| + }
|
| + });
|
| + updateColors();
|
| }
|
|
|
| /*
|
| @@ -544,6 +583,14 @@ public class DartOutlinePage extends Page implements IContentOutlinePage, IAdapt
|
| }
|
| }
|
|
|
| + protected void updateColors() {
|
| + IPreferenceStore store = DartOutlinePage.this.fEditor.getPreferences();
|
| + RGB rgb = PreferenceConverter.getColor(store, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND);
|
| + getTree().setForeground(DartUI.getColorManager().getColor(rgb));
|
| + rgb = PreferenceConverter.getColor(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
|
| + getTree().setBackground(DartUI.getColorManager().getColor(rgb));
|
| + }
|
| +
|
| protected void updateTreeFont() {
|
| Font newFont = JFaceResources.getFont(FontPreferencePage.BASE_FONT_KEY);
|
| Font oldFont = getTree().getFont();
|
| @@ -892,7 +939,7 @@ public class DartOutlinePage extends Page implements IContentOutlinePage, IAdapt
|
| @Override
|
| public void createControl(Composite parent) {
|
|
|
| - Tree tree = new Tree(parent, SWT.MULTI);
|
| + Tree tree = new Tree(parent, SWT.MULTI /*| SWT.FULL_SELECTION */); // TODO(messick) Is FULL_SELECTION needed?
|
|
|
| // AppearanceAwareLabelProvider lprovider = new AppearanceAwareLabelProvider(
|
| // AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | DartElementLabels.F_APP_TYPE_SIGNATURE
|
| @@ -1299,6 +1346,7 @@ public class DartOutlinePage extends Page implements IContentOutlinePage, IAdapt
|
| if (fOutlineViewer != null) {
|
| DartX.todo();
|
| // if (MembersOrderPreferenceCache.isMemberOrderProperty(event.getProperty())) {
|
| + fOutlineViewer.updateColors();
|
| fOutlineViewer.refresh(false);
|
| // }
|
| }
|
|
|