Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 163769 | Differences between
and this patch

Collapse All | Expand All

(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 2-8 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.jface.text
4
Bundle-SymbolicName: org.eclipse.jface.text
5
Bundle-Version: 3.5.100.qualifier
5
Bundle-Version: 3.6.100.qualifier
6
Bundle-Vendor: %providerName
6
Bundle-Vendor: %providerName
7
Bundle-Localization: plugin
7
Bundle-Localization: plugin
8
Export-Package: 
8
Export-Package: 
(-)src/org/eclipse/jface/text/source/DefaultAnnotationHover.java (-1 / +13 lines)
Lines 26-32 Link Here
26
 *
26
 *
27
 * @since 3.2
27
 * @since 3.2
28
 */
28
 */
29
public class DefaultAnnotationHover implements IAnnotationHover {
29
public class DefaultAnnotationHover implements IAnnotationHover, IAnnotationHoverExtension3 {
30
30
31
31
32
	/**
32
	/**
Lines 90-96 Link Here
90
					return formatMultipleMessages(messages);
90
					return formatMultipleMessages(messages);
91
			}
91
			}
92
		}
92
		}
93
		
94
		return getHoverInfo(lineNumber);
93
95
96
	}
97
98
	/* (non-Javadoc)
99
	 * @see org.eclipse.jface.text.source.IAnnotationHoverExtension3#getHoverInfo(int)
100
	 */
101
	/**
102
	 * @since 3.6
103
	 */
104
	public String getHoverInfo(int lineNumber) {
94
		if (fShowLineNumber && lineNumber > -1)
105
		if (fShowLineNumber && lineNumber > -1)
95
			return JFaceTextMessages.getFormattedString("DefaultAnnotationHover.lineNumber", new String[] { Integer.toString(lineNumber + 1) }); //$NON-NLS-1$
106
			return JFaceTextMessages.getFormattedString("DefaultAnnotationHover.lineNumber", new String[] { Integer.toString(lineNumber + 1) }); //$NON-NLS-1$
96
107
Lines 232-235 Link Here
232
243
233
		return javaAnnotations;
244
		return javaAnnotations;
234
	}
245
	}
246
235
}
247
}
(-)src/org/eclipse/jface/text/source/IAnnotationHoverExtension3.java (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jface.text.source;
12
13
/**
14
 * Extension interface for {@link org.eclipse.jface.text.source.IAnnotationHover} for
15
 * <ul>
16
 * <li>providing the hover information of a line without any annotations</li>
17
 * </ul>
18
 * 
19
 * @since 3.6
20
 * @author Prakash G.R.
21
 * 
22
 */
23
public interface IAnnotationHoverExtension3 {
24
	
25
	/**
26
	 * Returns the text which should be presented in the a
27
	 * hover popup window. This information is requested based on
28
	 * the specified line number. The implementation should ignore any 
29
	 * annotations in the line
30
	 *
31
	 * @param lineNumber the line number for which information is requested
32
	 * @return the requested information or <code>null</code> if no such information exists
33
	 * @since 3.6
34
	 */
35
	String getHoverInfo(int lineNumber);
36
37
38
}
(-)src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java (-2 / +31 lines)
Lines 51-57 Link Here
51
	 */
51
	 */
52
	protected void computeInformation() {
52
	protected void computeInformation() {
53
		Point location= getHoverEventLocation();
53
		Point location= getHoverEventLocation();
54
		int line= getVerticalRulerInfo().toDocumentLineNumber(location.y);
54
		IVerticalRulerInfo verticalRulerInfo= getVerticalRulerInfo();
55
		int line= verticalRulerInfo.toDocumentLineNumber(location.y);
55
		IAnnotationHover hover= getAnnotationHover();
56
		IAnnotationHover hover= getAnnotationHover();
56
57
57
		IInformationControlCreator controlCreator= null;
58
		IInformationControlCreator controlCreator= null;
Lines 59-65 Link Here
59
			controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator();
60
			controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator();
60
		setCustomInformationControlCreator(controlCreator);
61
		setCustomInformationControlCreator(controlCreator);
61
62
62
		setInformation(hover.getHoverInfo(getSourceViewer(), line), computeArea(location.y));
63
		String hoverInfo;
64
		if(hover instanceof IAnnotationHoverExtension3 && hasAnnotation(verticalRulerInfo, location.y)) {
65
			hoverInfo= ((IAnnotationHoverExtension3)hover).getHoverInfo(line);
66
		}else {
67
			hoverInfo= hover.getHoverInfo(getSourceViewer(), line);
68
		}
69
		
70
		setInformation(hoverInfo, computeArea(location.y));
71
	}
72
73
	/**
74
	 *  This method calculates whether an annotation is shown in the particular y coordinate.
75
	 *  
76
	 * @param verticalRulerInfo	The vertical ruler in which annotions are searched for
77
	 * @param y_coordinate The coordinate in the ruler's SWT control
78
	 * 
79
	 * @return <code>true</code> if an annotation exists, <code>false</code> otherwise 
80
	 */
81
	private boolean hasAnnotation(IVerticalRulerInfo verticalRulerInfo, int y_coordinate) {
82
		
83
		if(verticalRulerInfo instanceof IOverviewRuler) {
84
			IOverviewRuler overviewRuler = (IOverviewRuler)verticalRulerInfo;
85
			int height= overviewRuler.getAnnotationHeight();
86
			for (int i= y_coordinate-height; i <y_coordinate+height; i++) {
87
				if(overviewRuler.hasAnnotation(i))
88
					return true;
89
			}
90
		}
91
		return false;
63
	}
92
	}
64
93
65
	/**
94
	/**

Return to bug 163769