KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > javaeditor > JavaElementHyperlink


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.javaeditor;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.jface.action.IAction;
16
17 import org.eclipse.jface.text.IRegion;
18 import org.eclipse.jface.text.hyperlink.IHyperlink;
19
20
21 /**
22  * Java element hyperlink.
23  *
24  * @since 3.1
25  */

26 public class JavaElementHyperlink implements IHyperlink {
27
28     private final IRegion fRegion;
29     private final IAction fOpenAction;
30
31
32     /**
33      * Creates a new Java element hyperlink.
34      */

35     public JavaElementHyperlink(IRegion region, IAction openAction) {
36         Assert.isNotNull(openAction);
37         Assert.isNotNull(region);
38
39         fRegion= region;
40         fOpenAction= openAction;
41     }
42
43     /*
44      * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#getHyperlinkRegion()
45      * @since 3.1
46      */

47     public IRegion getHyperlinkRegion() {
48         return fRegion;
49     }
50
51     /*
52      * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#open()
53      * @since 3.1
54      */

55     public void open() {
56         fOpenAction.run();
57     }
58
59     /*
60      * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#getTypeLabel()
61      * @since 3.1
62      */

63     public String JavaDoc getTypeLabel() {
64         return null;
65     }
66
67     /*
68      * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#getHyperlinkText()
69      * @since 3.1
70      */

71     public String JavaDoc getHyperlinkText() {
72         return null;
73     }
74 }
75
Popular Tags