Eclipse and Dropbox - shiffman/Most-Pixels-Ever-Processing GitHub Wiki

How to set up Eclipse with Dropbox for MPE.

Introduction

One of the main annoyances with MPE development on multiple systems is keeping the code identical on all machines. One way of doing this is using a source control system, committing and checking out code every time a change is made. However, this takes a lot of time and "dirties" the repository, which in good practice should be reserved for working revisions, not tests.

This tutorial will show an alternative, using Dropbox to keep the code in sync automatically on all machines. This can be used in conjunction with a source control system, which can now be used appropriately.

This is trickier than it would be with non-MPE projects because all our files need to be the same except for the .xml file (which sets each client's ID and position).

Installing and Setting up Dropbox

  1. Register for an account here.
  2. Download and install Dropbox on all your machines. Just follow the instructions, it's pretty simple.
  3. Go to your Dropbox folder on one of the machines and create a subfolder called Eclipse. We'll use this as a workspace extension, where we will keep synched projects.

Creating your project

  1. On one of the machines, open Eclipse and create a new MPE project in your regular workspace. Follow the instructions on EclipseTutorial if you don't know how to do this. Don't worry about making anything complete at this point, you just want to have something that runs in MPE.
  2. Once that is done, delete the project from the workspace, but make sure Delete project contents on disk is unchecked.
  3. Navigate to your Eclipse workspace in the Finder (or file explorer if you're on a non-Mac OS) and move the folder of the project you just deleted to the Eclipse folder in your Dropbox.
  4. Go back in Eclipse, then select File / Import... / General / Existing Projects into Workspace from the menu.
  5. After clicking Next, browse to your project folder in the Dropbox next to the Select root directory: heading. Your project should appear in the list and be checked. Make sure Copy projects into workspace is unchecked and click Finish.
  6. Repeat the last 2 steps on all the other machines. The project will already be in the Dropbox as it is linked with the first machine.

Creating the XML file

  1. In Eclipse, select to File / New... / Project / General / Project from the menu.
  2. After clicking Next, name your project something like mpe-shared and make sure Use default location is checked so that it creates the project in your workspace. Click Finish.
  3. Right-click on the project you just created in the Package Explorer and select New / File. Call the file something like mpeConfig.xml. This will be the .XML configuration file for this machine. If you don't know what to put in here, have a look at Step 3 on EclipseTutorial.
  4. Repeat steps 1-3 on the other machines, keeping the .XML file name the same. Make sure you set id, localScreenSize, and localLocation accordingly for each one.
  5. In Eclipse, find the line where you create your TCPClient/UDPClient and change the path to the .INI file you just created. This path should be relative as it has to be the same on all machines, so it will probably look something like ../../../eclipse-workspace/mpe-shared/mpeConfig.xml.
  6. Save that file. If everything is linked properly, the files on the other machines should update automatically!

You can also grab the ID number dynamically without using the INI file (by basing it off of an IP address), something like:

InetAddress local = InetAddress.getLocalHost();
String ip = local.getHostAddress();
// Now parse the IP

And that's it! You should be able to run the server and all the clients and everything should work properly. You can also now modify the code on either machine and the other ones will update themselves automagically.

⚠️ **GitHub.com Fallback** ⚠️