~ubuntu-branches/ubuntu/vivid/eclipse-linuxtools/vivid-proposed

« back to all changes in this revision

Viewing changes to changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/GNUElementScanner.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam, Jakub Adam, tony mancill
  • Date: 2014-10-11 11:44:05 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20141011114405-yazjvxfzzhmi5sgj
Tags: 3.1.0-1
[ Jakub Adam ]
* New upstream release (Closes: #761524).
* Refreshed d/patches.
* Don't build removed feature org.eclipse.linuxtools.tools.launch
  - merged into org.eclipse.linuxtools.profiling.
* Use javac target 1.7.
* Build new feature org.eclipse.linuxtools.dataviewers.feature
  - required by Valgrind integration.
* Build-depend on eclipse-remote-services-api and eclipse-cdt-autotools.
* Bump Standards-Version to 3.9.6.
* Override incompatible-java-bytecode-format - linuxtools needs Java 7.
* Remove unused codeless-jar override.

[ tony mancill ]
* Tweak short package description to make lintian happy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
/**
17
17
 * Recognizes GNU format changelog. Can be configured to return different types
18
18
 * of tokens.
19
 
 * 
 
19
 *
20
20
 * @author klee (Kyu Lee)
21
21
 */
22
22
public class GNUElementScanner extends RuleBasedScanner {
23
23
 
24
 
        public static final String FILE_NAME = "_file_name"; // $NON-NLS-1$
 
24
    public static final String FILE_NAME = "_file_name"; // $NON-NLS-1$
25
25
    public static final String TEXT = "_text_content"; // $NON-NLS-1$
26
 
        public static final String EMAIL = "_author_email"; // $NON-NLS-1$
27
 
        public static final String DATE = "_entry_date"; // $NON-NLS-1$
28
 
        public static final String AUTHOR = "_author_name"; // $NON-NLS-1$
29
 
        public static final String FUNC_NAME = "_function_name"; // $NON-NLS-1$
30
 
        public static final String OTHER = "_other"; // $NON-NLS-1$
31
 
        /**
32
 
         * Build a scanner for syntax highlighting.
33
 
         * 
34
 
         * @param manager Color scheme to use.
35
 
         */
36
 
        public GNUElementScanner(ColorManager manager) {
37
 
                IToken file = new Token(new TextAttribute(manager
38
 
                                .getColor(IChangeLogColorConstants.FILE_NAME)));
39
 
 
40
 
                IToken func = new Token(new TextAttribute(manager
41
 
                                .getColor(IChangeLogColorConstants.FUNC_NAME)));
42
 
 
43
 
                IToken email = new Token(new TextAttribute(manager
44
 
                                .getColor(IChangeLogColorConstants.EMAIL)));
45
 
 
46
 
                IToken other = new Token(new TextAttribute(manager
47
 
                                .getColor(IChangeLogColorConstants.TEXT)));
48
 
 
49
 
                IRule[] rules = new IRule[3];
50
 
 
51
 
                // Add rule for file path
52
 
                rules[0] = new GNUFileEntryRule(file);
53
 
 
54
 
                // function
55
 
                rules[1] = new SingleLineRule("(", ")", func); // $NON-NLS-1$ // $NON-NLS-2$
56
 
                // email
57
 
                rules[2] = new SingleLineRule("<", ">\n", email); // $NON-NLS-1$ // $NON-NLS-2$
58
 
                
59
 
                setDefaultReturnToken(other);
60
 
                
61
 
                setRules(rules);
62
 
        }
63
 
 
64
 
        /**
65
 
         * Build a scanner for hyperlink.
66
 
         * 
67
 
         */
68
 
        public GNUElementScanner() {
69
 
                IToken file = new Token(FILE_NAME);
70
 
 
71
 
                IToken func = new Token(FUNC_NAME);
72
 
 
73
 
                IToken email = new Token(EMAIL);
74
 
                
75
 
                IToken other = new Token(OTHER);
76
 
 
77
 
                IRule[] rules = new IRule[3];
78
 
 
79
 
                // Add rule for file path
80
 
                rules[0] = new GNUFileEntryRule(file);
81
 
 
82
 
                // function
83
 
                rules[1] = new SingleLineRule("(", "):", func); // $NON-NLS-1$ // $NON-NLS-2$
84
 
                // email 
85
 
                rules[2]= new SingleLineRule("<", ">", email); // $NON-NLS-1$ // $NON-NLS-2$
86
 
 
87
 
                setDefaultReturnToken(other);
88
 
                
89
 
                setRules(rules);
90
 
        }
91
 
 
92
 
        /**
93
 
         * Get the file offset.
94
 
         * 
95
 
         * @return the file offset.
96
 
         */
97
 
        public int getOffset() {
98
 
                return fOffset;
99
 
        }
100
 
        
101
 
        /**
102
 
         * Get the default token.
103
 
         * 
104
 
         * @return the default token.
105
 
         */
106
 
        public IToken getDefaultToken() {
107
 
                return fDefaultReturnToken;
108
 
        }
 
26
    public static final String EMAIL = "_author_email"; // $NON-NLS-1$
 
27
    public static final String DATE = "_entry_date"; // $NON-NLS-1$
 
28
    public static final String AUTHOR = "_author_name"; // $NON-NLS-1$
 
29
    public static final String FUNC_NAME = "_function_name"; // $NON-NLS-1$
 
30
    public static final String OTHER = "_other"; // $NON-NLS-1$
 
31
    /**
 
32
     * Build a scanner for syntax highlighting.
 
33
     *
 
34
     * @param manager Color scheme to use.
 
35
     */
 
36
    public GNUElementScanner(ColorManager manager) {
 
37
        IToken file = new Token(new TextAttribute(manager
 
38
                .getColor(IChangeLogColorConstants.FILE_NAME)));
 
39
 
 
40
        IToken func = new Token(new TextAttribute(manager
 
41
                .getColor(IChangeLogColorConstants.FUNC_NAME)));
 
42
 
 
43
        IToken email = new Token(new TextAttribute(manager
 
44
                .getColor(IChangeLogColorConstants.EMAIL)));
 
45
 
 
46
        IToken other = new Token(new TextAttribute(manager
 
47
                .getColor(IChangeLogColorConstants.TEXT)));
 
48
 
 
49
        IRule[] rules = new IRule[3];
 
50
 
 
51
        // Add rule for file path
 
52
        rules[0] = new GNUFileEntryRule(file);
 
53
 
 
54
        // function
 
55
        rules[1] = new SingleLineRule("(", ")", func); // $NON-NLS-1$ // $NON-NLS-2$
 
56
        // email
 
57
        rules[2] = new SingleLineRule("<", ">\n", email); // $NON-NLS-1$ // $NON-NLS-2$
 
58
 
 
59
        setDefaultReturnToken(other);
 
60
 
 
61
        setRules(rules);
 
62
    }
 
63
 
 
64
    /**
 
65
     * Build a scanner for hyperlink.
 
66
     *
 
67
     */
 
68
    public GNUElementScanner() {
 
69
        IToken file = new Token(FILE_NAME);
 
70
 
 
71
        IToken func = new Token(FUNC_NAME);
 
72
 
 
73
        IToken email = new Token(EMAIL);
 
74
 
 
75
        IToken other = new Token(OTHER);
 
76
 
 
77
        IRule[] rules = new IRule[3];
 
78
 
 
79
        // Add rule for file path
 
80
        rules[0] = new GNUFileEntryRule(file);
 
81
 
 
82
        // function
 
83
        rules[1] = new SingleLineRule("(", "):", func); // $NON-NLS-1$ // $NON-NLS-2$
 
84
        // email
 
85
        rules[2]= new SingleLineRule("<", ">", email); // $NON-NLS-1$ // $NON-NLS-2$
 
86
 
 
87
        setDefaultReturnToken(other);
 
88
 
 
89
        setRules(rules);
 
90
    }
 
91
 
 
92
    /**
 
93
     * Get the file offset.
 
94
     *
 
95
     * @return the file offset.
 
96
     */
 
97
    public int getOffset() {
 
98
        return fOffset;
 
99
    }
 
100
 
 
101
    /**
 
102
     * Get the default token.
 
103
     *
 
104
     * @return the default token.
 
105
     */
 
106
    public IToken getDefaultToken() {
 
107
        return fDefaultReturnToken;
 
108
    }
109
109
}