running ACCELEO from ACCELEO on the DSL contained in model elements - eclipse-emf

I have a UML activity with OpaqueActions containing a DSL. The DSL grammar is expressed by means of XText thus there is an EMF ECORE model and editor for it. I have an ACCELEO M2T transformation transforming UML activities in text and I'd like to trigger (from such transformation) another transformation (from the DSL meta-model to text) providing as input the DSL containing in the opaque actions of the activity. Is there any way to easily do that?

You can create two generators, one for your UML transformation and the second one for your DSL and call the first one from the second one once you encounter your DSL elements while navigating in your UML model.

Related

Seeking Qt5 WYSIGWG editor design advice

I am planning a new desktop application. It will provide a WYSIWYG editor for HL7
files (OSS Project). HL7 is a structured file format often used by hospitals for
exchanging data between systems.
The basic structure of the format comprises of records which are \r
delimited. A record can have N fields which are | delimited. A field itself
can be sub-devided into components ^ and sub-components & and
fields can be repeated ~ (similar to an array). Every message type has a
different number of fields/components and sub-components. Empty fields at the
end of a record can be omitted.
Example of a simple record:
OBX|14|NM|0050–5^Calcium||8.9|mg/dl|8.4–10.4||||F
I have already implemented an efficient parser which turns a whole file into a
hirarchial data structure in C. I want to implement an application that
allows editing these files like in a text editor. I want to keep the underlaying
hirarchial datastructure at any point, so it is easy to validate structure and
content of every field, upon user changes, quickly.
Also note worthy is, that I already implemented a viewer where the document
strcuture is displayed in a QTreeView. The structure is using a QAbstractItemModel.
Now to my actual question: how would I approach the problem of having a text editor
with a structured data model in Qt. I have done some research:
there is a QDomDocument, it seems to be made to work with xml data. I could convert my structure into XML but can the dom object be used with a text editor ?
Is there a way to bind a tree like document model to QTextEdit or QPlainTextEdit?
is it possible to bind a QAbstractItemModel to a document in QTextEdit or QPlainTextEdit?
What would be the best approach to tackle the problem of having a textual representation of a tree that gets updated once text and/or stricture is changed by editing in the text field?
Performance and cross platform capability is important, so this project will be implemented in C++.
Thanks for any advice and examples appreciated if you have any.
-S

Generate draw.io map diagram from hierarchical JSON/XML

I'd like to programmatically generate a draw.io map diagram from nested XML/JSON exported from Zotero (individual items nested in sub-collections and collections).
I already have the basic JSON/XML, which can be adapted to draw.io's format, but I'm not clear how. There seems to be no schema for the app's diagram format, and the source XML of existing diagrams includes a lot of style and layout information that I want to avoid having to calculate -- I am assuming, given that the Layout option in the app is automatic, that there must be a way to automatically render a diagram without having to include manually-specified style/layout info.
So I have three questions:
Is there a standard XML/JSON scheme for hierarchical draw.io map diagrams?
Is it possible to give draw.io just the relationship info between elements, and have it determine the layout automatically (akin to the automatic Arrange > Layout options within the app)?
Within a draw.io map, can a node be connected to more than one parent?
I've created a converter from json to drawio format. It does not work with nested collections now, but it may help anyway.
https://github.com/Voravomas/drawio_diagram_converter
How about this VS Code extension? https://github.com/hediet/vscode-drawio

Is document/view architecture in MFC basically a Model/View/Controller pattern but without the controller?

Is the document/view architecture in MFC really a Model/View/Controller pattern without the controller part?
I'm studying MFC and I simply love it to bits. I know is somewhat outdated and somewhat bit more difficult to use, but I discovered that it gives me so much more power and performance gain when compared to QT.
Am I correct to think of the MFC doc/view model as simply MVC without the Controller part?
The Model/View/Controler has the following components:
Model
View: responsible to show the model to the user
Controller: responsible to get user input and translate it in operations on the model
MFC's Document/View has only 2 components:
The document, which is in fact our model
The View, which has the responsibility to show the Document AND interpret the user's commands. So it is the view+controller (refer to section Variants in this MSDN article)
Let's look at it:
The view contains UI code, both for rendering the data and for taking input from the user.
The document contains the serialization code.
From that perspective, there's just a separation between UI and a backend. However, there's more, because you can have multiple different views on the same document. You could also use the document to just provide data storage and put any actual program logic into the view. In particular when you only effectively use a single view per document, it is easy to blur the separation in practice.
In summary, I wouldn't say the MVC controller part is missing but that it's merged with the MVC view parts into the MFC view.

Generating class diagram from source code

I'm using Enterprise Architect and I wish to generate some class diagrams for a specific set of C++ objects within a massive project. By right clicking on a particular model and choosing Code Engineering from the context menu I can import the entire source directory for the project and generate class diagrams for all objects in the project.
I can also simply generate a class diagram for a single source file. However what I'd ideally like is to generate individual class diagrams for a particular set of files within the project (for example ones which only contain the text SNMP within their names). Can anyone help me apply this filter as the class diagram for the entire project is too large and unwieldy to manage in any capacity.
In Enterprise Architect once you have imported the entire model like you have already done you can create additional diagrams to show only the parts of the model you need. In fact I consider this normal practice.
First create a new diagram with Add->New View -> Class View & diagram.
Then drag only the classes you want from Model in the Project Browser onto the new Diagram.
If you comment your code using doxygen then you can generate these class diagrams automatically. Please look at our code at github/nvmecompliance/tnvme for example. I'm not sure if this directly applies to your case if the source code you are not going to modify..

Using JET with EMF

I need to run JET templates on a EMF model metadata - i.e. the model itself (not data) is input to my JET template.
More practically - I want generate non java code, based on EMF templates.
How I do it?
Thank you
I'm not sure I get you right, but you can pass your model just like any other object into the JET template (as described in the JET tutorial). Also, it makes no difference if you generate Java or any other text with JET. As an additional pointer, you might want to consider using Xpand (part of openArchitectureWare) for very comfortable model to text generation (including things like content assist for your model in the template editor).
For code generation, you could use Acceleo. That is like Xpand very comfortable model to text generation (Acceleo language is very intuitive for model browsing) and also less painful than JET.