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 protection is implemented through a strategy called Copyleft: software licenses claim copyright protection, and users shall not distribute the software unless such rights are explicitly granted to users. 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:
The eclipse workbench consists of several panes called views, such as the navigator view in the upper left corner. A set of PANES is called a 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.
The navigator view allows you to create, select, and delete projects. The right pane of navigator is the editor area. Depending on the document type selected in navigator, an appropriate editor window will open here. If eclipse does not register an appropriate editor for a specific document type (for example, the. DOC file on Windows), eclipse will try to open the document using an external editor.
The Outline View under navigator displays the document outline in the editor. The accuracy of this outline depends on the editor and document type. For Java source files, this outline displays all declared classes, attributes, and methods.
The tasks view collects 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 choose new => 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 change the perspective in the current window by selecting window => open perspective => JAVA, or by selecting window => new window, 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 called package 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 choose new => class, as shown in figure 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.
This will create a. Java file in the editor area that contains the Hello class and the empty main () method, as shown in 3. Then add the following code to the method (note that the I declaration is intentionally omitted ):
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 code snippets based on different keywords (such as for or while.
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 has a lightbulb icon behind the for statement because the I statement is omitted. Double-click the icon to bring up the recommended repair list. In this example, it provides suggestions for creating a class field I, a local variable I, or a method parameter I. Click 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 set a breakpoint in main () system. Out. println () after system. Out. println () is called. 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 see the current value of I.
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 Eclipse plug-ins list.
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. You need to register it, but 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, 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 choose new => other from the pop-up menu. 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" (using file => New => class) and assign it two private attributes listed below:
/** Person. Java
* @ Author David
*/
Public class person {
Private string name;
Private 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 ){
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 select Source => Generate getter and setter from the pop-up menu .)
Save and disable person. 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 choose new => attribute to add attributes to the class. In the new properties dialog box, enter the property name, type, and visibility. Right-click the class name and choose new => method to add the 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 its attribute address is not defined. Once the Address 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.
Address: http://www.javafan.net/article/20041209094024728.html