protected String getHref(IHelpResource res) { return (res instanceof ITopic) ? res.getHref() : null; }
protected String getHref(IHelpResource res) { return res.getHref(); }
/** @deprecated */ @Deprecated @Override public void displayHelpResource(IHelpResource helpResource) { // convenience method - funnel through the real method displayHelpResource(helpResource.getHref()); }
protected void doOpen(Object obj) { if (!(obj instanceof IHelpResource)) return; IHelpResource res = (IHelpResource) obj; if (res instanceof IToc || (res instanceof ITopic && ((ITopic) obj).getSubtopics().length > 0 && res .getHref() == null)) treeViewer.setExpandedState(obj, !treeViewer.getExpandedState(res)); if (res instanceof IToc) postUpdate(res); else if (res.getHref() != null) parent.showURL(res.getHref()); }
public boolean select(Viewer viewer, Object parentElement, Object element) { IHelpResource res = (IHelpResource) element; String href = res.getHref(); if (href == null) return true; return HelpBasePlugin.getActivitySupport().isEnabled(href); } }
private boolean isExcluded(String href, IHelpResource [] excludedTopics) { if (excludedTopics==null) return false; for (int i=0; i<excludedTopics.length; i++) { if (href.startsWith(excludedTopics[i].getHref())) return true; if (parent.isFilteredByRoles()) { if (!HelpBasePlugin.getActivitySupport().isEnabled(href)) return true; } } return false; }
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()); } } }
private String getHref(Object target) { if (target instanceof ISelectionProvider) { ISelectionProvider provider = (ISelectionProvider) target; IStructuredSelection ssel = (IStructuredSelection) provider .getSelection(); Object obj = ssel.getFirstElement(); if (obj instanceof IToc) return null; if (obj instanceof IHelpResource) { IHelpResource res = (IHelpResource) obj; return res.getHref(); } if (obj instanceof IIndexEntry) { /* * if index entry has single topic * it represents the topic by itself */ IHelpResource[] topics = ((IIndexEntry) obj).getTopics(); if (topics.length == 1) return topics[0].getHref(); return null; } } else if (target instanceof FormText) { FormText text = (FormText) target; Object href = text.getSelectedLinkHref(); if (href != null) return href.toString(); } return null; }
private boolean isEnabled(IHelpResource topic) { return isEnabled((Object)topic) && HelpBasePlugin.getActivitySupport().isEnabled(topic.getHref()); } }
private void doBookmark(Object target) { IHelpResource res = null; if (target instanceof IHelpResource) { res = (IHelpResource)target; } else { res = getResource(target); } if (res != null) { BaseHelpSystem.getBookmarkManager().addBookmark(res.getHref(), res.getLabel()); } }
&& (oldCat == null || !oldCat.getLabel().equals(cat.getLabel()))) { buff.append("<p>"); //$NON-NLS-1$ if (cat.getHref() != null) { buff.append("<a bold=\"true\" href=\""); //$NON-NLS-1$ String absoluteHref = ""; //$NON-NLS-1$ if (cat.getHref().endsWith(".xml")) { //$NON-NLS-1$ absoluteHref = absoluteHref + CAT_HEADING_PREFIX; absoluteHref = absoluteHref + hit.toAbsoluteHref(cat.getHref(), true); buff.append(part.parent.escapeSpecialChars(absoluteHref)); buff.append("\">"); //$NON-NLS-1$
IHelpResource[] topics = entry.getTopics(); if (topics.length == 1) { final String href = topics[0].getHref(); final String label = entry.getKeyword(); return new IHelpResource() {
public void displayContext(IContext context, IWorkbenchPart part, Control control) { if (reusableHelpPart != null) { /* * If the context help has no description text and exactly one * topic, go straight to the topic and skip context help. */ IHelpResource[] topics = context.getRelatedTopics(); if (context.getText() != null || topics.length != 1) { // Ensure that context help is currently showing reusableHelpPart.showPage(IHelpUIConstants.HV_CONTEXT_HELP_PAGE); // check if there is a dynamic version IContextProvider provider = null; if (part!=null) provider = (IContextProvider) part .getAdapter(IContextProvider.class); if (provider != null) reusableHelpPart.update(provider, context, part, control); else reusableHelpPart.update(context, part, control); } else { reusableHelpPart.showURL(topics[0].getHref()); } } }
private void displayContextAsInfopop(IContext context, int x, int y) { if (f1Dialog != null) { f1Dialog.close(); } if (context != null) { /* * If the context help has no description text and exactly one * topic, go straight to the topic and skip context help. */ IHelpResource[] topics = context.getRelatedTopics(); if (context.getText() == null && topics.length == 1) { try { PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(topics[0].getHref()); } catch (Exception e) { // should never happen } } else { f1Dialog = new ContextHelpDialog(context, x, y); f1Dialog.open(); } } }
private void displayContextAsHelpTray(Shell activeShell, IContext context) { Control controlInFocus = activeShell.getDisplay().getFocusControl(); TrayDialog dialog = (TrayDialog)activeShell.getData(); DialogTray tray = dialog.getTray(); if (tray == null) { tray = new HelpTray(); dialog.openTray(tray); } if (tray instanceof HelpTray) { ReusableHelpPart helpPart = ((HelpTray)tray).getHelpPart(); if (context != null) { IHelpResource[] topics = context.getRelatedTopics(); if (context.getText() == null && topics.length == 1) { helpPart.showURL(topics[0].getHref()); helpPart.update(context, null, controlInFocus); } else { helpPart.showPage(IHelpUIConstants.HV_CONTEXT_HELP_PAGE); helpPart.update(context, null, controlInFocus); } } else { helpPart.showPage(IHelpUIConstants.HV_FSEARCH_PAGE, true); } } else { // someone else was occupying the tray; not supported } }
public void mergeContext(IContext src) { String text = src.getText(); if (getText() == null || getText().length() == 0) { setText(text); } if (src instanceof IContext2 && getTitle() == null) { String title = ((IContext2)src).getTitle(); if (title != null) { setAttribute(ATTRIBUTE_TITLE, title); } } if (src instanceof IContext3) { ICommandLink[] commands = ((IContext3)src).getRelatedCommands(); for (int i=0;i<commands.length;++i) { appendChild(new CommandLink(commands[i])); } } IHelpResource[] topics = src.getRelatedTopics(); for (int i=0;i<topics.length;++i) { if (topics[i] instanceof ITopic) { appendChild(new Topic((ITopic)topics[i])); } else { Topic topic = new Topic(); topic.setHref(topics[i].getHref()); topic.setLabel(topics[i].getLabel()); appendChild(topic); } } }
boolean openInEditor = pref.getBoolean(IHelpBaseConstants.P_KEY_OPEN_IN_EDITOR); if (context.getText() == null && topics.length == 1 && openInEditor) { showInWorkbenchBrowser(topics[0].getHref(), true);