KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > text > java > hover > JavaTypeHover


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.internal.ui.text.java.hover;
12
13 import org.eclipse.jface.text.IRegion;
14 import org.eclipse.jface.text.ITextViewer;
15
16 import org.eclipse.ui.IEditorPart;
17
18 import org.eclipse.jdt.ui.text.java.hover.IJavaEditorTextHover;
19
20
21 public class JavaTypeHover implements IJavaEditorTextHover {
22
23     private IJavaEditorTextHover fProblemHover;
24     private IJavaEditorTextHover fJavadocHover;
25
26     public JavaTypeHover() {
27         fProblemHover= new ProblemHover();
28         fJavadocHover= new JavadocHover();
29     }
30
31     /*
32      * @see IJavaEditorTextHover#setEditor(IEditorPart)
33      */

34     public void setEditor(IEditorPart editor) {
35         fProblemHover.setEditor(editor);
36         fJavadocHover.setEditor(editor);
37     }
38
39     /*
40      * @see ITextHover#getHoverRegion(ITextViewer, int)
41      */

42     public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
43         return fJavadocHover.getHoverRegion(textViewer, offset);
44     }
45
46     /*
47      * @see ITextHover#getHoverInfo(ITextViewer, IRegion)
48      */

49     public String JavaDoc getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
50         String JavaDoc hoverInfo= fProblemHover.getHoverInfo(textViewer, hoverRegion);
51         if (hoverInfo != null)
52             return hoverInfo;
53
54         return fJavadocHover.getHoverInfo(textViewer, hoverRegion);
55     }
56 }
57
Popular Tags