concrete 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/CHANGELOG +32 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +87 -0
  4. data/concrete/basic_inline_editor.js +73 -0
  5. data/concrete/clipboard.js +72 -0
  6. data/concrete/concrete.js +58 -0
  7. data/concrete/constraint_checker.js +297 -0
  8. data/concrete/editor.js +964 -0
  9. data/concrete/element_extension.js +68 -0
  10. data/concrete/external_identifier_provider.js +112 -0
  11. data/concrete/helper.js +63 -0
  12. data/concrete/identifier_provider.js +168 -0
  13. data/concrete/inline_editor.js +55 -0
  14. data/concrete/metamodel_provider.js +171 -0
  15. data/concrete/model_interface.js +429 -0
  16. data/concrete/scroller.js +106 -0
  17. data/concrete/selector.js +302 -0
  18. data/concrete/template_provider.js +141 -0
  19. data/concrete/ui/abstract_dialog.js +80 -0
  20. data/concrete/ui/concrete_ui.js +28 -0
  21. data/concrete/ui/create_module_dialog.js +55 -0
  22. data/concrete/ui/images/close.png +0 -0
  23. data/concrete/ui/images/document-new.png +0 -0
  24. data/concrete/ui/images/document-save.png +0 -0
  25. data/concrete/ui/images/edit-find-replace.png +0 -0
  26. data/concrete/ui/images/emblem-symbolic-link.png +0 -0
  27. data/concrete/ui/images/help-browser.png +0 -0
  28. data/concrete/ui/images/minus_11px.png +0 -0
  29. data/concrete/ui/images/plus_11px.png +0 -0
  30. data/concrete/ui/images/preferences-system.png +0 -0
  31. data/concrete/ui/images/process-stop.png +0 -0
  32. data/concrete/ui/images/system-search.png +0 -0
  33. data/concrete/ui/layout_manager.js +54 -0
  34. data/concrete/ui/module_browser.js +88 -0
  35. data/concrete/ui/module_editor.js +217 -0
  36. data/concrete/ui/open_element_dialog.js +90 -0
  37. data/concrete/ui/preferences_dialog.js +75 -0
  38. data/concrete/ui/proceed_dialog.js +52 -0
  39. data/concrete/ui/search_replace_dialog.js +323 -0
  40. data/concrete/ui/style.css +296 -0
  41. data/concrete/ui/toolbar.js +74 -0
  42. data/concrete/ui/workbench.js +165 -0
  43. data/doc/concrete_developers_guide.html +1054 -0
  44. data/doc/concrete_developers_guide.txt +502 -0
  45. data/doc/concrete_users_guide.html +694 -0
  46. data/doc/concrete_users_guide.txt +223 -0
  47. data/example/formula_editor/example_data/example1.json +11 -0
  48. data/example/formula_editor/formula_editor.html +83 -0
  49. data/example/formula_editor/sqrt_horz.png +0 -0
  50. data/example/formula_editor/sqrt_vert.png +0 -0
  51. data/example/formula_editor/style.css +31 -0
  52. data/example/metamodel_editor/edit.rb +54 -0
  53. data/example/metamodel_editor/example_data/formula_metamodel.json +18 -0
  54. data/example/metamodel_editor/example_data/meta_metamodel.json +22 -0
  55. data/example/metamodel_editor/example_data/statemachine_metamodel.json +32 -0
  56. data/example/metamodel_editor/metamodel_editor.html +120 -0
  57. data/example/metamodel_editor/metamodel_editor2.html +135 -0
  58. data/example/metamodel_editor/metamodel_editor3.html +151 -0
  59. data/example/metamodel_editor/style.css +8 -0
  60. data/example/metamodel_editor/style2.css +19 -0
  61. data/example/metamodel_editor/style3.css +35 -0
  62. data/example/minimal_editor/minimal_editor.html +43 -0
  63. data/example/statemachine_editor/example_data/example1.json +11 -0
  64. data/example/statemachine_editor/state_background.png +0 -0
  65. data/example/statemachine_editor/statemachine_editor0.html +55 -0
  66. data/example/statemachine_editor/statemachine_editor1.html +62 -0
  67. data/example/statemachine_editor/statemachine_editor2.html +103 -0
  68. data/example/statemachine_editor/style0.css +8 -0
  69. data/example/statemachine_editor/style1.css +32 -0
  70. data/example/statemachine_editor/style2.css +43 -0
  71. data/example/themes/cobalt.css +176 -0
  72. data/example/themes/dialog-error.png +0 -0
  73. data/example/themes/dialog-information.png +0 -0
  74. data/example/themes/dialog-warning.png +0 -0
  75. data/example/themes/dots_12px.png +0 -0
  76. data/example/themes/fold_button_dots_when_hidden.css +18 -0
  77. data/example/themes/fold_button_plus_minus.css +21 -0
  78. data/example/themes/fold_button_plus_when_hidden.css +18 -0
  79. data/example/themes/light_blue.css +177 -0
  80. data/example/themes/minus_11px.png +0 -0
  81. data/example/themes/minus_13px.png +0 -0
  82. data/example/themes/minus_9px.png +0 -0
  83. data/example/themes/plus_11px.png +0 -0
  84. data/example/themes/plus_13px.png +0 -0
  85. data/example/themes/plus_9px.png +0 -0
  86. data/example/themes/white.css +177 -0
  87. data/lib/concrete/concrete_syntax_provider.rb +63 -0
  88. data/lib/concrete/config.rb +36 -0
  89. data/lib/concrete/file_cache_map.rb +88 -0
  90. data/lib/concrete/index_builder.rb +108 -0
  91. data/lib/concrete/metamodel/concrete_mmm.rb +45 -0
  92. data/lib/concrete/metamodel/ecore_to_concrete.rb +80 -0
  93. data/lib/concrete/server.rb +92 -0
  94. data/lib/concrete/util/logger.rb +24 -0
  95. data/lib/concrete/util/string_writer.rb +17 -0
  96. data/lib/concrete/working_set.rb +41 -0
  97. data/rakefile +33 -0
  98. data/redist/prototype.js +4320 -0
  99. data/redist/scriptaculous/builder.js +136 -0
  100. data/redist/scriptaculous/controls.js +991 -0
  101. data/redist/scriptaculous/dragdrop.js +975 -0
  102. data/redist/scriptaculous/effects.js +1130 -0
  103. data/redist/scriptaculous/scriptaculous.js +60 -0
  104. data/redist/scriptaculous/slider.js +275 -0
  105. data/redist/scriptaculous/sound.js +55 -0
  106. data/redist/scriptaculous/unittest.js +568 -0
  107. data/test/concrete_test.rb +5 -0
  108. data/test/file_cache_map_test.rb +90 -0
  109. data/test/file_cache_map_test/testdir/fileA +1 -0
  110. data/test/index_builder_test.rb +68 -0
  111. data/test/index_builder_test/ecore_index.js +85 -0
  112. data/test/index_builder_test/ecore_index_expected.js +85 -0
  113. data/test/integration/external_elements_test.html +114 -0
  114. data/test/metamodel_test.rb +40 -0
  115. data/test/metamodel_test/concrete_mmm_expected.js +19 -0
  116. data/test/metamodel_test/concrete_mmm_generated.js +19 -0
  117. data/test/metamodel_test/concrete_mmm_regenerated.js +19 -0
  118. data/test/unit/external_identifier_provider_test.html +138 -0
  119. data/test/unit/identifier_provider_test.html +269 -0
  120. data/test/unit/metamodel_provider_test.html +318 -0
  121. data/test/unit/model_interface_test.html +257 -0
  122. data/test/unit/template_provider_test.html +171 -0
  123. data/test/unit/test.css +90 -0
  124. data/test/working_set_test.rb +54 -0
  125. data/test/working_set_test/file1.txt +0 -0
  126. data/test/working_set_test/file2 +0 -0
  127. data/test/working_set_test/subdir/file3.xml +0 -0
  128. metadata +201 -0
