Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurtis D'Entremont2006-03-13 19:27:29 +0000
committerCurtis D'Entremont2006-03-13 19:27:29 +0000
commit094ad4e07eac6159aeccf945d1294aafe7b69005 (patch)
treeabfc37ea2e40a6a06be49ebfe7556222d8d9a13f
parent16568f821b5ac442021aaeb782b38e3f9bf8c1a4 (diff)
downloadeclipse.platform.ua-094ad4e07eac6159aeccf945d1294aafe7b69005.tar.gz
eclipse.platform.ua-094ad4e07eac6159aeccf945d1294aafe7b69005.tar.xz
eclipse.platform.ua-094ad4e07eac6159aeccf945d1294aafe7b69005.zip
10087 [Help] Missing Help Index Solution
-rw-r--r--org.eclipse.help.ui/icons/etool16/index_co.gifbin0 -> 362 bytes
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/IHelpUIConstants.java5
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java6
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties5
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java3
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java134
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexTypeinPart.java304
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java31
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java5
-rw-r--r--org.eclipse.help/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.help/schema/index.exsd6
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java17
12 files changed, 505 insertions, 13 deletions
diff --git a/org.eclipse.help.ui/icons/etool16/index_co.gif b/org.eclipse.help.ui/icons/etool16/index_co.gif
new file mode 100644
index 000000000..6645b64a9
--- /dev/null
+++ b/org.eclipse.help.ui/icons/etool16/index_co.gif
Binary files differ
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 4123dc4e7..c47dab65b 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
@@ -35,6 +35,7 @@ public interface IHelpUIConstants {
public static final String IMAGE_HELP_SEARCH = "etool16/helpsearch_co.gif"; //$NON-NLS-1$
public static final String IMAGE_RELATED_TOPICS = "etool16/reltopics_co.gif"; //$NON-NLS-1$
public static final String IMAGE_ALL_TOPICS = "etool16/alltopics_co.gif"; //$NON-NLS-1$
+ public static final String IMAGE_INDEX = "etool16/index_co.gif"; //$NON-NLS-1$
public static final String IMAGE_HELP = "etool16/help.gif"; //$NON-NLS-1$
public static final String IMAGE_DHELP = "view16/help_view.gif"; //$NON-NLS-1$
public static final String IMAGE_NW = "elcl16/openseparate_co.gif"; //$NON-NLS-1$
@@ -65,6 +66,10 @@ public interface IHelpUIConstants {
public static final String HV_RELATED_TOPICS = "related-topics"; //$NON-NLS-1$
public static final String HV_CONTEXT_HELP_PAGE = "context-help-page"; //$NON-NLS-1$
+ public static final String HV_INDEX = "index"; //$NON-NLS-1$
+ public static final String HV_INDEX_TYPEIN = "index-typein"; //$NON-NLS-1$
+ public static final String HV_INDEX_PAGE = "index-page"; //$NON-NLS-1$
+
static final String ENGINE_EXP_ID = "org.eclipse.help.ui.searchEngine"; //$NON-NLS-1$
static final String TAG_ENGINE = "engine"; //$NON-NLS-1$
static final String ATT_ID = "id"; //$NON-NLS-1$
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java
index b09d9a38f..05979e366 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.java
@@ -59,6 +59,7 @@ public final class Messages extends NLS {
public static String ReusableHelpPart_copyAction_label;
public static String ReusableHelpPart_bookmarkAction_label;
public static String ReusableHelpPart_status;
+ public static String ReusableHelpPart_indexPage_name;
public static String HelpView_defaultText;
public static String expression;
public static String expression_label;
@@ -68,6 +69,7 @@ public final class Messages extends NLS {
public static String SeeAlsoPart_goto;
public static String SeeAlsoPart_contextHelp;
public static String SeeAlsoPart_bookmarks;
+ public static String SeeAlsoPart_index;
public static String ContextHelpPart_about;
public static String ContextHelpPart_aboutP;
public static String ContextHelpPart_dynamicHelp;
@@ -179,4 +181,6 @@ public final class Messages extends NLS {
public static String ReusableHelpPart_internalWebBrowserError;
public static String ScopeSet_errorLoading;
public static String ScopeSet_errorSaving;
-} \ No newline at end of file
+ public static String IndexInstructions;
+ public static String IndexButton;
+}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties
index 41141c731..3e05293a3 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/Messages.properties
@@ -75,6 +75,7 @@ ReusableHelpPart_closeAction_tooltip=Close
ReusableHelpPart_bookmarkAction_label=&Add Bookmark
ReusableHelpPart_internalBrowserTitle=Help
ReusableHelpPart_status = {0} - {1}
+ReusableHelpPart_indexPage_name=Index
HelpView_defaultText=Click on any workbench part to show related help topics.
@@ -87,6 +88,7 @@ SeeAlsoPart_allTopics=All Topics
SeeAlsoPart_goto=Go To:
SeeAlsoPart_contextHelp=Related Topics
SeeAlsoPart_bookmarks = Bookmarks
+SeeAlsoPart_index = Index
ContextHelpPart_about=About
ContextHelpPart_aboutP=About {0}
ContextHelpPart_dynamicHelp=Search for other related topics
@@ -201,3 +203,6 @@ DefaultHelpUI_wtitle = Help
DefaultHelpUI_noPerspMessage =This operation requires at least one open perspective.
ContextHelpDialog_showInDynamicHelp = Open in dynamic help
+
+IndexInstructions = Typein the word to find:
+IndexButton = Display
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 a5393d659..fa2b8803d 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
@@ -359,8 +359,7 @@ public class HelpView extends ViewPart implements IPartListener2,
* @see org.eclipse.help.ui.internal.views.BaseHelpView#getHelpPartStyle()
*/
protected int getHelpPartStyle() {
- return ReusableHelpPart.ALL_TOPICS | ReusableHelpPart.CONTEXT_HELP
- | ReusableHelpPart.SEARCH | ReusableHelpPart.BOOKMARKS;
+ return ReusableHelpPart.getDefaultStyle();
}
public void setFocus() {
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java
new file mode 100644
index 000000000..ed7ae4c14
--- /dev/null
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Intel 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:
+ * Intel Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.help.ui.internal.views;
+
+import org.eclipse.help.HelpSystem;
+import org.eclipse.help.IHelpResource;
+import org.eclipse.help.IIndexEntry;
+import org.eclipse.help.ui.internal.IHelpUIConstants;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+public class IndexPart extends HyperlinkTreePart implements IHelpUIConstants {
+
+ class IndexProvider implements ITreeContentProvider {
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement == IndexPart.this) {
+ return HelpSystem.getIndex().getEntries();
+ }
+ if (parentElement instanceof IIndexEntry) {
+ return IndexPart.this.getChildren((IIndexEntry) parentElement);
+ }
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ }
+
+ class IndexLabelProvider extends LabelProvider {
+ public String getText(Object obj) {
+ if (obj instanceof IIndexEntry)
+ return ((IIndexEntry) obj).getKeyword();
+ if (obj instanceof IHelpResource)
+ return ((IHelpResource) obj).getLabel();
+ return super.getText(obj);
+ }
+
+ public Image getImage(Object obj) {
+ return super.getImage(obj);
+ }
+ }
+
+ public IndexPart(Composite parent, FormToolkit toolkit, IToolBarManager tbm) {
+ super(parent, toolkit, tbm);
+ }
+
+ protected void configureTreeViewer() {
+ treeViewer.setContentProvider(new IndexProvider());
+ treeViewer.setLabelProvider(new IndexLabelProvider());
+ }
+
+ protected void doOpen(Object obj) {
+ if (obj instanceof IHelpResource) {
+ parent.showURL(((IHelpResource) obj).getHref());
+ } else if (obj instanceof IIndexEntry) {
+ IIndexEntry entry = (IIndexEntry) obj;
+ if (getChildren(entry).length > 0) {
+ treeViewer.setExpandedState(obj, !treeViewer.getExpandedState(obj));
+ }
+ IHelpResource[] topics = entry.getTopics();
+ if (topics.length == 1) {
+ parent.showURL(topics[0].getHref());
+ }
+ }
+ }
+
+ protected boolean canAddBookmarks() {
+ return true;
+ }
+
+ public void saveState(IMemento memento) {
+ }
+
+ public void toggleRoleFilter() {
+ }
+
+ public void refilter() {
+ }
+
+ private Object[] getChildren(IIndexEntry entry) {
+ /*
+ * Index entry has two types of children: topics and subentries.
+ *
+ * The method returns topics among children only if number of the topics
+ * more than 1.
+ *
+ * In case when the entry owns only one topic, this topic is not returned
+ * as child because the entry will represent this topic by its keyword.
+ */
+ IHelpResource[] topics = entry.getTopics();
+ IIndexEntry[] subentries = entry.getSubentries();
+
+ if (topics.length <= 1) {
+ return subentries;
+ }
+
+ Object[] childrens = new Object[topics.length + subentries.length];
+ System.arraycopy(topics, 0, childrens, 0, topics.length);
+ System.arraycopy(subentries, 0, childrens, topics.length, subentries.length);
+
+ return childrens;
+ }
+
+ protected Tree getTreeWidget() {
+ return treeViewer.getTree();
+ }
+}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexTypeinPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexTypeinPart.java
new file mode 100644
index 000000000..edf4c1a22
--- /dev/null
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexTypeinPart.java
@@ -0,0 +1,304 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Intel 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:
+ * Intel Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.help.ui.internal.views;
+
+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.action.IToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.forms.AbstractFormPart;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+
+public class IndexTypeinPart extends AbstractFormPart implements IHelpPart, IHelpUIConstants {
+ private ReusableHelpPart parent;
+ String id;
+ private Composite container;
+ private FormText indexInstructions;
+ private Text indexText;
+ private Button indexButton;
+ private IndexPart indexPart;
+ private Tree indexTree;
+ private int itemCount;
+ private String[] rootItems;
+ private int currentIndex;
+
+ public IndexTypeinPart(Composite parent, FormToolkit toolkit, IToolBarManager tbm) {
+ container = toolkit.createComposite(parent);
+
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.numColumns = 2;
+ container.setLayout(layout);
+
+ // Instructions
+ indexInstructions = toolkit.createFormText(container, false);
+ indexInstructions.setText(Messages.IndexInstructions, false, false);
+ TableWrapData td = new TableWrapData();
+ td.colspan = 2;
+ indexInstructions.setLayoutData(td);
+
+ // Index typein
+ indexText = toolkit.createText(container, null);
+ td = new TableWrapData(TableWrapData.FILL_GRAB);
+ td.maxWidth = 100;
+ td.valign = TableWrapData.MIDDLE;
+ indexText.setLayoutData(td);
+ indexButton = toolkit.createButton(container, Messages.IndexButton, SWT.PUSH);
+ indexButton.setEnabled(false);
+
+ indexText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ indexButton.setEnabled(indexText.getText().length() > 0);//!!!
+ doNavigate(indexText.getText());
+ }});
+ indexText.addKeyListener(new KeyListener() {
+ public void keyReleased(KeyEvent e) {
+ if (e.character == '\r' && indexButton.isEnabled()) {
+ doOpen();
+ }
+ }
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == SWT.ARROW_UP) {
+ e.doit = false;
+ doUp();
+ } else if (e.keyCode == SWT.ARROW_DOWN) {
+ e.doit = false;
+ doDown();
+ }
+ }});
+ indexButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ doOpen();
+ }});
+
+ toolkit.paintBordersFor(container);
+
+ currentIndex = -1;
+ }
+
+ protected void doUp() {
+ checkTree();
+ if (indexTree == null) return;
+
+ int index = 0;
+ TreeItem[] items = indexTree.getSelection();
+ if (items.length > 0) {
+ index = indexTree.indexOf(items[0]) - 1;
+ if (index < 0) {
+ return;
+ }
+ }
+ TreeItem item = indexTree.getItem(index);
+ indexTree.setSelection(new TreeItem[] { item });
+ String text = item.getText();
+ indexText.setText(text);
+ indexText.setSelection(0, text.length());
+ }
+
+ protected void doDown() {
+ checkTree();
+ if (indexTree == null) return;
+
+ int index = 0;
+ TreeItem[] items = indexTree.getSelection();
+ if (items.length > 0) {
+ index = indexTree.indexOf(items[0]) + 1;
+ if (index >= indexTree.getItemCount()) {
+ return;
+ }
+ }
+ TreeItem item = indexTree.getItem(index);
+ indexTree.setSelection(new TreeItem[] { item });
+ String text = item.getText();
+ indexText.setText(text);
+ indexText.setSelection(0, text.length());
+ }
+
+ protected void doNavigate(String text) {
+ checkTree();
+ if (rootItems == null) return;
+
+ int index = searchPattern(text);
+ if (index != -1 && index != currentIndex) {
+ indexTree.setSelection(new TreeItem[] { indexTree.getItem(index) });
+ currentIndex = index;
+ }
+ }
+
+ private void checkTree() {
+ if (rootItems != null) return;
+
+ indexPart = (IndexPart)parent.findPart(HV_INDEX);
+ if (indexPart == null) return;
+
+ indexTree = indexPart.getTreeWidget();
+ if (indexTree == null) return;
+
+ itemCount = indexTree.getItemCount();
+ if (itemCount == 0) {
+ indexTree = null;
+ } else {
+ rootItems = new String[itemCount];
+ for (int i = 0; i < itemCount; i++) {
+ rootItems[i] = indexTree.getItem(i).getText();
+ }
+ }
+ }
+
+ /*
+ * TODO optimize
+ */
+ private int searchPattern(String pattern) {
+ int from = 0;
+ int to = rootItems.length;
+ int i;
+ int res;
+
+ while (to > from) {
+ i = (to + from) / 2;
+ res = compare(rootItems[i], pattern);
+ if (res == 0) {
+ while (i > 0) {
+ if (compare(rootItems[--i], pattern) != 0) {
+ i++;
+ break;
+ }
+ }
+ return i;
+ }
+
+ if (res < 0) {
+ from = i + 1;
+ } else {
+ to = i;
+ }
+ }
+
+ return -1;
+ }
+
+ /*
+ * TODO optimize
+ */
+ int compare(String keyword, String pattern) {
+ int kI = 0, pI = 0;
+ char kCh, pCh;
+
+ while (kI < keyword.length() && pI < pattern.length()) {
+ kCh = Character.toLowerCase(keyword.charAt(kI));
+ pCh = Character.toLowerCase(pattern.charAt(pI));
+ if (kCh > pCh) {
+ return 1;
+ } else if (kCh < pCh) {
+ return -1;
+ }
+ kI++;
+ pI++;
+ }
+ if (keyword.length() >= pattern.length()) {
+ return 0;
+ } else {
+ return -1;
+ }
+ }
+
+ protected void doOpen() {
+ checkTree();
+ if (indexTree == null) return;
+
+ TreeItem items[] = indexTree.getSelection();
+ if (items.length == 0) return;
+
+ Object obj = items[0].getData();
+ if (obj != null) {
+ indexPart.doOpen(obj);
+ }
+ }
+
+ public void init(ReusableHelpPart parent, String id, IMemento memento) {
+ // TODO Auto-generated method stub
+ this.parent = parent;
+ this.id = id;
+ }
+
+ public void saveState(IMemento memento) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Control getControl() {
+ return container;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setVisible(boolean visible) {
+ getControl().setVisible(visible);
+ }
+
+ public boolean hasFocusControl(Control control) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean fillContextMenu(IMenuManager manager) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public IAction getGlobalAction(String id) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void toggleRoleFilter() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void refilter() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setFocus() {
+ indexText.setFocus();
+ }
+
+ public Text getTextWidget() {
+ return indexText;
+ }
+}
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 6b6190e46..0e4cad7ad 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
@@ -30,6 +30,7 @@ import org.eclipse.help.IHelpResource;
import org.eclipse.help.IToc;
import org.eclipse.help.ITopic;
import org.eclipse.help.UAContentFilter;
+import org.eclipse.help.internal.HelpPlugin;
import org.eclipse.help.internal.base.BaseHelpSystem;
import org.eclipse.help.internal.base.HelpBasePlugin;
import org.eclipse.help.internal.base.IHelpBaseConstants;
@@ -105,6 +106,8 @@ public class ReusableHelpPart implements IHelpUIConstants,
public static final int BOOKMARKS = 1 << 4;
+ public static final int INDEX = 1 << 5;
+
public static final Collator SHARED_COLLATOR = Collator.getInstance();
private static final String PROMPT_KEY = "askShowAll"; //$NON-NLS-1$
@@ -631,7 +634,7 @@ public class ReusableHelpPart implements IHelpUIConstants,
}
public ReusableHelpPart(IRunnableContext runnableContext) {
- this(runnableContext, CONTEXT_HELP | SEARCH | ALL_TOPICS | BOOKMARKS);
+ this(runnableContext, getDefaultStyle());
}
public ReusableHelpPart(IRunnableContext runnableContext, int style) {
@@ -736,6 +739,16 @@ public class ReusableHelpPart implements IHelpUIConstants,
page.addPart(HV_RELATED_TOPICS, true);
page.addPart(HV_SEE_ALSO, false);
pages.add(page);
+
+ // index page
+ page = new HelpPartPage(HV_INDEX_PAGE,
+ Messages.ReusableHelpPart_indexPage_name,
+ IHelpUIConstants.IMAGE_INDEX);
+ page.setVerticalSpacing(0);
+ page.addPart(HV_INDEX_TYPEIN, false);
+ page.addPart(HV_INDEX, true);
+ page.addPart(HV_SEE_ALSO, false);
+ pages.add(page);
}
public void init(IActionBars bars, IToolBarManager toolBarManager,
@@ -1080,6 +1093,10 @@ public class ReusableHelpPart implements IHelpUIConstants,
part = new SearchPart(parent, mform.getToolkit());
} else if (id.equals(HV_BOOKMARKS_TREE)) {
part = new BookmarksPart(parent, mform.getToolkit(), tbm);
+ } else if (id.equals(HV_INDEX)) {
+ part = new IndexPart(parent, mform.getToolkit(), tbm);
+ } else if (id.equals(HV_INDEX_TYPEIN)) {
+ part = new IndexTypeinPart(parent, mform.getToolkit(), tbm);
}
if (part != null) {
mform.addPart(part);
@@ -1240,6 +1257,9 @@ public class ReusableHelpPart implements IHelpUIConstants,
private void contributeToDropDownMenu(IMenuManager manager) {
addPageAction(manager, IHelpUIConstants.HV_CONTEXT_HELP_PAGE);
addPageAction(manager, IHelpUIConstants.HV_ALL_TOPICS_PAGE);
+ if (HelpPlugin.getIndexManager().isIndexContributed()) {
+ addPageAction(manager, IHelpUIConstants.HV_INDEX_PAGE);
+ }
addPageAction(manager, IHelpUIConstants.HV_FSEARCH_PAGE);
addPageAction(manager, IHelpUIConstants.HV_BOOKMARKS_PAGE);
}
@@ -1638,5 +1658,14 @@ public class ReusableHelpPart implements IHelpUIConstants,
}
return engineManager;
}
+
+ static public int getDefaultStyle() {
+ int style = ALL_TOPICS | CONTEXT_HELP | SEARCH | BOOKMARKS;
+
+ if (HelpPlugin.getIndexManager().isIndexContributed())
+ style |= INDEX;
+
+ return style;
+ }
}
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 40d8ee037..54afe94a5 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
@@ -114,6 +114,11 @@ public class SeeAlsoPart extends AbstractFormPart implements IHelpPart {
IHelpUIConstants.HV_BOOKMARKS_PAGE,
IHelpUIConstants.IMAGE_BOOKMARKS, listener);
}
+ if ((helpPart.getStyle() & ReusableHelpPart.INDEX) != 0) {
+ addPageLink(container, toolkit, Messages.SeeAlsoPart_index,
+ IHelpUIConstants.HV_INDEX_PAGE,
+ IHelpUIConstants.IMAGE_INDEX, listener);
+ }
}
private void addPageLink(Composite container, FormToolkit toolkit, String text, String id,
diff --git a/org.eclipse.help/META-INF/MANIFEST.MF b/org.eclipse.help/META-INF/MANIFEST.MF
index 746e451b0..b6b6b378e 100644
--- a/org.eclipse.help/META-INF/MANIFEST.MF
+++ b/org.eclipse.help/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Bundle-Localization: plugin
Export-Package: org.eclipse.help,
org.eclipse.help.internal;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ui.intro,org.eclipse.ua.tests",
org.eclipse.help.internal.context;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.ua.tests",
- org.eclipse.help.internal.index;x-friends:="org.eclipse.help.webapp,org.eclipse.ua.tests",
+ org.eclipse.help.internal.index;x-friends:="org.eclipse.help.webapp,org.eclipse.ua.tests,org.eclipse.help.ui",
org.eclipse.help.internal.model;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ua.tests",
org.eclipse.help.internal.protocols;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ua.tests",
org.eclipse.help.internal.toc;x-friends:="org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.ua.tests",
diff --git a/org.eclipse.help/schema/index.exsd b/org.eclipse.help/schema/index.exsd
index dada03f33..d53d5df00 100644
--- a/org.eclipse.help/schema/index.exsd
+++ b/org.eclipse.help/schema/index.exsd
@@ -66,7 +66,11 @@
&lt;p&gt;&lt;b&gt;The topic element&lt;/b&gt;
&lt;p&gt;The topic element provides reference to help content related to the keyword. The href attribute is relative to the plug-in that manifest file belongs to. If you need to access a file in another plug-in, you can use the syntax
&lt;p&gt;&lt;tt&gt;&amp;lt;topic label=&quot;topic in another plug-in&quot; href=&quot;../other.plugin.id/concepts/some_other_file.html&quot;/&gt;&lt;/tt&gt;
-&lt;p&gt;The title attribute is optional. It is used to name the link to help content in the Index View in case when multiple topics are associated with the single keyword. If the attribute is not presented, the title comes from a TOC which own the link. If the attribute is not presented and the topic is not owned by any TOC, the title will be empty.
+&lt;p&gt;The title attribute is used to name the link to help content when multiple
+topics are associated with the single keyword. If the attribute is not
+specified, the title comes from a TOC which owns the link. If the link does not
+belong to any TOC, the title attribute must be specified, or else the title
+becomes undefined.
</documentation>
<appInfo>
<meta.attribute kind="resource"/>
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
index 4f6c3b569..7e34fc1c0 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
@@ -90,13 +90,6 @@ public class IndexManager {
return contributedIndexFiles;
}
- /**
- * @return Returns the contributingPlugins.
- */
- public Collection getContributingPlugins() {
- return contributingPlugins;
- }
-
public Index getIndex(String locale) {
if (locale == null)
return new Index();
@@ -136,4 +129,14 @@ public class IndexManager {
}
return ignored;
}
+
+ public boolean isIndexContributed() {
+ return isIndexContributed(Platform.getNL());
+ }
+
+ public boolean isIndexContributed(String locale) {
+ if (locale == null)
+ return false;
+ return !getContributedIndexFiles(locale).isEmpty();
+ }
}

Back to the top