redcar-javamateview 0.1-java
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +34 -0
- data/README +58 -0
- data/Rakefile +94 -0
- data/lib/javamateview.rb +41 -0
- data/lib/javamateview/example.rb +334 -0
- data/lib/javamateview/jar/java-mateview.jar +0 -0
- data/lib/javamateview/jcodings.jar +0 -0
- data/lib/javamateview/jdom.jar +0 -0
- data/lib/javamateview/joni.jar +0 -0
- data/spec/onig/match_spec.rb +50 -0
- data/spec/parsing/dynamic_parsing_spec.rb +172 -0
- data/spec/parsing/static_parsing_spec.rb +476 -0
- data/spec/spec_helper.rb +33 -0
- data/src/com/redcareditor/mate/Bundle.java +81 -0
- data/src/com/redcareditor/mate/DoublePattern.java +89 -0
- data/src/com/redcareditor/mate/Grammar.java +129 -0
- data/src/com/redcareditor/mate/IAnnotationAreaListener.java +7 -0
- data/src/com/redcareditor/mate/IGrammarListener.java +5 -0
- data/src/com/redcareditor/mate/IncludePattern.java +10 -0
- data/src/com/redcareditor/mate/LineNumberRulerColumn.java +922 -0
- data/src/com/redcareditor/mate/Marker.java +22 -0
- data/src/com/redcareditor/mate/MateText.java +697 -0
- data/src/com/redcareditor/mate/ParseThunk.java +71 -0
- data/src/com/redcareditor/mate/Parser.java +627 -0
- data/src/com/redcareditor/mate/ParserScheduler.java +237 -0
- data/src/com/redcareditor/mate/Pattern.java +152 -0
- data/src/com/redcareditor/mate/RangeSet.java +91 -0
- data/src/com/redcareditor/mate/Scanner.java +178 -0
- data/src/com/redcareditor/mate/Scope.java +534 -0
- data/src/com/redcareditor/mate/ScopeMatcher.java +162 -0
- data/src/com/redcareditor/mate/SharedTextColors.java +110 -0
- data/src/com/redcareditor/mate/SinglePattern.java +20 -0
- data/src/com/redcareditor/mate/WhitespaceCharacterPainter.java +395 -0
- data/src/com/redcareditor/mate/colouring/Colourer.java +16 -0
- data/src/com/redcareditor/mate/colouring/swt/MarginPaintListener.java +62 -0
- data/src/com/redcareditor/mate/colouring/swt/SwtColourer.java +501 -0
- data/src/com/redcareditor/mate/document/MateDocument.java +15 -0
- data/src/com/redcareditor/mate/document/MateTextFactory.java +9 -0
- data/src/com/redcareditor/mate/document/MateTextLocation.java +8 -0
- data/src/com/redcareditor/mate/document/MateTextLocationComparator.java +17 -0
- data/src/com/redcareditor/mate/document/MateTextRange.java +18 -0
- data/src/com/redcareditor/mate/document/swt/SwtMateDocument.java +143 -0
- data/src/com/redcareditor/mate/document/swt/SwtMateTextLocation.java +88 -0
- data/src/com/redcareditor/mate/document/swt/SwtMateTextRange.java +92 -0
- data/src/com/redcareditor/mate/document/swt/SwtScopePositionUpdater.java +90 -0
- data/src/com/redcareditor/mate/undo/MateTextUndoManager.java +11 -0
- data/src/com/redcareditor/mate/undo/swt/SwtMateTextUndoManager.java +166 -0
- data/src/com/redcareditor/onig/Match.java +212 -0
- data/src/com/redcareditor/onig/NullMatch.java +57 -0
- data/src/com/redcareditor/onig/NullRx.java +29 -0
- data/src/com/redcareditor/onig/Range.java +45 -0
- data/src/com/redcareditor/onig/Rx.java +167 -0
- data/src/com/redcareditor/plist/Dict.java +119 -0
- data/src/com/redcareditor/plist/PlistNode.java +52 -0
- data/src/com/redcareditor/plist/PlistPropertyLoader.java +44 -0
- data/src/com/redcareditor/theme/ScopeSelector.java +39 -0
- data/src/com/redcareditor/theme/Theme.java +122 -0
- data/src/com/redcareditor/theme/ThemeManager.java +41 -0
- data/src/com/redcareditor/theme/ThemeSetting.java +78 -0
- data/src/com/redcareditor/util/FileUtility.java +64 -0
- data/src/com/redcareditor/util/SingleLineFormatter.java +11 -0
- data/src/com/redcareditor/util/swt/ColourUtil.java +56 -0
- data/src/ruby/java-mateview.rb +68 -0
- data/test/com/redcareditor/mate/BundleTest.java +33 -0
- data/test/com/redcareditor/mate/EmptyRangeSetTest.java +27 -0
- data/test/com/redcareditor/mate/FilledRangeSetTest.java +82 -0
- data/test/com/redcareditor/mate/GrammarTest.java +158 -0
- data/test/com/redcareditor/mate/MateTextTest.java +35 -0
- data/test/com/redcareditor/mate/ScopeMatcherMatchingTest.java +55 -0
- data/test/com/redcareditor/mate/ScopeMatcherRankingTest.java +40 -0
- data/test/com/redcareditor/onig/RxTest.java +54 -0
- data/test/com/redcareditor/plist/DictTest.java +33 -0
- data/test/com/redcareditor/theme/RailsCastThemeTest.java +37 -0
- data/test/com/redcareditor/theme/ScopeSelectorTest.java +38 -0
- data/test/com/redcareditor/theme/ThemeManagerTest.java +29 -0
- data/test/com/redcareditor/util/swt/ColourUtilTest.java +17 -0
- metadata +142 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
package com.redcareditor.plist;
|
2
|
+
|
3
|
+
import static org.junit.Assert.assertArrayEquals;
|
4
|
+
import static org.junit.Assert.assertEquals;
|
5
|
+
import static org.junit.Assert.assertNotNull;
|
6
|
+
|
7
|
+
import org.junit.Before;
|
8
|
+
import org.junit.Test;
|
9
|
+
|
10
|
+
public class DictTest {
|
11
|
+
private Dict dict;
|
12
|
+
|
13
|
+
@Before
|
14
|
+
public void setup() {
|
15
|
+
dict = Dict.parseFile("input/Bundles/Ruby.tmbundle/Syntaxes/Ruby.plist");
|
16
|
+
assertNotNull(dict);
|
17
|
+
}
|
18
|
+
|
19
|
+
@Test
|
20
|
+
public void testSimpleStringItem() {
|
21
|
+
String firstLine = dict.getString("firstLineMatch");
|
22
|
+
assertEquals("^#!/.*\\bruby\\b", firstLine);
|
23
|
+
}
|
24
|
+
|
25
|
+
@Test
|
26
|
+
public void testFileTypes() {
|
27
|
+
String[] check = { "rb", "rbx", "rjs", "Rakefile", "rake", "cgi",
|
28
|
+
"fcgi", "gemspec", "irbrc", "capfile" };
|
29
|
+
String[] types = dict.getStrings("fileTypes");
|
30
|
+
|
31
|
+
assertArrayEquals(check, types);
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
package com.redcareditor.theme;
|
2
|
+
|
3
|
+
import org.junit.Before;
|
4
|
+
import org.junit.Test;
|
5
|
+
import static org.junit.Assert.*;
|
6
|
+
|
7
|
+
import com.redcareditor.plist.Dict;
|
8
|
+
|
9
|
+
|
10
|
+
public class RailsCastThemeTest {
|
11
|
+
private Theme theme;
|
12
|
+
|
13
|
+
@Before
|
14
|
+
public void setup(){
|
15
|
+
Dict themeDict = Dict.parseFile("input/Themes/Railscasts.tmTheme");
|
16
|
+
theme = new Theme(themeDict);
|
17
|
+
}
|
18
|
+
|
19
|
+
@Test
|
20
|
+
public void testGlobalSettings(){
|
21
|
+
String background = theme.globalSettings.get("background");
|
22
|
+
assertEquals("#2B2B2B", background);
|
23
|
+
|
24
|
+
String invisibles = theme.globalSettings.get("invisibles");
|
25
|
+
assertEquals("#404040", invisibles);
|
26
|
+
}
|
27
|
+
|
28
|
+
@Test
|
29
|
+
public void testSingleScopeSetting(){
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
@Test
|
34
|
+
public void testMultipleScopeSetting(){
|
35
|
+
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
package com.redcareditor.theme;
|
2
|
+
|
3
|
+
import java.util.List;
|
4
|
+
|
5
|
+
import org.junit.Test;
|
6
|
+
import static org.junit.Assert.*;
|
7
|
+
|
8
|
+
public class ScopeSelectorTest {
|
9
|
+
@Test
|
10
|
+
public void testSinglePositiveSelector(){
|
11
|
+
String selector = "entity.name.function";
|
12
|
+
List<ScopeSelector> selectors = ScopeSelector.compile(selector);
|
13
|
+
assertEquals(1, selectors.size());
|
14
|
+
|
15
|
+
ScopeSelector s = selectors.get(0);
|
16
|
+
assertEquals("(entity\\.name\\.function)", s.positiveRegex.pattern);
|
17
|
+
}
|
18
|
+
|
19
|
+
@Test
|
20
|
+
public void testMultiplePositiveSelectors(){
|
21
|
+
String selector = "meta.tag, declaration.tag, entity.name.tag, entity.other.attribute-name";
|
22
|
+
List<ScopeSelector> selectors = ScopeSelector.compile(selector);
|
23
|
+
assertEquals(4, selectors.size());
|
24
|
+
|
25
|
+
ScopeSelector s1 = selectors.get(0);
|
26
|
+
assertEquals("(meta\\.tag)", s1.positiveRegex.pattern);
|
27
|
+
|
28
|
+
ScopeSelector s3 = selectors.get(2);
|
29
|
+
assertEquals("(entity\\.name\\.tag)", s3.positiveRegex.pattern);
|
30
|
+
}
|
31
|
+
|
32
|
+
@Test
|
33
|
+
public void testPositiveAndNegativeSelector(){
|
34
|
+
String selector = "source.ruby string - string source";
|
35
|
+
List<ScopeSelector> selectors = ScopeSelector.compile(selector);
|
36
|
+
// TODO: test something here!
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
package com.redcareditor.theme;
|
2
|
+
|
3
|
+
import org.junit.Test;
|
4
|
+
|
5
|
+
import static org.junit.Assert.*;
|
6
|
+
import com.redcareditor.theme.ThemeManager;
|
7
|
+
|
8
|
+
public class ThemeManagerTest {
|
9
|
+
@Test
|
10
|
+
public void shouldLoadThemes() {
|
11
|
+
ThemeManager.loadThemes("input/");
|
12
|
+
assertEquals(3, ThemeManager.themes.size());
|
13
|
+
}
|
14
|
+
|
15
|
+
@Test
|
16
|
+
public void shouldContainTwoRightThemes() {
|
17
|
+
String [] expectedThemeNames = {"Mac Classic", "Railscasts", "Twilight"};
|
18
|
+
for(String theme : expectedThemeNames){
|
19
|
+
boolean found = false;
|
20
|
+
for(Theme t : ThemeManager.themes){
|
21
|
+
if(t.name.equals(theme)){
|
22
|
+
found = true;
|
23
|
+
break;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
assertTrue(String.format("Could not find theme '%s', which sould be loaded by now", theme), found);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
package com.redcareditor.util.swt;
|
2
|
+
|
3
|
+
import static org.junit.Assert.*;
|
4
|
+
|
5
|
+
import org.junit.Test;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* User: Mat Schaffer <mat.schaffer@gmail.com>
|
9
|
+
* Date: Sep 6, 2009
|
10
|
+
* Time: 1:08:54 PM
|
11
|
+
*/
|
12
|
+
public class ColourUtilTest {
|
13
|
+
@Test
|
14
|
+
public void shouldMergeColoursAccordingToTransparencyRules() {
|
15
|
+
assertEquals("#080808", ColourUtil.mergeColour("#000000", "#FFFFFF08"));
|
16
|
+
}
|
17
|
+
}
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redcar-javamateview
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: "0.1"
|
6
|
+
platform: java
|
7
|
+
authors:
|
8
|
+
- Daniel Lucraft
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-06-12 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: swt
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
description: ""
|
28
|
+
email:
|
29
|
+
- dan@fluentradical.com
|
30
|
+
executables: []
|
31
|
+
|
32
|
+
extensions: []
|
33
|
+
|
34
|
+
extra_rdoc_files: []
|
35
|
+
|
36
|
+
files:
|
37
|
+
- lib/javamateview/example.rb
|
38
|
+
- lib/javamateview/jcodings.jar
|
39
|
+
- lib/javamateview/jdom.jar
|
40
|
+
- lib/javamateview/joni.jar
|
41
|
+
- lib/javamateview/jar/java-mateview.jar
|
42
|
+
- LICENSE
|
43
|
+
- README
|
44
|
+
- Rakefile
|
45
|
+
- lib/javamateview.rb
|
46
|
+
- test/com/redcareditor/mate/BundleTest.java
|
47
|
+
- test/com/redcareditor/mate/EmptyRangeSetTest.java
|
48
|
+
- test/com/redcareditor/mate/FilledRangeSetTest.java
|
49
|
+
- test/com/redcareditor/mate/GrammarTest.java
|
50
|
+
- test/com/redcareditor/mate/MateTextTest.java
|
51
|
+
- test/com/redcareditor/mate/ScopeMatcherMatchingTest.java
|
52
|
+
- test/com/redcareditor/mate/ScopeMatcherRankingTest.java
|
53
|
+
- test/com/redcareditor/onig/RxTest.java
|
54
|
+
- test/com/redcareditor/plist/DictTest.java
|
55
|
+
- test/com/redcareditor/theme/RailsCastThemeTest.java
|
56
|
+
- test/com/redcareditor/theme/ScopeSelectorTest.java
|
57
|
+
- test/com/redcareditor/theme/ThemeManagerTest.java
|
58
|
+
- test/com/redcareditor/util/swt/ColourUtilTest.java
|
59
|
+
- spec/spec_helper.rb
|
60
|
+
- spec/onig/match_spec.rb
|
61
|
+
- spec/parsing/dynamic_parsing_spec.rb
|
62
|
+
- spec/parsing/static_parsing_spec.rb
|
63
|
+
- src/com/redcareditor/mate/Bundle.java
|
64
|
+
- src/com/redcareditor/mate/DoublePattern.java
|
65
|
+
- src/com/redcareditor/mate/Grammar.java
|
66
|
+
- src/com/redcareditor/mate/IAnnotationAreaListener.java
|
67
|
+
- src/com/redcareditor/mate/IGrammarListener.java
|
68
|
+
- src/com/redcareditor/mate/IncludePattern.java
|
69
|
+
- src/com/redcareditor/mate/LineNumberRulerColumn.java
|
70
|
+
- src/com/redcareditor/mate/Marker.java
|
71
|
+
- src/com/redcareditor/mate/MateText.java
|
72
|
+
- src/com/redcareditor/mate/Parser.java
|
73
|
+
- src/com/redcareditor/mate/ParserScheduler.java
|
74
|
+
- src/com/redcareditor/mate/ParseThunk.java
|
75
|
+
- src/com/redcareditor/mate/Pattern.java
|
76
|
+
- src/com/redcareditor/mate/RangeSet.java
|
77
|
+
- src/com/redcareditor/mate/Scanner.java
|
78
|
+
- src/com/redcareditor/mate/Scope.java
|
79
|
+
- src/com/redcareditor/mate/ScopeMatcher.java
|
80
|
+
- src/com/redcareditor/mate/SharedTextColors.java
|
81
|
+
- src/com/redcareditor/mate/SinglePattern.java
|
82
|
+
- src/com/redcareditor/mate/WhitespaceCharacterPainter.java
|
83
|
+
- src/com/redcareditor/mate/colouring/Colourer.java
|
84
|
+
- src/com/redcareditor/mate/colouring/swt/MarginPaintListener.java
|
85
|
+
- src/com/redcareditor/mate/colouring/swt/SwtColourer.java
|
86
|
+
- src/com/redcareditor/mate/document/MateDocument.java
|
87
|
+
- src/com/redcareditor/mate/document/MateTextFactory.java
|
88
|
+
- src/com/redcareditor/mate/document/MateTextLocation.java
|
89
|
+
- src/com/redcareditor/mate/document/MateTextLocationComparator.java
|
90
|
+
- src/com/redcareditor/mate/document/MateTextRange.java
|
91
|
+
- src/com/redcareditor/mate/document/swt/SwtMateDocument.java
|
92
|
+
- src/com/redcareditor/mate/document/swt/SwtMateTextLocation.java
|
93
|
+
- src/com/redcareditor/mate/document/swt/SwtMateTextRange.java
|
94
|
+
- src/com/redcareditor/mate/document/swt/SwtScopePositionUpdater.java
|
95
|
+
- src/com/redcareditor/mate/undo/MateTextUndoManager.java
|
96
|
+
- src/com/redcareditor/mate/undo/swt/SwtMateTextUndoManager.java
|
97
|
+
- src/com/redcareditor/onig/Match.java
|
98
|
+
- src/com/redcareditor/onig/NullMatch.java
|
99
|
+
- src/com/redcareditor/onig/NullRx.java
|
100
|
+
- src/com/redcareditor/onig/Range.java
|
101
|
+
- src/com/redcareditor/onig/Rx.java
|
102
|
+
- src/com/redcareditor/plist/Dict.java
|
103
|
+
- src/com/redcareditor/plist/PlistNode.java
|
104
|
+
- src/com/redcareditor/plist/PlistPropertyLoader.java
|
105
|
+
- src/com/redcareditor/theme/ScopeSelector.java
|
106
|
+
- src/com/redcareditor/theme/Theme.java
|
107
|
+
- src/com/redcareditor/theme/ThemeManager.java
|
108
|
+
- src/com/redcareditor/theme/ThemeSetting.java
|
109
|
+
- src/com/redcareditor/util/FileUtility.java
|
110
|
+
- src/com/redcareditor/util/SingleLineFormatter.java
|
111
|
+
- src/com/redcareditor/util/swt/ColourUtil.java
|
112
|
+
- src/ruby/java-mateview.rb
|
113
|
+
has_rdoc: true
|
114
|
+
homepage: http://github.com/danlucraft/redcar-javamateview
|
115
|
+
licenses: []
|
116
|
+
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: "0"
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: "0"
|
134
|
+
requirements: []
|
135
|
+
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 1.5.1
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: A source editing widget for SWT that understands Textmate syntaxes and themes
|
141
|
+
test_files: []
|
142
|
+
|