diff options
author | Chris Goldthorpe | 2011-02-15 18:39:22 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2011-02-15 18:39:22 +0000 |
commit | 35599e216439b3ed5bf3667bb3acd23478962507 (patch) | |
tree | 66e3985bc9f6a897ed31e1d97e593349c03bb1b6 /org.eclipse.help.ui | |
parent | 7c521a337f4f33b4a6d8c6a8b96df81372aaf474 (diff) | |
download | eclipse.platform.ua-35599e216439b3ed5bf3667bb3acd23478962507.tar.gz eclipse.platform.ua-35599e216439b3ed5bf3667bb3acd23478962507.tar.xz eclipse.platform.ua-35599e216439b3ed5bf3667bb3acd23478962507.zip |
Bug 291109 - [Help][Search] Help Pane search is hard to navigate
Diffstat (limited to 'org.eclipse.help.ui')
5 files changed, 126 insertions, 74 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java index 527e657e0..a6f1a5c29 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -63,6 +63,7 @@ public interface IHelpUIConstants { public static final String HV_TOPIC_TREE = "topic-tree"; //$NON-NLS-1$ public static final String HV_BOOKMARKS_TREE = "bookmarks-tree"; //$NON-NLS-1$ + public static final String HV_BOOKMARKS_HEADER = "bookmarks-header"; //$NON-NLS-1$ public static final String HV_SEE_ALSO = "see-also"; //$NON-NLS-1$ public static final String HV_BROWSER = "browser"; //$NON-NLS-1$ public static final String HV_CONTEXT_HELP = "context-help"; //$NON-NLS-1$ diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BookmarkHeaderPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BookmarkHeaderPart.java new file mode 100644 index 000000000..ac1201611 --- /dev/null +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BookmarkHeaderPart.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2011 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.help.ui.internal.views; + +/** + * Creates padding above the bookmarks view + */ + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.forms.AbstractFormPart; +import org.eclipse.ui.forms.widgets.FormToolkit; + +public class BookmarkHeaderPart extends AbstractFormPart implements IHelpPart { + + private Composite container; + private String id; + + public BookmarkHeaderPart(Composite parent, FormToolkit toolkit) { + container = toolkit.createComposite(parent); + Composite inner = toolkit.createComposite(container); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + container.setLayout(layout); + GridData data = new GridData(); + data.heightHint = 2; + inner.setLayoutData(data); + } + + public void init(ReusableHelpPart parent, String id, IMemento memento) { + this.id = id; + } + + public void saveState(IMemento memento) { + } + + public Control getControl() { + return container; + } + + public String getId() { + return id; + } + + public void setVisible(boolean visible) { + container.setVisible(visible); + } + + public boolean hasFocusControl(Control control) { + return false; + } + + public boolean fillContextMenu(IMenuManager manager) { + return false; + } + + public IAction getGlobalAction(String id) { + return null; + } + + public void stop() { + + } + + public void toggleRoleFilter() { + + } + + public void refilter() { + + } + +} diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java index 59de8f1b3..08706f186 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java @@ -172,7 +172,7 @@ public class ContextHelpPart extends SectionPart implements IHelpPart { } private static int getSectionStyle() { - int style = Section.EXPANDED | Section.TITLE_BAR; + int style = Section.EXPANDED ; if (RelatedTopicsPart.isUseDynamicHelp()) { style = style | Section.TWISTIE; } 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 89fdf7973..b77e3b066 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, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -742,9 +742,9 @@ public class ReusableHelpPart implements IHelpUIConstants, Messages.ReusableHelpPart_searchPage_name, IHelpUIConstants.IMAGE_HELP_SEARCH); page.setVerticalSpacing(0); + page.addPart(HV_SEE_ALSO, false); page.addPart(HV_FSEARCH, false); page.addPart(HV_FSEARCH_RESULT, true); - page.addPart(HV_SEE_ALSO, false); pages.add(page); // all topics page @@ -753,9 +753,9 @@ public class ReusableHelpPart implements IHelpUIConstants, IHelpUIConstants.IMAGE_ALL_TOPICS); page.setVerticalSpacing(0); page.setHorizontalMargin(0); + page.addPart(HV_SEE_ALSO, false); page.addPart(HV_SCOPE_SELECT, false); page.addPart(HV_TOPIC_TREE, true); - page.addPart(HV_SEE_ALSO, false); pages.add(page); // bookmarks page @@ -764,14 +764,15 @@ public class ReusableHelpPart implements IHelpUIConstants, IHelpUIConstants.IMAGE_BOOKMARKS); page.setVerticalSpacing(0); page.setHorizontalMargin(0); - page.addPart(HV_BOOKMARKS_TREE, true); page.addPart(HV_SEE_ALSO, false); + page.addPart(HV_BOOKMARKS_HEADER, false); + page.addPart(HV_BOOKMARKS_TREE, true); pages.add(page); // browser page page = new HelpPartPage(HV_BROWSER_PAGE, null); page.setVerticalSpacing(0); - page.addPart(HV_BROWSER, true); page.addPart(HV_SEE_ALSO, false); + page.addPart(HV_BROWSER, true); pages.add(page); // context help page @@ -782,8 +783,8 @@ public class ReusableHelpPart implements IHelpUIConstants, // page.addPart(HV_SEARCH_RESULT, false, true); page.setVerticalSpacing(0); page.setHorizontalMargin(0); - page.addPart(HV_RELATED_TOPICS, true); page.addPart(HV_SEE_ALSO, false); + page.addPart(HV_RELATED_TOPICS, true); pages.add(page); // index page @@ -791,10 +792,10 @@ public class ReusableHelpPart implements IHelpUIConstants, Messages.ReusableHelpPart_indexPage_name, IHelpUIConstants.IMAGE_INDEX); page.setVerticalSpacing(0); + page.addPart(HV_SEE_ALSO, false); page.addPart(HV_SCOPE_SELECT, false); page.addPart(HV_INDEX_TYPEIN, false); page.addPart(HV_INDEX, true); - page.addPart(HV_SEE_ALSO, false); pages.add(page); } @@ -1027,12 +1028,12 @@ public class ReusableHelpPart implements IHelpUIConstants, oldPage.stop(); oldPage.setVisible(false); } - mform.getForm().setText(newPage.getText()); + mform.getForm().setText(null); //(newPage.getText()); mform.getForm().getForm().setSeparatorVisible(newPage.getText()!=null); Image newImage=null; - String iconId = newPage.getIconId(); - if (iconId != null) - newImage = HelpUIResources.getImage(iconId); + //String iconId = newPage.getIconId(); + //if (iconId != null) + //newImage = HelpUIResources.getImage(iconId); mform.getForm().setImage(newImage); newPage.setVisible(true); toolBarManager.update(true); @@ -1177,6 +1178,8 @@ public class ReusableHelpPart implements IHelpUIConstants, part = new SeeAlsoPart(parent, mform.getToolkit()); } else if (id.equals(HV_FSEARCH)) { part = new SearchPart(parent, mform.getToolkit()); + } else if (id.equals(HV_BOOKMARKS_HEADER)) { + part = new BookmarkHeaderPart(parent, mform.getToolkit()); } else if (id.equals(HV_BOOKMARKS_TREE)) { part = new BookmarksPart(parent, mform.getToolkit(), tbm); } else if (id.equals(HV_INDEX)) { diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java index ca178dc3d..8b049ec79 100644 --- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java +++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -15,25 +15,19 @@ import org.eclipse.help.ui.internal.IHelpUIConstants; import org.eclipse.help.ui.internal.Messages; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IMemento; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.forms.AbstractFormPart; -import org.eclipse.ui.forms.FormColors; import org.eclipse.ui.forms.HyperlinkGroup; -import org.eclipse.ui.forms.IFormColors; import org.eclipse.ui.forms.events.HyperlinkAdapter; import org.eclipse.ui.forms.events.HyperlinkEvent; import org.eclipse.ui.forms.events.IHyperlinkListener; @@ -54,36 +48,16 @@ public class SeeAlsoPart extends AbstractFormPart implements IHelpPart { * @param style */ public SeeAlsoPart(Composite parent, FormToolkit toolkit) { - container = new Composite(parent, SWT.NULL); + container = toolkit.createComposite(parent); container.setBackgroundMode(SWT.INHERIT_DEFAULT); - container.addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - updateBackgroundImage(); - } - }); + GridLayout layout = new GridLayout(); layout.marginHeight = 0; //layout.marginWidth = 0; layout.verticalSpacing = 0; layout.marginTop = 2; container.setLayout(layout); - /* - Composite sep = toolkit.createCompositeSeparator(container); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.heightHint = 1; - sep.setLayoutData(gd); - */ - /* - Composite innerContainer = new Composite(container, SWT.NULL); - innerContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); - layout = new GridLayout(); - layout.marginHeight = 0; - innerContainer.setLayout(layout); - */ - Label label = toolkit.createLabel(container, Messages.SeeAlsoPart_goto); - label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); - label.setBackground(null); linkContainer = new Composite(container, SWT.NULL); linkContainer.setLayoutData(new GridData(GridData.FILL_BOTH)); RowLayout rlayout = new RowLayout(); @@ -99,41 +73,18 @@ public class SeeAlsoPart extends AbstractFormPart implements IHelpPart { hyperlinkGroup.setHyperlinkUnderlineMode(toolkit.getHyperlinkGroup().getHyperlinkUnderlineMode()); } - private void updateBackgroundImage() { - FormToolkit toolkit = helpPart.getForm().getToolkit(); - FormColors colors = toolkit.getColors(); - Rectangle carea = container.getClientArea(); - Image oldImage = bgImage; - if (bgImage!=null) { - Rectangle ibounds = bgImage.getBounds(); - if (carea.height==ibounds.height) - return; - } - bgImage = new Image(container.getDisplay(), 1, carea.height); - GC gc = new GC(bgImage); - gc.setBackground(colors.getColor(IFormColors.H_GRADIENT_END)); - gc.setForeground(colors.getColor(IFormColors.H_GRADIENT_START)); - gc.fillGradientRectangle(0, 0, - 1, - carea.height, - true); - gc.setForeground(colors.getColor(IFormColors.H_BOTTOM_KEYLINE2)); - gc.drawLine(0, 0, 1, 0); - gc.setForeground(colors.getColor(IFormColors.H_BOTTOM_KEYLINE1)); - gc.drawLine(0, 1, 1, 1); - gc.dispose(); - container.setBackgroundImage(bgImage); - if (oldImage != null && !oldImage.isDisposed()) { - oldImage.dispose(); - } - } - private void updateLinks(String href) { Control [] children = linkContainer.getChildren(); for (int i=0; i<children.length; i++) { ImageHyperlink link = (ImageHyperlink)children[i]; RowData data = (RowData)link.getLayoutData(); - data.exclude = link.getHref().equals(href); + boolean isCurrentPage = link.getHref().equals(href); + if (isCurrentPage) { + link.setFont(JFaceResources.getBannerFont()); + } else { + link.setFont(JFaceResources.getDefaultFont()); + } + data.exclude = false; link.setVisible(!data.exclude); } linkContainer.layout(); @@ -209,7 +160,17 @@ public class SeeAlsoPart extends AbstractFormPart implements IHelpPart { public void init(ReusableHelpPart parent, String id, IMemento memento) { this.helpPart = parent; this.id = id; - addLinks(linkContainer, helpPart.getForm().getToolkit()); + FormToolkit toolkit = helpPart.getForm().getToolkit(); + addLinks(linkContainer, toolkit); + Composite padding = toolkit.createComposite(container); + GridData paddingData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + paddingData.heightHint = 2; + padding.setLayoutData(paddingData); + Composite separator = new Composite(container, SWT.NULL); + GridData seperatorData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + separator.setBackground(toolkit.getColors().getBorderColor()); + seperatorData.heightHint = 1; + separator.setLayoutData(seperatorData); } public String getId() { |