concrete 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +32 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +87 -0
- data/concrete/basic_inline_editor.js +73 -0
- data/concrete/clipboard.js +72 -0
- data/concrete/concrete.js +58 -0
- data/concrete/constraint_checker.js +297 -0
- data/concrete/editor.js +964 -0
- data/concrete/element_extension.js +68 -0
- data/concrete/external_identifier_provider.js +112 -0
- data/concrete/helper.js +63 -0
- data/concrete/identifier_provider.js +168 -0
- data/concrete/inline_editor.js +55 -0
- data/concrete/metamodel_provider.js +171 -0
- data/concrete/model_interface.js +429 -0
- data/concrete/scroller.js +106 -0
- data/concrete/selector.js +302 -0
- data/concrete/template_provider.js +141 -0
- data/concrete/ui/abstract_dialog.js +80 -0
- data/concrete/ui/concrete_ui.js +28 -0
- data/concrete/ui/create_module_dialog.js +55 -0
- data/concrete/ui/images/close.png +0 -0
- data/concrete/ui/images/document-new.png +0 -0
- data/concrete/ui/images/document-save.png +0 -0
- data/concrete/ui/images/edit-find-replace.png +0 -0
- data/concrete/ui/images/emblem-symbolic-link.png +0 -0
- data/concrete/ui/images/help-browser.png +0 -0
- data/concrete/ui/images/minus_11px.png +0 -0
- data/concrete/ui/images/plus_11px.png +0 -0
- data/concrete/ui/images/preferences-system.png +0 -0
- data/concrete/ui/images/process-stop.png +0 -0
- data/concrete/ui/images/system-search.png +0 -0
- data/concrete/ui/layout_manager.js +54 -0
- data/concrete/ui/module_browser.js +88 -0
- data/concrete/ui/module_editor.js +217 -0
- data/concrete/ui/open_element_dialog.js +90 -0
- data/concrete/ui/preferences_dialog.js +75 -0
- data/concrete/ui/proceed_dialog.js +52 -0
- data/concrete/ui/search_replace_dialog.js +323 -0
- data/concrete/ui/style.css +296 -0
- data/concrete/ui/toolbar.js +74 -0
- data/concrete/ui/workbench.js +165 -0
- data/doc/concrete_developers_guide.html +1054 -0
- data/doc/concrete_developers_guide.txt +502 -0
- data/doc/concrete_users_guide.html +694 -0
- data/doc/concrete_users_guide.txt +223 -0
- data/example/formula_editor/example_data/example1.json +11 -0
- data/example/formula_editor/formula_editor.html +83 -0
- data/example/formula_editor/sqrt_horz.png +0 -0
- data/example/formula_editor/sqrt_vert.png +0 -0
- data/example/formula_editor/style.css +31 -0
- data/example/metamodel_editor/edit.rb +54 -0
- data/example/metamodel_editor/example_data/formula_metamodel.json +18 -0
- data/example/metamodel_editor/example_data/meta_metamodel.json +22 -0
- data/example/metamodel_editor/example_data/statemachine_metamodel.json +32 -0
- data/example/metamodel_editor/metamodel_editor.html +120 -0
- data/example/metamodel_editor/metamodel_editor2.html +135 -0
- data/example/metamodel_editor/metamodel_editor3.html +151 -0
- data/example/metamodel_editor/style.css +8 -0
- data/example/metamodel_editor/style2.css +19 -0
- data/example/metamodel_editor/style3.css +35 -0
- data/example/minimal_editor/minimal_editor.html +43 -0
- data/example/statemachine_editor/example_data/example1.json +11 -0
- data/example/statemachine_editor/state_background.png +0 -0
- data/example/statemachine_editor/statemachine_editor0.html +55 -0
- data/example/statemachine_editor/statemachine_editor1.html +62 -0
- data/example/statemachine_editor/statemachine_editor2.html +103 -0
- data/example/statemachine_editor/style0.css +8 -0
- data/example/statemachine_editor/style1.css +32 -0
- data/example/statemachine_editor/style2.css +43 -0
- data/example/themes/cobalt.css +176 -0
- data/example/themes/dialog-error.png +0 -0
- data/example/themes/dialog-information.png +0 -0
- data/example/themes/dialog-warning.png +0 -0
- data/example/themes/dots_12px.png +0 -0
- data/example/themes/fold_button_dots_when_hidden.css +18 -0
- data/example/themes/fold_button_plus_minus.css +21 -0
- data/example/themes/fold_button_plus_when_hidden.css +18 -0
- data/example/themes/light_blue.css +177 -0
- data/example/themes/minus_11px.png +0 -0
- data/example/themes/minus_13px.png +0 -0
- data/example/themes/minus_9px.png +0 -0
- data/example/themes/plus_11px.png +0 -0
- data/example/themes/plus_13px.png +0 -0
- data/example/themes/plus_9px.png +0 -0
- data/example/themes/white.css +177 -0
- data/lib/concrete/concrete_syntax_provider.rb +63 -0
- data/lib/concrete/config.rb +36 -0
- data/lib/concrete/file_cache_map.rb +88 -0
- data/lib/concrete/index_builder.rb +108 -0
- data/lib/concrete/metamodel/concrete_mmm.rb +45 -0
- data/lib/concrete/metamodel/ecore_to_concrete.rb +80 -0
- data/lib/concrete/server.rb +92 -0
- data/lib/concrete/util/logger.rb +24 -0
- data/lib/concrete/util/string_writer.rb +17 -0
- data/lib/concrete/working_set.rb +41 -0
- data/rakefile +33 -0
- data/redist/prototype.js +4320 -0
- data/redist/scriptaculous/builder.js +136 -0
- data/redist/scriptaculous/controls.js +991 -0
- data/redist/scriptaculous/dragdrop.js +975 -0
- data/redist/scriptaculous/effects.js +1130 -0
- data/redist/scriptaculous/scriptaculous.js +60 -0
- data/redist/scriptaculous/slider.js +275 -0
- data/redist/scriptaculous/sound.js +55 -0
- data/redist/scriptaculous/unittest.js +568 -0
- data/test/concrete_test.rb +5 -0
- data/test/file_cache_map_test.rb +90 -0
- data/test/file_cache_map_test/testdir/fileA +1 -0
- data/test/index_builder_test.rb +68 -0
- data/test/index_builder_test/ecore_index.js +85 -0
- data/test/index_builder_test/ecore_index_expected.js +85 -0
- data/test/integration/external_elements_test.html +114 -0
- data/test/metamodel_test.rb +40 -0
- data/test/metamodel_test/concrete_mmm_expected.js +19 -0
- data/test/metamodel_test/concrete_mmm_generated.js +19 -0
- data/test/metamodel_test/concrete_mmm_regenerated.js +19 -0
- data/test/unit/external_identifier_provider_test.html +138 -0
- data/test/unit/identifier_provider_test.html +269 -0
- data/test/unit/metamodel_provider_test.html +318 -0
- data/test/unit/model_interface_test.html +257 -0
- data/test/unit/template_provider_test.html +171 -0
- data/test/unit/test.css +90 -0
- data/test/working_set_test.rb +54 -0
- data/test/working_set_test/file1.txt +0 -0
- data/test/working_set_test/file2 +0 -0
- data/test/working_set_test/subdir/file3.xml +0 -0
- metadata +201 -0
@@ -0,0 +1,296 @@
|
|
1
|
+
/* Layout */
|
2
|
+
|
3
|
+
#ct_layout_toolbar {
|
4
|
+
background-color: #ccf;
|
5
|
+
border-bottom: 1px solid grey;
|
6
|
+
}
|
7
|
+
|
8
|
+
#ct_layout_sidebar_drag {
|
9
|
+
background-color: #ccf;
|
10
|
+
border-left: 1px solid grey;
|
11
|
+
border-right: 1px solid grey;
|
12
|
+
}
|
13
|
+
|
14
|
+
/* Toolbar */
|
15
|
+
|
16
|
+
a.ct_toolbar_icon {
|
17
|
+
width: 32px;
|
18
|
+
height: 32px;
|
19
|
+
margin: 6px 6px 6px 6px;
|
20
|
+
}
|
21
|
+
|
22
|
+
a.ct_toolbar_icon:hover {
|
23
|
+
margin: 3px 6px 9px 6px;
|
24
|
+
}
|
25
|
+
|
26
|
+
.ct_tooltip_popup {
|
27
|
+
background-color: #FFD;
|
28
|
+
border: 1px solid #777;
|
29
|
+
color: black;
|
30
|
+
padding: 3px;
|
31
|
+
white-space: nowrap;
|
32
|
+
font-family: arial;
|
33
|
+
}
|
34
|
+
|
35
|
+
.ct_create_module_button {
|
36
|
+
float:left;
|
37
|
+
background-image: url(images/document-new.png);
|
38
|
+
}
|
39
|
+
|
40
|
+
.ct_save_button {
|
41
|
+
float:left;
|
42
|
+
background-image: url(images/document-save.png);
|
43
|
+
}
|
44
|
+
|
45
|
+
.ct_open_element_button {
|
46
|
+
float:left;
|
47
|
+
background-image: url(images/system-search.png);
|
48
|
+
}
|
49
|
+
|
50
|
+
.ct_search_replace_button {
|
51
|
+
float:left;
|
52
|
+
background-image: url(images/edit-find-replace.png);
|
53
|
+
}
|
54
|
+
|
55
|
+
.ct_toggle_short_references_button {
|
56
|
+
float:left;
|
57
|
+
background-image: url(images/emblem-symbolic-link.png);
|
58
|
+
}
|
59
|
+
|
60
|
+
.ct_preferences_button {
|
61
|
+
float:right;
|
62
|
+
background-image: url(images/preferences-system.png);
|
63
|
+
}
|
64
|
+
|
65
|
+
.ct_browse_help_button {
|
66
|
+
float:right;
|
67
|
+
background-image: url(images/help-browser.png);
|
68
|
+
}
|
69
|
+
|
70
|
+
.ct_stop_server_button {
|
71
|
+
float:right;
|
72
|
+
background-image: url(images/process-stop.png);
|
73
|
+
}
|
74
|
+
|
75
|
+
/* Browser */
|
76
|
+
|
77
|
+
.ct_module_browser.ct_editor {
|
78
|
+
border: 0px;
|
79
|
+
}
|
80
|
+
|
81
|
+
.ct_module_browser.ct_editor.ct_focus {
|
82
|
+
border: 0px;
|
83
|
+
}
|
84
|
+
|
85
|
+
.ct_module_browser .ct_class_name {
|
86
|
+
}
|
87
|
+
|
88
|
+
.ct_module_browser .ct_feature_name {
|
89
|
+
display: none;
|
90
|
+
}
|
91
|
+
|
92
|
+
.ct_module_browser .ct_fold_open {
|
93
|
+
display: inline-block;
|
94
|
+
width: 11px;
|
95
|
+
height: 11px;
|
96
|
+
background-image: url("images/minus_11px.png");
|
97
|
+
}
|
98
|
+
|
99
|
+
.ct_module_browser .ct_fold_closed {
|
100
|
+
display: inline-block;
|
101
|
+
width: 11px;
|
102
|
+
height: 11px;
|
103
|
+
background-image: url("images/plus_11px.png");
|
104
|
+
}
|
105
|
+
|
106
|
+
.ct_module_browser .ct_fold_empty {
|
107
|
+
display: none;
|
108
|
+
}
|
109
|
+
|
110
|
+
/* Editor */
|
111
|
+
|
112
|
+
.ct_module_editor.ct_editor {
|
113
|
+
border: 0px;
|
114
|
+
}
|
115
|
+
|
116
|
+
.ct_module_editor.ct_editor.ct_focus {
|
117
|
+
border: 0px;
|
118
|
+
}
|
119
|
+
|
120
|
+
.ct_module_editor .ct_fold_open {
|
121
|
+
display: inline-block;
|
122
|
+
width: 11px;
|
123
|
+
height: 11px;
|
124
|
+
background-image: url("images/minus_11px.png");
|
125
|
+
}
|
126
|
+
|
127
|
+
.ct_module_editor .ct_fold_closed {
|
128
|
+
display: inline-block;
|
129
|
+
width: 11px;
|
130
|
+
height: 11px;
|
131
|
+
background-image: url("images/plus_11px.png");
|
132
|
+
}
|
133
|
+
|
134
|
+
.ct_module_editor .ct_fold_empty {
|
135
|
+
display: none;
|
136
|
+
}
|
137
|
+
|
138
|
+
/* Clipboard */
|
139
|
+
|
140
|
+
.ct_clipboard_area {
|
141
|
+
margin: 30px 10px 10px 10px;
|
142
|
+
background-color: white;
|
143
|
+
color: black;
|
144
|
+
border: 1px solid grey;
|
145
|
+
}
|
146
|
+
|
147
|
+
/* Auto Completer */
|
148
|
+
|
149
|
+
.auto_complete_dropdown {
|
150
|
+
position: absolute;
|
151
|
+
border: 1px solid grey;
|
152
|
+
background-color: white;
|
153
|
+
padding: 0;
|
154
|
+
margin: 0;
|
155
|
+
}
|
156
|
+
|
157
|
+
.auto_complete_dropdown ul {
|
158
|
+
padding: 0;
|
159
|
+
margin: 0;
|
160
|
+
}
|
161
|
+
|
162
|
+
.auto_complete_dropdown ul li {
|
163
|
+
padding: 0;
|
164
|
+
margin: 0;
|
165
|
+
list-style-type: none;
|
166
|
+
color: black;
|
167
|
+
text-align: left;
|
168
|
+
}
|
169
|
+
|
170
|
+
.auto_complete_dropdown ul li.selected {
|
171
|
+
background-color: #ccf;
|
172
|
+
}
|
173
|
+
|
174
|
+
/* Popup Dialog General */
|
175
|
+
|
176
|
+
.popup_dialog {
|
177
|
+
font-family: "arial";
|
178
|
+
font-size: 14;
|
179
|
+
}
|
180
|
+
|
181
|
+
.popup_dialog .dialog_box {
|
182
|
+
background-color: white;
|
183
|
+
border: 1px solid gray;
|
184
|
+
}
|
185
|
+
|
186
|
+
.popup_dialog .shadow {
|
187
|
+
background-color: grey;
|
188
|
+
left: -5px;
|
189
|
+
top: -5px;
|
190
|
+
position: absolute;
|
191
|
+
opacity: 0.2;
|
192
|
+
z-index: -1;
|
193
|
+
border-radius: 5px;
|
194
|
+
}
|
195
|
+
|
196
|
+
.popup_dialog .title_bar {
|
197
|
+
padding: 5px;
|
198
|
+
background-color: #ccf;
|
199
|
+
font-size: 16;
|
200
|
+
font-weight: bold;
|
201
|
+
border-bottom: 1px solid gray;
|
202
|
+
cursor: move;
|
203
|
+
}
|
204
|
+
|
205
|
+
.popup_dialog .container {
|
206
|
+
margin: 15px;
|
207
|
+
}
|
208
|
+
|
209
|
+
.popup_dialog .label {
|
210
|
+
padding: 0;
|
211
|
+
margin-top: 5px;
|
212
|
+
margin-bottom: 5px;
|
213
|
+
font-size: 16;
|
214
|
+
color: black;
|
215
|
+
}
|
216
|
+
|
217
|
+
.popup_dialog .text_input {
|
218
|
+
width: 100%;
|
219
|
+
margin-top: 5px;
|
220
|
+
margin-bottom: 5px;
|
221
|
+
border: 1px solid grey;
|
222
|
+
color: black;
|
223
|
+
}
|
224
|
+
|
225
|
+
.popup_dialog .dropdown_input {
|
226
|
+
width: 100%;
|
227
|
+
margin-top: 5px;
|
228
|
+
margin-bottom: 5px;
|
229
|
+
border: 1px solid grey;
|
230
|
+
color: black;
|
231
|
+
}
|
232
|
+
|
233
|
+
.popup_dialog .button_input {
|
234
|
+
padding: 5px 20px 5px 20px;
|
235
|
+
border: 1px solid grey;
|
236
|
+
background-color: #ccf;
|
237
|
+
color: black;
|
238
|
+
margin: 5px;
|
239
|
+
}
|
240
|
+
|
241
|
+
.popup_dialog .close_button {
|
242
|
+
width: 16px;
|
243
|
+
height: 16px;
|
244
|
+
float: right;
|
245
|
+
background-image: url(images/close.png);
|
246
|
+
cursor: default;
|
247
|
+
}
|
248
|
+
|
249
|
+
/* Open Element Dialog */
|
250
|
+
|
251
|
+
#ct_open_element_dialog {
|
252
|
+
width: 600px;
|
253
|
+
}
|
254
|
+
|
255
|
+
#ct_open_element_dialog .search_box_list_container {
|
256
|
+
margin-top: 10px;
|
257
|
+
background-color: white;
|
258
|
+
border: 1px solid grey;
|
259
|
+
width: 100%;
|
260
|
+
height: 200px;
|
261
|
+
}
|
262
|
+
|
263
|
+
/* in this dialog there is already a box around the dropdown area */
|
264
|
+
#ct_open_element_dialog .auto_complete_dropdown {
|
265
|
+
border: 0;
|
266
|
+
}
|
267
|
+
|
268
|
+
#ct_open_element_dialog .search_box_list {
|
269
|
+
width: 100%;
|
270
|
+
height: 200px;
|
271
|
+
overflow-x: hidden;
|
272
|
+
overflow-y: auto;
|
273
|
+
}
|
274
|
+
|
275
|
+
#ct_open_element_dialog .search_box_list li {
|
276
|
+
padding: 3px;
|
277
|
+
}
|
278
|
+
|
279
|
+
#ct_open_element_dialog .search_box_identifier {
|
280
|
+
color: #aa0000;
|
281
|
+
}
|
282
|
+
|
283
|
+
#ct_open_element_dialog .search_box_class_name {
|
284
|
+
color: #0000aa;
|
285
|
+
}
|
286
|
+
|
287
|
+
#ct_open_element_dialog .search_box_module_name {
|
288
|
+
font-size: 90%;
|
289
|
+
}
|
290
|
+
|
291
|
+
/* Search Replace Dialog */
|
292
|
+
|
293
|
+
#ct_search_replace_dialog {
|
294
|
+
width: 600px;
|
295
|
+
}
|
296
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
Concrete.UI.Toolbar = Class.create({
|
2
|
+
|
3
|
+
initialize: function(parentElement) {
|
4
|
+
this.toolbar = this._createDomElement(parentElement);
|
5
|
+
this.popup = this.toolbar.down(".ct_tooltip_popup");
|
6
|
+
this.hotkeys = new Hash();
|
7
|
+
this.tooltips = {};
|
8
|
+
},
|
9
|
+
|
10
|
+
handleEvent: function(event) {
|
11
|
+
var handeled = false;
|
12
|
+
if (event.type == "keydown") {
|
13
|
+
this.hotkeys.keys().each(function(k) {
|
14
|
+
var match = k.match(/^(ctrl\+)?(shift\+)?(\w)$/);
|
15
|
+
if (match) {
|
16
|
+
var ctrl = match[1];
|
17
|
+
var shift = match[2];
|
18
|
+
var keyCode = match[3].charCodeAt(0);
|
19
|
+
if ((shift && event.shiftKey || !shift && !event.shiftKey) &&
|
20
|
+
(ctrl && event.ctrlKey || !ctrl && !event.ctrlKey) &&
|
21
|
+
keyCode == event.keyCode) {
|
22
|
+
this.hotkeys.get(k)();
|
23
|
+
event.stop();
|
24
|
+
handeled = true;
|
25
|
+
throw $break;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}, this);
|
29
|
+
}
|
30
|
+
else if (event.type == "mousemove") {
|
31
|
+
var element = Event.element(event);
|
32
|
+
this.popup.hide();
|
33
|
+
if (element.hasClassName("ct_toolbar_icon")) {
|
34
|
+
var clazz = element.className.sub("ct_toolbar_icon ","");
|
35
|
+
var tooltip = this.tooltips[clazz];
|
36
|
+
if (tooltip && tooltip.length > 0) {
|
37
|
+
this.popup.innerHTML = tooltip;
|
38
|
+
var left = event.clientX+20;
|
39
|
+
if (left > document.viewport.getDimensions().width - this.popup.getWidth()) {
|
40
|
+
left = document.viewport.getDimensions().width - this.popup.getWidth();
|
41
|
+
}
|
42
|
+
this.popup.setStyle({left: left, top: event.clientY+20});
|
43
|
+
this.popup.show();
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return handeled;
|
48
|
+
},
|
49
|
+
|
50
|
+
addCommand: function(options, func) {
|
51
|
+
if (options.hotkey) {
|
52
|
+
this.hotkeys.set(options.hotkey, func);
|
53
|
+
}
|
54
|
+
var clazz = options.buttonClass || "";
|
55
|
+
if (options.tooltip && clazz.length > 0) {
|
56
|
+
this.tooltips[clazz] = options.tooltip;
|
57
|
+
}
|
58
|
+
Element.insert(this.toolbar, { bottom:
|
59
|
+
"<a class='ct_toolbar_icon "+clazz+"'></a>"
|
60
|
+
});
|
61
|
+
var icon = this.toolbar.childElements().last();
|
62
|
+
icon.onclick = func;
|
63
|
+
},
|
64
|
+
|
65
|
+
_createDomElement: function(parentElement) {
|
66
|
+
Element.insert(parentElement, { bottom:
|
67
|
+
"<div class='ct_toolbar'>" +
|
68
|
+
"<div style='position: fixed; display: none; left: 0; top: 0;' class='ct_tooltip_popup'></div>" +
|
69
|
+
"</div>"
|
70
|
+
});
|
71
|
+
return parentElement.childElements().last();
|
72
|
+
},
|
73
|
+
|
74
|
+
});
|
@@ -0,0 +1,165 @@
|
|
1
|
+
Concrete.UI.Workbench = {
|
2
|
+
|
3
|
+
// Toplevel setup of an editor workbench.
|
4
|
+
// Creates editor views and connects event and command handlers.
|
5
|
+
//
|
6
|
+
// Options:
|
7
|
+
//
|
8
|
+
// moduleBrowserOptions: options passed to the module browser, default: none
|
9
|
+
// moduleEditorOptions: options passed to the module editor, default: none
|
10
|
+
//
|
11
|
+
setup: function(metamodel, indexMetamodel, options) {
|
12
|
+
options = options || {};
|
13
|
+
|
14
|
+
var layoutManager = new Concrete.UI.LayoutManager();
|
15
|
+
|
16
|
+
var toolbar = new Concrete.UI.Toolbar(layoutManager.toolbar);
|
17
|
+
|
18
|
+
var mp = new Concrete.MetamodelProvider(metamodel);
|
19
|
+
|
20
|
+
var index = [];
|
21
|
+
var eip = new Concrete.IndexBasedExternalIdentifierProvider(index, mp);
|
22
|
+
|
23
|
+
var editorOptions = options.moduleEditorOptions || {};
|
24
|
+
editorOptions.onFollowReference = function(module, ident) {
|
25
|
+
jumpReference(module, ident);
|
26
|
+
};
|
27
|
+
var moduleEditor = new Concrete.UI.ModuleEditor(layoutManager.main, eip, mp, editorOptions);
|
28
|
+
|
29
|
+
var browserOptions = options.moduleBrowserOptions || {};
|
30
|
+
browserOptions.onOpenModule = function(module, ident) {
|
31
|
+
jumpReference(module, ident);
|
32
|
+
};
|
33
|
+
var moduleBrowser = new Concrete.UI.ModuleBrowser(layoutManager.sidebar, indexMetamodel, browserOptions);
|
34
|
+
|
35
|
+
var openElementDialog = new Concrete.UI.OpenElementDialog(eip, {
|
36
|
+
onOpenReference: function(module, ident) {
|
37
|
+
jumpReference(module, ident);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
var searchReplaceDialog = new Concrete.UI.SearchReplaceDialog({
|
42
|
+
metamodelProvider: mp
|
43
|
+
});
|
44
|
+
|
45
|
+
var preferencesDialog = new Concrete.UI.PreferencesDialog();
|
46
|
+
|
47
|
+
// Event Handler
|
48
|
+
|
49
|
+
Event.observe(window, 'click', function(event) {
|
50
|
+
moduleEditor.handleEvent(event);
|
51
|
+
moduleBrowser.handleEvent(event);
|
52
|
+
});
|
53
|
+
Event.observe(window, 'dblclick', function(event) {
|
54
|
+
moduleBrowser.handleEvent(event);
|
55
|
+
});
|
56
|
+
Event.observe(window, 'keydown', function(event) {
|
57
|
+
if (toolbar.handleEvent(event)) {}
|
58
|
+
else if ($$(".popup_dialog").any(function(d) {return d.visible();})) {}
|
59
|
+
else {
|
60
|
+
moduleEditor.handleEvent(event);
|
61
|
+
moduleBrowser.handleEvent(event);
|
62
|
+
}
|
63
|
+
});
|
64
|
+
Event.observe(window, 'mousedown', function(event) {
|
65
|
+
layoutManager.handleEvent(event);
|
66
|
+
});
|
67
|
+
Event.observe(window, 'mouseup', function(event) {
|
68
|
+
layoutManager.handleEvent(event);
|
69
|
+
});
|
70
|
+
Event.observe(window, 'mousemove', function(event) {
|
71
|
+
toolbar.handleEvent(event);
|
72
|
+
if (layoutManager.handleEvent(event)) {}
|
73
|
+
else {
|
74
|
+
moduleEditor.handleEvent(event);
|
75
|
+
moduleBrowser.handleEvent(event);
|
76
|
+
}
|
77
|
+
});
|
78
|
+
|
79
|
+
// Commands
|
80
|
+
|
81
|
+
toolbar.addCommand({buttonClass: "ct_create_module_button", tooltip: "Create Module"}, function() {
|
82
|
+
moduleEditor.createModule({
|
83
|
+
onSuccess: function() {
|
84
|
+
loadIndex();
|
85
|
+
},
|
86
|
+
onFailure: function() {
|
87
|
+
alert("Create module failed");
|
88
|
+
}
|
89
|
+
});
|
90
|
+
});
|
91
|
+
|
92
|
+
toolbar.addCommand({buttonClass: "ct_save_button", hotkey: "ctrl+shift+S", tooltip: "Save Module"}, function() {
|
93
|
+
moduleEditor.save({
|
94
|
+
onSuccess: function() {
|
95
|
+
loadIndex();
|
96
|
+
},
|
97
|
+
onFailure: function() {
|
98
|
+
alert("Save failed");
|
99
|
+
}
|
100
|
+
});
|
101
|
+
});
|
102
|
+
|
103
|
+
toolbar.addCommand({buttonClass: "ct_open_element_button", hotkey: "ctrl+shift+E", tooltip: "Open Element"}, function() {
|
104
|
+
openElementDialog.open(eip.getAllElementInfo());
|
105
|
+
});
|
106
|
+
|
107
|
+
toolbar.addCommand({buttonClass: "ct_search_replace_button", hotkey: "ctrl+shift+F", tooltip: "Search and Replace"}, function() {
|
108
|
+
searchReplaceDialog.open(moduleEditor.editor);
|
109
|
+
});
|
110
|
+
|
111
|
+
toolbar.addCommand({buttonClass: "ct_toggle_short_references_button", tooltip: "Toggle Short References"}, function() {
|
112
|
+
moduleEditor.toggleShortReferences();
|
113
|
+
});
|
114
|
+
|
115
|
+
toolbar.addCommand({buttonClass: "ct_stop_server_button", tooltip: "Stop Server"}, function() {
|
116
|
+
new Ajax.Request("/exit");
|
117
|
+
});
|
118
|
+
|
119
|
+
toolbar.addCommand({buttonClass: "ct_browse_help_button", tooltip: "Browse Help"}, function() {
|
120
|
+
window.open("/doc/concrete_users_guide.html", "Concrete Users Guide");
|
121
|
+
});
|
122
|
+
|
123
|
+
toolbar.addCommand({buttonClass: "ct_preferences_button", tooltip: "Preferences"}, function() {
|
124
|
+
preferencesDialog.open();
|
125
|
+
});
|
126
|
+
|
127
|
+
function jumpReference(module, ident) {
|
128
|
+
var href = "#"+module+((ident && ":"+ident) || "");
|
129
|
+
window.location.href = href;
|
130
|
+
}
|
131
|
+
|
132
|
+
function loadIndex(options) {
|
133
|
+
new Ajax.Request("/loadIndex", {
|
134
|
+
method: "get",
|
135
|
+
onSuccess: function(transport) {
|
136
|
+
index.clear();
|
137
|
+
var indexJson = transport.responseText.evalJSON();
|
138
|
+
indexJson.sortBy(function(m) {return m.name}).each(function(m) {
|
139
|
+
index.push(m);
|
140
|
+
});
|
141
|
+
moduleBrowser.loadIndex(index);
|
142
|
+
if (options && options.onIndexLoaded) options.onIndexLoaded();
|
143
|
+
}
|
144
|
+
});
|
145
|
+
}
|
146
|
+
|
147
|
+
window.onresize = function() {
|
148
|
+
layoutManager.layout();
|
149
|
+
};
|
150
|
+
|
151
|
+
window.onhashchange = function() {
|
152
|
+
var match = window.location.href.match(/#([^:]+):?(.*)/)
|
153
|
+
var module = match && match[1];
|
154
|
+
var ident = match && match[2];
|
155
|
+
moduleEditor.select(module, ident);
|
156
|
+
};
|
157
|
+
|
158
|
+
// first update after loading
|
159
|
+
window.onresize();
|
160
|
+
loadIndex({onIndexLoaded: function() {
|
161
|
+
window.onhashchange();
|
162
|
+
}});
|
163
|
+
}
|
164
|
+
};
|
165
|
+
|