Integrate JET Templates to an EMF-GMF plugin - eclipse-plugin

I created an plugin that lets me model JSF Applications. I created it using Emfatic, Ecore, EMF, GMF.
So now i have 5 projects in my workspace:
myapp
myapp.diagram
myapp.edit
myapp.editor
myapp.tests
If i run myapp as a Eclipse Application i can draw/design a .myapp_diagram based on the meta-model.
Now I want to know how can i integrate JET Templates with what i have here.
I have the diagram, i know how to build JET Templates, i just want to know how can i feed the diagram as input to the JET temples so that code will be generated.
What i have done until now is convert the "myapp" project to JET Project and wrote the template files. But if i now run "myapp" and draw a diagram, theres nowhere a GENERATE CODE button/option.

Unfortunately none of the Eclipse-based modelling projects provide a "generate code" button. There are a wide range of possible model sources and code generation platforms (JET, OAW, Xpand), so you will have to implement the button and the relevant source code yourself. However, the process is fairly straightforward.
One approach is to implement an org.eclipse.ui.popupMenus extension point, which then calls the Java class necessary to generate the code.
As an example, you can check out the plugin.xml used in the IAML project to generate PHP/Javascript source code, using openArchitectureWare (OAW) templates. The relevant Eclipse Action is GenerateCodeAction - check out the method doExecute(). Hope this helps :)

Related

Adding a two new phases to an Xcode framework project