@@ -0,0 +1,18 @@
1
+ /* Folding
2
+ *****************************************************************************/
3
+
4
+ .ct_fold_open {
5
+ display: none;
6
+ }
7
+
8
+ .ct_fold_closed {
9
+ display: inline-block;
10
+ width: 12px;
11
+ height: 12px;
12
+ background-image: url("dots_12px.png");
13
+ }
14
+
15
+ .ct_fold_empty {
16
+ display: none;
17
+ }
18
+
@@ -0,0 +1,21 @@
1
+ /* Folding
2
+ *****************************************************************************/
3
+
4
+ .ct_fold_open {
5
+ display: inline-block;
6
+ width: 11px;
7
+ height: 11px;
8
+ background-image: url("minus_11px.png");
9
+ }
10
+
11
+ .ct_fold_closed {
12
+ display: inline-block;
13
+ width: 11px;
14
+ height: 11px;
15
+ background-image: url("plus_11px.png");
16
+ }
17
+
18
+ .ct_fold_empty {
19
+ display: none;
20
+ }
21
+
@@ -0,0 +1,18 @@
1
+ /* Folding
2
+ *****************************************************************************/
3
+
4
+ .ct_fold_open {
5
+ display: none;
6
+ }
7
+
8
+ .ct_fold_closed {
9
+ display: inline-block;
10
+ width: 11px;
11
+ height: 11px;
12
+ background-image: url("plus_11px.png");
13
+ }
14
+
15
+ .ct_fold_empty {
16
+ display: none;
17
+ }
18
+
@@ -0,0 +1,177 @@
1
+
2
+ /* General Editor
3
+ *****************************************************************************/
4
+
5
+ body {
6
+ background-color: #c5cfe7;
7
+ color: black;
8
+ font-family: "courier new";
9
+ font-size: 12;
10
+ cursor: default;
11
+ }
12
+
13
+ /* editor */
14
+ .ct_editor {
15
+ padding: 10px;
16
+ border: 1px solid #888;
17
+ }
18
+
19
+ /* editor when focused */
20
+ .ct_editor.ct_focus {
21
+ border: 1px solid #555;
22
+ }
23
+
24
+ /* Inline Editor
25
+ *****************************************************************************/
26
+
27
+ /* text input element */
28
+ .ct_inline_editor input {
29
+ font-family: "courier new";
30
+ font-size: 12;
31
+ color: black;
32
+ background-color: transparent;
33
+ border: 0;
34
+ }
35
+
36
+ /* dropdown list */
37
+ .ct_inline_editor ul {
38
+ padding: 0;
39
+ margin: 0;
40
+ }
41
+
42
+ /* dropdown list item */
43
+ .ct_inline_editor ul li {
44
+ padding: 0;
45
+ margin: 0;
46
+ list-style-type: none;
47
+ color: black;
48
+ text-align: left;
49
+ }
50
+
51
+ /* dropdown list element when selected */
52
+ .ct_inline_editor ul li.selected {
53
+ background-color: #aaf;
54
+ }
55
+
56
+ /* General Syntax Highlighting
57
+ *****************************************************************************/
58
+
59
+ /* these styles are mainly intended for textual representations of the model */
60
+
61
+ /* Class name */
62
+ .ct_class_name {
63
+ color: #00008b;
64
+ }
65
+
66
+ /* Feature name */
67
+ .ct_feature_name {
68
+ color: #8b0000;
69
+ }
70
+
71
+ /* Element name */
72
+ .ct_identifier_attribute .ct_value {
73
+ color: black;
74
+ text-decoration: underline;
75
+ }
76
+
77
+ /* don't show feature name for identifier attributes */
78
+ .ct_identifier_attribute .ct_feature_name {
79
+ display: none;
80
+ }
81
+
82
+ /* indentation of containment features */
83
+ .ct_containment {
84
+ padding-left: 10px;
85
+ }
86
+
87
+ /* indentation of contained elements */
88
+ .ct_containment .ct_element {
89
+ margin-left: 10px;
90
+ }
91
+
92
+ /* indentation of inline editor when editing a contained element */
93
+ /* won't work in case a template is putting something around the slot */
94
+ .ct_containment > .ct_slot > .ct_inline_editor {
95
+ margin-left: 10px;
96
+ }
97
+
98
+ /* space between references and attributes */
99
+ .ct_value {
100
+ margin-right: 5px;
101
+ }
102
+
103
+ /* empty element/value used to insert new elements/values */
104
+ .ct_empty {
105
+ background-color: #777;
106
+ }
107
+
108
+ /* Selection
109
+ *****************************************************************************/
110
+
111
+ /* element/value selected */
112
+ .ct_selected {
113
+ background-color: #aaf;
114
+ }
115
+
116
+ /* cursor */
117
+ .ct_cursor {
118
+ width: 4px;
119
+ height: 4px;
120
+ background-color: #00A;
121
+ }
122
+
123
+ /* Errors
124
+ *****************************************************************************/
125
+
126
+ /* element/feature with an error */
127
+ .ct_error {
128
+ border-left: 5px solid #F77;
129
+ }
130
+
131
+ /* inline editor showing an error while editing */
132
+ .inline_editor.ct_error {
133
+ background-color: #F77;
134
+ }
135
+
136
+ /* Message Popup
137
+ *****************************************************************************/
138
+
139
+ /* popup shown when hovering over an element/feature */
140
+ .ct_message_popup {
141
+ background-color: #FFD;
142
+ border: 1px solid #777;
143
+ color: black;
144
+ }
145
+
146
+ .ct_error_message {
147
+ padding-left: 19px;
148
+ background: url("dialog-error.png") no-repeat;
149
+ min-height: 16px;
150
+ margin: 3px;
151
+ }
152
+
153
+ .ct_info_message {
154
+ padding-left: 19px;
155
+ background: url("dialog-information.png") no-repeat;
156
+ min-height: 16px;
157
+ margin: 3px;
158
+ }
159
+
160
+ /* References
161
+ *****************************************************************************/
162
+
163
+ /* target of a reference when hovering over the source */
164
+ .ct_ref_target {
165
+ background: #88F;
166
+ }
167
+
168
+ /* source of a reference when hovering over it */
169
+ .ct_ref_source {
170
+ text-decoration: underline;
171
+ color: #88F;
172
+ }
173
+
174
+ /* source when within target */
175
+ .ct_ref_target .ct_ref_source {
176
+ color: #FFF;
177
+ }
@@ -0,0 +1,177 @@
1
+
2
+ /* General Editor
3
+ *****************************************************************************/
4
+
5
+ body {
6
+ background-color: #fff;
7
+ color: #000;
8
+ font-family: "courier new";
9
+ font-size: 12;
10
+ cursor: default;
11
+ }
12
+
13
+ /* editor */
14
+ .ct_editor {
15
+ padding: 10px;
16
+ border: 1px solid #555;
17
+ }
18
+
19
+ /* editor when focused */
20
+ .ct_editor.ct_focus {
21
+ border: 1px solid #888;
22
+ }
23
+
24
+ /* Inline Editor
25
+ *****************************************************************************/
26
+
27
+ /* text input element */
28
+ .ct_inline_editor input {
29
+ font-family: "courier new";
30
+ font-size: 12;
31
+ color: #000;
32
+ background-color: transparent;
33
+ border: 0;
34
+ }
35
+
36
+ /* dropdown list */
37
+ .ct_inline_editor ul {
38
+ padding: 0;
39
+ margin: 0;
40
+ }
41
+
42
+ /* dropdown list item */
43
+ .ct_inline_editor ul li {
44
+ padding: 0;
45
+ margin: 0;
46
+ list-style-type: none;
47
+ color: black;
48
+ text-align: left;
49
+ }
50
+
51
+ /* dropdown list element when selected */
52
+ .ct_inline_editor ul li.selected {
53
+ background-color: #ccf;
54
+ }
55
+
56
+ /* General Syntax Highlighting
57
+ *****************************************************************************/
58
+
59
+ /* these styles are mainly intended for textual representations of the model */
60
+
61
+ /* Class name */
62
+ .ct_class_name {
63
+ color: #0000aa;
64
+ }
65
+
66
+ /* Feature name */
67
+ .ct_feature_name {
68
+ color: #008800;
69
+ }
70
+
71
+ /* Element name */
72
+ .ct_identifier_attribute .ct_value {
73
+ color: #aa0000;
74
+ }
75
+
76
+ /* don't show feature name for identifier attributes */
77
+ .ct_identifier_attribute .ct_feature_name {
78
+ display: none;
79
+ }
80
+
81
+ /* indentation of containment features */
82
+ .ct_containment {
83
+ padding-left: 10px;
84
+ }
85
+
86
+ /* indentation of contained elements */
87
+ .ct_containment .ct_element {
88
+ margin-left: 10px;
89
+ }
90
+
91
+ /* indentation of inline editor when editing a contained element */
92
+ /* won't work in case a template is putting something around the slot */
93
+ .ct_containment > .ct_slot > .ct_inline_editor {
94
+ margin-left: 10px;
95
+ }
96
+
97
+ /* space between references and attributes */
98
+ .ct_value {
99
+ margin-right: 5px;
100
+ }
101
+
102
+ /* empty element/value used to insert new elements/values */
103
+ .ct_empty {
104
+ background-color: #777;
105
+ }
106
+
107
+ /* Selection
108
+ *****************************************************************************/
109
+
110
+ /* element/value selected */
111
+ .ct_selected {
112
+ background-color: #ccf;
113
+ }
114
+
115
+ /* cursor */
116
+ .ct_cursor {
117
+ width: 4px;
118
+ height: 4px;
119
+ background-color: #f0f;
120
+ }
121
+
122
+ /* Errors
123
+ *****************************************************************************/
124
+
125
+ /* element/feature with an error */
126
+ .ct_error {
127
+ border-left: 5px solid #F77;
128
+ }
129
+
130
+ /* inline editor showing an error while editing */
131
+ .inline_editor.ct_error {
132
+ background-color: #F77;
133
+ }
134
+
135
+ /* Message Popup
136
+ *****************************************************************************/
137
+
138
+ /* popup shown when hovering over an element/feature */
139
+ .ct_message_popup {
140
+ background-color: #FFD;
141
+ border: 1px solid #777;
142
+ color: black;
143
+ }
144
+
145
+ .ct_error_message {
146
+ padding-left: 19px;
147
+ background: url("dialog-error.png") no-repeat;
148
+ min-height: 16px;
149
+ margin: 3px;
150
+ }
151
+
152
+ .ct_info_message {
153
+ padding-left: 19px;
154
+ background: url("dialog-information.png") no-repeat;
155
+ min-height: 16px;
156
+ margin: 3px;
157
+ }
158
+
159
+ /* References
160
+ *****************************************************************************/
161
+
162
+ /* target of a reference when hovering over the source */
163
+ .ct_ref_target {
164
+ background: #77F;
165
+ }
166
+
167
+ /* source of a reference when hovering over it */
168
+ .ct_ref_source {
169
+ text-decoration: underline;
170
+ color: #77F;
171
+ }
172
+
173
+ /* source when within target */
174
+ .ct_ref_target .ct_ref_source {
175
+ color: #FFF;
176
+ }
177
+
@@ -0,0 +1,63 @@
1
+ module Concrete
2
+
3
+ class ConcreteSyntaxProvider
4
+
5
+ class ConcreteSyntax
6
+ attr_accessor :ident, :dir, :name, :desc, :htmlTemplates, :cssStyleFile
7
+ end
8
+
9
+ def initialize(configDirs, logger, config=nil)
10
+ @configDirs = configDirs
11
+ @logger = logger
12
+ @config = config
13
+ @selectedSyntax = nil
14
+ end
15
+
16
+ def selectedSyntax
17
+ syn = syntaxes
18
+ storedIdent = @config.andand.loadValue("concrete_syntax")
19
+ storedSyntax = syn.find{|s| s.ident == storedIdent} if storedIdent
20
+ storedSyntax || @selectedSyntax || syn.first
21
+ end
22
+
23
+ def selectSyntax(ident)
24
+ @selectedSyntax = syntaxes.find{|s| s.ident == ident}
25
+ @config.andand.storeValue("concrete_syntax", ident.to_s)
26
+ end
27
+
28
+ def syntaxesAsJson
29
+ '{ "syntaxes": [' + syntaxes.collect do |s|
30
+ '{ "ident": "'+s.ident+'", "name": "'+s.name+'" }'
31
+ end.join(", ") + '], "selected": "'+@selectedSyntax.andand.ident.to_s+'" }'
32
+ end
33
+
34
+ def syntaxes
35
+ result = []
36
+ @configDirs.each do |cd|
37
+ next unless File.exist?(cd)
38
+ Dir.entries(cd).sort.each do |sd|
39
+ next if sd == "." || sd == ".."
40
+ syntaxDir = cd+"/"+sd
41
+ templatesFile = syntaxDir + "/templates.html"
42
+ styleFile = syntaxDir + "/style.css"
43
+ unless File.exist?(templatesFile) || File.exist?(styleFile)
44
+ @logger.warn("Concrete syntax dir without a templates.html or a style.css: #{syntaxDir}")
45
+ next
46
+ end
47
+ s = ConcreteSyntax.new
48
+ s.ident = syntaxDir.gsub("\\","/")
49
+ s.dir = syntaxDir
50
+ s.name = sd.split(/[_\W]/).collect{|w| w.capitalize}.join(" ")
51
+ s.desc = ""
52
+ s.cssStyleFile = styleFile if File.exist?(styleFile)
53
+ s.htmlTemplates = File.read(templatesFile) if File.exist?(templatesFile)
54
+ result << s
55
+ end
56
+ end
57
+ result
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+