Mercurial > projects > dwt-addons
annotate dwtx/jface/text/hyperlink/URLHyperlink.d @ 158:25f1f92fa3df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 26 Aug 2008 02:46:34 +0200 |
parents | 26688fec6d23 |
children | 1a5b8f8129df |
rev | line source |
---|---|
129 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2008 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.jface.text.hyperlink.URLHyperlink; | |
14 | |
131 | 15 import dwtx.jface.text.hyperlink.IHyperlinkPresenterExtension; // packageimport |
16 import dwtx.jface.text.hyperlink.MultipleHyperlinkPresenter; // packageimport | |
17 import dwtx.jface.text.hyperlink.HyperlinkManager; // packageimport | |
18 import dwtx.jface.text.hyperlink.IHyperlinkDetectorExtension2; // packageimport | |
19 import dwtx.jface.text.hyperlink.IHyperlinkDetector; // packageimport | |
20 import dwtx.jface.text.hyperlink.IHyperlinkPresenter; // packageimport | |
21 import dwtx.jface.text.hyperlink.URLHyperlinkDetector; // packageimport | |
22 import dwtx.jface.text.hyperlink.DefaultHyperlinkPresenter; // packageimport | |
23 import dwtx.jface.text.hyperlink.AbstractHyperlinkDetector; // packageimport | |
24 import dwtx.jface.text.hyperlink.IHyperlinkDetectorExtension; // packageimport | |
25 import dwtx.jface.text.hyperlink.HyperlinkMessages; // packageimport | |
26 import dwtx.jface.text.hyperlink.IHyperlink; // packageimport | |
27 | |
28 | |
129 | 29 import dwt.dwthelper.utils; |
158 | 30 import dwtx.dwtxhelper.MessageFormat; |
129 | 31 |
32 import dwt.program.Program; | |
33 import dwtx.core.runtime.Assert; | |
34 import dwtx.jface.text.IRegion; | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 /** | |
41 * URL hyperlink. | |
42 * | |
43 * @since 3.1 | |
44 */ | |
45 public class URLHyperlink : IHyperlink { | |
46 | |
47 private String fURLString; | |
48 private IRegion fRegion; | |
49 | |
50 /** | |
51 * Creates a new URL hyperlink. | |
52 * | |
53 * @param region | |
54 * @param urlString | |
55 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
56 public this(IRegion region, String urlString) { |
129 | 57 Assert.isNotNull(urlString); |
58 Assert.isNotNull(region); | |
59 | |
60 fRegion= region; | |
61 fURLString= urlString; | |
62 } | |
63 | |
64 /* | |
65 * @see dwtx.jdt.internal.ui.javaeditor.IHyperlink#getHyperlinkRegion() | |
66 */ | |
67 public IRegion getHyperlinkRegion() { | |
68 return fRegion; | |
69 } | |
70 | |
71 /* | |
72 * @see dwtx.jdt.internal.ui.javaeditor.IHyperlink#open() | |
73 */ | |
74 public void open() { | |
75 if (fURLString !is null) { | |
76 Program.launch(fURLString); | |
77 fURLString= null; | |
78 return; | |
79 } | |
80 } | |
81 | |
82 /* | |
83 * @see dwtx.jdt.internal.ui.javaeditor.IHyperlink#getTypeLabel() | |
84 */ | |
85 public String getTypeLabel() { | |
86 return null; | |
87 } | |
88 | |
89 /* | |
90 * @see dwtx.jdt.internal.ui.javaeditor.IHyperlink#getHyperlinkText() | |
91 */ | |
92 public String getHyperlinkText() { | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
93 return MessageFormat.format(HyperlinkMessages.getString("URLHyperlink.hyperlinkText"), fURLString ); //$NON-NLS-1$ |
129 | 94 } |
95 | |
96 /** | |
97 * Returns the URL string of this hyperlink. | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
98 * |
129 | 99 * @return the URL string |
100 * @since 3.2 | |
101 */ | |
102 public String getURLString() { | |
103 return fURLString; | |
104 } | |
105 | |
106 } |