本文整理汇总了Java中org.eclipse.jface.internal.text.html.HTMLPrinter类的典型用法代码示例。如果您正苦于以下问题:Java HTMLPrinter类的具体用法?Java HTMLPrinter怎么用?Java HTMLPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTMLPrinter类属于org.eclipse.jface.internal.text.html包,在下文中一共展示了HTMLPrinter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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$
}
}
示例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();
}
示例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());
}
示例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();
}
示例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$
}
}
示例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();
}
示例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);
}
示例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;
}
示例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
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
}
}
示例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;
}