I am building a project on Github written in Objective-C. It resolves MAC addresses down to manufacturer details. The lookup table is currently stored as text file manuf.txt (from the Wireshark project), which is parsed at run-time, which is costly. I would prefer to compile this down to archived objects at build-time, and load that instead.
I would like to amend the build phases such that I:
Build a simple compiler
Run the compiler, parsing manuf.txt and outputting archived objects
Build the framework
Copy the archived objects into the framwork
I am looking for wisdom on how to achieve steps 1 and 2 using Xcode v7.3 as Xcode provides only a Copy Files phase or a Run Script phase. An example of other projects achieving similar goals would be inspiring.
I suspect that what you are asking is possible, but tricky. The reason is that you will need to write a bunch of class files and then dynamically add them to the project.
Firstly you will need to employ a run script phase to run various tools from the command line to parse your file and generate a number of class files from it. I would suggest looking into various templating engines. For example appledoc uses moustache templates to generate API documentation files. You could use the same technique to generate header and implementation files.
Next, rather than generating archived objects an trying to import into a framework. I think you may be better off generating raw source code, adding it to a project and compiling into a framework. Probably simpler in the long run.
To automatically include the generated code I would look into (which means I haven't actually tried this :-) adding a folder reference to the project rather than an Xcode group. Folder references are an option in the 'Add files to ...' dialog.
Folder references refer to a directory and automatically add the entire contents of that directory to a project. So you can use one to point to the directory where you have generated the source code. This is a much better option than trying to manipulate the project or injecting things into an established framework.
I would prefer to parse the file at runtime. After launch you can look for an already existing output, otherwise parse it one time.
However, I have to do something similar at Objective-Cloud. I simply added a run script build phase and put the compiler call into it.

Compiling .hx code directly (or indirectly) to a dynamic library (ndll)

I am working on a project and I have a plan to separate certain sections out into separate dlls/ndlls in the final program. The main reason I want to do this is to support plugins and add ons, so more functionality can be added if needed, but the core app can still be used if that's the only requirement.
I have done something similar in C# (abet through an IDE so I never had to write any linker/compiling commands) so I know the general process but I can't seem to find a way to write HX code and then have it compile into a ndll.
I found this http://old.haxe.org/doc/cpp/ffi?lang=en which shows how to compile cpp code into a ndll using hxcpp and g++. I would think there should be a way I can use LIME or HXCPP to create a build file that will allow me to do it in one step instead of having to make a "fake" main function to compile the HX to CPP or CS.
If anyone knows of a project that does this and has a build.hxml or build.xml file that describes this or a tutorial or guide that takes about this, I would love it see it.
Try this:
lime create extension TestExt
lime rebuild TestExt windows
Replace "windows" with "mac" or "linux" as appropriate. Assuming it works, the ndll will show up in a subfolder of TestExt/ndll/.
As for tutorials, I wrote this one. It's targeted at OpenFL programmers, but the "Writing code for iOS" section covers what you'll need to know. (You can also just model your code on the template.)
In case it helps, I've made a tool to generate some of the boilerplate code that Lime requires.

Merge build definition changes back into build template in TFS 2013

How can one persist or version-control a detailed history of build modifications (not just template modifications)?
In Visual Studio 2013 using a TFS build server, we know of two places where you can edit a TFS build configuration (screenshots below):
In the build template xaml file, using the Workflow Designer:
In the build definition directly, using the build editor:
I know you can version control the xaml build template, edit it, check it in, and refresh the build definition from that. The question is, how can someone go the other way—edit the build template using the same editor that the build definition uses? The actual build editor exposes myriad properties that the Workflow Designer conceals or abstracts away in undefined variables.
How can you modify build settings—like run settings, code coverage, and code analysis—across a very large number of solutions? The Workflow Designer doesn't appear to expose these, and build modifications are absent from the server-side xaml that the Download link yields (I've edited and saved builds, and diffed the new vs. old xaml; they're identical).
Build definition changes aren't completely inaccessible as code, are they?
Editor screenshots:
Editing the build template xaml file, using the Workflow Designer:
Editing the build definition directly, using the Team Build editor:
Note: Microsoft's guide to customizing your build process template doesn't address this. It describes template editing & deployment, but doesn't speak to the difference in properties exposed by the build editor vs. the template editor (a.k.a. workflow designer).
Conceptually a template is the workflow that drives the build, a template exposes Arguments that can be populated by the Build definition. A single template can be consumed by multiple build definitions, with the differences being the arguments that are passed from the build definition to the template. Changing the build definition DOES NOT in any way alter the template
Standard arguments that are passed in are the workspace, the solution to build and any arguments that need to passed to the test runner, such as a run settings file.
I have a standard template that i use for 95% of my builds, this is customised to update assembly versions, run stylecop, display a warning if code coverage falls below a threshold and other little tweeks.
if you want to apply something accross multiple builds then you need to customise the template, for arguments that are exposed to the build definition you can supply default values. This then means that all of your builds will follow the same process.
when you then create a build definition you can use the same template and just supply information specific to that build such as solution file and run settings, you can override the default settings that you created for an argument in the template with specific values for that particular build.
As an example, in my template i have an Argument of TargetCodeCoverage, this has a default value of 70, so all definitions will have a default value of 70, if for a specific build i want 80 i can just change that value in the build definition.
Build definitions have been hard to track as they exist in the database and are not as such source controlled, if you install Community TFS Build Manager, you can right click on a build definition and export it. you can then save this exported file in Source control.
Another way to 'standardise' your definitions is to create a definition you are happy with and then just clone it, repeatedly, this will then give you all of the same setting that you created on the first and you can then just update the workspace and the solution file

How to maintain different file headers per project in IntelliJ?

IntelliJ allows you to configure the "File and Code Templates" in Settings.
This is a global setting, however I want different templates depending on which project I am working on (for example there will be different #author tags if its commercial / open source work, and version information varies by project).
Eclipse manages this on a per-workspace basis; how can I achieve the same thing in IntelliJ IDEA?
Unfortunately per project templates are not supported in IntelliJ IDEA. I recommend you comment-on/vote-for/track the feature request Make file templates per-project. (See UPDATE about this feature request below)
A few workarounds you can try...
Create a File Template for each project. Then when you create a new class, use the project's template rather than the standard "Java class" template. It will clutter up your template list a bit, and you have to remember to change from the default template when creating a new class (remember than inline search is available in the new class dialog when setting the type). But it is workable.
The copyright settings are done on a per project basis. Sometimes a need for a specific header can be met using the copyright utility (even if it is not an actual copyright statement). The options are pretty good for determining where it gets placed. The one shortcoming will be that while you can configure it to be a comment just before the class declaration, you can only configure to be a block comment or inline comment, not a javadoc comment.
Finally, a last option would be to write a live template for each project with the header information. Then after you create a class use the proper one to place the header information.
Hopefully those things will help while we wait for the feature to get implemented.
UPDATE
The above mentioned feature request to allow for file templates to be saved on a per project basis has been implemented in IDEA v14.1. It is currently (Feb 2015) available as an EAP (i.e. beta). It is scheduled for release at the end of Q1 2015.

active reports in C /CLI

Can we use Active Reports 7.0 in C++/CLI? I have just started using active reports. I tried building a report in C# without any problem. I tried doing the same in C++/CLI, but I am unable to use the Active reports toolbox. And also when running the application, it is giving licensing errors.
The designer that generates code-based won't work with C++/CLI. You also won't be able to write "script" inside the reports with C++. However, you can design reports as the XML-based reports (rpx) instead and then you shouldn't have any problem instantiating and calling on those from C++ via the SectionReport class (for example). Something like the following:
GrapeCity::ActiveReports::SectionReport ^sectionReport = gcnew GrapeCity::ActiveReports::SectionReport();
System::Xml::XmlTextReader ^xtr = new System::Xml::XmlTextReader("..\\..\\rptScript.rpx");
sectionReport->LoadLayout(xtr);
xtr->Close();
viewer1->LoadDocument(sectionReport);
...
Keep in mind ActiveReports users are almost exclusively C# & VB.NET users so you won't find any C++ code samples, but it should be pretty trivial to translate the code from C# to C++/CLI.
The example is based on SectionReport not PageReport, but PageReport is entirely xml-based so it should work easily too.
So to clarify, if you want a C++ only solution, you need to do the following:
Create your reports as XML-based reports (*.rpx files) using the "Standalone" designer application that is installed in the start menu when you install ActiveReports. Since you can save your reports as a standalone, independent .rpx file, you will not need to use any C#/VB.NET DLL. As shown in the code example above, you can just load the .rpx files from a file directly from C++ (for example).
Although this technique does not require any C# or VB.NET DLL/EXE, if you use the scripting feature inside the standalone .rpx report file, the script will have to be either C# or VB script. However, you won't have to compile that yourself, ActiveReports deals with the script internally.