<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to packages</title><link>https://sourceforge.net/p/floctrl/wiki/packages/</link><description>Recent changes to packages</description><atom:link href="https://sourceforge.net/p/floctrl/wiki/packages/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 12 Mar 2012 17:19:35 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/floctrl/wiki/packages/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage packages modified by Billy Keyes</title><link>https://sourceforge.net/p/floctrl/wiki/packages/</link><description>Packages and Projects in Eclipse
================================

Java, like many programming languages, provides support for organizing code into namespaces. In Java, namespaces are known as packages. In any project with more than two or three files and more than one or two developers, packages are a good way to make project structure understandable.

In addition, proper packaging ensures that namespace conflict are minimized. Two classes with the same name can be distinguished only if they are in different packages. Using no package, i.e. the default package, can be disruptive, as most Java tools expect classes to have *fully-qualified* names.

Packages for floctrl
--------------------
The `floctrl` project uses the following package scheme as of 3/12/2012.

1. All code is placed in a subpackage of `edu.cmu.cs.floctrl`. The use of the domain name structure follows standard Java conventions.
2. The subpackage name is a shortened version of the project or component name. For example, the publish/subscribe code is the the `pubsub` subpackage, giving full path of `edu.cmu.cs.floctrl`.
3. You can use additional subpackages as needed. For instance, you might find it convenient to put all code for your GUI in a package (`edu.cmu.cs.floctrl.conductor.gui`).
4. If you have test code, place it in the package `edu.cmu.cs.floctrl.test`. If you have multiple test files, you can create subpackages of the `test` package.

Packages in Eclipse
-------------------
Eclipse has good support for dealing with packages. You can create new packages in the same way you create new classes, using either `File -&gt; New -&gt; Package`, the button in the toolbar next to the "New Java Class" button, or right-clicking in the Package Explorer panel and choosing `New -&gt; Package`.

*Aside: If you do not have the Package Explorer open, go to `Window -&gt; Show View -&gt; Package Explorer`*

Eclipse should be able to find the correct paths for any classes you want to use and automatically add import statements. `Ctrl + Shift + O` is a handy shortcut for organizing and correcting import statements.

Subprojects in Eclipse
----------------------
Eclipse can only manage import statements if it knows where all the necessary code is located. If your code depends on code that someone else wrote in a different project, you'll have to add that project as a dependency of your own project. Here's how:

1. Right-click on your project in the Package Explorer
2. Click on `Build Path -&gt; Configure Build Path...`
3. Click on the `Projects` tab
4. Click the `Add...` button
5. Select the required projects and click `OK`

Note that you have to have the projects open in your workspace to add them as dependencies. Use the `File -&gt; Import` menu to add the projects to your workspace.

Adding new Subprojects
----------------------
Because of the way our git repository is setup, adding new subprojects is simple. 

1. Click on `File -&gt; New -&gt; Java Project` (or use the toolbar icon)
2. In the New Java Project dialog, uncheck `Use default location`.
3. Click the `Browse` button and select the directory that was created when you checked out the repository. This directory should have all the other project folders inside.
4. Finish creating your new project and add/commit it when you are ready.

Directory Structure
-------------------
Because all the project folders are at the top-level of the git repository, there should be no path problems, because everyone with a copy of the repository should have the same structure.

If you do have path problems, make sure you haven't moved any projects out of the git repository.

Migration Issues
----------------
The package structure was added by Billy Keyes on 3/12/2012. If you have any problems with the new structure, please [email him](http://www.google.com/recaptcha/mailhide/d?k=01MTfrPSDlxB1wp-jl97dRFg==&amp;c=BOjl_Y0AqSChk08-qbnl5cpB5J3HQs5CmcWZ_TsTfv4=).
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Billy Keyes</dc:creator><pubDate>Mon, 12 Mar 2012 17:19:35 -0000</pubDate><guid>https://sourceforge.net85a49df23712d15e6106419582e7d322102927ad</guid></item></channel></rss>