mmedit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ ==0.1.0
2
+
3
+ Initial version
4
+
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2010 Martin Thiede
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
@@ -0,0 +1,63 @@
1
+ = MMEdit - A EMF/ECore metamodel editor based on Concrete
2
+
3
+ MMEdit is an example of a Concrete based editor. Concrete is a lightweight, web-based model editor which can be configured for different DSLs (Domain Specific Languages).
4
+
5
+ MMEdit is an editor for metamodels compatible with the Eclipse Modelling Framework (EMF, http://www.eclipse.org/modeling/emf). In other words, it can edit models which are instances of the ECore meta-metamodel and it can read and write the XMI serialization used by the original Eclipse based metamodel editor. Thus metamodels can be exchanged between both programs in either direction.
6
+
7
+ Being a Concrete based editor it features:
8
+ * Keyboard based editing with auto completion
9
+ * Rich graphical style with tables, boxes and icons. Use the preferences dialog to switch between the predefined layouts.
10
+
11
+ In addition to the EMF compatible .ecore XML files, MMEdit can edit ECore metamodels serialized in the RGen Ruby representation. This way it greatly improves the way RGen metamodels can be created and maintained.
12
+
13
+ MMEdit is only beta (if not alpha), so be sure to create a backup of the metamodels you are going to edit.
14
+
15
+
16
+ == Download
17
+
18
+ You can get the latest version from github.
19
+
20
+
21
+ == Installation
22
+
23
+ MMEdit can be installed as a Ruby gem:
24
+
25
+ > gem install mmedit
26
+
27
+ It requires Concrete, RGen and the little "andand" gem which should be installed automatically. Otherwise you can install them using:
28
+
29
+ > gem install andand rgen concrete
30
+
31
+ The Ruby part of Concrete should work with any Ruby version starting with Ruby 1.8.6. The Ruby installers can be downloaded from:
32
+
33
+ http://ruby-lang.org
34
+
35
+
36
+ == Documentation
37
+
38
+ Start MMEdit and press the "Browse Help" toolbar button to show the Concrete User's Guide.
39
+
40
+
41
+ == Examples
42
+
43
+ There are two example metamodel files which come with MMEdit. One is serialized using XMI, the other is serialized in the RGen metamodel format.
44
+ * example/statemachine_metamodel.ecore
45
+ * example/statemachine_metamodel.rb
46
+
47
+ In order to view and edit the metamodels just pass the respective metamodel file to MMEdit:
48
+
49
+ > mmedit example/statemachine_metamodel.ecore
50
+
51
+ or
52
+
53
+ > mmedit example/statemachine_metamodel.rb
54
+
55
+ You can also pass both metamodel files to mmedit at the same time. However this will lead to errors due to duplicate identifiers since both files contain the same metamodels.
56
+
57
+ Once MMEdit has started, point your browser to http://localhost:1234 to start editing. For best results use an up-to-date version of Chrome or Firefox.
58
+
59
+
60
+ == License
61
+
62
+ MMEdit is licensed under the terms of the MIT license, see the included MIT-LICENSE file.
63
+
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require 'mmedit'
3
+
4
+ MMEdit.run
5
+
@@ -0,0 +1,12 @@
1
+ <ecore:EPackage xmi:version="2.0" name="StatemachineMetamodel" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
2
+ <eClassifiers name="Statemachine" xsi:type="ecore:EClass">
3
+ <eStructuralFeatures name="states" derived="false" containment="true" transient="false" changeable="true" resolveProxies="true" unsettable="false" xsi:type="ecore:EReference" upperBound="-1" ordered="true" volatile="false" lowerBound="0" eType="#//State" unique="true"/>
4
+ </eClassifiers>
5
+ <eClassifiers name="Transition" xsi:type="ecore:EClass">
6
+ <eStructuralFeatures name="targetState" derived="false" containment="false" transient="false" changeable="true" resolveProxies="true" unsettable="false" xsi:type="ecore:EReference" upperBound="1" ordered="true" volatile="false" lowerBound="0" eType="#//State" unique="true"/>
7
+ </eClassifiers>
8
+ <eClassifiers name="State" xsi:type="ecore:EClass">
9
+ <eStructuralFeatures name="name" derived="false" transient="false" changeable="true" unsettable="false" iD="false" xsi:type="ecore:EAttribute" upperBound="1" ordered="true" volatile="false" lowerBound="0" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" unique="true"/>
10
+ <eStructuralFeatures name="transitions" derived="false" containment="true" transient="false" changeable="true" resolveProxies="true" unsettable="false" xsi:type="ecore:EReference" upperBound="-1" ordered="true" volatile="false" lowerBound="0" eType="#//Transition" unique="true"/>
11
+ </eClassifiers>
12
+ </ecore:EPackage>
@@ -0,0 +1,22 @@
1
+ require 'rgen/metamodel_builder'
2
+
3
+ module StatemachineMetamodel
4
+ extend RGen::MetamodelBuilder::ModuleExtension
5
+ include RGen::MetamodelBuilder::DataTypes
6
+
7
+
8
+ class Statemachine < RGen::MetamodelBuilder::MMBase
9
+ end
10
+
11
+ class State < RGen::MetamodelBuilder::MMBase
12
+ has_attr 'name', String, :lowerBound => 1
13
+ end
14
+
15
+ class Transition < RGen::MetamodelBuilder::MMBase
16
+ end
17
+
18
+ end
19
+
20
+ StatemachineMetamodel::Statemachine.contains_many_uni 'states', StatemachineMetamodel::State
21
+ StatemachineMetamodel::State.contains_many_uni 'transitions', StatemachineMetamodel::Transition
22
+ StatemachineMetamodel::Transition.has_one 'targetState', StatemachineMetamodel::State
@@ -0,0 +1,41 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" href="/concrete/example/themes/white.css" type="text/css" />
4
+ <link rel="stylesheet" href="/concrete/concrete/ui/style.css" type="text/css" />
5
+ <link rel="stylesheet" href="/html/style.css" type="text/css" />
6
+ <link rel="stylesheet" href="/syntax/style.css" type="text/css" />
7
+ <script src="/concrete/redist/prototype.js" type="text/javascript"></script>
8
+ <script src="/concrete/redist/scriptaculous/scriptaculous.js" type="text/javascript"></script>
9
+ <script src="/concrete/concrete/concrete.js" type="text/javascript"></script>
10
+ <script src="/concrete/concrete/ui/concrete_ui.js" type="text/javascript"></script>
11
+ <script src="metamodel.js" type="text/javascript"></script>
12
+ <script src="index_metamodel.js" type="text/javascript"></script>
13
+ </head>
14
+ <body>
15
+
16
+ <div id="editor_templates" style='display: none'>
17
+ <!-- html templates -->
18
+ </div>
19
+
20
+ <script type="text/javascript" language="javascript" charset="utf-8">
21
+ // <![CDATA[
22
+
23
+ Concrete.UI.Workbench.setup(Metamodel, IndexMetamodel, {
24
+
25
+ moduleEditorOptions: {
26
+ rootClasses: ["EPackage"],
27
+ templateProvider: new Concrete.TemplateProvider($("editor_templates"), {
28
+ identifierAttribute: "name",
29
+ alwaysHideFeatures: ["ordered", "unique", "changeable", "derived", "transient", "unsettable", "volatile", "iD", "resolveProxies", "instanceClassName", "abstract", "interface"]
30
+ }),
31
+ shortReferences: true
32
+ }
33
+ });
34
+
35
+ // ]]>
36
+ </script>
37
+ </body>
38
+ </html>
39
+
40
+
41
+
File without changes
@@ -0,0 +1,42 @@
1
+ require 'version'
2
+ require 'mmedit/data_provider'
3
+ require 'concrete/working_set'
4
+ require 'concrete/index_builder'
5
+ require 'concrete/util/logger'
6
+ require 'concrete/server'
7
+ require 'concrete/concrete_syntax_provider'
8
+ require 'concrete/config'
9
+
10
+ module MMEdit
11
+
12
+ def self.run
13
+ puts "mmedit #{MMEDIT_VERSION}"
14
+ puts
15
+
16
+ edit
17
+
18
+ exit(0)
19
+ end
20
+
21
+ def self.edit
22
+ logger = Concrete::Util::Logger.new
23
+
24
+ workingSet = Concrete::WorkingSet.new(".")
25
+ ARGV.each{|a| workingSet.addFile(a)}
26
+
27
+ logger.info "Point your Firefox or Chrome to http://localhost:1234 ..."
28
+ mm = RGen::ECore
29
+ indexBuilder = Concrete::IndexBuilder.new(mm)
30
+ indexBuilder.indexMetamodel
31
+
32
+ userHome = File.expand_path("~")
33
+ logger.info "User syntax load dir: #{userHome}/.mmedit"
34
+ syntaxDirs = [File.dirname(__FILE__)+"/../syntax", userHome+"/.mmedit"]
35
+
36
+ dataProvider = MMEdit::DataProvider.new(workingSet, mm, indexBuilder, logger)
37
+ config = Concrete::Config.new(File.expand_path("~/.mmedit_config"))
38
+ syntaxProvider = Concrete::ConcreteSyntaxProvider.new(syntaxDirs, logger, config)
39
+ Concrete::Server.new(workingSet, dataProvider, syntaxProvider, File.dirname(__FILE__)+"/../html").start
40
+ end
41
+
42
+ end
@@ -0,0 +1,249 @@
1
+ require 'rgen/environment'
2
+ require 'rgen/instantiator/ecore_xml_instantiator'
3
+ require 'rgen/serializer/xmi20_serializer'
4
+ require 'mmgen/metamodel_generator'
5
+ require 'concrete/file_cache_map'
6
+ require 'concrete/util/string_writer'
7
+ require 'concrete/metamodel/ecore_to_concrete'
8
+ require 'rgen/serializer/json_serializer'
9
+ require 'rgen/instantiator/json_instantiator'
10
+
11
+ module MMEdit
12
+
13
+ class DataProvider
14
+ include MMGen::MetamodelGenerator
15
+
16
+ BuiltInIdent = "_builtin"
17
+
18
+ def initialize(workingSet, mm, indexBuilder, logger)
19
+ @workingSet = workingSet
20
+ @mm = mm
21
+ @indexBuilder = indexBuilder
22
+ @logger = logger
23
+ @jsonModelCache = Concrete::FileCacheMap.new(".mmedit", ".json")
24
+ @jsonModelCache.versionInfo = MMEDIT_VERSION
25
+ @jsonIndexCache = Concrete::FileCacheMap.new(".mmedit", ".index")
26
+ @jsonIndexCache.versionInfo = MMEDIT_VERSION
27
+ end
28
+
29
+ def metamodelAsJson
30
+ return @metamodelAsJson if @metamodelAsJson
31
+
32
+ env = RGen::Environment.new
33
+
34
+ trans = Concrete::Metamodel::ECoreToConcrete.new(nil, env, :featureFilter => proc{|f| !f.derived && f.name != "eSubTypes"})
35
+ trans.trans(@mm.ecore.eAllClasses)
36
+
37
+ writer = Concrete::Util::StringWriter.new
38
+ ser = RGen::Serializer::JsonSerializer.new(writer, :leadingSeparator => false)
39
+ ser.serialize(env.find(:class => Concrete::Metamodel::ConcreteMMM::Classifier))
40
+
41
+ @metamodelAsJson = "var Metamodel = "+writer.string+";"
42
+ end
43
+
44
+ def indexMetamodelAsJson
45
+ return @indexMetamodelAsJson if @indexMetamodelAsJson
46
+
47
+ env = RGen::Environment.new
48
+ trans = Concrete::Metamodel::ECoreToConcrete.new(nil, env)
49
+ trans.trans(@indexBuilder.indexMetamodel.ecore.eAllClasses)
50
+
51
+ writer = Concrete::Util::StringWriter.new
52
+ ser = RGen::Serializer::JsonSerializer.new(writer, :leadingSeparator => false)
53
+ ser.serialize(env.find(:class => Concrete::Metamodel::ConcreteMMM::Classifier))
54
+
55
+ @indexMetamodelAsJson = "var IndexMetamodel = "+writer.string+";"
56
+ end
57
+
58
+ def getJsonModel(fileIdent)
59
+ if (fileIdent == BuiltInIdent)
60
+ builtInJsonModel
61
+ else
62
+ cachedData(fileIdent, @jsonModelCache)
63
+ end
64
+ end
65
+
66
+ def createModule(fileIdent)
67
+ return if fileIdent =~ /\.\./
68
+ newfile = Pathname.new(@workingSet.rootPath + "/" + fileIdent).cleanpath.to_s
69
+
70
+ unless File.exist?(newfile)
71
+ @logger.info("Creating module #{newfile}")
72
+ FileUtils.mkdir_p(File.dirname(newfile))
73
+
74
+ root = RGen::ECore::EPackage.new(:name => "Untitled")
75
+ if fileIdent =~ /\.ecore$/
76
+ File.open(newfile,"w") do |f|
77
+ ser = RGen::Serializer::XMI20Serializer.new(f)
78
+ ser.serialize(root)
79
+ end
80
+ else
81
+ generateMetamodel(root, newfile)
82
+ end
83
+ else
84
+ @logger.info("Using existing module #{newfile}")
85
+ end
86
+
87
+ @workingSet.addFile(newfile)
88
+ end
89
+
90
+ def setJsonModel(fileIdent, data)
91
+ return if (fileIdent == BuiltInIdent)
92
+
93
+ env = RGen::Environment.new
94
+
95
+ inst = RGen::Instantiator::JsonInstantiator.new(env, @mm, :separator => "/", :leadingSeparator => true)
96
+ unresolvedReferences = inst.instantiate(data)
97
+
98
+ resolveReferencesToBuiltins(unresolvedReferences)
99
+
100
+ outfile = @workingSet.getFile(fileIdent)
101
+ return unless outfile
102
+
103
+ tempfile = outfile+".mmedit.tmp"
104
+ root = env.find(:class => RGen::ECore::EPackage).find{|p| p.eSuperPackage.nil?}
105
+ if fileIdent =~ /\.ecore$/
106
+ File.open(tempfile,"w") do |f|
107
+ ser = RGen::Serializer::XMI20Serializer.new(f)
108
+ ser.serialize(root)
109
+ end
110
+ else
111
+ generateMetamodel(root, tempfile)
112
+ end
113
+ FileUtils.mv(tempfile, outfile)
114
+
115
+ @jsonModelCache.storeData(outfile, data)
116
+ generateJsonIndex(outfile, root)
117
+ end
118
+
119
+ def getAllJsonIndex
120
+ puts "load index"
121
+ "[" + (@workingSet.fileIdentifiers + [BuiltInIdent]).collect do |ident|
122
+ '{ "_class": "Module", "name": "'+ident+'", "elements":'+"\n"+getJsonIndex(ident)+"}"
123
+ end.join(",\n") + "]"
124
+ end
125
+
126
+ private
127
+
128
+ def getJsonIndex(fileIdent)
129
+ if (fileIdent == BuiltInIdent)
130
+ builtInJsonIndex
131
+ else
132
+ cachedData(fileIdent, @jsonIndexCache)
133
+ end
134
+ end
135
+
136
+ def cachedData(fileIdent, cache)
137
+ infile = @workingSet.getFile(fileIdent)
138
+ return unless infile
139
+ outdata = cache.loadData(infile)
140
+ if outdata == :invalid
141
+ generateArtefacts(infile)
142
+ outdata = cache.loadData(infile)
143
+ end
144
+ outdata
145
+ end
146
+
147
+ def generateArtefacts(file)
148
+ if file =~ /\.ecore$/
149
+ rootp = loadECoreMetamodel(file)
150
+ else
151
+ rootp = loadRGenMetamodel(file)
152
+ end
153
+ generateJsonModel(file, rootp)
154
+ generateJsonIndex(file, rootp)
155
+ end
156
+
157
+ def generateJsonModel(file, root)
158
+ @logger.info "caching json model..."
159
+ writer = Concrete::Util::StringWriter.new
160
+ ser = RGen::Serializer::JsonSerializer.new(writer)
161
+ ser.serialize(root)
162
+ @jsonModelCache.storeData(file, writer.string)
163
+ end
164
+
165
+ def generateJsonIndex(file, root)
166
+ @logger.info "caching json index..."
167
+ index = @indexBuilder.buildIndex(root)
168
+ writer = Concrete::Util::StringWriter.new
169
+ ser = RGen::Serializer::JsonSerializer.new(writer)
170
+ ser.serialize(index)
171
+ @jsonIndexCache.storeData(file, writer.string)
172
+ end
173
+
174
+ def self.removeLoadContainer
175
+ remove_const(:LoadContainer) if const_defined?(:LoadContainer)
176
+ end
177
+
178
+ def loadRGenMetamodel(file)
179
+ self.class.removeLoadContainer
180
+ eval("module LoadContainer; end")
181
+ LoadContainer.module_eval(File.read(file))
182
+ mmname = LoadContainer.constants.find{|c| LoadContainer.const_get(c).respond_to?(:ecore)}
183
+ LoadContainer.const_get(mmname).ecore
184
+ end
185
+
186
+ def loadECoreMetamodel(file)
187
+ env = RGen::Environment.new
188
+ File.open(file) do |f|
189
+ ECoreXMLInstantiator.new(env).instantiate(f.read)
190
+ end
191
+ env.find(:class => RGen::ECore::EPackage).find{|p| p.eSuperPackage.nil?}
192
+ end
193
+
194
+ def builtInJsonModel
195
+ writer = Concrete::Util::StringWriter.new
196
+ ser = RGen::Serializer::JsonSerializer.new(writer)
197
+ ser.serialize(builtInModel)
198
+ writer.string
199
+ end
200
+
201
+ def builtInJsonIndex
202
+ index = builtInModel.collect{|e| @indexBuilder.buildIndex(e)}
203
+ writer = Concrete::Util::StringWriter.new
204
+ ser = RGen::Serializer::JsonSerializer.new(writer)
205
+ ser.serialize(index)
206
+ writer.string
207
+ end
208
+
209
+ def builtInModel
210
+ [
211
+ RGen::ECore::EString,
212
+ RGen::ECore::EInt,
213
+ RGen::ECore::EBoolean,
214
+ RGen::ECore::EFloat,
215
+ RGen::ECore::ERubyObject,
216
+ RGen::ECore::EJavaObject,
217
+ RGen::ECore::ERubyClass,
218
+ RGen::ECore::EJavaClass
219
+ ]
220
+ end
221
+
222
+ def resolveReferencesToBuiltins(unresolvedReferences)
223
+ unresolvedReferences.each do |ur|
224
+ target = case ur.proxy.targetIdentifier
225
+ when "/EString"; RGen::ECore::EString
226
+ when "/EInt"; RGen::ECore::EInt
227
+ when "/EFloat"; RGen::ECore::EFloat
228
+ when "/EBoolean"; RGen::ECore::EBoolean
229
+ when "/EJavaObject"; RGen::ECore::EJavaObject
230
+ when "/EJavaClass"; RGen::ECore::EJavaClass
231
+ when "/ERubyObject"; RGen::ECore::ERubyObject
232
+ when "/ERubyClass"; RGen::ECore::ERubyClass
233
+ else
234
+ nil
235
+ end
236
+ if ur.element.hasManyMethods(ur.featureName)
237
+ ur.element.removeGeneric(ur.featureName, ur.proxy)
238
+ ur.element.addGeneric(ur.featureName, target)
239
+ else
240
+ # this will replace the proxy
241
+ ur.element.setGeneric(ur.featureName, target)
242
+ end
243
+ end
244
+ end
245
+
246
+ end
247
+
248
+ end
249
+
@@ -0,0 +1,2 @@
1
+ MMEDIT_VERSION = "0.1.0"
2
+
@@ -0,0 +1,10 @@
1
+ # Run in non-Gem mode
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__),"lib")
4
+ # Uncomment the following lines to also require rgen and concrete directly from source code
5
+ #$:.unshift File.join(File.dirname(__FILE__),"../rgen/lib")
6
+ #$:.unshift File.join(File.dirname(__FILE__),"../concrete/lib")
7
+
8
+ require 'MMEdit'
9
+
10
+ MMEdit.run
@@ -0,0 +1,37 @@
1
+ VERSION_FILE = File.dirname(__FILE__)+"/lib/version.rb"
2
+ require VERSION_FILE
3
+
4
+ require 'pathname'
5
+ require 'rake/gempackagetask'
6
+
7
+ GemSpec = Gem::Specification.new do |s|
8
+ s.name = "mmedit"
9
+ s.version = MMEDIT_VERSION
10
+ s.date = Time.now.strftime("%Y-%m-%d")
11
+ s.summary = %q{A metamodel editor based on Concrete}
12
+ s.authors = ["Martin Thiede"]
13
+ # we want no rdoc or ri
14
+ s.rdoc_options = ["-x", ".*"]
15
+ s.required_ruby_version = Gem::Version::Requirement.new(">= 1.8.6")
16
+ s.add_dependency('rgen', '>= 0.5.2')
17
+ s.add_dependency('concrete', '>= 0.2.0')
18
+ gemfiles = Rake::FileList.new
19
+ gemfiles.include("example/**/*")
20
+ gemfiles.include("html/**/*")
21
+ gemfiles.include("lib/**/*")
22
+ gemfiles.include("syntax/**/*")
23
+ gemfiles.include("mmedit.rb", "rakefile", "CHANGELOG", "MIT-LICENSE", "README.rdoc")
24
+ s.files = gemfiles
25
+ s.require_paths << "lib"
26
+ s.executables = ["mmedit"]
27
+ end
28
+
29
+ Rake::GemPackageTask.new(GemSpec) do |p|
30
+ p.need_zip = false
31
+ end
32
+
33
+ task :default => :package
34
+
35
+ task :clobber => :clobber_package
36
+
37
+
@@ -0,0 +1,119 @@
1
+ /* overwrite general styles */
2
+
3
+ body {
4
+ font-family: verdana;
5
+ }
6
+
7
+ .ct_inline_editor input {
8
+ font-family: verdana;
9
+ }
10
+
11
+ /* overwrite predefined styles for module editor */
12
+
13
+ .ct_module_editor .ct_value {
14
+ margin: 0;
15
+ }
16
+
17
+ .ct_module_editor .ct_empty {
18
+ background-color: #aaa;
19
+ }
20
+
21
+ /* EPackage */
22
+
23
+ .ct_module_editor .ct_element.ctc_EPackage {
24
+ padding: 2px 0 2px 0;
25
+ border: 1px solid grey;
26
+ margin: 10px;
27
+ background-color: rgba(255, 255, 0, 0.3);
28
+ }
29
+
30
+ .ct_module_editor .ctc_EPackage > .ctn_name {
31
+ font-size: 150%;
32
+ border-bottom: 1px solid grey;
33
+ padding: 3px;
34
+ }
35
+
36
+ .ct_module_editor .ctc_EPackage .ct_fold_button {
37
+ margin: 2px 4px 2px 4px;
38
+ }
39
+
40
+ /* EClass */
41
+
42
+ .ct_module_editor .ct_element.ctc_EClass {
43
+ padding: 2px 0 2px 0;
44
+ border: 1px solid grey;
45
+ display: inline-block;
46
+ margin: 10px;
47
+ background-color: #faa;
48
+ }
49
+
50
+ .ct_module_editor .ctc_EClass > .ctn_name {
51
+ font-size: 150%;
52
+ border-bottom: 1px solid grey;
53
+ text-align: center;
54
+ padding: 3px;
55
+ }
56
+
57
+ .ct_module_editor .ctc_EClass .ct_fold_button {
58
+ margin: 2px 4px 2px 4px;
59
+ }
60
+
61
+ .ct_module_editor .ctn_eSuperTypes .ct_value {
62
+ display: block;
63
+ }
64
+
65
+ /* EReference */
66
+
67
+ .ct_module_editor .ctc_EReference > .icon {
68
+ display: inline-block;
69
+ width: 20px;
70
+ height: 9px;
71
+ background-image: url("images/ref_icon_thin.png");
72
+ }
73
+
74
+ .ct_module_editor .ctn_containment > .icon {
75
+ display: inline-block;
76
+ width: 16px;
77
+ height: 9px;
78
+ background-image: url("images/composite_icon.png");
79
+ margin-right: 3px;
80
+ }
81
+
82
+ .ct_module_editor .ctn_eOpposite > .icon {
83
+ display: inline-block;
84
+ width: 16px;
85
+ height: 9px;
86
+ background-image: url("images/opposite_icon.png");
87
+ margin-right: 3px;
88
+ }
89
+
90
+ /* EAttribute */
91
+
92
+ .ct_module_editor .ctc_EAttribute > .icon {
93
+ display: inline-block;
94
+ width: 20px;
95
+ height: 9px;
96
+ background-image: url("images/attr_icon_thin.png");
97
+ }
98
+
99
+ /* general styles which must overwrite styles defined about */
100
+
101
+ .ct_module_editor .ct_selected {
102
+ background-color: #ccf;
103
+ }
104
+
105
+ .ct_module_editor .ct_element.ct_selected {
106
+ background-color: #ccf;
107
+ }
108
+
109
+ .ct_module_editor .ct_ref_target {
110
+ background-color: #ddf;
111
+ }
112
+
113
+ .ct_module_editor .ct_element.ct_ref_target {
114
+ background-color: #ddf;
115
+ }
116
+
117
+ .ct_module_editor .ct_element.ct_error {
118
+ border-left: 5px solid #F77;
119
+ }
@@ -0,0 +1,76 @@
1
+ <div class="ct_element ctc_EPackage">
2
+ <div class="ct_handle"></div>
3
+ <div class="ct_attribute ctn_name"><span class='ct_fold_button'></span><span class="ct_slot"></span></div>
4
+ <div style="margin: 5px">
5
+ <span class="ct_attribute ctn_nsPrefix ct_always_hide"><span class="ct_feature_name">nsPrefix: </span><span class="ct_slot"></span></span>
6
+ <span class="ct_attribute ctn_nsURI ct_always_hide"><span class="ct_feature_name">nsURI: </span><span class="ct_slot"></span></span>
7
+ <span class="ct_reference ctn_eFactoryInstance ct_always_hide"><span class="ct_feature_name">eFactoryInstance: </span><span class="ct_slot"></span></span>
8
+ </div>
9
+ <div class="ct_containment ctn_eClassifiers ct_auto_hide" style="padding: 5px">
10
+ <div class="ct_slot"></div>
11
+ </div>
12
+ <div class="ct_containment ctn_eSubpackages ct_auto_hide" style="padding: 5px">
13
+ <div class="ct_slot"></div>
14
+ </div>
15
+ <div class="ct_containment ctn_eAnnotations ct_auto_hide" style="padding: 5px">
16
+ <div class="ct_slot"></div>
17
+ </div>
18
+ </div>
19
+
20
+ <div class="ct_element ctc_EClass">
21
+ <div class="ct_handle"></div>
22
+ <div class="ct_reference ctn_eSuperTypes ct_auto_hide" style="text-align: right; text-decoration: italic"><span class="ct_slot"></span></div>
23
+ <div class="ct_attribute ctn_name"><span class='ct_fold_button'></span><span class="ct_slot"></span></div>
24
+ <div style="margin: 5px">
25
+ <span class="ct_attribute ctn_abstract ct_always_hide"><span class="ct_feature_name">abstract: </span><span class="ct_slot"></span></span>
26
+ <span class="ct_attribute ctn_interface ct_always_hide"><span class="ct_feature_name">interface: </span><span class="ct_slot"></span></span>
27
+ <span class="ct_attribute ctn_instanceClassName ct_always_hide"><span class="ct_feature_name">instanceClassName: </span><span class="ct_slot"></span></span>
28
+ </div>
29
+ <div class="ct_containment ctn_eStructuralFeatures ct_auto_hide" style="padding: 5px">
30
+ <div class="ct_slot"></div>
31
+ </div>
32
+ <div class="ct_containment ctn_eOperations ct_auto_hide" style="padding: 5px">
33
+ <div class="ct_slot"></div>
34
+ </div>
35
+ <div class="ct_containment ctn_eAnnotations ct_auto_hide" style="padding: 5px">
36
+ <div class="ct_slot"></div>
37
+ </div>
38
+ </div>
39
+
40
+ <div class="ct_element ctc_EReference" style="margin: 0">
41
+ <span class="icon"></span>
42
+ <span class="ct_attribute ctn_name" style=""><span class="ct_slot"></span></span>:
43
+ <span class="ct_reference ctn_eType" style=""><span class="ct_slot"></span></span>
44
+ [<span class="ct_attribute ctn_lowerBound ct_auto_hide" style=""><span class="ct_slot"></span></span>,<span class="ct_attribute ctn_upperBound ct_auto_hide" style=""><span class="ct_slot"></span></span>]
45
+ <span class="ct_attribute ctn_containment ct_auto_hide"><span class="icon"></span><span class="ct_slot"></span></span>
46
+ <span class="ct_reference ctn_eOpposite ct_auto_hide"><span class="icon"></span><span class="ct_slot"></span></span>
47
+
48
+ <span class="ct_attribute ctn_ordered ct_always_hide"><span class="ct_feature_name">ordered: </span><span class="ct_slot"></span></span>
49
+ <span class="ct_attribute ctn_unique ct_always_hide"><span class="ct_feature_name">unique: </span><span class="ct_slot"></span></span>
50
+ <span class="ct_attribute ctn_changeable ct_always_hide"><span class="ct_feature_name">changeable: </span><span class="ct_slot"></span></span>
51
+ <span class="ct_attribute ctn_derived ct_always_hide"><span class="ct_feature_name">derived: </span><span class="ct_slot"></span></span>
52
+ <span class="ct_attribute ctn_transient ct_always_hide"><span class="ct_feature_name">transient: </span><span class="ct_slot"></span></span>
53
+ <span class="ct_attribute ctn_unsettable ct_always_hide"><span class="ct_feature_name">unsettable: </span><span class="ct_slot"></span></span>
54
+ <span class="ct_attribute ctn_volatile ct_always_hide"><span class="ct_feature_name">volatile: </span><span class="ct_slot"></span></span>
55
+ <span class="ct_attribute ctn_resolveProxies ct_always_hide"><span class="ct_feature_name">resolveProxies: </span><span class="ct_slot"></span></span>
56
+ <span class="ct_attribute ctn_defaultValueLiteral ct_always_hide"><span class="ct_feature_name">defaultValueLiteral: </span><span class="ct_slot"></span></span>
57
+ <div class="ct_containment ctn_eAnnotations ct_auto_hide"><span class="ct_feature_name">eAnnotations: </span><div class="ct_slot"></div></div>
58
+ </div>
59
+
60
+ <div class="ct_element ctc_EAttribute" style="margin: 0">
61
+ <span class="icon"></span>
62
+ <span class="ct_attribute ctn_name" style=""><span class="ct_slot"></span></span>:
63
+ <span class="ct_reference ctn_eType" style=""><span class="ct_slot"></span></span>
64
+ [<span class="ct_attribute ctn_lowerBound ct_auto_hide" style=""><span class="ct_slot"></span></span>,<span class="ct_attribute ctn_upperBound ct_auto_hide" style=""><span class="ct_slot"></span></span>]
65
+
66
+ <span class="ct_attribute ctn_ordered ct_always_hide"><span class="ct_feature_name">ordered: </span><span class="ct_slot"></span></span>
67
+ <span class="ct_attribute ctn_unique ct_always_hide"><span class="ct_feature_name">unique: </span><span class="ct_slot"></span></span>
68
+ <span class="ct_attribute ctn_changeable ct_always_hide"><span class="ct_feature_name">changeable: </span><span class="ct_slot"></span></span>
69
+ <span class="ct_attribute ctn_derived ct_always_hide"><span class="ct_feature_name">derived: </span><span class="ct_slot"></span></span>
70
+ <span class="ct_attribute ctn_transient ct_always_hide"><span class="ct_feature_name">transient: </span><span class="ct_slot"></span></span>
71
+ <span class="ct_attribute ctn_unsettable ct_always_hide"><span class="ct_feature_name">unsettable: </span><span class="ct_slot"></span></span>
72
+ <span class="ct_attribute ctn_volatile ct_always_hide"><span class="ct_feature_name">volatile: </span><span class="ct_slot"></span></span>
73
+ <span class="ct_attribute ctn_defaultValueLiteral ct_always_hide"><span class="ct_feature_name">defaultValueLiteral: </span><span class="ct_slot"></span></span>
74
+ <span class="ct_attribute ctn_iD ct_always_hide"><span class="ct_feature_name">iD: </span><span class="ct_slot"></span></span>
75
+ <div class="ct_containment ctn_eAnnotations ct_auto_hide"><span class="ct_feature_name">eAnnotations: </span><div class="ct_slot"></div></div>
76
+ </div>
File without changes
File without changes
@@ -0,0 +1,33 @@
1
+ .ctn_eStructuralFeatures table {
2
+ font-family: "courier new";
3
+ font-size: 12;
4
+ border-collapse: collapse;
5
+ border-spacing: 0px;
6
+ margin: 2px;
7
+ margin-left: 10px;
8
+ }
9
+
10
+ .ctn_eStructuralFeatures thead {
11
+ color: black;
12
+ background-color: #bbb;
13
+ }
14
+
15
+ .ctn_eStructuralFeatures table td {
16
+ border: 1px solid #777;
17
+ padding: 2px;
18
+ }
19
+
20
+ .ctc_EReference .icon {
21
+ display: inline-block;
22
+ width: 20px;
23
+ height: 16px;
24
+ background-image: url("images/ref_icon.png")
25
+ }
26
+
27
+ .ctc_EAttribute .icon {
28
+ display: inline-block;
29
+ width: 20px;
30
+ height: 16px;
31
+ background-image: url("images/attr_icon.png")
32
+ }
33
+
@@ -0,0 +1,78 @@
1
+ <div class="ct_element ctc_EClass">
2
+ <span class="ct_handle ct_class_name">EClass</span>
3
+ <span class="ct_attribute ctn_name ct_identifier_attribute">
4
+ <span class="ct_feature_name">name: </span><span class="ct_slot"></span>
5
+ </span>
6
+ <span class="ct_reference ctn_eSuperTypes ct_auto_hide">
7
+ <span class="ct_feature_name">eSuperTypes: </span><span class="ct_slot"></span>
8
+ </span>
9
+ <span class="ct_attribute ctn_abstract ct_always_hide">
10
+ <span class="ct_feature_name">abstract: </span><span class="ct_slot"></span>
11
+ </span>
12
+ <span class="ct_attribute ctn_interface ct_always_hide">
13
+ <span class="ct_feature_name">interface: </span><span class="ct_slot"></span>
14
+ </span> <span class="ct_attribute ctn_instanceClassName ct_always_hide">
15
+ <span class="ct_feature_name">instanceClassName: </span><span class="ct_slot"></span>
16
+ </span>
17
+ <div class="ct_containment ctn_eStructuralFeatures ct_auto_hide">
18
+ <span class="ct_feature_name">eStructuralFeatures: </span>
19
+ <table>
20
+ <thead>
21
+ <tr><td></td><td>Name</td><td>Cont</td><td>LowLim</td><td>UpLim</td><td>Type</td><td>Opposite</td><td>..</td></tr>
22
+ </thead>
23
+ <tbody class="ct_slot">
24
+ </tbody>
25
+ </table>
26
+ </div>
27
+ <div class="ct_containment ctn_eOperations ct_auto_hide">
28
+ <span class="ct_feature_name">eOperations: </span><span class="ct_slot"></span>
29
+ </div>
30
+ <div class="ct_containment ctn_eAnnotations ct_always_hide">
31
+ <span class="ct_feature_name">eAnnotations: </span><span class="ct_slot"></span>
32
+ </div>
33
+ </div>
34
+ <table> <!-- dummy table to make valid template dom -->
35
+ <tr class="ct_element ctc_EReference">
36
+ <td><span class="icon"></span></td>
37
+ <td class="ct_attribute ctn_name"><span class="ct_slot"></span></td>
38
+ <td class="ct_attribute ctn_containment"><span class="ct_slot"></span></td>
39
+ <td class="ct_attribute ctn_lowerBound" style="text-align: right"><span class="ct_slot"></span></td>
40
+ <td class="ct_attribute ctn_upperBound" style="text-align: right"><span class="ct_slot"></span></td>
41
+ <td class="ct_reference ctn_eType"><span class="ct_slot"></span></td>
42
+ <td class="ct_reference ctn_eOpposite"><span class="ct_slot"></span></td>
43
+ <td>
44
+ <span class="ct_attribute ctn_ordered ct_always_hide"><span class="ct_feature_name">ordered: </span><span class="ct_slot"></span></span>
45
+ <span class="ct_attribute ctn_unique ct_always_hide"><span class="ct_feature_name">unique: </span><span class="ct_slot"></span></span>
46
+ <span class="ct_attribute ctn_changeable ct_always_hide"><span class="ct_feature_name">changeable: </span><span class="ct_slot"></span></span>
47
+ <span class="ct_attribute ctn_derived ct_always_hide"><span class="ct_feature_name">derived: </span><span class="ct_slot"></span></span>
48
+ <span class="ct_attribute ctn_transient ct_always_hide"><span class="ct_feature_name">transient: </span><span class="ct_slot"></span></span>
49
+ <span class="ct_attribute ctn_unsettable ct_always_hide"><span class="ct_feature_name">unsettable: </span><span class="ct_slot"></span></span>
50
+ <span class="ct_attribute ctn_volatile ct_always_hide"><span class="ct_feature_name">volatile: </span><span class="ct_slot"></span></span>
51
+ <span class="ct_attribute ctn_resolveProxies ct_always_hide"><span class="ct_feature_name">resolveProxies: </span><span class="ct_slot"></span></span>
52
+ <span class="ct_attribute ctn_defaultValueLiteral ct_always_hide"><span class="ct_feature_name">defaultValueLiteral: </span><span class="ct_slot"></span></span>
53
+ <div class="ct_containment ctn_eAnnotations ct_always_hide"><span class="ct_feature_name">eAnnotations: </span><div class="ct_slot"></div></div>
54
+ </td>
55
+ </tr>
56
+ <tr class="ct_element ctc_EAttribute">
57
+ <td><span class="icon"></span></td>
58
+ <td class="ct_attribute ctn_name"><span class="ct_slot"></span></td>
59
+ <td>-</td>
60
+ <td class="ct_attribute ctn_lowerBound" style="text-align: right"><span class="ct_slot"></span></td>
61
+ <td class="ct_attribute ctn_upperBound" style="text-align: right"><span class="ct_slot"></span></td>
62
+ <td class="ct_reference ctn_eType"><span class="ct_slot"></span></td>
63
+ <td>-</td>
64
+ <td>
65
+ <span class="ct_attribute ctn_ordered ct_always_hide"><span class="ct_feature_name">ordered: </span><span class="ct_slot"></span></span>
66
+ <span class="ct_attribute ctn_unique ct_always_hide"><span class="ct_feature_name">unique: </span><span class="ct_slot"></span></span>
67
+ <span class="ct_attribute ctn_changeable ct_always_hide"><span class="ct_feature_name">changeable: </span><span class="ct_slot"></span></span>
68
+ <span class="ct_attribute ctn_derived ct_always_hide"><span class="ct_feature_name">derived: </span><span class="ct_slot"></span></span>
69
+ <span class="ct_attribute ctn_transient ct_always_hide"><span class="ct_feature_name">transient: </span><span class="ct_slot"></span></span>
70
+ <span class="ct_attribute ctn_unsettable ct_always_hide"><span class="ct_feature_name">unsettable: </span><span class="ct_slot"></span></span>
71
+ <span class="ct_attribute ctn_volatile ct_always_hide"><span class="ct_feature_name">volatile: </span><span class="ct_slot"></span></span>
72
+ <span class="ct_attribute ctn_defaultValueLiteral ct_always_hide"><span class="ct_feature_name">defaultValueLiteral: </span><span class="ct_slot"></span></span>
73
+ <span class="ct_attribute ctn_iD ct_always_hide"><span class="ct_feature_name">iD: </span><span class="ct_slot"></span></span>
74
+ <div class="ct_containment ctn_eAnnotations ct_always_hide"><span class="ct_feature_name">eAnnotations: </span><div class="ct_slot"></div></div>
75
+ </td>
76
+ </tr>
77
+ </table>
78
+
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mmedit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Martin Thiede
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-06-14 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rgen
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.5.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: concrete
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.0
34
+ version:
35
+ description:
36
+ email:
37
+ executables:
38
+ - mmedit
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - example/statemachine_metamodel.ecore
45
+ - example/statemachine_metamodel.rb
46
+ - html/editor.html
47
+ - html/style.css
48
+ - lib/mmedit/data_provider.rb
49
+ - lib/mmedit.rb
50
+ - lib/version.rb
51
+ - syntax/box_layout/images/attr_icon_thin.png
52
+ - syntax/box_layout/images/composite_icon.png
53
+ - syntax/box_layout/images/opposite_icon.png
54
+ - syntax/box_layout/images/ref_icon_thin.png
55
+ - syntax/box_layout/style.css
56
+ - syntax/box_layout/templates.html
57
+ - syntax/standard_layout/style.css
58
+ - syntax/standard_layout/templates.html
59
+ - syntax/table_layout/images/attr_icon.png
60
+ - syntax/table_layout/images/ref_icon.png
61
+ - syntax/table_layout/style.css
62
+ - syntax/table_layout/templates.html
63
+ - mmedit.rb
64
+ - rakefile
65
+ - CHANGELOG
66
+ - MIT-LICENSE
67
+ - README.rdoc
68
+ has_rdoc: true
69
+ homepage:
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options:
74
+ - -x
75
+ - .*
76
+ require_paths:
77
+ - lib
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 1.8.6
84
+ version:
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ version:
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.3.5
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: A metamodel editor based on Concrete
98
+ test_files: []
99
+