Выбрать главу

Figure 7.18: Import Plug-ins and Fragments dialog.

Back in the Project Development perspective you’ll find a new project in the Package Explorer view. Take a look at some of the Java files and open the manifest to get a feel for what’s going on.

However, before you can build and run the example, you must point PDE at the correct target environment. Select Window→Preferences→Plug-in Development→Target Platform. Browse to the eRCP/ directory under the eRCP installation directory. Back in the Manifest editor launch the application.

Summary

Plug-ins, written in Java, are the mechanism for extending the functionality of Eclipse. The Plug-in Development Environment (PDE), itself a collection of plug-ins, provides intuitive graphical tools to aid the process of plug-in development.

Eclipse defines some 200 extension points where the basic platform can be enhanced by plugging in extensions. The role of a plug-in, then, is to implement extensions.

Normal plug-ins execute as extensions of the Eclipse workbench. The Rich Client Platform (RCP) provides a mechanism that allows you to use the same plug-in development environment to build stand-alone Java applications that utilize Eclipse UI features. Another project, the embedded Rich Client Platform (eRCP), brings the same capability to embedded devices.

The next chapter looks at a couple of advanced features of Eclipse that are also of value to embedded developers, source code control using CVS, and software design modeling using UML.

Resources

There are countless books on Java programming. Here are a few that look interesting.

Block, Joshua. 2008. Effective Java. (2nd ed.) Prentice-Hall.

Eckel, Bruce. 2006. Thinking in Java. (4th ed.) Prentice Hall.

Horstmann, Cay S., and Gary Cornell. 2007. Core Java Volume 1 — Fundamentals. (8th ed.) Prentice Hall.

Horstmann, Cay S., and Gary Cornell. 2007. Core Java Volume 2 — Advanced Features. (8th ed.) Prentice Hall.

Sierra, Kathy, and Bert Bates. 2005. Head First Java. (2nd ed.) O’Reilly.

http://www.java.sun.com/ — This is Sun’s website for Java developers.

http://www.geocities.com/kollurihari/hari/programming.html/ — This is an interesting and very extensive website with tutorials on a wide range of software topics including Java. Nothing on Eclipse yet.

Here is a great starting point for writing plug-ins.

Clayberg, Eric and Dan Rubel, Eclipse: Building Commercial Quality Plug-ins, 2nd edition, Addison-Wesley, 2006.

CHAPTER 8

Eclipse Advanced Features

With a solid background in CDT, it’s time to turn our attention to some other tools in the Eclipse workshop that can aid software developers. Specifically, in this chapter we’ll look at source code control using CVS and software design modeling using UML.

8.1 UML

UML (Unified Modeling Language) is a mechanism for expressing the constructs and relationships of complex systems, in particular software systems. More specifically, it is a graphical notation that can be used to describe the various models of a software system.

Some of the ways UML is useful include:

• Requirements capture

• Expressing system concepts as classes

• Understanding how objects interact with each other in specific scenarios

• Characterizing the life cycle of objects by identifying the various states to which an object can transition

• Organizing classes into packages and subsystems

• Depicting the deployment of components in a final system

The UML 2.x  specifications[10] define 13 types of diagrams that are split into three categories:

• Structural diagrams. Identify the objects in the modeclass="underline"

 ○ Class diagram

 ○ Component diagram

 ○ Composite structure diagram

 ○ Deployment diagram

 ○ Object diagram

 ○ Package diagram

• Behavior diagrams. Describe what must happen in the system being modeled:

 ○ Activity diagram

 ○ State machine diagram

 ○ Use case diagram

• Interaction diagrams. A subset of Behavior diagrams, these emphasize the flow of control and data among the objects in the modeclass="underline"

 ○ Communication diagram

 ○ Interaction overview diagram

 ○ Sequence diagram

 ○ Timing diagram

Clearly then, the role of an Eclipse UML plug-in is to facilitate creating these diagrams and documenting the properties associated with them. UML is not tied to any specific programming language or software development methodology, although it is very much object-oriented and thus is a natural fit for Java and C++.

This chapter can only skim the surface of UML itself. The objective here is to show how a UML editor works in the context of Eclipse. The Resources section at the end of the chapter lists some resources for UML.

It should be noted that issues of modeling are also being addressed by the Eclipse organization itself through the Eclipse Modeling Framework project (EMF). EMF is described as a modeling framework and code generation facility for building tools and other applications based on a structured data model. For the time being anyway, EMF is primarily oriented toward Java programmers and so may not be particularly useful for embedded developers.

8.1.1 Installing Omondo EclipseUML

Eclipse.org does not itself have a complete UML plug-in. Instead, we’ll use a free plugin offered by Omondo, a UML tool vendor. EclipseUML Free Edition supports all UML 2.1 diagrams and is a good package for exploring what UML is all about.

The EclipseUML download page is: http://www.eclipsedownload.com/download_free_eclipse_3.3.html. There are three distributions available. For our purposes, the correct one is the EclipseUML Free Installer for Windows and Linux. It’s a jar file. Download it to your workstation.

Make sure Eclipse is not running, and in a shell window  execute:[11]

java –jar eclipseUML_E330_2007_freeEdition_3.3.0.v20071210.jar

This brings up an installation dialog. The first step is to select a language and click OK. Click Next to exit the welcome screen. The next screen is a little confusing in its description of system requirements. It says that three Eclipse plug-ins are required for EclipseUML and implies that one of them, Graphical Editor Framework, is included. In fact, all three of the required plug-ins are included.

Click Next and accept the license terms. The next screen shows your Eclipse installation path. Click Next again. This brings up the configuration screen of Figure 8.1. Leave all six items checked. Click Next and the installation begins. The installer creates an uninstall script should you wish to remove EclipseUML later.

вернуться

10

Version 2.0 was released by the Object Management Group (OMG) in 2003.

вернуться

11

Be aware, of course, that the file name may change.