[119704] [misc] dangerous uses of "new GC(Display)" (update HTMLTextPresenter)
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTMLTextPresenter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTMLTextPresenter.java
index 86fa284..d56b2d5 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTMLTextPresenter.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTMLTextPresenter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,6 +21,7 @@
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextPresentation;
import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.graphics.Drawable;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Display;
import org.eclipse.wst.sse.ui.internal.Logger;
@@ -30,7 +31,7 @@
* Modifications were made to use own Logger to log exception, and the
* ellipses constant
*/
-public class HTMLTextPresenter implements DefaultInformationControl.IInformationPresenter {
+public class HTMLTextPresenter implements DefaultInformationControl.IInformationPresenter, DefaultInformationControl.IInformationPresenterExtension {
private static final String ELLIPSES = "..."; //$NON-NLS-1$
private static final String LINE_DELIM = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -96,16 +97,26 @@
return (i == length ? line : line.substring(0, i)) + " "; //$NON-NLS-1$
}
- /*
+ /**
* @see IHoverInformationPresenter#updatePresentation(Display display,
* String, TextPresentation, int, int)
+ * @deprecated Use {@link #updatePresentation(Drawable, String, TextPresentation, int, int)}
+ * instead
*/
public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) {
+ return updatePresentation((Drawable)display, hoverInfo, presentation, maxWidth, maxHeight);
+ }
+
+ /*
+ * @see IHoverInformationPresenterExtension#updatePresentation(Drawable drawable, String, TextPresentation, int, int)
+ * @since 3.2
+ */
+ public String updatePresentation(Drawable drawable, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) {
if (hoverInfo == null)
return null;
- GC gc = new GC(display);
+ GC gc = new GC(drawable);
try {
StringBuffer buffer = new StringBuffer();