]>
Commit | Line | Data |
---|---|---|
1b2798f6 EK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2010, 2011 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 java.util.List; | |
14 | ||
15 | import org.eclipse.jface.text.IRegion; | |
16 | import org.eclipse.jface.text.hyperlink.IHyperlink; | |
17 | ||
18 | import org.eclipse.jdt.core.IJavaElement; | |
19 | import org.eclipse.jdt.core.IMethod; | |
20 | ||
21 | import org.eclipse.jdt.ui.actions.SelectionDispatchAction; | |
22 | ||
23 | import org.eclipse.jdt.internal.ui.actions.SelectionConverter; | |
24 | ||
25 | ||
26 | /** | |
27 | * Java element implementation hyperlink detector for methods. | |
28 | * | |
29 | * @since 3.5 | |
30 | */ | |
31 | public class JavaElementHyperlinkImplementationDetector extends JavaElementHyperlinkDetector { | |
32 | ||
33 | /* | |
34 | * @see org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector#createHyperlink(org.eclipse.jface.text.IRegion, org.eclipse.jdt.ui.actions.SelectionDispatchAction, org.eclipse.jdt.core.IJavaElement, boolean, org.eclipse.ui.texteditor.ITextEditor) | |
35 | * @since 3.5 | |
36 | */ | |
37 | @Override | |
38 | protected void addHyperlinks(List<IHyperlink> hyperlinksCollector, IRegion wordRegion, SelectionDispatchAction openAction, IJavaElement element, boolean qualify, JavaEditor editor) { | |
39 | if (element.getElementType() == IJavaElement.METHOD && SelectionConverter.canOperateOn(editor)) { | |
40 | hyperlinksCollector.add(new JavaElementImplementationHyperlink(wordRegion, openAction, (IMethod)element, qualify, editor)); | |
41 | } | |
42 | } | |
43 | } |