aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvasyn2013-05-21 14:02:56 (EDT)
committerGerrit Code Review @ Eclipse.org2013-08-02 13:00:48 (EDT)
commita9b13322cc384a3454a0979cfea72592705106ed (patch)
tree8eed14e0464fae2ff79ac3a49e2a35ca1f2dc26f
parent03ef555d031fbf1c342116f8c281e174ff30da63 (diff)
downloadeclipse.platform.ui-a9b13322cc384a3454a0979cfea72592705106ed.zip
eclipse.platform.ui-a9b13322cc384a3454a0979cfea72592705106ed.tar.gz
eclipse.platform.ui-a9b13322cc384a3454a0979cfea72592705106ed.tar.bz2
Bug 385987 - Hidden tabs' filenames should be bolded in "Show List"refs/changes/56/15056/2
drop-down of tabbed editor view. Fixed by asking a StackRenderer about CTabItem for MPart, and checking it's showing state. Change-Id: I00166e34613c461a4a0b334facb3d38f6bf66bfd Signed-off-by: Leonid Ripeynih <akafakir@gmail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/internal/workbench/renderers/swt/BasicPartList.java40
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java4
2 files changed, 40 insertions, 4 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/internal/workbench/renderers/swt/BasicPartList.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/internal/workbench/renderers/swt/BasicPartList.java
index 5f27a21..0f6cc48 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/internal/workbench/renderers/swt/BasicPartList.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/internal/workbench/renderers/swt/BasicPartList.java
@@ -22,6 +22,7 @@ import org.eclipse.e4.ui.model.application.ui.MUILabel;
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer;
import org.eclipse.e4.ui.workbench.swt.util.ISWTResourceUtilities;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -31,9 +32,13 @@ import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
@@ -43,6 +48,29 @@ public class BasicPartList extends AbstractTableInformationControl {
private class BasicStackListLabelProvider extends ColumnLabelProvider {
+ private Font boldFont;
+
+ public BasicStackListLabelProvider() {
+ Font font = Display.getDefault().getSystemFont();
+ FontData[] fontDatas = font.getFontData();
+ for (FontData fontData : fontDatas) {
+ fontData.setStyle(fontData.getStyle() | SWT.BOLD);
+ }
+ boldFont = new Font(Display.getDefault(), fontDatas);
+ }
+
+ @Override
+ public Font getFont(Object element) {
+ if (element instanceof MPart) {
+ MPart part = (MPart) element;
+ CTabItem item = renderer.findItemForPart(part);
+ if (item != null && !item.isShowing()) {
+ return boldFont;
+ }
+ }
+ return super.getFont(element);
+ }
+
public String getText(Object element) {
if (element instanceof MDirtyable
&& ((MDirtyable) element).isDirty()) {
@@ -66,6 +94,11 @@ public class BasicPartList extends AbstractTableInformationControl {
public boolean useNativeToolTip(Object object) {
return true;
}
+
+ @Override
+ public void dispose() {
+ boldFont.dispose();
+ }
}
private Map<String, Image> images = new HashMap<String, Image>();
@@ -76,17 +109,20 @@ public class BasicPartList extends AbstractTableInformationControl {
private EPartService partService;
+ private StackRenderer renderer;
+
public BasicPartList(Shell parent, int shellStyle, int treeStyler,
EPartService partService, MElementContainer<?> input,
- ISWTResourceUtilities utils, boolean alphabetical) {
+ StackRenderer renderer, ISWTResourceUtilities utils,
+ boolean alphabetical) {
super(parent, shellStyle, treeStyler);
this.partService = partService;
this.input = input;
+ this.renderer = renderer;
this.utils = utils;
if (alphabetical && getTableViewer() != null) {
getTableViewer().setComparator(new ViewerComparator());
}
-
}
private Image getLabelImage(String iconURI) {
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
index 700c49c..413fe9a 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
@@ -732,7 +732,7 @@ public class StackRenderer extends LazyStackRenderer {
return null;
}
- protected CTabItem findItemForPart(MPart part) {
+ public CTabItem findItemForPart(MPart part) {
// is this a direct child of the stack?
if (part.getParent() != null
&& part.getParent().getRenderer() == StackRenderer.this) {
@@ -983,7 +983,7 @@ public class StackRenderer extends LazyStackRenderer {
IEclipseContext ctxt = getContext(stack);
final BasicPartList editorList = new BasicPartList(ctf.getShell(),
SWT.ON_TOP, SWT.V_SCROLL | SWT.H_SCROLL,
- ctxt.get(EPartService.class), stack,
+ ctxt.get(EPartService.class), stack, this,
(ISWTResourceUtilities) ctxt.get(IResourceUtilities.class),
getInitialMRUValue(ctf));
editorList.setInput();