Papyrus Developer Guide
- 1 Development Environment
- 2 Development Plan
- 3 Getting the code
- 4 Papyrus Architecture
- 5 Papyrus Generation
- 6 Papyrus Code Standards
- 7 Papyrus Coding guidelines
- 8 How To ...
- 8.1 Commit, Report Bugs, patchs (Code Contributing)
- 8.2 Commit, Report Bugs, patchs (Gerrit Contributing)
- 8.3 Papyrus Code Examples
- 8.4 Papyrus Log
- 8.5 Papyrus Editors
- 8.6 JUnit Tests
- 8.7 Write Documentation for Papyrus
- 8.8 Papyrus Discovery
- 9 Papyrus Table Developer Documentation
- 10 Papyrus Diagram Developer Documentation
- 11 Papyrus Embedded Editors Documentation
- 12 Papyrus Extraplugins Documentation
- 13 Papyrus Build Process
- 14 New plugin Submition Process
To ease the development on Papyrus, each member of the team works with basically the same configuration.
One way to manage this is using the Eclipse Oomph Installer to manage your Papyrus development workbench.
Papyrus Oomph Setup Model
The Eclipse Oomph Installer provides a set-up model for Papyrus, making it easier than ever to get a complete Eclipse workbench up and running for development on the Papyrus source code. Just download the Oomph Installer from the linked wiki page and follow the simple wizard to create your IDE and import the Papyrus source projects that you want to work on.
Pick any product you like on the first page, but be sure it's the latest release of that product for the Papyrus stream you're working on. For example, if you're working on the Luna service stream of Papyrus, you need the Luna release of Eclipse. On the second page, expand Eclipse.org / Papyrus to see the various components that you can import to work on. Pick any combination of the leaf-level sub-(sub-)projects, even all of them if you like. In the third page where you specify variables such as install location, workspace location, git clone, etc. be sure to choose "Luna" for the Target Platform. This ensures that you will be set up to work on Papyrus Luna (SR1), which is the only development stream currently supported by the setup model (until Mars development gets under way).
Contributing your changes is easy because Oomph will clone the Papyrus Git repository for you and configure Gerrit push.
Amongst possibly other details, the setup model configures:
- your IDE with all of the tools needed to edit and build the source projects you choose
- your workspace with a Git clone and the source projects imported from it that you choose
- a PDE target that includes all of the dependencies required by Papyrus plus the latest nightly build of Papyrus, itself, so that you can import only a subset of the (many) source projects but still run the complete Papyrus toolset in a run-time workbench
- Mylyn queries for current open bugs and enhancements in the Papyrus bugzilla database
- Mylyn queries for the status of the latest Papyrus automated builds, including tests
- Mylyn queries for open Gerrit reviews
- preferences enforcing the Papyrus standard compiler and code formatter/template settings
Please raise bugs if you see any problems in the setup configuration.
When you first launch the Eclipse Oomph Installer, it will show the default "simple mode" installer presentation:
You can choose to proceed from here, picking for example the "Eclipse IDE for Committers" package to install, which is the minimal configuration, and later using Oomph to import the Papyrus sources into the workspace (box 1 in the screenshot). However, you may as well select all of the Papyrus content that you need in your development environment now to set everything up in one go. To do that, switch to the "advanced mode": open the dialog tray by clicking on the button (box 2) and select "Advanced Mode..." (box 3). Now you should see the dialog reconfigured as shown below:
Again, the simplest option is to start with the "Eclipse IDE for Committers" package because the setup model will add everything else you need for working on Papyrus's various code and models.
On the second page, pick whatever Papyrus components you need to import into the workspace:
If you need to work on and test the Papyrus setup model, itself, then you should also import the "Papyrus / Developer / Oomph Setup" project (selected in the screenshot above) to configure the workbench to load the Papyrus setup model from your Git checkout instead of from the central Git repository via HTTP.
Next, tell Oomph where to check out the Papyrus repository, where to install Eclipse, and where to create the workspace:
Note that exactly how this page looks will depend on the options you choose for how to manage installation and workspace locations, and whether you have previously used Oomph to install other Eclipse instances (I have).
Note also that if you do not see the target platform that you need in the 'Target Platform' pick-list (for example, Neon to start working on the Papyrus Neon branch that is the master at the time of this writing), then you can just type the name into the field.
The last page summarizes the steps that Oomph will follow to start the installation:
After the newly installed Eclipse instance starts up, it will complete the setup by performing the rest of the tasks that have to be done in the workspace that didn't exist initially. These include the git checkout, importing projects from the checkout into the workspace, creating working sets, Mylyn queries, and more. Once these steps have completed, you will be ready to start working on the Papyrus code.
If you used Oomph's "simple mode" to create your Eclipse workspace, or if you need to make changes to what Papyrus bits you have imported (even for setting up the set-up model redirection), you can do this at any time by launching the Oomph installer wizard from within the Eclipse workbench. Note that you will first have to make the Oomph setup actions available in the toolbar be enabling the preference:
This launches essentially the same wizard as the "advanced mode" of the Oomph Installer.
Following is a description of the basic configuration:
- The latest Eclipse Modeling (Or Standard) release
-  JAutoDoc
- Configure the header template according to your company: Eclipse Preferences -> Java -> JAutodoc
- Java 1.6:
- Eclipse Preferences -> Java -> Compiler
- Eclipse Preferences -> Java -> Installed JREs
- VM Arguments for debug mode:
-Dosgi.requiredJavaVersion=1.6 -Xms768m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=384m -XX:+CMSClassUnloadingEnabled
Required External Plugins
Papyrus may require some external plugins to compile.
The following page maintain a list of Papyrus Required External Plugins
[Future] Maven Integration
The Hudson builds are currently implemented with Maven, using Tycho to build Eclipse-compatible artifacts. Therefore, all active plug-in and feature projects have Maven POM files describing them. There is a proposal under consideration to implement Maven Nature provided by M2Eclipse in the Papyrus source projects, to more closely align the Hudson build environment with the developer's local build environment in the Eclipse workbench.
An initial analysis of what would be involved in this change, both in terms of actually implementing the Maven Nature and its impact on Papyrus developers' daily workflow, is captured in this document:
- Adopting Maven Nature in the Papyrus source projects
The specifications are available here: Luna plan
Contributing to the plan for the release
- How To - Contributing to the release plan, ... Papyrus Developer Guide/How To- Plan contribution
Getting the code
Cloning the Git repository and importing the code
The Papyrus code and some documents are located in a Git repository. In the website http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git you will find the most recent activity information of the repository and, at the bottom of the page, you will find the URIs of the Git repository (e.g., http://git.eclipse.org/gitroot/papyrus/org.eclipse.papyrus.git).
Follow the next instructions if you never used Git before and want to know how to import the source files of one or more Papyrus plugins in your Eclipse workspace.
First, you have to clone the Papyrus repository. Open the Eclipse import wizard (“File” => “Import”), select “Git” => “Projects from Git” and click “Next”. Select “Clone URI” and click “Next”. Now you will have to enter the repository’s location and connection data. Entering the repository URI will automatically fill some fields. In the case of using the URI http://git.eclipse.org/gitroot/papyrus/org.eclipse.papyrus.git, you will not have to fill any field. Complete any other required fields and hit “Next”.
The Git repository of Papyrus contains many different branches and you must select at least one. Select the branch “streams/1.0-maintenance” if you want to fix code bugs in the Luna version of the Papyrus plugins or “master” if you want to contribute with new features to the latest version of Papyrus called Mars. Click “Next” and select the storage location (e.g., “C:\git”) and the name of the initial branch (e.g., “streams/1.0-maintenance”).
Finally, follow the import projects wizard to select the plugins projects that you want to study or modify, and click “Finish”. You will see all those projects in your workspace.
See the Papyrus project developer resources page for more details
Note about compilable plugins
To know if a downloaded plugin should compile, you can have a look to a Papyrus installation. If the plugin comes with the installation, it should compile!
- The following plugins are not distributed and could be closed (deprecated, not yet provided in the Papyrus distribution or for developpers only):
all plugins of the layer 'developer', except if you need to generate diagrams (in this case you should install GMF Tooling as well) oep.infra.emf.editor oep.infra.emf.embeddededitor oep.infra.emf.newchild oep.team.svn
- Only the follwing projects are currently provided by the Papyrus extra-plugins update site. The others projects can be closed.(They are deprecated, not yet provided in the Papyrus distribution or for developpers only):
org.eclipse.papyrus.compare.report.ui org.eclipse.papyrus.compare.report org.eclipse.papyrus.diagramtemplate.edit org.eclipse.papyrus.diagramtemplate.editor org.eclipse.papyrus.diagramtemplate org.eclipse.papyrus.eclipse.project.editors org.eclipse.papyrus.infra.gmfdiag.css.configuration org.eclipse.papyrus.infra.gmfdiag.css.properties org.eclipse.papyrus.infra.gmfdiag.css.theme org.eclipse.papyrus.infra.gmfdiag.css.xtext.ui org.eclipse.papyrus.infra.gmfdiag.css.xtext org.eclipse.papyrus.infra.gmfdiag.css org.eclipse.papyrus.layout.algorithms.gridAlgorithm org.eclipse.papyrus.layout.algorithms.horizontalAlgorithm org.eclipse.papyrus.layout.algorithms.horizontalSymmetryAlgorithm org.eclipse.papyrus.layout.algorithms.horizontalTreeAlgorithm org.eclipse.papyrus.layout.algorithms.radialAlgorithm org.eclipse.papyrus.layout.algorithms.springAlgorithm org.eclipse.papyrus.layout.algorithms.treeAlgorithm org.eclipse.papyrus.layout.algorithms.verticalAlgorithm org.eclipse.papyrus.layout.algorithms.verticalSymmetryAlgorithm org.eclipse.papyrus.layout.subeditor.gmf org.eclipse.papyrus.layout org.eclipse.papyrus.marte.properties org.eclipse.papyrus.marte.static.profile org.eclipse.papyrus.marte.vsl org.eclipse.papyrus.migration.properties.model org.eclipse.papyrus.uml.export
- The tests plug-ins are located under tests/junit/plugins or tests/junit/extraplugins. Other test projects are not necessarily maintained
Retrieve configuration files
The Papyrus Code Templates and Java Formatter files are available under the Papyrus repository in the folder doc/DeveloperDocuments/templates/
FAQ How do I control the Java formatter
FAQ How can templates make me the fastest coder ever
The note explains how to install the templates in your environment.
- Papyrus architecture is explained here: Papyrus Architecture
- Papyrus generation mechanism is explained here: Papyrus Developer Guide/Papyrus diagram generation
Papyrus Code Standards
- Java Doc - every class, method and field including private ones should be documented with Java Doc
- No abbreviations - the class, methods and variables should have meaningful names
- Formatting - the code should be formatted in accordance with format templates
- Always use brackets in conditions, loops, ...
- Compile - the modified code and other plugins should be compilable. Be sure to use Java 1.5 code compatibility. Check other plugins that could be influenced before commiting!
- Standard Java Rules coding - Unless specified differently, the Java Standard Coding rules should be applied: no abbreviations, variables starting with lower case; class and types with upper case; Composed name separated with upper case; no underscore in names; ...
- In case of doubt - check existing code from those following the rules :-)
Papyrus Plug-ins and Features
Papyrus Coding guidelines
A few points may be a little tricky when coding for Papyrus. Among them:
Papyrus Plugin Naming Scheme and Folders Structure
- Papyrus plugins naming scheme and folder structure used to locate and name plugins is described here: Papyrus_Plugin_Naming_Scheme
Structure and behavior of papyrus
- Presentation of the papyrus stucture and the behavior of some parts Papyrus Developer Guide/Papyrus Structure Behavior
Papyrus Command Execution, History, Undo/Redo
- This first document describes the usage of editing domains and gmf/gef/emf commands. See this detailed article Papyrus Developer Guide/Editing Domains and Commands.
- This second document tries to explain how the differents Eclipse Command frameworks work and how they are related. It also explains how commands should be executed in Papyrus, in order to have correct undo/redo.
- Following UML model with code reverse can also be useful:
The ServiceRegistry is one of the main Papyrus component. The idea is that each Papyrus feature should be a service registered to the ServiceRegistry.
The ServiceRegistry should be accessible from any code. It allows to retrieve the components you need to perform your task.
A new implementation of the ServiceRegistry is submitted. The new ServiceRegistry is discused here Papyrus Developer Guide/Service Registry
How To ...
Commit, Report Bugs, patchs (Code Contributing)
- How To - related to reporting bugs, patching, commit, ... Papyrus Developer Guide/How To- Code Contributing
Commit, Report Bugs, patchs (Gerrit Contributing)
- How To - related to reporting bugs, patching, commit, ... Papyrus_Developer_Guide/How_to_Contribute_to_Papyrus_with_Gerrit
Papyrus Code Examples
- How to - Related to Papyrus code,Papyrus Developer Guide/How To Code Examples
- Papyrus Log is explained here Papyrus Developer Guide/Papyrus Log
Currently Papyrus provides 2 editors kinds : Diagrams and Table. How to add your own editor kind is explained here Papyrus Developper Guide/How to - Add your own editor in Papyrus
- How to add JUnit tests to the build: Papyrus Developer Guide/Add JUnit Test Bundle
- A code generation framework has been developed to automatically generate JUnit tests for GMF-based editors: Papyrus Developer Guide/Automatic Test Generation for Diagram Editors
- Useful utilities for JUnit tests: Papyrus Developer Guide/JUnit Test Framework
Write Documentation for Papyrus
How to - Related to documentation Papyrus Developer Guide/Writing Documentation
Papyrus additional components
To add extra features to the Papyrus Discover, you should edit the files located here: ssh://USER_ID@git.eclipse.org/gitroot/www.eclipse.org/papyrus.git
Papyrus as a Modeling component
Papyrus is available from the Modeling Package, using the discovery UI of this package. This contribution is made by the project located here: git://git.eclipse.org/gitroot/www.eclipse.org/modeling/amalgam.git,
the file is located in the folders discovery/downloads/RELEASE_NAME
Papyrus Table Developer Documentation
- The documentation for developers is available here Table Developer Documentation
Papyrus Diagram Developer Documentation
- The documentation for developpers is available here Diagram Developer Documentation
Papyrus Embedded Editors Documentation
- The documentation for developers is available here Embedded Editors Developer Documentation
Papyrus Extraplugins Documentation
The following describe developer guide for papyrus extraplugins:
Papyrus Build Process
- Papyrus build process: How to Use Papyrus Developer Guide/Build Process: How To.
- Papyrus build process: Documentation Papyrus Developer Guide/Build Process: Doc.
- Papyrus Release Standard Operating Procedure: Papyrus Developer Guide/Release Standard Operating Procedure: Doc.
New plugin Submition Process
New plugin should follow the submition process describe here: Papyrus New Plugin Submission Process