Using JET with EMF - eclipse-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.

Related

wxDataViewModel: What is it and how do i use it?

i read the documentation http://docs.wxwidgets.org/3.0/classwx_data_view_model.html several times but it hardly answers any questions. Maybe i'm confused as to the function of this class?
so i riddle you this:
Is this a View Model as we know from MVVM?
How do you implement a derivative?
How do you set data in the containing wxDataViewListCtrl?
Is this the right/recommended way to make a table?
As its name subtly hints, wxDataViewModel is indeed the model in the usual MVC design (while wxDataViewCtrl is both the view and the controller).
You can see a couple of examples of custom models in the dataview sample.
Notice that wxDataViewListCtrl is mostly a compatibility class made for transitioning the code using wxListCtrl to wxDataViewCtrl and it already defines its own trivial list model. I don't recommend using it unless this is exactly what you need.

How do I generate standardized model instance template code in django?

I'm developing a website in Django where many of the sites' models' instances are presented to the user in a standardized format on many different pages. I'd like to avoid redundancy in the template coding by creating standard model instance template code then just inserting it each page where a model instance needs to be displayed.
What is the best practice for creating standardized instance display code, then adding it into many different pages?
There are several ways of accomplishing this...
One is to use an include tag and pass your object to the template. Another, similar approach is to create a template tag to render the object, which is useful if you need to do some extra processing in Python before doing the rendering.
Yet another way is to add an instance method to your model to render itself to HTML (or some other format), much the same way a form instance has .as_ul or .as_p that you can call in your template where needed.
Neither way is right or wrong, it just depends on what you're most comfortable with stylistically and what's most efficient for your needs.

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..

Django - Single model instance

I want to add a layout model to my website (a general settings file), and I want it to be available in the admin interface for configuration.
class Layout(...Model):
primary_header
logo_image
...
This structure shouldn't saved be in a table.
I am wondering if there is a built-in feature that can help me do this.
Thanks
My use case is a configurable layout of the website. Wordpress style. I would like to store that data in a concrete class, without having to implement the file /xml serialization myself.
What about an abstract model? It does not save in the database and is meant to be subclassed, but you are allowed to create instances of it and use its attributes. I assume you want some kind of temporary data structure to pass around that meets the requirements of a model instance.
class Layout(models.Model):
class Meta:
abstract = True
If you for some reason need actual concrete models, and are fine with it creating tables for them, you could technically also re-implement the save() method and make it no-op.
I don't really understand where and how you will be using this, but this is indeed a model that doesn't save.
Personally, I have actually used models that aren't intended to be saved, in a project that uses mongodb and the nonrel django fork. I create models that are purely meant to be embedded into other models as nested sub-documents and I never want them to be committed to a separate collection.
Update
Here is another suggestion that might make things a whole lot easier for your goal. Why not just use a normal django model, save it to the database like normal, and create a simple import/export function to save it out to XML or read into an instance from XML. That way you get 100% normal admin functionality, you can still query the database for the values, and the XML part is just a simple add-on. You can also use this to version up preferences and mark a certain one as active.

Is there a good WikiField for django models?

Is there a simple way I can add a "WikiField" to a model I have in my application?
I think the most important requirements are:
A text field that can be added to any model.
simple wiki markup or editor widget that enables text formatting and easy insertion of links and images.
saves revision history with author information, and easily allows reverting back to any previous version.
Just to explain what I'm trying to do: Imagine you have a bookstore app. Most of the Book model's data come from the store's catalog. Now we would like to add a block of text that is a community wiki, so that users can write the plot summary for example.
How about a combination of django-reversion and django-tinymce, or Markdown if you prefer writing markdown?
I've not come across any field types specifically for Wikis, but with those components writing one really shouldn't take too long.