blob: bef048ef415a2d52f326e2abc5763d01a59d1043 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.emf.emfatic.ui.partition;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.text.source.DefaultAnnotationHover;
/**
* Determines all markers for the given line and collects, concatenates, and
* formats returns their messages in HTML.
*
* @since 3.2
*/
public class HTMLAnnotationHover extends DefaultAnnotationHover {
/*
* Formats a message as HTML text.
*/
protected String formatSingleMessage(String message) {
StringBuffer buffer = new StringBuffer();
HTMLPrinter.addPageProlog(buffer);
HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(message));
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
/*
* Formats several message as HTML text.
*/
protected String formatMultipleMessages(List messages) {
StringBuffer buffer = new StringBuffer();
HTMLPrinter.addPageProlog(buffer);
HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent("Multiple markers at this line"));
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();
}
}