-
Notifications
You must be signed in to change notification settings - Fork 5
Configure a development environment
These instructions lead you through configuration of a CX4CBDDS development environment. This is a 'quick-and-dirty' method. It omits some tools needed to modify specific source artifacts (missing: Xtend2 template editing, UML2 model editing, 'DDK' code generation). However, it allows you to import the GitHub project, and quickly run and debug a Papyrus CX instance
Ensure that curl
and git
are installed. On Linux, these are available via your package manager.
CX4CBDDS (Papyrus CX) is currently built with Java 11, which you must install on your machine. There are a number of ways to do this. Choose the one that resonates with you.
If you like an easy and reliable way to switch between JDKs, consider using SDKMan. Note that is works best on Unix-like platforms. Once installed, the following SDKman commands are useful:
List available installs (filtering for those available from Eclipse Temurin):
sdk list java | grep tem
Install an Eclipse Temurin JDK 11 from the above list:
sdk install java 11.0.19-tem
Find the JAVA Home for an installed JDK:
sdk home java 11.0.19-tem
Alternately, Eclipse Temurin has OpenJDK 11 builds available.
Lastly, Linux package managers many also be used.
- Navigate to the Eclipse downloads page
- On the left-hand side of the page, choose the download button for your architecture. (As of 2023-03, the download includes the required JRE.)
- Extract the downloaded archive file (the extension and tools will vary, depending on you operating system).
- Navigate into the extracted folder to find
eclipse-inst
. Double-click it to start the installer.
- With the Eclipse installer running, select Eclipse IDE for Eclipse Committers and click Next.
- Click Next to move through the Projects wizard page without change.
- Provide a name for your installation folder. (It will be created in your home directory.)
- Click Next, then on the Confirmation page, click Finish.
- During the installation, you may be prompted to accept licenses, to accept code signing certificates or to accept unsigned code. In each case, accept and continue.
- After the installation completes, click Finish once again. Your new IDE will start.
Complete the following in your new IDE:
- Create a workspace name. One is proposed, but you can choose whatever name you like, in any folder you like.
- If presented with a Welcome screen, close it.
- Configure the JDK 11 you installed above:
- Choose Windows > Preferences. Type
jre
to filter the available choices, and choose Installed JREs. - Click Add, and accept Standard VM as the JRE type and click Next.
- Enter the 'home' directory of the JDK 11 you installed earlier. Click Finish.
- Check the newly installed JRE in the Installed JREs page and click Apply and Close.
- Choose Windows > Preferences. Type
- Configure GIT to checkout:
- Open the GIT perspective (Window > Perspective > Open Perspective > Other).
- If you have not already cloned CX4CBDDS, choose Clone a Git repository and follow the instructions in the wizard. DO NOT import existing projects at this time.
- If CX4CBDDS is already closed, choose Add an existing local Git repository.
- Ensure that the
papyrus
branch is checked out. If not:- Expand CX4CBDDS > Branches > Remote Tracking, find origin/papyrus, right click, and choose Checkout.
- Import existing projects into the Eclipse workspace:
- Right click CX4CBDDS > Working Tree, and choose Import Projects.
- Click Finish, to run the import wizard without changes.
- Organize you workspace for development:
- Open the Plug-in Development perspective (Window > Perspective > Open Perspective > Other).
- In the Project view, expand
dds4ccm
to revealtests
. Expandtests
and select all the projects underneath it. Right click and choose Close Projects.
- Disable API baselines:
- Click Window > Preferences and type
baseline
to filter. Choose API Baselines. From the Missing API baseline drop down, choose Ignore, then click Apply and Close. If prompted, click Build.
- Click Window > Preferences and type
- Setup a 'Target Platform', which will eliminate compile errors:
- Close Window > Preferences, type
target
to filter, and choose Target Platform. - Check the
Papyrus CX for AXCIOMA...
whose path starts with/dds4ccm/
. (You may have to make the dialog wider to see this.) - Click Apply and Close.
- Watch the 'progress' indicator (lower-right) as it resolves the platform and rebuilds the workspace. Once complete, the Problems view should show no errors (although it will still show warnings.)
- Close Window > Preferences, type
- Create a 'launch configuration' to run Papyrus CX from within your development IDE:
- From the menu, click Run > Run Configurations.
- Click Eclipse Application, then click the icon showing a page with a small yellow plus-sign in the top-right corner (hover text is New launch configuration.
- For Name, enter
papyrus-cx
(or some other name meaningful to you). - From the Run a product drop-down, choose
com.zeligsoft.papyrus-cx.axcioma.rcp.product
. - Click Run to start Papyrus-CX.
- After you have explored a bit, exit (From the menu, choose File > Exit.)
Your launch configuration is saved in your development IDE.
- You can easily re-launch it from either the Run menu (Run > Run History) or from the Run toolbar icon (green circle with a white triangle within).
- The launch configuration is also used to start the Eclipse debugger. (The green bug icon immediately to the left of the run icon.) A debug instance of Papyrus CX looks identical to a 'run' version; the only difference is that you can use the debugger against it.
The 'Debug Perspective' is useful. (Menu Window > Perspective > Open Perspective > Other, then Debug.
You can use the Project Explorer view to find source code (and then set breakpoints).
You can use the Console view to see console output from the running Papyrus CX. Stack traces can be printed here, which can serve as links back to the code.
From the Debug view, you can select a thread (for example main
, the UI thread), and then suspend it using the suspend icon (two vertical yellow bars) on the toolbar. The resume icon can resume a thread.
From the Breakpoints view, you can see, edit and remove breakpoints. Breakpoints are generally added by double-clicking in the left-margin of a source file.
If you have a stack trace, finding the source file/line and setting a break point there is a great start. When you hit a breakpoint, you can look at variable values (Variables views), amongst many other things.
Sometimes, you get lucky, and that's all you need. Most times, however, you need to do more, including setting breakpoints earlier in the flow, to see what's happening.
One particularly frustrating aspect of debugging is having to stop at the same line over and over again. Conditional breakpoints can make this less tedious: you can write a Java expression that must evaluate to true before the debugger will actually stop. Be forewarned that evaluating conditional breakpoints can noticeably slow down execution.
Another use for conditional breakpoints is to introduce 'trace' statements. You can put any group of statements you want in a conditional breakpoint, including print statements! So a 'trace' break point might call System.out.println
(printing variable values) and then return false
(to not stop). The println output will still show in the Console view.
You can also set breakpoints when certain exceptions are thrown.