Author: vrubezhny
Date: 2011-08-08 15:30:21 -0400 (Mon, 08 Aug 2011)
New Revision: 33688
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.java
Removed:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHooverMessages.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
Log:
JBIDE-9448
EL tooltip doesn't work
Issue is fixed.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2011-08-08
19:30:03 UTC (rev 33687)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2011-08-08
19:30:21 UTC (rev 33688)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2007-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at
http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.jsp;
@@ -21,7 +21,6 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.IInformationControl;
@@ -35,23 +34,19 @@
import org.eclipse.jface.text.quickassist.IQuickAssistAssistant;
import org.eclipse.jface.text.quickassist.QuickAssistAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
import
org.eclipse.wst.html.ui.internal.contentassist.HTMLStructuredContentAssistProcessor;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.correction.CompoundQuickAssistProcessor;
import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
-import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
@@ -195,15 +190,29 @@
partitionType);
ITextHover[] hovers = (ITextHover[]) extendedTextHover
.toArray(new ITextHover[extendedTextHover.size()]);
- return hovers;
+
+ ITextHover chainTextHover = new ChainTextHover(hovers);
+
+ return new ITextHover[] {chainTextHover};
}
@Override
protected IInformationProvider getInformationProvider(
ISourceViewer sourceViewer, String partitionType) {
-
- ITextHover chainTextHover = new ChainTextHover(
- createDocumentationHovers(partitionType));
+ ITextHover chainTextHover = null;
+ ITextHover[] hovers = createDocumentationHovers(partitionType);
+ if (hovers == null) {
+ hovers = new ITextHover[] {new ChainTextHover(
+ new ITextHover[0])};
+ }
+
+ if (hovers.length == 1) {
+ chainTextHover = hovers[0];
+ } else {
+ chainTextHover = new ChainTextHover(
+ hovers);
+ }
+
return new TextHoverInformationProvider(chainTextHover);
}
@@ -224,15 +233,16 @@
&& computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
String hoverType = hoverDescs[i].getId();
if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
- textHover = new ProblemAnnotationHoverProcessor();
+// textHover = new ProblemAnnotationHoverProcessor();
+ textHover = new MarkerProblemAnnotationHoverProcessor();
else if (TextHoverManager.ANNOTATION_HOVER
.equalsIgnoreCase(hoverType))
textHover = new AnnotationHoverProcessor();
else if (TextHoverManager.COMBINATION_HOVER
- .equalsIgnoreCase(hoverType))
- return new MarkerProblemAnnotationHoverProcessor();
- else if (TextHoverManager.DOCUMENTATION_HOVER
.equalsIgnoreCase(hoverType)) {
+ textHover = new ChainTextHover(createDocumentationHovers(contentType));
+ } else if (TextHoverManager.DOCUMENTATION_HOVER
+ .equalsIgnoreCase(hoverType)) {
ITextHover[] hovers = createDocumentationHovers(contentType);
if (hovers.length > 0) {
textHover = hovers[0];
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2011-08-08
19:30:03 UTC (rev 33687)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2011-08-08
19:30:21 UTC (rev 33688)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2007-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at
http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.jsp;
@@ -22,6 +22,7 @@
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.information.IInformationProvider;
import org.eclipse.jface.text.quickassist.IQuickAssistAssistant;
import org.eclipse.jface.text.quickassist.QuickAssistAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -32,18 +33,20 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
+import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
import org.jboss.tools.common.text.xml.JBDSQuickAssistProcessor;
import org.jboss.tools.common.text.xml.contentassist.ProposalSorter;
import org.jboss.tools.common.text.xml.xpl.MarkerProblemAnnotationHoverProcessor;
+import org.jboss.tools.jst.jsp.jspeditor.info.ChainTextHover;
/**
* @author Igels
@@ -175,22 +178,89 @@
return new IContentAssistProcessor[0];
}
+ /**
+ * Create documentation hovers based on hovers contributed via
+ * <code>org.eclipse.wst.sse.ui.editorConfiguration</code> extension point
+ *
+ * Copied from
+ * {@link org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration} because
+ * of private modifier
+ *
+ * @param partitionType
+ * @return
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private ITextHover[] createDocumentationHovers(String partitionType) {
+ List extendedTextHover = ExtendedConfigurationBuilder.getInstance()
+ .getConfigurations(
+ ExtendedConfigurationBuilder.DOCUMENTATIONTEXTHOVER,
+ partitionType);
+ ITextHover[] hovers = (ITextHover[]) extendedTextHover
+ .toArray(new ITextHover[extendedTextHover.size()]);
+
+ ITextHover chainTextHover = new ChainTextHover(hovers);
+
+ return new ITextHover[] {chainTextHover};
+ }
+
@Override
- public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int
stateMask) {
- TextHoverManager.TextHoverDescriptor[] hoverDescs =
SSEUIPlugin.getDefault().getTextHoverManager().getTextHovers();
+ protected IInformationProvider getInformationProvider(
+ ISourceViewer sourceViewer, String partitionType) {
+ ITextHover chainTextHover = null;
+ ITextHover[] hovers = createDocumentationHovers(partitionType);
+ if (hovers == null) {
+ hovers = new ITextHover[] {new ChainTextHover(
+ new ITextHover[0])};
+ }
+
+ if (hovers.length == 1) {
+ chainTextHover = hovers[0];
+ } else {
+ chainTextHover = new ChainTextHover(
+ hovers);
+ }
+
+ return new TextHoverInformationProvider(chainTextHover);
+ }
+
+ @Override
+ public ITextHover getTextHover(ISourceViewer sourceViewer,
+ String contentType, int stateMask) {
+ ITextHover textHover = null;
+
+ /*
+ * Returns a default problem, annotation, and best match hover depending
+ * on stateMask
+ */
+ TextHoverManager.TextHoverDescriptor[] hoverDescs = SSEUIPlugin
+ .getDefault().getTextHoverManager().getTextHovers();
int i = 0;
- while (i < hoverDescs.length) {
- if (hoverDescs[i].isEnabled() &&
computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
+ while (i < hoverDescs.length && textHover == null) {
+ if (hoverDescs[i].isEnabled()
+ && computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
String hoverType = hoverDescs[i].getId();
- if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType)){
- return new MarkerProblemAnnotationHoverProcessor();
+ if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
+// textHover = new ProblemAnnotationHoverProcessor();
+ textHover = new MarkerProblemAnnotationHoverProcessor();
+ else if (TextHoverManager.ANNOTATION_HOVER
+ .equalsIgnoreCase(hoverType))
+ textHover = new AnnotationHoverProcessor();
+ else if (TextHoverManager.COMBINATION_HOVER
+ .equalsIgnoreCase(hoverType)) {
+ textHover = new ChainTextHover(createDocumentationHovers(contentType));
+ } else if (TextHoverManager.DOCUMENTATION_HOVER
+ .equalsIgnoreCase(hoverType)) {
+ ITextHover[] hovers = createDocumentationHovers(contentType);
+ if (hovers.length > 0) {
+ textHover = hovers[0];
+ }
}
}
i++;
}
-
- return super.getTextHover(sourceViewer, contentType, stateMask);
+ return textHover;
}
+
private IQuickAssistAssistant fQuickAssistant = null;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java 2011-08-08
19:30:03 UTC (rev 33687)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java 2011-08-08
19:30:21 UTC (rev 33688)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2009-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -23,7 +23,7 @@
import org.eclipse.wst.sse.ui.internal.Logger;
import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.DebugInfoHoverProcessor;
-import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
+import org.jboss.tools.common.text.xml.xpl.MarkerProblemAnnotationHoverProcessor;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
@@ -39,7 +39,7 @@
*
*/
@SuppressWarnings("restriction")
-public class ChainTextHover implements ITextHover, ITextHoverExtension {
+public class ChainTextHover implements ITextHover, ITextHoverExtension,
ITextHoverExtension2 {
private ITextHover fBestMatchHover; // current best match text hover
private ITextHover[] fTagInfoHovers; // documentation/information hover
private List<ITextHover> fTextHovers; // list of text hovers to consider in best
@@ -67,7 +67,8 @@
hoverList.add(new DebugInfoHoverProcessor());
}
- hoverList.add(new ProblemAnnotationHoverProcessor());
+// hoverList.add(new ProblemAnnotationHoverProcessor());
+ hoverList.add(new MarkerProblemAnnotationHoverProcessor());
if (fTagInfoHovers != null) {
for (int i = 0; i < fTagInfoHovers.length; i++) {
@@ -108,7 +109,7 @@
try {
displayInfo = fBestMatchHover.getHoverInfo(viewer, hoverRegion);
} catch (Exception e) {
- JspEditorPlugin.getPluginLog().logError(ELInfoHooverMessages.ELInfoHoover_error_gettingInfo,
e);
+ JspEditorPlugin.getPluginLog().logError(ELInfoHoverMessages.ELInfoHoover_error_gettingInfo,
e);
}
}
// either had no best match hover or best match hover returned null
@@ -127,13 +128,51 @@
displayInfo = hover.getHoverInfo(viewer, hoverRegion);
}
} catch (Exception e) {
- JspEditorPlugin.getPluginLog().logError(ELInfoHooverMessages.ELInfoHoover_error_gettingInfo,
e);
+ JspEditorPlugin.getPluginLog().logError(ELInfoHoverMessages.ELInfoHoover_error_gettingInfo,
e);
}
}
}
return displayInfo;
}
+
+
+ @Override
+ public Object getHoverInfo2(ITextViewer viewer, IRegion hoverRegion) {
+ Object objectInfo = null;
+
+ // already have a best match hover picked out from getHoverRegion call
+ if (fBestMatchHover != null) {
+ try {
+ if (fBestMatchHover instanceof ITextHoverExtension2) {
+ objectInfo = ((ITextHoverExtension2) fBestMatchHover).getHoverInfo2(viewer,
hoverRegion);
+ } else {
+ objectInfo = fBestMatchHover.getHoverInfo(viewer, hoverRegion);
+ }
+ } catch (Exception e) {
+ JspEditorPlugin.getPluginLog().logError(ELInfoHoverMessages.ELInfoHoover_error_gettingInfo,
e);
+ }
+ }
+ // either had no best match hover or best match hover returned null
+ if (objectInfo == null) {
+ // go through the list of text hovers and return first display string
+ Iterator<ITextHover> i = getTextHovers().iterator();
+ while ((i.hasNext()) && (objectInfo == null)) {
+ ITextHover hover = (ITextHover) i.next();
+ try {
+ if(hover instanceof ITextHoverExtension2) {
+ objectInfo = ((ITextHoverExtension2)hover).getHoverInfo2(viewer, hoverRegion);
+ } else {
+ objectInfo = hover.getHoverInfo(viewer, hoverRegion);
+ }
+ } catch (Exception e) {
+ JspEditorPlugin.getPluginLog().logError(ELInfoHoverMessages.ELInfoHoover_error_gettingInfo,
e);
+ }
+ }
+ }
+ return objectInfo;
+ }
+
/*
* (non-Javadoc)
*
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHooverMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHooverMessages.java 2011-08-08
19:30:03 UTC (rev 33687)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHooverMessages.java 2011-08-08
19:30:21 UTC (rev 33688)
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.jspeditor.info;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ELInfoHooverMessages extends NLS {
-
- private static final String BUNDLE_NAME= ELInfoHooverMessages.class.getName();
-
- private ELInfoHooverMessages() {
- // Do not instantiate
- }
-
- public static String ELInfoHover_noAttachments; //
- public static String ELInfoHover_noAttachedJavadoc; //
- public static String ELInfoHover_noAttachedJavaSource; //
- public static String ELInfoHover_noInformation; //
- public static String ELInfoHover_error_gettingJavadoc; //
- public static String ELInfoHoover_error_gettingInfo; //
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, ELInfoHooverMessages.class);
- }
-}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.java
(from rev 33604,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHooverMessages.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.java 2011-08-08
19:30:21 UTC (rev 33688)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.jspeditor.info;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ELInfoHoverMessages extends NLS {
+
+ private static final String BUNDLE_NAME= ELInfoHoverMessages.class.getName();
+
+ private ELInfoHoverMessages() {
+ // Do not instantiate
+ }
+
+ public static String ELInfoHover_noAttachments; //
+ public static String ELInfoHover_noAttachedJavadoc; //
+ public static String ELInfoHover_noAttachedJavaSource; //
+ public static String ELInfoHover_noInformation; //
+ public static String ELInfoHover_error_gettingJavadoc; //
+ public static String ELInfoHoover_error_gettingInfo; //
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, ELInfoHoverMessages.class);
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java 2011-08-08
19:30:03 UTC (rev 33687)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java 2011-08-08
19:30:21 UTC (rev 33688)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -10,6 +10,9 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor.info;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
import java.util.List;
import java.util.Map;
@@ -18,10 +21,15 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
@@ -29,6 +37,8 @@
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.sse.ui.internal.derived.HTML2TextReader;
+import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor;
@@ -44,13 +54,13 @@
import org.jboss.tools.common.el.core.resolver.ELSegment;
import org.jboss.tools.common.el.core.resolver.JavaMemberELSegmentImpl;
import org.jboss.tools.common.text.TextProposal;
+import
org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor.TextRegion;
import org.jboss.tools.jst.jsp.contentassist.Utils;
-import
org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor.TextRegion;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
-import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
import org.w3c.dom.Node;
@@ -389,4 +399,41 @@
return ie;
}
+
+ private static final String EMPTY_STRING= ""; //$NON-NLS-1$
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator()
+ */
+ public IInformationControlCreator getHoverControlCreator() {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent, new HTMLTextPresenter(true) {
+
+ @Override
+ protected Reader createReader(String hoverInfo,
+ TextPresentation presentation) {
+ return new HTML2TextReader(new StringReader(hoverInfo), presentation) {
+ /*
+ * @see
org.eclipse.jdt.internal.ui.text.SubstitutionTextReader#computeSubstitution(int)
+ */
+ protected String computeSubstitution(int c) throws IOException {
+ String substitution = super.computeSubstitution(c);
+ if (substitution != null && substitution.length() > 0) {
+ // This cuts off all The tags from the text
+ if (substitution.startsWith("<") &&
substitution.endsWith(">")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return EMPTY_STRING;
+ }
+ }
+ return substitution;
+ }
+ };
+ }
+ });
+ }
+ };
+ }
+
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java 2011-08-08
19:30:03 UTC (rev 33687)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java 2011-08-08
19:30:21 UTC (rev 33688)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -327,7 +327,7 @@
if (useFullHTML) {
HTMLPrinter.addBullet(buffer, getInfoText(elements[i], false, useFullHTML));
} else {
- buffer.append('�').append(' ').append(getInfoText(elements[i],
false, useFullHTML));
+ buffer.append('\u002d').append(' ').append(getInfoText(elements[i],
false, useFullHTML));
}
hasContents= true;
}
@@ -408,20 +408,20 @@
boolean hasSource= openable.getBuffer() != null;
if (!hasAttachedSource && !hasAttachedJavadoc)
- reader= new StringReader(ELInfoHooverMessages.ELInfoHover_noAttachments);
+ reader= new StringReader(ELInfoHoverMessages.ELInfoHover_noAttachments);
else if (!hasAttachedJavadoc && !hasSource)
- reader= new StringReader(ELInfoHooverMessages.ELInfoHover_noAttachedJavadoc);
+ reader= new StringReader(ELInfoHoverMessages.ELInfoHover_noAttachedJavadoc);
else if (!hasAttachedSource)
- reader= new StringReader(ELInfoHooverMessages.ELInfoHover_noAttachedJavaSource);
+ reader= new StringReader(ELInfoHoverMessages.ELInfoHover_noAttachedJavaSource);
else if (!hasSource)
- reader= new StringReader(ELInfoHooverMessages.ELInfoHover_noInformation);
+ reader= new StringReader(ELInfoHoverMessages.ELInfoHover_noInformation);
} else {
base= JavaDocLocations.getBaseURL(member);
}
} catch (JavaModelException ex) {
- reader= new StringReader(ELInfoHooverMessages.ELInfoHover_error_gettingJavadoc);
+ reader= new StringReader(ELInfoHoverMessages.ELInfoHover_error_gettingJavadoc);
JavaPlugin.log(ex);
}