Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris McLaren2004-02-25 06:34:36 +0000
committerChris McLaren2004-02-25 06:34:36 +0000
commit8977332c6c0fcf49ecb91d80ddc2d25c89f43cf0 (patch)
tree2c84a7687972227827b2702a2e0c99b17beaa60d /bundles/org.eclipse.ui.workbench/Eclipse UI/org
parentb4ed121de3cbc712f242d62eaa829d20214f012f (diff)
downloadeclipse.platform.ui-8977332c6c0fcf49ecb91d80ddc2d25c89f43cf0.tar.gz
eclipse.platform.ui-8977332c6c0fcf49ecb91d80ddc2d25c89f43cf0.tar.xz
eclipse.platform.ui-8977332c6c0fcf49ecb91d80ddc2d25c89f43cf0.zip
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org')
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java17
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarManager.java83
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TabbedEditorWorkbook.java36
3 files changed, 73 insertions, 63 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java
index 3a26b7992d0..6059ffd4456 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarContributionItem.java
@@ -62,7 +62,7 @@ public class PerspectiveBarContributionItem extends ContributionItem {
}
public void fill(ToolBar parent, int index) {
- if (toolItem == null && parent != null) {
+ if (toolItem == null && parent != null && !parent.isDisposed()) {
toolBar = parent;
if (index >= 0)
toolItem = new ToolItem(parent, SWT.CHECK, index);
@@ -92,7 +92,8 @@ public class PerspectiveBarContributionItem extends ContributionItem {
workbenchPage.setPerspective(perspective);
update();
getParent().update(true);
- }
+ } else
+ toolItem.setSelection(true);
}
});
toolItem.setData(this); //TODO review need for this
@@ -101,7 +102,7 @@ public class PerspectiveBarContributionItem extends ContributionItem {
}
public void update() {
- if (!toolItem.isDisposed()) {
+ if (toolItem != null && !toolItem.isDisposed()) {
toolItem
.setSelection(workbenchPage.getPerspective() == perspective);
if (preferenceStore
@@ -114,7 +115,7 @@ public class PerspectiveBarContributionItem extends ContributionItem {
public void update(IPerspectiveDescriptor newDesc) {
perspective = newDesc;
- if (!toolItem.isDisposed()) {
+ if (toolItem != null && !toolItem.isDisposed()) {
ImageDescriptor imageDescriptor = perspective.getImageDescriptor();
if (imageDescriptor != null) {
toolItem.setImage(imageDescriptor.createImage());
@@ -154,15 +155,17 @@ public class PerspectiveBarContributionItem extends ContributionItem {
this.perspective = newPerspective;
}
- // TODO review need for this method;
+ // TODO review need for this method
void setSelection(boolean b) {
- if (!toolItem.isDisposed()) toolItem.setSelection(b);
+ if (toolItem != null && !toolItem.isDisposed())
+ toolItem.setSelection(b);
}
private static final String ellipsis = "..."; //$NON-NLS-1$
protected String shortenText(String textValue, ToolItem item) {
- if (textValue == null) return null;
+ if (textValue == null || toolItem == null || toolItem.isDisposed())
+ return null;
GC gc = new GC(item.getDisplay());
int maxWidth = item.getImage().getBounds().width * 5;
if (gc.textExtent(textValue).x < maxWidth) return textValue;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarManager.java
index 1a00f524c16..3bfa4c45812 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveBarManager.java
@@ -18,45 +18,46 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.ToolBar;
public class PerspectiveBarManager extends ToolBarManager {
-
- /**
- * The symbolic font name for the small font (value <code>"org.eclipse.jface.smallfont"</code>).
- */
- public static final String SMALL_FONT = "org.eclipse.ui.smallFont"; //$NON-NLS-1$
-
- public PerspectiveBarManager(int style) {
- super(style);
- }
-
- public ToolBar createControl(Composite parent) {
- ToolBar control = super.createControl(parent);
- control.setFont(getFont());
- return control;
- }
-
- public PerspectiveBarManager(ToolBar toolbar) {
- super(toolbar);
- toolbar.setFont(getFont());
- }
-
- // TODO begin refactor this out?
- private CBanner banner;
-
- void layout(boolean b) {
- if (banner != null)
- banner.layout(b);
- }
-
- void setBanner(CBanner banner) {
- this.banner = banner;
- }
- // TODO end refactor this out?
-
- public void updateFont(){
- getControl().setFont(getFont());
- }
-
- private Font getFont(){
- return JFaceResources.getFont(SMALL_FONT);
- }
+
+ /**
+ * The symbolic font name for the small font (value <code>"org.eclipse.jface.smallfont"</code>).
+ */
+ public static final String SMALL_FONT = "org.eclipse.ui.smallFont"; //$NON-NLS-1$
+
+ public PerspectiveBarManager(int style) {
+ super(style);
+ }
+
+ public ToolBar createControl(Composite parent) {
+ ToolBar control = super.createControl(parent);
+
+ if (control != null && !control.isDisposed())
+ control.setFont(getFont());
+
+ return control;
+ }
+
+ public PerspectiveBarManager(ToolBar toolbar) {
+ super(toolbar);
+
+ if (toolbar != null && !toolbar.isDisposed())
+ toolbar.setFont(getFont());
+ }
+
+ // TODO begin refactor this out?
+ private CBanner banner;
+
+ void layout(boolean b) {
+ if (banner != null && !banner.isDisposed()) banner.layout(b);
+ }
+
+ void setBanner(CBanner banner) {
+ this.banner = banner;
+ }
+
+ // TODO end refactor this out?
+
+ private Font getFont() {
+ return JFaceResources.getFont(SMALL_FONT);
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TabbedEditorWorkbook.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TabbedEditorWorkbook.java
index 0cf7ecffbf7..9fd3c31ad24 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TabbedEditorWorkbook.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/TabbedEditorWorkbook.java
@@ -81,21 +81,27 @@ public class TabbedEditorWorkbook extends EditorWorkbook {
*/
}
- public void restore(CTabFolderEvent event) {
- EditorPane visibleEditor = getVisibleEditor();
- WorkbenchPage page = visibleEditor.getPage();
-
- if (page != null && page.isZoomed()) doZoom();
-
- //forceLayout();
- }
-
- public void maximize(CTabFolderEvent event) {
- EditorPane visibleEditor = getVisibleEditor();
- WorkbenchPage page = visibleEditor.getPage();
-
- if (page != null && !page.isZoomed()) doZoom();
- }
+ public void restore(CTabFolderEvent event) {
+ EditorPane visibleEditor = getVisibleEditor();
+
+ if (visibleEditor != null) {
+ WorkbenchPage page = visibleEditor.getPage();
+
+ if (page != null && page.isZoomed()) doZoom();
+
+ //forceLayout();
+ }
+ }
+
+ public void maximize(CTabFolderEvent event) {
+ EditorPane visibleEditor = getVisibleEditor();
+
+ if (visibleEditor != null) {
+ WorkbenchPage page = visibleEditor.getPage();
+
+ if (page != null && !page.isZoomed()) doZoom();
+ }
+ }
};
/*

Back to the top