Eclipse platform entry

Source: Internet
Author: User


Eclipse platform entry Original ENGLISH


Content:


What is Eclipse?
Eclipse is open-source software.
What is Eclipse?
Eclipse workbench
Java Development Environment (JDE)

Additional plug-ins

Example: A plug-in for UML modeling
Summary
Prospect of Eclipse
References
About the author
Comments on this article


Related content:
Insert swing-based development tools into eclipse
International Eclipse plug-in
Use eclipse to build a user interface for XM
Developerworks toolbox submodules


In the Linux zone, there are:
Tutorial
Tools and products
Code and components
Article


Use Eclipse plug-ins to edit, compile, and debug applications

Level: Entry

David Gallardo (david@gallardo.org)
Software Consultant
January 2004
This article provides an overview of the Eclipse platform, including its source and architecture. This article first briefly discusses the open-source nature of Eclipse and its support for multiple programming languages, and then demonstrates the Java development environment through a simple program example. This article also examines some software development tools available in the form of plug-in extensions, and shows a plug-in extension for UML modeling.

What is Eclipse?
Eclipse is an open-source and Java-based scalable development platform. In itself, it is only a framework and a set of services, used to build a development environment through plug-in components. Fortunately, Eclipse comes with a standard plug-in set, including Java Development Tools (JDT ).

Although most users are happy to use Eclipse as a Java IDE, the goal of Eclipse is not limited to this. Eclipse also includes the Plug-in Development Environment (Plug-in Development Environment, PDE). This component is mainly used by software developers who want to expand Eclipse, because it allows them to build tools that are seamlessly integrated with the Eclipse environment. Because everything in Eclipse is a plug-in, for Eclipse to provide plug-ins, and to provide users with a consistent and unified integrated development environment, all Tool developers have the same place to play.

This equality and consistency is not limited to Java development tools. Although Eclipse is developed in Java, its usage is not limited to Java. For example, plug-ins supporting programming languages such as C/C ++, COBOL, and Eiffel are available, or is expected to be released. The Eclipse framework can also be used as the basis for other application types unrelated to software development, such as the content management system.

An outstanding example of eclipse-based applications is IBM's WebSphere Studio workbench, which forms the basis of the IBM Java development tool series. For example, WebSphere Studio Application Developer adds support for JSP, Servlet, EJB, XML, Web Services, and database access.

Eclipse is open-source software.
Open-source software is such a software that carries a license designed to ensure that certain rights are granted to users upon release. Of course, the most obvious right is that the source code must be available so that users can freely modify and re-distribute the software. This kind of user rights is protectedCopyleftThe software license claims copyright protection. Unless such rights are explicitly granted to the user, the user shall not distribute the software. Copyleft also requires the same license to cover any software that is redistributed. This actually reverses the purpose of copyright-using copyright to grant user rights, rather than retaining copyright for software developers-Copyleft is often described as "retaining all copyrights ".

