Want to contribute? Welcome to the developer guide!
You will find here useful information to develop on Violet.
There's many way to contribute to an open source project. You can send a feedback, propose a fix, a new feature. If you want to work on the source code, you need to have skills in Java, Swing, dependency injection, Maven.
First of all, you have to install a Java Development Kit 6 (here). Then, I recommend to work with STS (SpringSource Tool Suite), an Eclipse distro available here. This Eclipse embeds a full Maven integration which will really simplify your job.
How to add SVN feature to STS?
Oops! There's a little thing missing in STS : there's not SVN plugin by default. Don't worry, I will show you how to install it.
Go to Help -> Install New Software...
Select "work with : All available sites" (be patient while feature list is refreshed)
Look for "Collaboration" (you can use the text filter just above the list) and select all the items starting with "Subversive". You will need to restart Eclipse after installation.
On restart, Eclipse will ask you to choose an SVN client. My personal choice si "SVN kit 1.3.2" which is a pure Java implementation. It will be automatically downloaded.
Getting the sources from SVN
All the source code is hosted on sourceforge.net's SVN servers (we don't use CVS anymore). Use the following configuration:
Anonymous access is accepted on sourceforge (and restricted to read-only)
I engage you to always checkout VioletFramework as it is the core project. You will often be in its code.
--*-- Eclipse Tips --*--
If you use Eclipse STS, I have a few tips to give you.
Maven plugin :When you check out any project from SVN, don't forget to switch to Java perspective. Right-click on project and select Maven->Enable Dependency Management to make Eclipse and Maven deal with external libraries.
Maven plugin :After having enabled Maven Dependency Management on your project or refreshing project configuration from Maven , go to project properties and check that files located in src/main/resources are not excluded in Java Build Path. (see the screenshot below)
The global Violet project is split into several sub-projects :
Violet : main project; only used to build the final product with maven.
VioletFramework : framework project. This includes the graphical user interface (menus, panels...), diagram toolkit (abstract graph, nodes and edges), tools to load/save files, java interfaces to develop plugins, etc...
VioletIDE.eclipse : project embedding all classes and definition file needed to port Violet as an Eclipse plugin
VioletPlugin.* : plugin projects such as Class Diagram
Ready for a short code review? OK, let's go. Before we start, you have to know that all class attributes are declared at the end of each file (and not at the top). We also have a code formatter. You can import it info Eclipse from horstmann.eclipse.code.formatter.xml in 'Violet' project.
A short "Violet" code review
This project is used to start the program in standalone mode and applet mode. For example, look at UMLEditorApplication. You will see the workflow used to start. This project is also important because it contains all the menus. To avoid duplicated code, we created a factory to build them. Let's open EditMenu. You will things like that :
@ResourceBundleBean(resourceReference = MenuFactory.class)
public class EditMenu extends JMenu
@ResourceBundleBean(key = "edit.select_previous")
private JMenuItem selectPrevious;
The two annotations are used to configure and inject preconfigured menu items. Here, the configuration of 'selectPrevious' is read from the property file MenuFactory.properties with the key 'edit.select_previous'.
Now, let's jump to AboutDialog located in the help package. You can see that all resources (such as images) are located in the package. It's a programming rule we want to keep because it's very difficult to maintain used and deprecated resources when they are located outside the package where they are used.
Let's go to "VioletFramework"
This project contains all core classes of the project. It has two main parts :
a part with services around diagrams (such as file management, printing, etc...) located in com.horstmann.violet.framework
and a part dedicated to build diagrams, display and work with them located in com.horstmann.violet.product
The following class diagram (made with Violet!) shows the overall design of classes inside com.horstmann.violet.product
To be continued on next project...
The following informations are only for active project members. By the way, you will not be able to publish artifacts if you are anonymous contributor.
We use Maven because it became a standard "de facto". The first benefit is in the common project structure it brings. So, in almost all Maven projects, you will find :
the source code in src/main/java
all external resources in src/main/resources
A Maven project is defined by a pom.xml file located at the root folder of the project. It contains the project name, version, its library dependencies and all its custom configuration used by Maven plugins during the build cycle.
Maven is "IDE" free. So, you don't have anymore adherence to your development environment. Feel free to use NetBeans, Eclipse, IntelliJ or notepad.
By the way, Maven is not intrusive on your system. Just download it, unzip it somewhere, define an environment variable M2_HOME and add the 'mvn' command to your program path.
Configuring you settings.xml
This step is only if you planned to publish any Violet release and if you are an active contributor. So, when you consider that your project is stable, you publish its artifact on our sourceforge repo. To to that you need to modify your settings.xml with the following instructions to authorize maven to upload file on sourceforge's sftp :
How to compile the code from command line?
First of all, you have to know that you don't have to compile all the code. Violet is split in several sub-projects. Why? Because it's convenient to compile only the VioletPlugin.ClassDiaram project you modified instead of compiling all as we did in previous release.
So, check out from SVN the project which you want to modify (for example, VioletPlugin.ClassDiagram) and just do mvn clean install to compile and deploy the jar file to your local Maven repository.
How to test the project?
Here you need to check out the project called 'Violet'. Do a mvn clean package from its root folder. Then do java -jar [your-violet-jar]
Want to add a link to this site on your web page? Please, do not copy-paste current url. Use http://violet.sourceforge.net instead.
Powered by FCKwiki, the wiki for programmers developed by Alexandre de Pellegrin.