blob: 388fdc926f69aae90f26eb1109b4db45932461db (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*******************************************************************************
* Copyright (c) 2006 Red Hat Inc. and others.
* All rights reserved. This program and the accompanying materials
* are 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:
* Kyu Lee <klee@redhat.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.internal.changelog.core.editors;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
/**
* Hyperlink that opens up editor for a file.
*
* @author klee (Kyu Lee)
*
*/
public class FileHyperlink implements IHyperlink {
private IFile fileLoc;
private IRegion region;
public FileHyperlink(IRegion regionIn, IFile fileIn) {
fileLoc = fileIn;
region = regionIn;
}
public IRegion getHyperlinkRegion() {
return region;
}
public String getTypeLabel() {
// TODO Auto-generated method stub
return null;
}
public String getHyperlinkText() {
// TODO Auto-generated method stub
return null;
}
/**
* Opens the hyperlink in new editor window.
*/
public void open() {
IWorkbench ws = PlatformUI.getWorkbench();
try {
org.eclipse.ui.ide.IDE.openEditor(ws.getActiveWorkbenchWindow()
.getActivePage(), fileLoc, true);
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
|