Many fears, worries, and doubts about open-source software have spread everywhere, are related to the so-called "virus" nature of some Copyleft licenses-if you use open source software as part of your program, you will lose your intellectual property rights, this license will "infect" the proprietary part of your development. In other words, this license may require that all software packaged with open source software must be released under the same license. Although this may be true for the most famous Copyleft license (that is, the GNU General Public License, for example, Linux is issued under this license, other licenses provided a good balance between commercialization and community considerations.

Open source code initiative is a non-profit organization that clearly defines the meaning of open source code and certification licenses that meet its standards. Eclipse is licensed under OSI-recognized General Public License (CPL) Version 1.0. Cpl "aims to promote the commercial use of programs ......" (For a link to the full text of General Public License version 1.0, see references later in this article ).

Developers who create plug-ins for eclipse or use eclipse as the basis for software development applications need to publish any eclipse code they use or modify under Cpl, however, they are free to decide how to grant their own code licenses. The proprietary code packaged with the software from eclipse does not need to be licensed as open source code, and the source code does not need to be provided to users.

Although most developers do not use eclipse to develop plug-ins or create new eclipse-based products, the open source code of eclipse means that, it doesn't just make eclipse available for free (although a license that is easy to commercialize means that the plug-in may have to spend money ). Open Source Code encourages innovation and inspires developers (even commercial developers) to contribute code to public open source code libraries. There are many reasons for this, but the most fundamental reason is that the more developers contribute to this project, the more valuable this project will become to everyone. As this project becomes more useful, more developers will use it and build a community around it, just like those around Apache and Linux.

What is eclipse?
Eclipse.org manages and guides eclipse development in progress. After it is said that IBM spent $40 million to develop eclipse and release it as an open-source project, the eclipse.org Association absorbed many software tool providers, including Borland, merant, rational, RedHat, Suse, togethersoft, and QNX. Other companies have joined since then, including Hewlett Packard, Fujitsu, and Sybase. These companies have assigned a representative to the Council to determine the direction and scope of the eclipse project.

At the highest level, the Project Management Board (PMC) manages Eclipse projects. This project is divided into multiple sub-projects, each of which has a person in charge. Large sub-projects are divided into groups, and each group also has a person in charge. At present, most of these management roles are held by the people of Object Technology International (OTI), an IBM subsidiary that initially developed Eclipse, but as an open-source project, it welcomes anyone to participate. The responsibility of any specific department is obtained through the contribution of the Department to the project.

Now we have examined some theories, history, and management behind Eclipse. Let's examine this product.

Eclipse workbench
When you open Eclipse for the first time, you first see the following welcome screen:

Figure 1. Eclipse workbench

The Eclipse workbench is calledView)Such as the Navigator view in the upper left corner. The set of PANES is calledPerspective (perspective). The default perspective is the Resource perspective, which is a basic universal visual gallery for managing projects and viewing and editing files in projects.

Navigator ViewAllows you to create, select, and delete projects. The right pane of Navigator isEditor Area. Depending on the document type selected in Navigator, an appropriate editor window will open here. If Eclipse is not registered for a specific document type (for example.docFile), Eclipse will try to use an external editor to open this document.

Under NavigatorOutline ViewThe outline of the document is displayed in the editor. The accuracy of the outline depends on the editor and document type. For Java source files, the outline displays all declared classes, attributes, and methods.

Tasks ViewCollect information about the project you are operating on. This can be information generated by Eclipse, such as compilation errors, or tasks you manually add.

Most of the other features of the workbench, such as menus and toolbar, should be similar to other familiar applications. A convenient feature is the shortcut Toolbar of different perspectives, which is displayed on the left side of the screen. These features vary significantly with context and history. Eclipse also comes with a robust help system, which includes the Eclipse workbench and the included plug-ins (such as Java development tools) User Guide. It is worthwhile to browse the help system at least once, so that you can see the available options and better understand the Eclipse workflow.

To continue this short Eclipse journey, we will create a project in Navigator. Right-click the Navigator view and selectNew => Project. When the New Project dialog box appears, select Java on the left. Standard Eclipse only has one Java Project type, named "Java Project ". If the plug-in is installed to provide JSP and servlet support, we will see an additional option for Web applications. Select a Java Project, enter "Hello" when prompted, and then press Finish.

Next, we will check the Java perspective. Depending on your favorite screen management method, you can chooseWindow => Open Perspective => JavaTo change the perspective in the current window, you can also selectWindow => New WindowAnd then select the new perspective to open a new window.

As you might expect, the Java perspective contains a set of views that are more suitable for Java development. One of them is the view in the upper left corner, which is a hierarchy that contains various Java packages, classes, jar and other files. This view is calledPackage Explorer. Note that the main menu has been expanded -- and two new menu items are displayed: Source and Refactor.

Java Development Environment (JDE)
To test the Java development environment, we will create and run a "Hello, world" application. Use the Java perspective, right-click the "Hello" project, and selectNew => Class, 2. In the subsequent dialog box, type "Hello" as the class name. In "Which method stubs wocould you like to create ?" Next, select the "public static void main (String [] args)" check box, and then press Finish.

Figure 2. Create a class in the Java perspective

