Starter project configuration for the course COMP 303: Software Design at McGill University
This repository is configured to be seamlessly imported into the latest version of the Eclipse IDE. However, if you know what you are doing, you can import the project into the IDE of your choice and find the corresponding tools.
To set yourself up:
- Make sure you have Eclipse for Java (or your favorite Java IDE) and Java 17 or higher.
- Install JavaFX and create a library for it in Eclipse by following these instructions
- Make sure you call your library
JavaFX
to match the build configuration on the repository. - If on a Mac, when you run the application, from the run configuration, make sure the checkbox "Use the -XstartOnFirstThread argument when launching with SWT" is not checked.
- Install the Checkstyle Eclipse Plug-in. In Eclipse, select
Help | Eclipse Marketplace...
and enterCheckstyle
in theFind:
box. From the results, installCheckstyle Plug-In...
. - Clone this GitHub repository into your Eclipse workspace. In the Eclipse package explorer, right-click and select
Import... | Git -> Projects from Git | Clone URI
and under URI enterhttps://github.com/prmr/COMP303Starter
, then click-through, requesting to import existing Eclipse projects. Once imported, the project should compile without errors. - While you're at it, clone the JetUML project into your Eclipse workspace. For convenience, you can also install it.
- Similarly, clone the Minesweeper and Solitaire projects into your Eclipse workspace.
If you do get a build error, make sure you have the correct version of Java installed, and issue the command
Project | Clean... | Clean all projects
. This will force the code to recompile and solve most problems due to out of date or improperly synched files, which sometimes happens.
To ensure that everything works and start experimenting:
- In package
demo
, right-click on the fileWelcome.java
and selectRun As... | Java Application
. You should see a small GUI application appear. Try the different buttons which should do trigger some interaction from the user interface. - Right-click on the file
TestAlternatingLabelProvider.java
and selectRun As... | JUnit Test
. A green bar should appear. - Right-click again on the file
TestAlternatingLabelProvider.java
and selectCoverage As... | JUnit Test
. A green bar should appear, along with a view showing coverage information. If you go back to the source code file, most lines should be highlighted in green. The meaning of this will be explained later in the term. - Access the "Problems" view in Eclipse. You should see at lest two warnings of the type "Checkstyle Problem". If you do not, right-click on your project and select
Checkstyle | Activate Checkstyle
.
Once everything works as described above, try the following:
- Fix the code to make the Checkstyle warnings go away. To see the full list of coding rules checked by the tool, right-click on the project and select
Properties | Checkstyle | Configure
and play around with the viewer. - Change line 37 of file
AlternatingLabelProvider.java
to returnaLabel1
instead ofaLabel2
, and re-run the test. The test should fail. - Learn some seriously useful shortcuts. My personal favorites are:
CTRL-1
,CTRL-SHIFT-R
,CTRL-SPACE
,CTRL-O
,ALT-SHIFT-R
.
Unless otherwise noted, the content of this repository is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Copyright Martin P. Robillard 2022