Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
MoDisco/CSharpDiscoverer
The goal of CSharp Discoverer plugin is to allow practical extractions of CSharp models from an Eclipse project containing csharp files (*.cs). The CSharp models could also be converted in KDM models (OMG specifications).
Unfortunally, our available parser in not open-source compliant. We have planned to implements an open-source version of csharp parser, and a first step has been initialized using TCS project.
Description
This plugin aims at analysing csharp source code compliant with C# 2.0 standard and providing a model describing the information found. As shown in next figure, this model can conform either to the CSharp metamodel or to the KDM metamodel.
The CSharp model contains the full abstract syntax tree of the CSharp program : each statement such as attribute definition, method invocation or loop is described. In addition, links between elements are resolved (by resolved link we mean for instance a link between a method invocation and the declaration of this method, or the usage of a variable and its declaration). The model can thus be seen as an abstract syntax graph (ASG).
The KDM model represents only the structure of the CSharp application. The mapping between CSharp concepts and elements of CSharp and KDM metamodels is described in the following table.
In this version, the only data flow elements (below the method declaration) described in the KDM model are : • The creation of instances (Creates) • The method invocations (Calls) • The return statements returning a variable (UsesType)
The mapping to KDM can be changed or completed easily by updating the ATL rules.
Requirements
To use the plug-in you need:
- JDK 1.5 or above
- a version of Eclipse 3.3 or above with the following set of plugins installed
- EMF 2.3.0 or higher
- ATL 2.0.0 or higher
- CSharp metamodel
- KDM metamodel
Install
You will find a version of this plug-in attached in following bug.
As IP review of this plugin is not finished, here is installation instructions :
- Extract archive file in your Eclipse workspace, then use "import" menu to import this project.
- Use "export" menu to export this project as a plugin (Deployable plugins and fragments) in your Eclipse installation. Don't forget to choose "Package plug-ins as individual jar archives" option.
- re-start your Eclipse to take in account this plug-in
User manual
The plugin provides the user with a contextual menu to easily create models.
If you want to create a KDM model using an existing CSharp model, you can also right-click on a CSharp model file and select “Convert CSharp to KDM Model” in the contextual menu (see next Figure).
A progress bar will appear at the bottom of the window as soon as the operation begins. Depending on the size of your application, the reverse engineering and transformation might take some time to complete (see next Figure).
At the end of the process, the newly created model files are added at the root of your project and are automatically opened in the default editor (see next Figure).
.kdm files and .csharp files could be opened in the Sample Reflexive Ecore Model Editor (see next Figure).
They could also be opened in MoDisco model browser (see next Figure) which brings some graphical improvements.
Current limitations
Unfortunally, our available parser in not open-source compliant. We have planned to implements an open-source version of csharp parser, and a first step has been initialized using TCS project.