blob: 5da2c445be6a6a502e8d3feead26ebe4111f7c86 (
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
|
/*******************************************************************************
* Copyright (c) 2017 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:
* Red Hat Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.internal.changelog.core.editors;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.RuleBasedScanner;
import org.eclipse.jface.text.rules.Token;
public class GNUHyperlinkScanner extends RuleBasedScanner {
public static final String FILE_NAME = "_file_name"; // $NON-NLS-1$
public static final String OTHER = "_other"; // $NON-NLS-1$
/**
* Build a scanner for hyperlink.
*
*/
public GNUHyperlinkScanner() {
IToken file = new Token(FILE_NAME);
IToken other = new Token(OTHER);
IRule[] rules = new IRule[1];
// Add rule for file path
rules[0] = new GNUFileEntryRule(file);
setDefaultReturnToken(other);
setRules(rules);
}
/**
* Get the file offset.
*
* @return the file offset.
*/
public int getOffset() {
return fOffset;
}
/**
* Get the default token.
*
* @return the default token.
*/
public IToken getDefaultToken() {
return fDefaultReturnToken;
}
}
|