In this way, an includeHelloClass and emptymain()Method.javaFile, as shown in 3. Then add the following code to the method (note thati):

Figure 3. Hello class in the Java Editor

You will notice some features of the Eclipse editor when typing, including syntax check and Automatic completion of code. In version 2.1 (I have downloaded version M2 for trial), Eclipse will automatically provide the pair symbol when you type parentheses or double quotation marks and place the cursor within the pair.

In other cases, you can call the code auto-completion function by pressing Ctrl-Space. The code automatically provides a list of context-sensitive suggestions. You can select from the list by keyboard or mouse. These suggestions can be a list of methods for a specific object, or they can be based on different keywords (suchforOrwhile.

Syntax check depends on incremental compilation. Every time you save the code, it receives the compilation and syntax check in the background. By default, syntax errors are displayed with red underscores, and a red dot with white "X" appears on the left side. Other errors are indicated by the lightbulb icon on the left of the editor. These are the problems that the editor may Fix for you-the so-called Quick Fix feature.

The above code example is as follows:forThe statement is followed by a bulb icon, becauseiIs omitted. Double-click the icon to bring up the recommended repair list. In this example, it provides the ability to create a class fieldi, A local variableiOr a method parameteriClick each suggestion to display the code to be generated. Figure 4 shows the recommended list and code generated after a local variable is created.

Figure 4. Quick Fix suggestions

Double-click the suggestion to insert the suggestion code to the proper position in the code.

Once the code compilation is completed without errors, you can select Run from the Eclipse menu to execute the program (note that there is no separate compilation step here, because compilation is performed when you save the code. If the Code has no syntax errors, it can run ). In this case, a Launch events dialog box with the appropriate default settings appears. Press the Run button in the upper right corner. A New Option Pane appears in the following pane (console), showing program output, as shown in Figure 5.

Figure 5. program output

You can also run the program in the Java debugger. Double-click the gray edge on the left of the editor view to callSystem.out.println()Aftermain() System.out.println()Set a breakpoint. A blue point will appear there. Select Debug from the Run menu. As described above, a Launch events dialog box is displayed. Select Run. The perspective is automatically switched to the Debug perspective, with many interesting new views, as shown in Figure 6:

Figure 6. Debug perspective

First, pay attention to the Debug view in the upper-left corner of the perspective. This view displays the call stack and has a toolbar in the title bar that allows you to control program execution, including continuing, suspending or terminating the program, tracking the next statement, and executing the next statement in one step, or return from the method.

The upper-right pane contains a number of Option-style views, including Variables, Breakpoints, Expressions, and Display. Here I click the Variables view so that we can seei.

You can obtain more information about these views through context-sensitive help: Click the view title, and then press F1.

Additional plug-ins
Except for plug-ins like JDT used to edit, compile, and debug applications, some available plug-ins support the complete development process from modeling, automatic generation, unit testing, performance testing, Version Control to configuration management.

Eclipse is a standard plug-in that works with CVS. CVS is an open source code Concurrent Version System (Concurrent Versions System) for source code control ). The team plug-in connects to the CVS server, allowing developers to operate on a group of source code files without overwriting others' changes. It is not intended to further explore how to implement source code control from within eclipse, because it requires the installation of the CVS server. However, supporting the development team is not just independent development, which is an important essential feature of Eclipse.

Some third-party plug-ins available or announced to be launched include:

Version Control and configuration management

  • CVS
  • Merant PVCS
  • Rational ClearCase

UML modeling

  • OMONDO EclipseUML
  • Rational XDE (instead of Rose)
  • Together WebSphere Studio Edition

Graphics

  • Batik SVG
  • Macromedia Flash

Web development, HTML, XML

  • Macromedia Dreamweaver
  • XMLBuddy

Application Server Integration

  • Sysdeo Tomcat launcher

For a complete list of available plug-ins, see the links in references.

