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,90 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)+"/../lib")
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'concrete/file_cache_map'
|
6
|
+
|
7
|
+
class FileCacheMapTest < Test::Unit::TestCase
|
8
|
+
|
9
|
+
TestDir = File.dirname(__FILE__)+"/file_cache_map_test/testdir"
|
10
|
+
|
11
|
+
def setup
|
12
|
+
FileUtils.rm_r(Dir[TestDir+"/*"])
|
13
|
+
# * doesn't include dot files
|
14
|
+
FileUtils.rm_r(Dir[TestDir+"/.cache"])
|
15
|
+
@cm = Concrete::FileCacheMap.new(".cache", ".test")
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_nocache
|
19
|
+
assert_equal(:invalid, @cm.loadData(TestDir+"/fileA"))
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_storeload
|
23
|
+
keyFile = TestDir+"/fileA"
|
24
|
+
File.open(keyFile, "w") {|f| f.write("somedata")}
|
25
|
+
@cm.storeData(keyFile, "valuedata")
|
26
|
+
assert(File.exist?(TestDir+"/.cache/fileA.test"))
|
27
|
+
assert_equal("valuedata", @cm.loadData(keyFile))
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_storeload_subdir
|
31
|
+
keyFile = TestDir+"/subdir/fileA"
|
32
|
+
FileUtils.mkdir(TestDir+"/subdir")
|
33
|
+
File.open(keyFile, "w") {|f| f.write("somedata")}
|
34
|
+
@cm.storeData(keyFile, "valuedata")
|
35
|
+
assert(File.exist?(TestDir+"/subdir/.cache/fileA.test"))
|
36
|
+
assert_equal("valuedata", @cm.loadData(keyFile))
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_storeload_postfix
|
40
|
+
keyFile = TestDir+"/fileB.txt"
|
41
|
+
File.open(keyFile, "w") {|f| f.write("somedata")}
|
42
|
+
@cm.storeData(keyFile, "valuedata")
|
43
|
+
assert(File.exist?(TestDir+"/.cache/fileB.txt.test"))
|
44
|
+
assert_equal("valuedata", @cm.loadData(keyFile))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_storeload_empty
|
48
|
+
keyFile = TestDir+"/fileA"
|
49
|
+
File.open(keyFile, "w") {|f| f.write("")}
|
50
|
+
@cm.storeData(keyFile, "valuedata")
|
51
|
+
assert(File.exist?(TestDir+"/.cache/fileA.test"))
|
52
|
+
assert_equal("valuedata", @cm.loadData(keyFile))
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_corruptcache
|
56
|
+
keyFile = TestDir+"/fileA"
|
57
|
+
File.open(keyFile, "w") {|f| f.write("somedata")}
|
58
|
+
@cm.storeData(keyFile, "valuedata")
|
59
|
+
File.open(TestDir+"/.cache/fileA.test","a") {|f| f.write("more data")}
|
60
|
+
assert_equal(:invalid, @cm.loadData(keyFile))
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_changedcontent
|
64
|
+
keyFile = TestDir+"/fileA"
|
65
|
+
File.open(keyFile, "w") {|f| f.write("somedata")}
|
66
|
+
@cm.storeData(keyFile, "valuedata")
|
67
|
+
File.open(keyFile, "a") {|f| f.write("more data")}
|
68
|
+
assert_equal(:invalid, @cm.loadData(keyFile))
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_versioninfo
|
72
|
+
keyFile = TestDir+"/fileA"
|
73
|
+
File.open(keyFile, "w") {|f| f.write("somedata")}
|
74
|
+
@cm.versionInfo = "123"
|
75
|
+
@cm.storeData(keyFile, "valuedata")
|
76
|
+
assert(File.exist?(TestDir+"/.cache/fileA.test"))
|
77
|
+
assert_equal("valuedata", @cm.loadData(keyFile))
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_changed_version
|
81
|
+
keyFile = TestDir+"/fileA"
|
82
|
+
File.open(keyFile, "w") {|f| f.write("somedata")}
|
83
|
+
@cm.versionInfo = "123"
|
84
|
+
@cm.storeData(keyFile, "valuedata")
|
85
|
+
@cm.versionInfo = "456"
|
86
|
+
assert_equal(:invalid, @cm.loadData(keyFile))
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
somedata
|
@@ -0,0 +1,68 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)+"/../lib")
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'rgen/array_extensions'
|
6
|
+
require 'rgen/serializer/json_serializer'
|
7
|
+
require 'concrete/index_builder'
|
8
|
+
|
9
|
+
class IndexBuilderTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
TestDir = File.dirname(__FILE__)+"/index_builder_test"
|
12
|
+
|
13
|
+
def test_index_metamodel
|
14
|
+
builder = Concrete::IndexBuilder.new(RGen::ECore)
|
15
|
+
mm = builder.indexMetamodel
|
16
|
+
assert_equal [
|
17
|
+
"EAttribute", "EClass", "EClassifier", "EDataType",
|
18
|
+
"EEnum", "EEnumLiteral", "ENamedElement", "EOperation",
|
19
|
+
"EPackage", "EParameter", "EReference", "EStructuralFeature",
|
20
|
+
"ETypedElement", "IndexElement", "Module"
|
21
|
+
], mm.ecore.eAllClasses.name.sort
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_index_metamodel_reference_only
|
25
|
+
builder = Concrete::IndexBuilder.new(RGen::ECore, :ignoreReferences => proc{|r| r.eType.name != "EReference"})
|
26
|
+
mm = builder.indexMetamodel
|
27
|
+
# metamodel should only contain the EReference class and its container classes and base elements
|
28
|
+
assert_equal [
|
29
|
+
"EClass",
|
30
|
+
"EPackage", "EReference",
|
31
|
+
"IndexElement", "Module"
|
32
|
+
], mm.ecore.eAllClasses.name.sort
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_index_metamodel_different_ident_name
|
36
|
+
builder = Concrete::IndexBuilder.new(RGen::ECore, :identifierName => "theName")
|
37
|
+
mm = builder.indexMetamodel
|
38
|
+
# metamodel should only contain the base elements
|
39
|
+
assert_equal [
|
40
|
+
"IndexElement", "Module"
|
41
|
+
], mm.ecore.eAllClasses.name.sort
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_index_metamodel_module_class_name
|
45
|
+
builder = Concrete::IndexBuilder.new(RGen::ECore, :moduleClassName => "File")
|
46
|
+
mm = builder.indexMetamodel
|
47
|
+
assert mm.ecore.eAllClasses.all?{|c| c.name != "Module"}
|
48
|
+
assert mm.ecore.eAllClasses.any?{|c| c.name == "File"}
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_metamodel_loaded
|
52
|
+
builder = Concrete::IndexBuilder.new(RGen::ECore)
|
53
|
+
mm = builder.indexMetamodel
|
54
|
+
assert mm.is_a?(Module)
|
55
|
+
assert mm::IndexElement.is_a?(Class)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_build_index
|
59
|
+
builder = Concrete::IndexBuilder.new(RGen::ECore)
|
60
|
+
index = builder.buildIndex(RGen::ECore.ecore)
|
61
|
+
File.open(TestDir+"/ecore_index.js", "w") do |f|
|
62
|
+
ser = RGen::Serializer::JsonSerializer.new(f)
|
63
|
+
ser.serialize(index)
|
64
|
+
end
|
65
|
+
assert_equal File.read(TestDir+"/ecore_index_expected.js").strip, File.read(TestDir+"/ecore_index.js").strip
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
{ "_class": "EPackage", "name": "ECore", "elements": [
|
2
|
+
{ "_class": "EClass", "name": "EModelElement", "elements": [
|
3
|
+
{ "_class": "EReference", "name": "eAnnotations" }] },
|
4
|
+
{ "_class": "EClass", "name": "EReference", "elements": [
|
5
|
+
{ "_class": "EAttribute", "name": "container" },
|
6
|
+
{ "_class": "EAttribute", "name": "containment" },
|
7
|
+
{ "_class": "EAttribute", "name": "resolveProxies" },
|
8
|
+
{ "_class": "EReference", "name": "eOpposite" },
|
9
|
+
{ "_class": "EReference", "name": "eReferenceType" }] },
|
10
|
+
{ "_class": "EClass", "name": "ETypedElement", "elements": [
|
11
|
+
{ "_class": "EAttribute", "name": "lowerBound" },
|
12
|
+
{ "_class": "EAttribute", "name": "ordered" },
|
13
|
+
{ "_class": "EAttribute", "name": "unique" },
|
14
|
+
{ "_class": "EAttribute", "name": "upperBound" },
|
15
|
+
{ "_class": "EAttribute", "name": "many" },
|
16
|
+
{ "_class": "EAttribute", "name": "required" },
|
17
|
+
{ "_class": "EReference", "name": "eType" }] },
|
18
|
+
{ "_class": "EClass", "name": "EAttribute", "elements": [
|
19
|
+
{ "_class": "EAttribute", "name": "iD" },
|
20
|
+
{ "_class": "EReference", "name": "eAttributeType" }] },
|
21
|
+
{ "_class": "EClass", "name": "EFactory", "elements": [
|
22
|
+
{ "_class": "EReference", "name": "ePackage" }] },
|
23
|
+
{ "_class": "EClass", "name": "EObject" },
|
24
|
+
{ "_class": "EClass", "name": "EStructuralFeature", "elements": [
|
25
|
+
{ "_class": "EAttribute", "name": "changeable" },
|
26
|
+
{ "_class": "EAttribute", "name": "defaultValue" },
|
27
|
+
{ "_class": "EAttribute", "name": "defaultValueLiteral" },
|
28
|
+
{ "_class": "EAttribute", "name": "derived" },
|
29
|
+
{ "_class": "EAttribute", "name": "transient" },
|
30
|
+
{ "_class": "EAttribute", "name": "unsettable" },
|
31
|
+
{ "_class": "EAttribute", "name": "volatile" },
|
32
|
+
{ "_class": "EReference", "name": "eContainingClass" }] },
|
33
|
+
{ "_class": "EClass", "name": "EStringToStringMapEntry", "elements": [
|
34
|
+
{ "_class": "EAttribute", "name": "key" },
|
35
|
+
{ "_class": "EAttribute", "name": "value" }] },
|
36
|
+
{ "_class": "EClass", "name": "ENamedElement", "elements": [
|
37
|
+
{ "_class": "EAttribute", "name": "name" }] },
|
38
|
+
{ "_class": "EClass", "name": "EEnumLiteral", "elements": [
|
39
|
+
{ "_class": "EAttribute", "name": "literal" },
|
40
|
+
{ "_class": "EAttribute", "name": "value" },
|
41
|
+
{ "_class": "EReference", "name": "eEnum" }] },
|
42
|
+
{ "_class": "EClass", "name": "EPackage", "elements": [
|
43
|
+
{ "_class": "EAttribute", "name": "nsPrefix" },
|
44
|
+
{ "_class": "EAttribute", "name": "nsURI" },
|
45
|
+
{ "_class": "EReference", "name": "eClassifiers" },
|
46
|
+
{ "_class": "EReference", "name": "eSubpackages" },
|
47
|
+
{ "_class": "EReference", "name": "eSuperPackage" },
|
48
|
+
{ "_class": "EReference", "name": "eFactoryInstance" }] },
|
49
|
+
{ "_class": "EClass", "name": "EEnum", "elements": [
|
50
|
+
{ "_class": "EReference", "name": "eLiterals" }] },
|
51
|
+
{ "_class": "EClass", "name": "EParameter", "elements": [
|
52
|
+
{ "_class": "EReference", "name": "eOperation" }] },
|
53
|
+
{ "_class": "EClass", "name": "EAnnotation", "elements": [
|
54
|
+
{ "_class": "EAttribute", "name": "source" },
|
55
|
+
{ "_class": "EReference", "name": "eModelElement" },
|
56
|
+
{ "_class": "EReference", "name": "details" },
|
57
|
+
{ "_class": "EReference", "name": "contents" },
|
58
|
+
{ "_class": "EReference", "name": "references" }] },
|
59
|
+
{ "_class": "EClass", "name": "EDataType", "elements": [
|
60
|
+
{ "_class": "EAttribute", "name": "serializable" }] },
|
61
|
+
{ "_class": "EClass", "name": "EClassifier", "elements": [
|
62
|
+
{ "_class": "EAttribute", "name": "defaultValue" },
|
63
|
+
{ "_class": "EAttribute", "name": "instanceClass" },
|
64
|
+
{ "_class": "EAttribute", "name": "instanceClassName" },
|
65
|
+
{ "_class": "EReference", "name": "ePackage" }] },
|
66
|
+
{ "_class": "EClass", "name": "EOperation", "elements": [
|
67
|
+
{ "_class": "EReference", "name": "eContainingClass" },
|
68
|
+
{ "_class": "EReference", "name": "eParameters" },
|
69
|
+
{ "_class": "EReference", "name": "eExceptions" }] },
|
70
|
+
{ "_class": "EClass", "name": "EClass", "elements": [
|
71
|
+
{ "_class": "EAttribute", "name": "abstract" },
|
72
|
+
{ "_class": "EAttribute", "name": "interface" },
|
73
|
+
{ "_class": "EReference", "name": "eIDAttribute" },
|
74
|
+
{ "_class": "EReference", "name": "eAllAttributes" },
|
75
|
+
{ "_class": "EReference", "name": "eAllContainments" },
|
76
|
+
{ "_class": "EReference", "name": "eAllOperations" },
|
77
|
+
{ "_class": "EReference", "name": "eAllReferences" },
|
78
|
+
{ "_class": "EReference", "name": "eAllStructuralFeatures" },
|
79
|
+
{ "_class": "EReference", "name": "eAllSuperTypes" },
|
80
|
+
{ "_class": "EReference", "name": "eAttributes" },
|
81
|
+
{ "_class": "EReference", "name": "eReferences" },
|
82
|
+
{ "_class": "EReference", "name": "eOperations" },
|
83
|
+
{ "_class": "EReference", "name": "eStructuralFeatures" },
|
84
|
+
{ "_class": "EReference", "name": "eSuperTypes" },
|
85
|
+
{ "_class": "EReference", "name": "eSubTypes" }] }] }
|
@@ -0,0 +1,85 @@
|
|
1
|
+
{ "_class": "EPackage", "name": "ECore", "elements": [
|
2
|
+
{ "_class": "EClass", "name": "EModelElement", "elements": [
|
3
|
+
{ "_class": "EReference", "name": "eAnnotations" }] },
|
4
|
+
{ "_class": "EClass", "name": "EReference", "elements": [
|
5
|
+
{ "_class": "EAttribute", "name": "container" },
|
6
|
+
{ "_class": "EAttribute", "name": "containment" },
|
7
|
+
{ "_class": "EAttribute", "name": "resolveProxies" },
|
8
|
+
{ "_class": "EReference", "name": "eOpposite" },
|
9
|
+
{ "_class": "EReference", "name": "eReferenceType" }] },
|
10
|
+
{ "_class": "EClass", "name": "ETypedElement", "elements": [
|
11
|
+
{ "_class": "EAttribute", "name": "lowerBound" },
|
12
|
+
{ "_class": "EAttribute", "name": "ordered" },
|
13
|
+
{ "_class": "EAttribute", "name": "unique" },
|
14
|
+
{ "_class": "EAttribute", "name": "upperBound" },
|
15
|
+
{ "_class": "EAttribute", "name": "many" },
|
16
|
+
{ "_class": "EAttribute", "name": "required" },
|
17
|
+
{ "_class": "EReference", "name": "eType" }] },
|
18
|
+
{ "_class": "EClass", "name": "EAttribute", "elements": [
|
19
|
+
{ "_class": "EAttribute", "name": "iD" },
|
20
|
+
{ "_class": "EReference", "name": "eAttributeType" }] },
|
21
|
+
{ "_class": "EClass", "name": "EFactory", "elements": [
|
22
|
+
{ "_class": "EReference", "name": "ePackage" }] },
|
23
|
+
{ "_class": "EClass", "name": "EObject" },
|
24
|
+
{ "_class": "EClass", "name": "EStructuralFeature", "elements": [
|
25
|
+
{ "_class": "EAttribute", "name": "changeable" },
|
26
|
+
{ "_class": "EAttribute", "name": "defaultValue" },
|
27
|
+
{ "_class": "EAttribute", "name": "defaultValueLiteral" },
|
28
|
+
{ "_class": "EAttribute", "name": "derived" },
|
29
|
+
{ "_class": "EAttribute", "name": "transient" },
|
30
|
+
{ "_class": "EAttribute", "name": "unsettable" },
|
31
|
+
{ "_class": "EAttribute", "name": "volatile" },
|
32
|
+
{ "_class": "EReference", "name": "eContainingClass" }] },
|
33
|
+
{ "_class": "EClass", "name": "EStringToStringMapEntry", "elements": [
|
34
|
+
{ "_class": "EAttribute", "name": "key" },
|
35
|
+
{ "_class": "EAttribute", "name": "value" }] },
|
36
|
+
{ "_class": "EClass", "name": "ENamedElement", "elements": [
|
37
|
+
{ "_class": "EAttribute", "name": "name" }] },
|
38
|
+
{ "_class": "EClass", "name": "EEnumLiteral", "elements": [
|
39
|
+
{ "_class": "EAttribute", "name": "literal" },
|
40
|
+
{ "_class": "EAttribute", "name": "value" },
|
41
|
+
{ "_class": "EReference", "name": "eEnum" }] },
|
42
|
+
{ "_class": "EClass", "name": "EPackage", "elements": [
|
43
|
+
{ "_class": "EAttribute", "name": "nsPrefix" },
|
44
|
+
{ "_class": "EAttribute", "name": "nsURI" },
|
45
|
+
{ "_class": "EReference", "name": "eClassifiers" },
|
46
|
+
{ "_class": "EReference", "name": "eSubpackages" },
|
47
|
+
{ "_class": "EReference", "name": "eSuperPackage" },
|
48
|
+
{ "_class": "EReference", "name": "eFactoryInstance" }] },
|
49
|
+
{ "_class": "EClass", "name": "EEnum", "elements": [
|
50
|
+
{ "_class": "EReference", "name": "eLiterals" }] },
|
51
|
+
{ "_class": "EClass", "name": "EParameter", "elements": [
|
52
|
+
{ "_class": "EReference", "name": "eOperation" }] },
|
53
|
+
{ "_class": "EClass", "name": "EAnnotation", "elements": [
|
54
|
+
{ "_class": "EAttribute", "name": "source" },
|
55
|
+
{ "_class": "EReference", "name": "eModelElement" },
|
56
|
+
{ "_class": "EReference", "name": "details" },
|
57
|
+
{ "_class": "EReference", "name": "contents" },
|
58
|
+
{ "_class": "EReference", "name": "references" }] },
|
59
|
+
{ "_class": "EClass", "name": "EDataType", "elements": [
|
60
|
+
{ "_class": "EAttribute", "name": "serializable" }] },
|
61
|
+
{ "_class": "EClass", "name": "EClassifier", "elements": [
|
62
|
+
{ "_class": "EAttribute", "name": "defaultValue" },
|
63
|
+
{ "_class": "EAttribute", "name": "instanceClass" },
|
64
|
+
{ "_class": "EAttribute", "name": "instanceClassName" },
|
65
|
+
{ "_class": "EReference", "name": "ePackage" }] },
|
66
|
+
{ "_class": "EClass", "name": "EOperation", "elements": [
|
67
|
+
{ "_class": "EReference", "name": "eContainingClass" },
|
68
|
+
{ "_class": "EReference", "name": "eParameters" },
|
69
|
+
{ "_class": "EReference", "name": "eExceptions" }] },
|
70
|
+
{ "_class": "EClass", "name": "EClass", "elements": [
|
71
|
+
{ "_class": "EAttribute", "name": "abstract" },
|
72
|
+
{ "_class": "EAttribute", "name": "interface" },
|
73
|
+
{ "_class": "EReference", "name": "eIDAttribute" },
|
74
|
+
{ "_class": "EReference", "name": "eAllAttributes" },
|
75
|
+
{ "_class": "EReference", "name": "eAllContainments" },
|
76
|
+
{ "_class": "EReference", "name": "eAllOperations" },
|
77
|
+
{ "_class": "EReference", "name": "eAllReferences" },
|
78
|
+
{ "_class": "EReference", "name": "eAllStructuralFeatures" },
|
79
|
+
{ "_class": "EReference", "name": "eAllSuperTypes" },
|
80
|
+
{ "_class": "EReference", "name": "eAttributes" },
|
81
|
+
{ "_class": "EReference", "name": "eReferences" },
|
82
|
+
{ "_class": "EReference", "name": "eOperations" },
|
83
|
+
{ "_class": "EReference", "name": "eStructuralFeatures" },
|
84
|
+
{ "_class": "EReference", "name": "eSuperTypes" },
|
85
|
+
{ "_class": "EReference", "name": "eSubTypes" }] }] }
|
@@ -0,0 +1,114 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<link rel="stylesheet" href="../../example/themes/cobalt.css" type="text/css" />
|
4
|
+
<link rel="stylesheet" href="../../example/metamodel_editor/style.css" type="text/css" />
|
5
|
+
<script src="../../redist/prototype.js" type="text/javascript"></script>
|
6
|
+
<script src="../../redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
|
7
|
+
<script src="../../concrete/concrete.js" type="text/javascript"></script>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<div id="templates1" style="display: none">
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div id="templates2" style="display: none">
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div id="metamodel" style="display: none">
|
18
|
+
[{"_class": "Datatype", "name": "String"},
|
19
|
+
{"_class": "Class", "name": "PackageableElement", "abstract": true, "features":
|
20
|
+
{"_class": "Feature", "name": "name", "kind": "attribute", "type": "String"}},
|
21
|
+
{"_class": "Class", "name": "Package", "superTypes": "PackageableElement", "features":
|
22
|
+
{"_class": "Feature", "name": "elements", "kind": "containment", "type": "PackageableElement"}},
|
23
|
+
{"_class": "Class", "name": "Class", "superTypes": "PackageableElement", "features":
|
24
|
+
{"_class": "Feature", "name": "references", "kind": "containment", "type": "Reference"}},
|
25
|
+
{"_class": "Class", "name": "Reference", "features": [
|
26
|
+
{"_class": "Feature", "name": "role", "kind": "attribute", "lowerLimit": 1, "upperLimit": 1, "type": "String"},
|
27
|
+
{"_class": "Feature", "name": "target", "kind": "reference", "lowerLimit": 1, "upperLimit": 1, "type": "Class"}]}]
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div id="index_metamodel" style="display: none">
|
31
|
+
[{"_class": "Datatype", "name": "String"},
|
32
|
+
{"_class": "Class", "name": "IndexElement", "abstract": true, "features": [
|
33
|
+
{"_class": "Feature", "name": "name", "kind": "attribute", "type": "String"},
|
34
|
+
{"_class": "Feature", "name": "elements", "kind": "containment", "type": "IndexElement"}]},
|
35
|
+
{"_class": "Class", "name": "Module", "superTypes": "IndexElement"},
|
36
|
+
{"_class": "Class", "name": "Package", "superTypes": "IndexElement"},
|
37
|
+
{"_class": "Class", "name": "Class", "superTypes": "IndexElement"}]
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div id="example_index_model" style="display: none">
|
41
|
+
[{"_class": "Module", "name": "Module1", "elements": [
|
42
|
+
{"_class": "Package", "name": "ExtP1", "elements": [
|
43
|
+
{"_class": "Class", "name": "A"},
|
44
|
+
{"_class": "Class", "name": "B", "elements": [
|
45
|
+
{"_class": "Class", "name": "B1"},
|
46
|
+
{"_class": "Class", "name": "B2"}]}]},
|
47
|
+
{"_class": "Package", "name": "ExtP2", "elements":
|
48
|
+
{"_class": "Package", "name": "ExtP21", "elements": [
|
49
|
+
{"_class": "Class", "name": "C", "elements": [
|
50
|
+
{"_class": "Class", "name": "C1"},
|
51
|
+
{"_class": "Class", "name": "C2"}]},
|
52
|
+
{"_class": "Class", "name": "D"}]}}]},
|
53
|
+
{"_class": "Module", "name": "Module2", "elements":
|
54
|
+
{"_class": "Package", "name": "ExtP3", "elements":
|
55
|
+
{"_class": "Class", "name": "E"}}}]
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div class="ct_editor" id="index_view" style="position: absolute; width: 200px">
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div id="main" style="margin-left: 250px">
|
62
|
+
<div class="ct_editor" id="editor">
|
63
|
+
</div>
|
64
|
+
<br/>
|
65
|
+
<textarea id="clipboard1" style="background-color: white; color: black; border: 1px solid grey" cols="80" rows="10" wrap="off"></textarea>
|
66
|
+
</div>
|
67
|
+
|
68
|
+
<script type="text/javascript" language="javascript" charset="utf-8">
|
69
|
+
// <![CDATA[
|
70
|
+
function createEditor(cb, eip, mp) {
|
71
|
+
var tp = new Concrete.TemplateProvider($("templates1"), {identifierAttribute: "name"});
|
72
|
+
var ip = new Concrete.QualifiedNameBasedIdentifierProvider({nameAttribute: "name"});
|
73
|
+
var ed = new Concrete.Editor($("editor"), tp, mp, ip,
|
74
|
+
{clipboard: cb,
|
75
|
+
externalIdentifierProvider: eip,
|
76
|
+
onFollowExternalReference: function(module, ident) { alert("Would open "+ident+" in "+module); },
|
77
|
+
rootClasses: mp.metaclasses.select(function(c) {return c.name == "Package"})});
|
78
|
+
return ed;
|
79
|
+
}
|
80
|
+
|
81
|
+
function createIndexView(cb) {
|
82
|
+
var tp = new Concrete.TemplateProvider($("templates2"), {identifierAttribute: "name"});
|
83
|
+
var mp = new Concrete.MetamodelProvider($("index_metamodel").textContent.evalJSON());
|
84
|
+
var ip = new Concrete.QualifiedNameBasedIdentifierProvider({nameAttribute: "name"});
|
85
|
+
var ed = new Concrete.Editor($("index_view"), tp, mp, ip,
|
86
|
+
{clipboard: cb, readOnlyMode: true});
|
87
|
+
return ed;
|
88
|
+
}
|
89
|
+
|
90
|
+
var mp = new Concrete.MetamodelProvider($("metamodel").textContent.evalJSON());
|
91
|
+
var cb = new Concrete.Clipboard($("clipboard1"));
|
92
|
+
var index = $("example_index_model").textContent.evalJSON();
|
93
|
+
var eip = new Concrete.IndexBasedExternalIdentifierProvider(index, mp);
|
94
|
+
var editor = createEditor(cb, eip, mp);
|
95
|
+
var indexView = createIndexView(cb);
|
96
|
+
indexView.setModel($("example_index_model").textContent);
|
97
|
+
|
98
|
+
Event.observe(window, 'click', function(event) {
|
99
|
+
editor.handleEvent(event);
|
100
|
+
indexView.handleEvent(event);
|
101
|
+
});
|
102
|
+
Event.observe(window, 'keydown', function(event) {
|
103
|
+
editor.handleEvent(event);
|
104
|
+
indexView.handleEvent(event);
|
105
|
+
});
|
106
|
+
Event.observe(window, 'mousemove', function(event) {
|
107
|
+
editor.handleEvent(event);
|
108
|
+
indexView.handleEvent(event);
|
109
|
+
});
|
110
|
+
// ]]>
|
111
|
+
</script>
|
112
|
+
</body>
|
113
|
+
</html>
|
114
|
+
|