• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HTMLPrinter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jface.internal.text.html.HTMLPrinter的典型用法代码示例。如果您正苦于以下问题:Java HTMLPrinter类的具体用法?Java HTMLPrinter怎么用?Java HTMLPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HTMLPrinter类属于org.eclipse.jface.internal.text.html包,在下文中一共展示了HTMLPrinter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getStyleSheet

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
protected String getStyleSheet() {
	if (fgStyleSheet == null)
		fgStyleSheet = loadStyleSheet();
	String css = fgStyleSheet;
	if (css != null) {
		FontData fontData = JFaceResources.getFontRegistry().getFontData(
				fontSymbolicName)[0];
		css = HTMLPrinter.convertTopLevelFont(css, fontData);
	}
	return css;
}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:12,代码来源:CustomCSSHelpHoverProvider.java


示例2: setHeader

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Set the header string.
 * 
 * @param header
 *            A string to set (may be <code>null</code>)
 * @param buffer
 * @param useHTMLTags
 */
private void setHeader(String header, StringBuffer buffer, boolean useHTMLTags)
{
	if (StringUtil.isEmpty(header))
	{
		return;
	}
	if (useHTMLTags)
	{
		buffer.append("<div class=\"header\">"); //$NON-NLS-1$
		HTMLPrinter.addSmallHeader(buffer, header);
		buffer.append("</div>"); //$NON-NLS-1$
	}
	else
	{
		// plain printing
		buffer.append('[');
		buffer.append(header);
		buffer.append("]\n"); //$NON-NLS-1$
	}

}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:30,代码来源:AbstractDocumentationHover.java


示例3: formatMultipleMessages

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Hook method to formats the given messages.
 * <p>
 * Subclasses can change this to create a different format like HTML.
 * </p>
 * 
 * @param messages
 *            the messages to format (element type: {@link String})
 * @return the formatted message
 */
@SuppressWarnings("rawtypes")
protected String formatMultipleMessages(List messages)
{
	StringBuffer buffer = new StringBuffer();

	HTMLPrinter.addPageProlog(buffer);
	HTMLPrinter.addParagraph(buffer,
			HTMLPrinter.convertToHTMLContent(Messages.CommonAnnotationHover_multipleMarkersMessage));
	HTMLPrinter.startBulletList(buffer);
	Iterator e = messages.iterator();
	while (e.hasNext())
	{
		HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent((String) e.next()));
	}
	HTMLPrinter.endBulletList(buffer);
	HTMLPrinter.addPageEpilog(buffer);

	return buffer.toString();
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:30,代码来源:CommonAnnotationHover.java