Example: A plug-in for UML modeling
To view the example of a plug-in and how it is integrated with Eclipse, download the popular omondo eclipseuml (see references). You need to register, however, this plug-in is free of charge. This plug-in depends on GEF, that is, Graphical Editor framework, which is another Eclipse plug-in. GEF is part of the tool subitem. To download GEF, go to the eclipse web site (see references), select "downloads", and click the "Tools PMC Downloads page" link. Note that you need to download the GEF version recommended by omondo (GEF 2.0 for omondo 1.0.2 ).

After downloading the plug-in, you can usually decompress the downloaded file and copy its content to the Eclipse plug-in directory. In this example, GEF needs to be decompressed to the eclipse directory (it will automatically enter the plug-in directory from this directory ). To ensure security, you may want to extract it to a temporary directory and then copy the relevant directory from it. If eclipse is running, you need to stop it and restart it so that it can identify the newly installed plug-in.

Once eclipseuml (and GEF) is installed, you can create a class diagram just like creating a Java class file. In the Java perspective, right-click the "hello" project in package explorer and selectNew => Other. The left pane of the New dialog box contains a New option for UML. The free version of EclipseUML only supports Class diagrams. Therefore, the only option on the right is UML Class digoal. Select UML Class digoal and enter a name for the Class Diagram, such as "Hello ":

Figure 7. Class digoal Editor

The editor area displays a graphic editor with a canvas for drawing class diagrams. You can create a class diagram in two ways: drag and drop a Java file from Package Explorer to the class diagram to reverse engineer the existing code; alternatively, you can use the painting tools available in the toolbar above the blank class diagram. To test the first method, create a new class named Person (UseFile => New => Class), And then grant it two private attributes listed below:

/** Person.java * @author david */public class Person {private String name;private Address address;/** * Returns the address. * @return Address */public Address getAddress() {         return address;}/** * Returns the name. * @return String */public String getName() {        return name;}/** * Sets the address. * @param address The address to set */public void setAddress(Address address) {        this.address = address;}/** * Sets the name. * @param name The name to set */public void setName(String name) {       this.name = name;}}

(It should be admitted that I only typed rows for name and address. The getter and setter methods are automatically generated through Eclipse, that is, right-click the source code and selectSource => Generate Getter and Setter.)

Save and closePerson.java Hello.ucd。

Figure 8. Person class diagram

To create a Java class from UML, click the "New class" button on the toolbar at the top of the class diagram window, that is, the third button from the left, and then click the class diagram. When the New Class Wizard is opened, enter Adress as the class name and press Finish.

You can right-click the class name and selectNew => AttributeTo add attributes to the class. In the New properties dialog box, enter the property name, type, and visibility. Right-click the class name and selectNew => MethodTo add a method.

When you change a class chart, the Source Editor window below the chart will reflect the changes. Finally, you can click the Association button (the fifth one from the left) to draw a line segment from the Person class to the Address class to draw the relationship between the two classes. This will bring up another dialog box, where you can enter the association attributes (refer to EclipseUML help for more information about the required information ). The figure after completion should be similar to the following:

Figure 9. Join

This UML plug-in shows several typical features of the Eclipse plug-in. First, it shows close integration between tools. On the surface, it is absolutely impossible to see that multiple components are working. Integration with the Eclipse platform and JDT is seamless. For example, when the Person class is created, it displays a syntax error because it has an attribute.AddressNot defined. OnceAddressAfter the class is created in the UML diagram, these components are displayed separately.

Another feature is that EclipseUML leverages the capabilities provided by other plug-ins-in this example, the GEF plug-in provides tools for developing visual editors.

Another feature is that EclipseUML plug-in uses multi-level functions for distribution. The basic plug-ins that support class diagrams are free of charge, but more mature versions are charged for use.

Eclipse Platform Architecture
The Eclipse platform is a framework with a strong set of services that support plug-ins, such as JDT and plug-in development environments (PDE ). It consists of several major components: Platform Runtime Library, work zone, workbench, team support and help.

Figure 10. architecture of the Eclipse Platform

Platform
The Platform Runtime Library is the kernel. It checks which plug-ins are installed at startup and creates registry information about them. To reduce the startup time and resource usage, the plug-in is loaded only when any plug-in is actually required. Everything except the kernel is implemented as a plug-in.

