Sunday 7 November 2010

Getting Started with Eclipse and P4Eclipse

How do I set up Eclipse and Perforce workspaces on Windows, Linux, or Mac OS X operating systems?

Prior to downloading P4Eclipse, please check the latest release notes for platform and Eclipse version compatibility. You can find the release notes for the latest P4Eclipse here:

http://www.perforce.com/perforce/doc.current/user/p4eclipsenotes.txt

This article is divided into the following sections for your convenience:

1. Install Eclipse (if you do not have an existing instance of Eclipse)

Download the latest Eclipse version that is supported by P4Eclipse from: http://www.eclipse.orgUncompress the distribution and install. For example, on Linux, run: $ tar -zxvf eclipse-rcp-ganymede-SR1-linux-gtk-x86_64.tar.gz$ cd eclipse$ ./eclipse

Important: Your Eclipse workspace must be different than your Perforce workspace.

You want the files in your Eclipse projects to be under Perforce control, but you do not want the Eclipse metadata to fall under Perforce control, because it is particular to that installation of Eclipse. Therefore, Eclipse project files must NOT be under the Perforce client root.

Please see KB article #1048: Eclipse vs. Perforce Workspaces for a more detailed explanation.

2. Install the Perforce plug-in

The following instructions apply to Eclipse 3.5/3.6:

Uninstall any older versions of P4Eclipse/P4WSAD that might have been installed previously. Please see KB article #1049: Uninstalling the P4Eclipse Plug-In for more detailed instructions. Choose: Help | Install New Software in Eclipse. In the Available Software dialog, click Add... to add a new site. In the pop-up dialog, copy and paste the following URL into the Location box: http://www.perforce.com/downloads/http/p4-eclipse/install/3.5http://www.perforce.com/downloads/http/p4-eclipse/install/3.6Check the box for P4Eclipse and then click Next....

Note: If there is more than one version of Perforce in the list, select the latest one.

Complete the setup by selecting P4Eclipse and clicking Finish. When prompted, restart Eclipse.

Please see the Release Notes for more detailed installation instructions. See the Release Notes for P4WSAD 2009.2 for installation instructions for Websphere Studio and other versions of Eclipse.

3. Configure the Perforce plug-in

Mac Users: Please note that your Preferences window is found under Eclipse | Preferences, rather than the Window menu.

After restarting, verify that the Eclipse workspace is not the same as your Perforce workspace, and is not under the control of Perforce. If you are not prompted, choose: File | Switch Workspace | Other

Open a Perforce perspective by choosing: Window | Open Perspective | Other... | Perforce | OK

P4WSAD/P4Eclipse 2009.1 and later

You will see a "No servers are currently defined..." message under the P4 Connections tab. Create a ?New Connection? by clicking on the green plus icon ().

The Add a New Perforce Server Connection form is displayed.

In the Location section, fill in the fields for the "Host", "Port number", and "Charset" (if you have a Unicode server running).  In the Authentication section, fill in the "User", and "Password" fields. Click Next>.

The Choose a Perforce Client Workspace form is displayed.

Either choose an existing client workspace for your user ID from the list box, or create a new client workspace by entering the name of the client in the Workspace name field and the client root in the Location field. Click Finish>.

The P4 Connections pane shows a list of depots available to you in your Perforce server.

P4WSAD 2008.2

You will see a "No servers are currently defined..." message under the P4 Depots tab. Create a ?New Connection? by clicking on the green plus icon (), and filling in the values for the "Port", "User", and "Client Workspace" (and "Charset" if you have a Unicode server running).

Note: You cannot create a Perforce client workspace with the P4WSAD plug-in, so the client must already exist. Run p4 info from within your client workspace to get the correct P4PORT, P4USER, and P4CLIENT settings.

If you get an error message stating ?P4 command line application not found...?, you need to tell Eclipse where the P4 command-line executable is located. To do this, choose: Window | Preferences | Team (click arrow) | Perforce, and click on the radio button for the "Location:" field under the "Location of p4 executable" section. Specify the path to P4 (or p4.exe executable).

General Settings

Descriptions of each of the following settings can be found in Eclipse's Help: 

Help | Help Contents | Perforce SCM  | Setting Preferences

As of 2009.1, a pure Java NIO interface (P4Java) is the default method for interacting with the Perforce server.

Enabling Label Decorations

As of 2009.1 the decorations are configured by default, and are consistent with P4V.

Choose: Window | Preferences | General | Appearance | Label Decorations
Check the "Perforce" box, and click Apply.
Choose: Window | Preferences | Team | Perforce | Label Decorations
Check the box under Ignored Resource Decoration Text labeled "Decorate files/folders contained in .p4ignore".
Choose appropriate locations for File Decoration Icons such as Bottom Right, Top Left, Top Left, Top Right, Top Right, Bottom Left. Click the "OK" button to accept the changes.

Customize Perspectives

To customize perspectives, choose: Window | Customize Perspective | Command Groups Availability tab | check Perforce | OK

9 users have rated this article 4 out of 5

View the original article here

No comments:

Post a Comment