Mercurial > projects > dwt-addons
annotate dwtx/jface/text/hyperlink/URLHyperlink.d @ 140:26688fec6d23
Following dsss compile errors
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 03:23:46 +0200 |
parents | 7d818bd32d63 |
children | 25f1f92fa3df |
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; |
30 | |
31 import com.ibm.icu.text.MessageFormat; | |
32 | |
33 import dwt.program.Program; | |
34 import dwtx.core.runtime.Assert; | |
35 import dwtx.jface.text.IRegion; | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 /** | |
42 * URL hyperlink. | |
43 * | |
44 * @since 3.1 | |
45 */ | |
46 public class URLHyperlink : IHyperlink { | |
47 | |
48 private String fURLString; | |
49 private IRegion fRegion; | |
50 | |
51 /** | |
52 * Creates a new URL hyperlink. | |
53 * | |
54 * @param region | |
55 * @param urlString | |
56 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
57 public this(IRegion region, String urlString) { |
129 | 58 Assert.isNotNull(urlString); |
59 Assert.isNotNull(region); | |
60 | |
61 fRegion= region; | |
62 fURLString= urlString; | |
63 } | |
64 | |
65 /* | |
66 * @see dwtx.jdt.internal.ui.javaeditor.IHyperlink#getHyperlinkRegion() | |
67 */ | |
68 public IRegion getHyperlinkRegion() { | |
69 return fRegion; | |
70 } | |
71 | |
72 /* | |
73 * @see dwtx.jdt.internal.ui.javaeditor.IHyperlink#open() | |
74 */ | |
75 public void open() { | |
76 if (fURLString !is null) { | |
77 Program.launch(fURLString); | |
78 fURLString= null; | |
79 return; | |
80 } | |
81 } | |
82 | |
83 /* | |
84 * @see dwtx.jdt.internal.ui.javaeditor.IHyperlink#getTypeLabel() | |
85 */ | |
86 public String getTypeLabel() { | |
87 return null; | |
88 } | |
89 | |
90 /* | |
91 * @see dwtx.jdt.internal.ui.javaeditor.IHyperlink#getHyperlinkText() | |
92 */ | |
93 public String getHyperlinkText() { | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
94 return MessageFormat.format(HyperlinkMessages.getString("URLHyperlink.hyperlinkText"), fURLString ); //$NON-NLS-1$ |
129 | 95 } |
96 | |
97 /** | |
98 * Returns the URL string of this hyperlink. | |
140
26688fec6d23
Following dsss compile errors
Frank Benoit <benoit@tionex.de>
parents:
133
diff
changeset
|
99 * |
129 | 100 * @return the URL string |
101 * @since 3.2 | |
102 */ | |
103 public String getURLString() { | |
104 return fURLString; | |
105 } | |
106 | |
107 } |