示例4: getInfoText

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
private static String getInfoText(IJavaElement element, ITypeRoot editorInputElement, IRegion hoverRegion, boolean allowImage) {
		long flags= getHeaderFlags(element);
		StringBuffer label= new StringBuffer(JavaElementLinks.getElementLabel(element, flags));
		
		if (element.getElementType() == IJavaElement.FIELD) {
			String constantValue= getConstantValue((IField) element, editorInputElement, hoverRegion);
			if (constantValue != null) {
				constantValue= HTMLPrinter.convertToHTMLContentWithWhitespace(constantValue);
				IJavaProject javaProject= element.getJavaProject();
				label.append(getFormattedAssignmentOperator(javaProject));
				label.append(constantValue);
			}
		}

//		if (element.getElementType() == IJavaElement.METHOD) {
//			IMethod method= (IMethod)element;
//			//TODO: add default value for annotation type members, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=249016
//		}

		return getImageAndLabel(element, allowImage, label.toString());
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:JavadocHover.java


示例5: toHtml

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
private String toHtml(String header, String string, String errorString, boolean addPreFormatted) {
	StringBuffer buffer= new StringBuffer();
	HTMLPrinter.addSmallHeader(buffer, header);

	if (string != null) {
		if (addPreFormatted) {
			HTMLPrinter.addParagraph(buffer, ""); //$NON-NLS-1$
			HTMLPrinter.addPreFormatted(buffer, HTMLPrinter.convertToHTMLContent(string));
		} else {
			HTMLPrinter.addParagraph(buffer, string);
		}
		if (errorString != null) {
			HTMLPrinter.addParagraph(buffer, errorString);
		}
	} else {
		HTMLPrinter.addParagraph(buffer, JavaHoverMessages.NLSStringHover_NLSStringHover_missingKeyWarning);
	}

	HTMLPrinter.insertPageProlog(buffer, 0);
	HTMLPrinter.addPageEpilog(buffer);
	return buffer.toString();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:NLSStringHover.java


示例6: printDefinitions

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
private void printDefinitions(StringBuffer buffer, List<String> list, boolean firstword) {
	Iterator<String> e= list.iterator();
	while (e.hasNext()) {
		String s= e.next();
		buffer.append("<dd>"); //$NON-NLS-1$
		if (!firstword)
			buffer.append(s);
		else {
			buffer.append("<b>"); //$NON-NLS-1$

			int i= getParamEndOffset(s);
			if (i <= s.length()) {
				buffer.append(HTMLPrinter.convertToHTMLContent(s.substring(0, i)));
				buffer.append("</b>"); //$NON-NLS-1$
				buffer.append(s.substring(i));
			} else {
				buffer.append("</b>"); //$NON-NLS-1$
			}
		}
		buffer.append("</dd>"); //$NON-NLS-1$
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:JavaDoc2HTMLTextReader.java


示例7: formatMultipleMessages

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
@Override
protected String formatMultipleMessages(@SuppressWarnings("rawtypes") List messages) {
    StringBuffer buffer = new StringBuffer();
    HTMLPrinter.addPageProlog(buffer);
    HTMLPrinter.addParagraph(buffer, HTMLPrinter
            .convertToHTMLContent(JavaUIMessages.JavaAnnotationHover_multipleMarkersAtThisLine));

    HTMLPrinter.startBulletList(buffer);
    Iterator<?> e = messages.iterator();
    while (e.hasNext())
        HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent((String) e.next()));
    HTMLPrinter.endBulletList(buffer);

    HTMLPrinter.addPageEpilog(buffer);
    return buffer.toString();
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:17,代码来源:ApexAnnotationHover.java


示例8: endPage

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
public static void endPage(StringBuffer buffer, ITextViewer textViewer) {
	ITheme theme = null;
	if (textViewer != null) {
		TMPresentationReconciler reconciler = getTMPresentationReconciler(textViewer);
		if (reconciler != null) {
			theme = (ITheme) reconciler.getTokenProvider();
		}
		if (theme == null) {
			theme = TMUIPlugin.getThemeManager().getDefaultTheme();
		}
	}
	HTMLPrinter.insertPageProlog(buffer, 0, colorInfoForeground, colorInfoBackround,
			HTMLTypeScriptPrinter.getStyleSheet() + (theme != null ? theme.toCSSStyleSheet() : ""));
	HTMLPrinter.addPageEpilog(buffer);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:16,代码来源:HTMLTypeScriptPrinter.java


示例9: getStyleSheet

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Returns the Javadoc hover style sheet with the current Javadoc font from
 * the preferences.
 * 
 * @return the updated style sheet
 * @since 3.4
 */
private static String getStyleSheet() {
	if (fgStyleSheet == null) {
		fgStyleSheet = loadStyleSheet("/css/TypeScriptHoverStyleSheet.css"); //$NON-NLS-1$
	}
	String css = fgStyleSheet;
	if (css != null) {
		FontData fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT)[0];
		css = HTMLPrinter.convertTopLevelFont(css, fontData);
	}

	return css;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:20,代码来源:HTMLTypeScriptPrinter.java


示例10: loadStyleSheet

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Loads and returns the style sheet associated with either Javadoc hover or
 * the view.
 * 
 * @param styleSheetName
 *            the style sheet name of either the Javadoc hover or the view
 * @return the style sheet, or <code>null</code> if unable to load
 * @since 3.4
 */
private static String loadStyleSheet(String styleSheetName) {
	Bundle bundle = Platform.getBundle(TypeScriptUIPlugin.PLUGIN_ID);
	URL styleSheetURL = bundle.getEntry(styleSheetName);
	if (styleSheetURL == null)
		return null;

	BufferedReader reader = null;
	try {
		reader = new BufferedReader(new InputStreamReader(styleSheetURL.openStream()));
		StringBuffer buffer = new StringBuffer(1500);
		String line = reader.readLine();
		while (line != null) {
			buffer.append(line);
			buffer.append('\n');
			line = reader.readLine();
		}

		FontData fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT)[0];
		return HTMLPrinter.convertTopLevelFont(buffer.toString(), fontData);
	} catch (IOException ex) {
		TypeScriptUIPlugin.log("Error while loading style sheets", ex);
		return ""; //$NON-NLS-1$
	} finally {
		try {
			if (reader != null)
				reader.close();
		} catch (IOException e) {
			// ignore
		}
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:41,代码来源:HTMLTypeScriptPrinter.java


示例11: getHoverInfo

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
protected XtextBrowserInformationControlInput getHoverInfo(EObject element, IRegion hoverRegion,
		XtextBrowserInformationControlInput previous) {
	String html = getHoverInfoAsHtml(element);
	if (html != null) {
		StringBuffer buffer = new StringBuffer(html);
		HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet());
		HTMLPrinter.addPageEpilog(buffer);
		html = buffer.toString();
		XtextBrowserInformationControlInput browserInput = new XtextBrowserInformationControlInput(previous, element, html, labelProvider);
		return browserInput;
	}
	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:14,代码来源:DefaultEObjectHoverProvider.java


示例12: getLabel

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
protected String getLabel (EObject o) {
	String text = getLabelProvider().getText(o);
	if(!isEmpty(text))
		return HTMLPrinter.convertToHTMLContent(text);
	else
		return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:8,代码来源:DefaultEObjectHoverProvider.java


示例13: getStyleSheet

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Returns the Javadoc hover style sheet with the current JSON font from the
 * preferences.
 * 
 * @return the updated style sheet
 */
private static String getStyleSheet() {
	if (fgStyleSheet == null) {
		fgStyleSheet = loadStyleSheet("/JSONHoverStyleSheet.css"); //$NON-NLS-1$
	}
	String css = fgStyleSheet;
	if (css != null) {
		FontData fontData = JFaceResources.getFontRegistry().getFontData(
				JFaceResources.DIALOG_FONT)[0];
		css = HTMLPrinter.convertTopLevelFont(css, fontData);
	}

	return css;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:20,代码来源:HTMLJSONPrinter.java


示例14: loadStyleSheet

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Loads and returns the style sheet associated with either JSON hover or
 * the view.
 * 
 * @param styleSheetName
 *            the style sheet name of either the Javadoc hover or the view
 * @return the style sheet, or <code>null</code> if unable to load
 */
private static String loadStyleSheet(String styleSheetName) {
	Bundle bundle = Platform.getBundle(JSONUIPlugin.PLUGIN_ID);
	URL styleSheetURL = bundle.getEntry(styleSheetName);
	if (styleSheetURL == null)
		return null;

	BufferedReader reader = null;
	try {
		reader = new BufferedReader(new InputStreamReader(
				styleSheetURL.openStream()));
		StringBuffer buffer = new StringBuffer(1500);
		String line = reader.readLine();
		while (line != null) {
			buffer.append(line);
			buffer.append('\n');
			line = reader.readLine();
		}

		FontData fontData = JFaceResources.getFontRegistry().getFontData(
				JFaceResources.DIALOG_FONT)[0];
		return HTMLPrinter.convertTopLevelFont(buffer.toString(), fontData);
	} catch (IOException ex) {
		Logger.logException("Error while loading style sheets", ex);
		return ""; //$NON-NLS-1$
	} finally {
		try {
			if (reader != null)
				reader.close();
		} catch (IOException e) {
			// ignore
		}
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:42,代码来源:HTMLJSONPrinter.java


示例15: getStyleSheet

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Returns the PHP hover style sheet
 */
private String getStyleSheet()
{
	if (styleSheet == null)
	{
		styleSheet = loadStyleSheet(getCSSPath());
	}
	if (styleSheet != null)
	{
		FontData fontData = JFaceResources.getFontRegistry().getFontData("Dialog")[0]; //$NON-NLS-1$
		return HTMLPrinter.convertTopLevelFont(styleSheet, fontData);
	}

	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:18,代码来源:AbstractDocumentationHover.java


示例16: formatSingleMessage

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Hook method to format the given single message.
 * <p>
 * Subclasses can change this to create a different format like HTML.
 * </p>
 * 
 * @param message
 *            the message to format
 * @return the formatted message
 */
protected String formatSingleMessage(String message)
{
	StringBuffer buffer = new StringBuffer();

	HTMLPrinter.addPageProlog(buffer);
	HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(message));
	HTMLPrinter.addPageEpilog(buffer);

	return buffer.toString();
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:CommonAnnotationHover.java


示例17: formatSingleMessage

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
@Override
protected String formatSingleMessage(String message) {
	StringBuffer buffer= new StringBuffer();
	HTMLPrinter.addPageProlog(buffer);
	HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(message));
	HTMLPrinter.addPageEpilog(buffer);
	return buffer.toString();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:HTMLAnnotationHover.java


示例18: formatMultipleMessages

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
@Override
protected String formatMultipleMessages(List messages) {
	StringBuffer buffer= new StringBuffer();
	HTMLPrinter.addPageProlog(buffer);
	HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(JavaUIMessages.JavaAnnotationHover_multipleMarkersAtThisLine));

	HTMLPrinter.startBulletList(buffer);
	Iterator<?> e= messages.iterator();
	while (e.hasNext())
		HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent((String) e.next()));
	HTMLPrinter.endBulletList(buffer);

	HTMLPrinter.addPageEpilog(buffer);
	return buffer.toString();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:HTMLAnnotationHover.java


示例19: getAdditionalProposalInfo

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
	if (getProposalInfo() != null) {
		String info= getProposalInfo().getInfo(monitor);
		if (info != null && info.length() > 0) {
			StringBuffer buffer= new StringBuffer();
			HTMLPrinter.insertPageProlog(buffer, 0, getCSSStyles());

			buffer.append(info);

			IJavaElement element= null;
			try {
				element= getProposalInfo().getJavaElement();
				if (element instanceof IMember) {
					String base= JavaDocLocations.getBaseURL(element, ((IMember) element).isBinary());
					if (base != null) {
						int endHeadIdx= buffer.indexOf("</head>"); //$NON-NLS-1$
						buffer.insert(endHeadIdx, "\n<base href='" + base + "'>\n"); //$NON-NLS-1$ //$NON-NLS-2$
					}
				}
			} catch (JavaModelException e) {
				JavaPlugin.log(e);
			}

			HTMLPrinter.addPageEpilog(buffer);
			info= buffer.toString();

			return new JavadocBrowserInformationControlInput(null, element, info, 0);
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:AbstractJavaCompletionProposal.java


示例20: getCSSStyles

import org.eclipse.jface.internal.text.html.HTMLPrinter; //导入依赖的package包/类
/**
 * Returns the style information for displaying HTML (Javadoc) content.
 *
 * @return the CSS styles
 * @since 3.3
 */
protected String getCSSStyles() {
	if (fgCSSStyles == null) {
		Bundle bundle= Platform.getBundle(JavaPlugin.getPluginId());
		URL url= bundle.getEntry("/JavadocHoverStyleSheet.css"); //$NON-NLS-1$
		if (url != null) {
			BufferedReader reader= null;
			try {
				url= FileLocator.toFileURL(url);
				reader= new BufferedReader(new InputStreamReader(url.openStream()));
				StringBuffer buffer= new StringBuffer(200);
				String line= reader.readLine();
				while (line != null) {
					buffer.append(line);
					buffer.append('\n');
					line= reader.readLine();
				}
				fgCSSStyles= buffer.toString();
			} catch (IOException ex) {
				JavaPlugin.log(ex);
			} finally {
				try {
					if (reader != null)
						reader.close();
				} catch (IOException e) {
				}
			}

		}
	}
	String css= fgCSSStyles;
	if (css != null) {
		FontData fontData= JFaceResources.getFontRegistry().getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0];
		css= HTMLPrinter.convertTopLevelFont(css, fontData);
	}
	return css;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:43,代码来源:AbstractJavaCompletionProposal.java



注:本文中的org.eclipse.jface.internal.text.html.HTMLPrinter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AutoScalingGroup类代码示例发布时间:2022-05-22
下一篇:
Java Emote类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap