Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2010-03-30 20:18:03 +0000
committerChris Goldthorpe2010-03-30 20:18:03 +0000
commitadb29cea96f2a4220dc5cee63faf9bae2eb65c65 (patch)
tree27664890d4d5b00a3dca3754afd3a3c46b076aa2
parentb03bc87a7448c28fdf176f0264535b7c6675a4fb (diff)
downloadeclipse.platform.ua-adb29cea96f2a4220dc5cee63faf9bae2eb65c65.tar.gz
eclipse.platform.ua-adb29cea96f2a4220dc5cee63faf9bae2eb65c65.tar.xz
eclipse.platform.ua-adb29cea96f2a4220dc5cee63faf9bae2eb65c65.zip
Bug 306852 - Help tray in dialogs not wide enough to show all toolbar buttons
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java75
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpTray.java4
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java4
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java49
4 files changed, 84 insertions, 48 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java
index f6d24b5b7..11cb39201 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -95,7 +95,7 @@ public class BrowserPart extends AbstractFormPart implements IHelpPart {
private String title;
public BrowserPart(final Composite parent, FormToolkit toolkit,
- final IToolBarManager tbm) {
+ final IToolBarManager tbm, IMenuManager menuManager) {
browser = new Browser(parent, SWT.NULL);
browser.addLocationListener(new LocationListener() {
public void changing(LocationEvent event) {
@@ -190,6 +190,7 @@ public class BrowserPart extends AbstractFormPart implements IHelpPart {
}
});
contributeToToolBar(tbm);
+ contributeToMenu(menuManager);
}
private String executeQuery(String domValue) {
@@ -248,31 +249,6 @@ public class BrowserPart extends AbstractFormPart implements IHelpPart {
bookmarkAction.setImageDescriptor(HelpUIResources
.getImageDescriptor(IHelpUIConstants.IMAGE_ADD_BOOKMARK));
- if (FontUtils.canRescaleHelpView()) {
- magnifyAction = new Action() {
- public void run() {
- doMagnify(SCALE_INCREMENT);
- }
- };
- magnifyAction.setToolTipText(Messages.BrowserPart_magnifyTooltip);
- magnifyAction.setImageDescriptor(HelpUIResources
- .getImageDescriptor(IHelpUIConstants.IMAGE_MAGNIFY));
- magnifyAction.setDisabledImageDescriptor(HelpUIResources
- .getImageDescriptor(IHelpUIConstants.IMAGE_D_MAGNIFY));
-
- reduceAction = new Action() {
- public void run() {
- doMagnify(-SCALE_INCREMENT);
- }
- };
- reduceAction.setToolTipText(Messages.BrowserPart_reduceTooltip);
- reduceAction.setImageDescriptor(HelpUIResources
- .getImageDescriptor(IHelpUIConstants.IMAGE_REDUCE));
- reduceAction.setDisabledImageDescriptor(HelpUIResources
- .getImageDescriptor(IHelpUIConstants.IMAGE_D_REDUCE));
- fontScalePercentage = Platform.getPreferencesService().getInt(HelpBasePlugin.PLUGIN_ID, HELP_VIEW_SCALE, 100, null);
- }
-
highlightAction = new Action() {
public void run() {
InstanceScope instanceScope = new InstanceScope();
@@ -300,13 +276,50 @@ public class BrowserPart extends AbstractFormPart implements IHelpPart {
tbm.insertBefore("back", printAction); //$NON-NLS-1$
tbm.insertBefore("back", bookmarkAction); //$NON-NLS-1$
tbm.insertBefore("back", highlightAction); //$NON-NLS-1$
- if (magnifyAction != null) {
- tbm.insertBefore("back", magnifyAction); //$NON-NLS-1$
- tbm.insertBefore("back", reduceAction); //$NON-NLS-1$
- }
tbm.insertBefore("back", new Separator()); //$NON-NLS-1$
enableButtons();
}
+
+ private void contributeToMenu(IMenuManager menuManager) {
+ if (FontUtils.canRescaleHelpView()) {
+ fontScalePercentage = Platform.getPreferencesService().getInt(HelpBasePlugin.PLUGIN_ID,
+ HELP_VIEW_SCALE, 100, null);
+ if (menuManager != null) {
+ addMenuActions(menuManager);
+ }
+ }
+ }
+
+ private void addMenuActions(IMenuManager menuManager) {
+ magnifyAction = new Action() {
+
+ public void run() {
+ doMagnify(SCALE_INCREMENT);
+ }
+ };
+ magnifyAction.setToolTipText(Messages.BrowserPart_magnifyTooltip);
+ magnifyAction.setText(Messages.BrowserPart_magnifyTooltip);
+ magnifyAction.setImageDescriptor(HelpUIResources
+ .getImageDescriptor(IHelpUIConstants.IMAGE_MAGNIFY));
+ magnifyAction.setDisabledImageDescriptor(HelpUIResources
+ .getImageDescriptor(IHelpUIConstants.IMAGE_D_MAGNIFY));
+
+ reduceAction = new Action() {
+
+ public void run() {
+ doMagnify(-SCALE_INCREMENT);
+ }
+ };
+ reduceAction.setToolTipText(Messages.BrowserPart_reduceTooltip);
+ reduceAction.setText(Messages.BrowserPart_reduceTooltip);
+ reduceAction
+ .setImageDescriptor(HelpUIResources.getImageDescriptor(IHelpUIConstants.IMAGE_REDUCE));
+ reduceAction.setDisabledImageDescriptor(HelpUIResources
+ .getImageDescriptor(IHelpUIConstants.IMAGE_D_REDUCE));
+ menuManager.add(new Separator());
+ menuManager.add(reduceAction);
+ menuManager.add(magnifyAction);
+ }
/*
* (non-Javadoc)
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpTray.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpTray.java
index e527cae66..0fa89e379 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpTray.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpTray.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 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
@@ -122,7 +122,7 @@ public class HelpTray extends DialogTray implements IPageChangedListener {
gd.heightHint = 1;
separator.setLayoutData(gd);
helpPart = new ReusableHelpPart(PlatformUI.getWorkbench().getProgressService());
- helpPart.init(null, tbm, null, null);
+ helpPart.init(null, tbm, null, null, null);
helpPart.setDefaultContextHelpText(Messages.HelpView_defaultText);
helpPart.createControl(container, toolkit);
gd = new GridData(GridData.FILL_BOTH);
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java
index 1235c4189..1916c3281 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -94,7 +94,7 @@ public class HelpView extends ViewPart implements IPartListener2,
getHelpPartStyle());
IActionBars actionBars = site.getActionBars();
reusableHelpPart.init(actionBars, actionBars.getToolBarManager(),
- actionBars.getStatusLineManager(), memento);
+ actionBars.getStatusLineManager(), actionBars.getMenuManager(), memento);
IWorkbenchWindow window = site.getPage().getWorkbenchWindow();
IPartService service = window.getPartService();
service.addPartListener(this);
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
index 8e7e148b6..71c8c7c8f 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -52,6 +52,7 @@ import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.SubMenuManager;
import org.eclipse.jface.action.SubStatusLineManager;
import org.eclipse.jface.action.SubToolBarManager;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
@@ -181,6 +182,8 @@ public class ReusableHelpPart implements IHelpUIConstants,
private EngineDescriptorManager engineManager;
+ public IMenuManager menuManager;
+
private abstract class BusyRunAction extends Action {
public BusyRunAction(String name) {
super(name);
@@ -299,7 +302,9 @@ public class ReusableHelpPart implements IHelpUIConstants,
private SubActionBars bars;
- private IToolBarManager toolBarManager;
+ private IToolBarManager subToolBarManager;
+
+ private IMenuManager subMenuManager;
protected ArrayList partRecs;
@@ -310,11 +315,21 @@ public class ReusableHelpPart implements IHelpUIConstants,
this.text = text;
partRecs = new ArrayList();
if (ReusableHelpPart.this.actionBars != null) {
+ // Help View
bars = new SubActionBars(ReusableHelpPart.this.actionBars);
- toolBarManager = bars.getToolBarManager();
- } else
- toolBarManager = new SubToolBarManager(
+ subToolBarManager = bars.getToolBarManager();
+ subMenuManager = bars.getMenuManager();
+ } else {
+ // Help Tray
+ subToolBarManager = new SubToolBarManager(
ReusableHelpPart.this.toolBarManager);
+ if (ReusableHelpPart.this.menuManager != null) {
+ subMenuManager = new SubMenuManager(
+ ReusableHelpPart.this.menuManager);
+ } else {
+ subMenuManager = null;
+ }
+ }
}
public HelpPartPage(String id, String text, String iconId) {
@@ -326,10 +341,14 @@ public class ReusableHelpPart implements IHelpUIConstants,
if (bars != null) {
bars.dispose();
bars = null;
- toolBarManager = null;
+ subToolBarManager = null;
+ subMenuManager = null;
} else {
try {
- ((SubToolBarManager) toolBarManager).disposeManager();
+ ((SubToolBarManager) subToolBarManager).disposeManager();
+ if (subMenuManager != null) {
+ ((SubMenuManager)subMenuManager).disposeManager();
+ }
} catch (RuntimeException e) {
// Bug 218079
}
@@ -354,7 +373,7 @@ public class ReusableHelpPart implements IHelpUIConstants,
}
public IToolBarManager getToolBarManager() {
- return toolBarManager;
+ return subToolBarManager;
}
public String getId() {
@@ -494,7 +513,10 @@ public class ReusableHelpPart implements IHelpUIConstants,
bars.deactivate();
bars.updateActionBars();
} else {
- ((SubToolBarManager) toolBarManager).setVisible(visible);
+ ((SubToolBarManager) subToolBarManager).setVisible(visible);
+ if (subMenuManager != null) {
+ ((SubMenuManager)subMenuManager).setVisible(visible);
+ }
ReusableHelpPart.this.toolBarManager.update(true);
getControl().getParent().layout();
}
@@ -511,7 +533,7 @@ public class ReusableHelpPart implements IHelpUIConstants,
private void createRecPart(PartRec rec) throws SWTError {
if (rec.part == null) {
- rec.part = createPart(rec.id, toolBarManager);
+ rec.part = createPart(rec.id, subToolBarManager, subMenuManager);
}
}
@@ -775,10 +797,11 @@ public class ReusableHelpPart implements IHelpUIConstants,
}
public void init(IActionBars bars, IToolBarManager toolBarManager,
- IStatusLineManager statusLineManager, IMemento memento) {
+ IStatusLineManager statusLineManager, IMenuManager menuManager, IMemento memento) {
this.memento = memento;
this.actionBars = bars;
this.toolBarManager = toolBarManager;
+ this.menuManager = menuManager;
this.statusLineManager = statusLineManager;
definePages();
makeActions();
@@ -1122,7 +1145,7 @@ public class ReusableHelpPart implements IHelpUIConstants,
mform.setInput(new ContextHelpProviderInput(provider, context, control, part, isExplicitRequest));
}
- private IHelpPart createPart(String id, IToolBarManager tbm) {
+ private IHelpPart createPart(String id, IToolBarManager tbm, IMenuManager menuManager) {
IHelpPart part = null;
Composite parent = mform.getForm().getBody();
@@ -1141,7 +1164,7 @@ public class ReusableHelpPart implements IHelpUIConstants,
((RelatedTopicsPart) part)
.setDefaultText(getDefaultContextHelpText());
} else if (id.equals(HV_BROWSER)) {
- part = new BrowserPart(parent, mform.getToolkit(), tbm);
+ part = new BrowserPart(parent, mform.getToolkit(), tbm, menuManager);
} else if (id.equals(HV_SEARCH_RESULT)) {
part = new DynamicHelpPart(parent, mform.getToolkit());
} else if (id.equals(HV_FSEARCH_RESULT)) {

Back to the top