Mercurial > projects > dwt-addons
comparison dwtx/jface/text/hyperlink/URLHyperlinkDetector.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 |
comparison
equal
deleted
inserted
replaced
139:93a6ec48fd28 | 140:26688fec6d23 |
---|---|
53 * | 53 * |
54 * @since 3.2 | 54 * @since 3.2 |
55 */ | 55 */ |
56 public this() { | 56 public this() { |
57 } | 57 } |
58 | 58 |
59 /** | 59 /** |
60 * Creates a new URL hyperlink detector. | 60 * Creates a new URL hyperlink detector. |
61 * | 61 * |
62 * @param textViewer the text viewer in which to detect the hyperlink | 62 * @param textViewer the text viewer in which to detect the hyperlink |
63 * @deprecated As of 3.2, replaced by {@link URLHyperlinkDetector} | 63 * @deprecated As of 3.2, replaced by {@link URLHyperlinkDetector} |
92 int offsetInLine= offset - lineInfo.getOffset(); | 92 int offsetInLine= offset - lineInfo.getOffset(); |
93 | 93 |
94 bool startDoubleQuote= false; | 94 bool startDoubleQuote= false; |
95 int urlOffsetInLine= 0; | 95 int urlOffsetInLine= 0; |
96 int urlLength= 0; | 96 int urlLength= 0; |
97 | 97 |
98 int urlSeparatorOffset= line.indexOf("://"); //$NON-NLS-1$ | 98 int urlSeparatorOffset= line.indexOf("://"); //$NON-NLS-1$ |
99 while (urlSeparatorOffset >= 0) { | 99 while (urlSeparatorOffset >= 0) { |
100 | 100 |
101 // URL protocol (left to "://") | 101 // URL protocol (left to "://") |
102 urlOffsetInLine= urlSeparatorOffset; | 102 urlOffsetInLine= urlSeparatorOffset; |
116 return null; | 116 return null; |
117 | 117 |
118 urlLength= tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffsetInLine; | 118 urlLength= tokenizer.nextToken().length() + 3 + urlSeparatorOffset - urlOffsetInLine; |
119 if (offsetInLine >= urlOffsetInLine && offsetInLine <= urlOffsetInLine + urlLength) | 119 if (offsetInLine >= urlOffsetInLine && offsetInLine <= urlOffsetInLine + urlLength) |
120 break; | 120 break; |
121 | 121 |
122 urlSeparatorOffset= line.indexOf("://", urlSeparatorOffset + 1); //$NON-NLS-1$ | 122 urlSeparatorOffset= line.indexOf("://", urlSeparatorOffset + 1); //$NON-NLS-1$ |
123 } | 123 } |
124 | 124 |
125 if (urlSeparatorOffset < 0) | 125 if (urlSeparatorOffset < 0) |
126 return null; | 126 return null; |
127 | 127 |
128 if (startDoubleQuote) { | 128 if (startDoubleQuote) { |
129 int endOffset= -1; | 129 int endOffset= -1; |
147 urlString= null; | 147 urlString= null; |
148 return null; | 148 return null; |
149 } | 149 } |
150 | 150 |
151 IRegion urlRegion= new Region(lineInfo.getOffset() + urlOffsetInLine, urlLength); | 151 IRegion urlRegion= new Region(lineInfo.getOffset() + urlOffsetInLine, urlLength); |
152 return new IHyperlink[] {new URLHyperlink(urlRegion, urlString)}; | 152 return [new URLHyperlink(urlRegion, urlString)]; |
153 } | 153 } |
154 | 154 |
155 } | 155 } |