@Override public String getTitle() { if (context instanceof IContext2) { String ctitle = ((IContext2)context).getTitle(); if (ctitle!=null) { return ctitle; } } return title; }
@Override public String getCategory(IHelpResource topic) { if (context instanceof IContext2) { return ((IContext2)context).getCategory(topic); } return null; }
@Override public String getStyledText() { if (context instanceof IContext2) { return ((IContext2)context).getStyledText(); } return context.getText(); }
private void updateTitle() { String title = null; if (lastContext != null && lastContext instanceof IContext2) { IContext2 c2 = (IContext2)lastContext; title = c2.getTitle(); } if (title==null && lastPart != null) title = NLS.bind(Messages.ContextHelpPart_aboutP, lastPart .getSite().getRegisteredName()); if (title==null) title = Messages.ContextHelpPart_about; getSection().setText(title); }
public int category(Object element) { if (element instanceof IHelpResource) { IHelpResource r = (IHelpResource)element; String c = context.getCategory(r); if (c!=null) { return -5; } } return super.category(element); }
/** * Make sure to support the Help system bold tag. Help systen returns a * regular string for getText(). Use internal apis for now to get bold. * * @param context * @return */ private String decodeContextBoldTags(IContext context) { String styledText; if (context instanceof IContext2) { styledText = ((IContext2) context).getStyledText(); if (styledText == null) { styledText = context.getText(); } } else { styledText = context.getText(); } if (styledText == null) { return Messages.ContextHelpPart_noDescription; } String decodedString = styledText.replaceAll("<@#\\$b>", "<b>"); //$NON-NLS-1$ //$NON-NLS-2$ decodedString = decodedString.replaceAll("</@#\\$b>", "</b>"); //$NON-NLS-1$ //$NON-NLS-2$ decodedString = parent.escapeSpecialChars(decodedString, true); decodedString = decodedString.replaceAll("\r\n|\n|\r", "<br/>"); //$NON-NLS-1$ //$NON-NLS-2$ return decodedString; }
private void updateDynamicHelp(boolean explicitContext) { if (explicitContext && lastContext instanceof IContext2) { String title = ((IContext2)lastContext).getTitle(); if (title!=null) { updateDynamicHelp(stripMnemonic(title), lastControl); return; } } if (lastProvider != null || lastControl != null) updateDynamicHelp(lastProvider != null ? lastProvider .getSearchExpression(lastControl) : null, lastControl); }
public int compare(Viewer viewer, Object e1, Object e2) { int cat1 = category(e1); int cat2 = category(e2); if (cat1 != cat2) return cat1 - cat2; IHelpResource r1 = (IHelpResource) e1; IHelpResource r2 = (IHelpResource) e2; String c1 = context.getCategory(r1); String c2 = context.getCategory(r2); if (c1!=null && c2!=null) { int cat = super.compare(viewer, c1, c2); if (cat!=0) return cat; } return 0; } }
styledText = ((IContext2) context).getStyledText();
public JavadocHelpContext(IContext context, Object[] elements) throws JavaModelException { Assert.isNotNull(elements); if (context instanceof IContext2) fTitle= ((IContext2)context).getTitle();
String cat = null; if (context instanceof IContext2) { cat = ((IContext2)context).getCategory(link);
public JavadocHelpContext(IContext context, Object[] elements) throws JavaModelException { Assert.isNotNull(elements); if (context instanceof IContext2) fTitle= ((IContext2)context).getTitle();
public JavadocHelpContext(IContext context, Object[] elements) throws JavaModelException { Assert.isNotNull(elements); if (context instanceof IContext2) fTitle= ((IContext2)context).getTitle();
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); } } }