Work Zone
The workspace is a plug-in for managing user resources. This includes projects created by users, files in those projects, file changes and other resources. The workspace also notifies other plug-ins about resource changes, such as file creation, deletion, or modification.

Workbench
The Workbench provides a user interface for Eclipse. It is built using the standard Window Toolkit (SWT) and a more advanced API (JFace); SWT is a non-standard replacement of Java's Swing/awt gui api, JFace provides user interface components based on SWT.

SWT has proved to be the most controversial part of Eclipse. SWT maps to the local graphics function of the underlying operating system more closely than Swing or SWT. This not only makes SWT faster, but also makes Java programs look more like local applications. Using this New gui api may limit the portability of the Eclipse workbench, but SWT porting versions for most popular operating systems are available.

Eclipse's use of SWT only affects the portability of Eclipse itself-No Java applications built using Eclipse will be affected unless they use SWT instead of Swing/AWT.

Team support
The team support component provides support for version control and configuration management. It adds views as needed to allow users to interact with any version control system (if any) in use. Most plug-ins do not need to interact with the team's support components unless they provide version control services.

Help
The help component has the same scalability as the Eclipse platform itself. Similar to adding a plug-in to Eclipse, the plug-in provides an additional navigation structure that allows tools to add documents as HTML files.

Prospect of Eclipse
Development around Eclipse is in a critical stage. Major software and tool providers are involved, and the number of open-source Eclipse plug-in projects is growing.

The portable, extensible, and open-source framework is not a new idea (You may think of Emacs), but Eclipse brings new impetus due to its mature, robust, and elegant design. The release of world-class software worth $40 million in IBM in the open source code field has brought a long-lasting shock to the industry.

References

  • You can obtain Eclipse documents, articles, and download Eclipse from the Eclipse project website.

  • View the contents of General Public License v1.0.
  • Browse the complete list of Eclipse plug-ins.
  • Download the popular OMONDO EclipseUML. You need to register it, but this plug-in is free of charge.
  • Information about open source software, including certified open source code licenses such as public general license, can be found on the open source code plan Web site.
  • Authoritative interpretations of copyleft can be found on the Free Software Foundation Web site.
  • Read the press release announcing that IBM has donated Eclipse to the open-source community.
  • In the followingDeveloperWorksFor more information about Eclipse, see the following section:
    • "Interview with Marc Erikson about the Eclipse code donation "(DeveloperWorks, January 1, November 2001 ).
    • "Working the Eclipse Platform "(DeveloperWorks, January 1, November 2001 ).
    • "Getting to know WebSphere Studio Application Developer "(DeveloperWorks, January 1, November 2001 ).
    • "Help for reusing your assets "(DeveloperWorks, January 1, November 2001 ).
    • "Create native, cross-platform GUI applications "(DeveloperWorks, January 1, April 2002 ).
    • "International Eclipse plug-in "(DeveloperWorks, January 1, June 2002 ).
    • "Test your international Eclipse plug-in "(DeveloperWorks, January 1, July 2002 ).
    • "Insert Swing-based development tools into Eclipse "(DeveloperWorks, January 1, January 2003 ).
    • "Working XML: Use Eclipse to build a user interface for XM "(DeveloperWorks, January 1, October 2002 ).
  • Recently, many articles about Eclipse have appeared in the computer press. In "Promoting shared software through Eclipse "(DTmag.comNovember 2002) I learned why a professor at Carleton University chose to build two ambitious projects based on Eclipse.
About the author
David Gallardo, an independent software consultant and writer, specializes in Software Internationalization, Java Web application and database development. He has been a professional software engineer for 15 years and has many operating systems, programming languages, and network protocols. He was recently engaged in advanced database and International Development at TradeAccess, Inc., a B2B e-commerce company. Prior to that, he was a senior engineer at the International Product Development Department of Lotus Development Corporation, responsible for developing a cross-platform library that provides Unicode and international language support for Lotus products (including Domino. You can contact David through a david@gallardo.org.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.