Getting started with the Eclipse platform. What is the Eclipse platform and how to use it

IDE (Integrated Development Environment), or integrated development environment in Russian, is a tool designed for development software. We wrote the program code in text editor, then compiled and ran the program via the command line, which is not entirely convenient. The IDE allows you to unified environment write, compile, run and debug a program.

The most popular free IDEs for Java programmers are: Eclipse, NetBeans and IntelliJ IDEA. exists on the Internet a lot of controversy about which IDE is better, however, there is no clear answer to this question; it all depends on the range of tasks that need to be solved. Also, each programmer usually chooses the one that is more convenient for him and to which he is accustomed. At the initial stage, you can choose any one, it doesn’t matter.

Also, there are many supporters of the theory that for the first few months you should work exclusively with a notepad and command line, because this is the only way to understand how everything works from the inside, and there is truth in this. But, after several unsuccessful attempts compiling and manually correcting syntax errors in the code, you may simply lose the desire to do this further, so I am a supporter of going straight to the IDE.
In any case, the choice is yours.

In this tutorial we'll look at how to get started with the Eclipse IDE.

  • Install Eclipse IDE on your computer
  • Let's create a Hello World program in it.

Installing and Running Eclipse IDE

  1. Follow the link http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplerr and download Eclipse corresponding to the operating system.
    Installation for Windows will be discussed next.
  2. Unpack the downloaded .zip archive into a directory C:\Program Files\
  3. This completes the installation!
  4. To launch the Eclipse IDE, you need to open the file eclipse.exe located in the folder C:\Program Files\eclipse\.
  5. When launched, a window will open asking you to select work area(Workspace), where the project program files will be stored. We indicate the directory convenient for us (Fig. 3.1.) and click OK.

6. Close the welcome message (Fig. 3.2.), thereby moving to the working environment.

Getting started with Eclipse IDE

Now let's create a new project. To do this, select the menu File->New->Project..

In the window that opens, select Java Project(Fig. 3.3.) and press Next.

In the next window, enter the name of our project (Fig. 3.4.) and click Finish.

The project will appear on the left side of the screen and should contain the element JRE System Library(Fig. 3.5.)

If this element is not there, then you need to add it manually! For this we choose Windows -> Preferences, in the window that opens Preferences on the left we will select Java -> Installed JREs, press the button Add… on the right (Figure 3.6.). In the window that opens, select Standard VM and press the button Next.

In the window that opens Add JRE, indicate the directory in which Java is installed (Figure 3.7.) and click Finish.

The first step is to create a class. Let's click right click on the project folder and select from the context menu New -> Class(Figure 2.7.).

In the window that opens New Java Class enter the name of the project class HelloWorld and check the box for the method public static void main(String args)(Figure 2.8.). Click Finish.

As a result, Eclipse will create a new class Hello World

Let's open the created class and complete our program. Let's add the following code to the main method (Figure 2.9.).

System.out.println("Hello World");

Let's save the changes using the Ctrl+S keys or the special icon at the top of the toolbar. Ready!

In the window that opens, on the left side, double-click on Java Application after which, a new element will be created with the name New_configuration, which we can later change on the right side. On the right side we will also fill in the fields Project And Main Class. Project must contain the name of the project, Main Class - the name of the main class, in our case - HelloWorld( rice. 3.10). Then click Apply And Run.

As a result, the words will be printed in the console Hello World(Fig. 3.11).

To launch the program in the future, just press special icon on the toolbar by selecting Hello World(Fig. 3.12.).

This concludes this lesson.

Detailed instructions for working with Eclipse, albeit in English, can be found at the link: http://www.vogella.com/articles/Eclipse/article.html

Eclipse is a Java-based, extensible, open-source development platform source code. In essence, it is simply a development environment and a set of services for building applications based on embedded components (plugins). Fortunately, Eclipse comes with a standard set of plugins, including the well-known toolkit - Java Development Tools (JDT).

While most users who use Eclipse as a Java integrated development environment (IDE) are happy with it, there's much more to it than that. Eclipse also includes a plugin development environment (PDE), which will primarily be of interest to those who want to extend Eclipse itself, as it allows you to create your own tools that are built into the Eclipse environment. Because Eclipse is made entirely of plugins, all toolkit developers have the opportunity to offer their own extensions to Eclipse and provide users with a consistent and seamless integrated development environment (IDE).

This integrity and consistency is not unique to Java development tools. Although Eclipse is written in Java, it can be used with other languages. For example, plugins are already available (or are being developed) that support programming languages ​​such as C/C++ and COBOL. The Eclipse framework can also be used as a basis for other types of applications unrelated to software development, such as content management systems.

An excellent example of an Eclipse-based application is IBM's Rational Software Architect, which forms the basis of IBM's family of Java development tools.

Eclipse is open source

Open source software is released under a license designed to guarantee certain rights to users. The most obvious of these, of course, is that the source code must be made available to users, and they have every right modify and independently distribute the software. This protection of user rights is achieved through a mechanism called "copyleft": The software license is copyright protected and prohibits distribution of the software unless the user is granted such rights. A copyleft license also requires that all software distributed by users be covered by the original license without modification. Thus, the meaning of copyright is essentially turned upside down, and a copyleft license, which uses copyright to give rights to the user rather than to retain them for the software developer, is often jokingly said “all rights are perverted” (all rights reversed).

Much of the common fear, uncertainty, and doubt about open source software is based on the so-called viral nature of some copyleft licenses. The idea is that if you use open source software as part of your own development program, you will lose your intellectual property, since the license will “infect” your personal parts of the program. In other words, the license may require that all open source software, including any newly created software, be distributed under the same license. While this is true for the most famous copyleft license, the GNU General Public License (under which, for example, Linux is distributed), there are other licenses that provide a different balance of commercial and public interests.

Open Software Initiative - OSI (Open Software Initiative) is a non-profit organization that clearly defines what constitutes open source and certifies licenses that meet its criteria. Eclipse is distributed under the EPL - Eclipse Public License V1.0, an OSI-approved license designed to facilitate commercial acceptance of Eclipse while maintaining credit to the original code authors.

Those who create plugins for Eclipse or use Eclipse as a base for software development are required to publish any Eclipse code they use or modify under the EPL, but are free to license their own add-ons as they like. Native code bundled with software from Eclipse does not need to be licensed as open source, and the source code itself does not need to be made publicly available.

While most programmers wouldn't use Eclipse to develop plugins or create new products based on it, the open source nature of Eclipse is significant not only because it makes Eclipse available completely free of charge (and despite its commercially oriented nature). the license implies that plugins may cost money). Open source promotes innovation and creates an incentive for developers (even commercial ones) to contribute their source code to the community. There are several reasons for this, but perhaps the most significant is that the more developers contribute to the project, the more meaningful it becomes for everyone. And when the project becomes useful, that's it larger number developers will use it and create a community around it, similar to those that have formed around Apache and Linux.

What is Eclipse?

Eclipse is an open source community of developers whose projects aim to build open platform for development, consisting of an extensible development environment, tools, and runtime libraries for building, deploying, and managing software throughout its life cycle. The Eclipse Foundation is a non-profit, member-supported organization that hosts Eclipse projects and helps improve the open source community and ecosystem of complementary products and services.

The Eclipse project was created in November 2001 by IBM and supported by a consortium of software vendors. The Eclipse Foundation was created in January 2004 as an independent, non-profit organization serving as a steward of the Eclipse community. It was created to help a vendor-neutral, open, and transparent community grow around Eclipse. Today's Eclipse community consists of individuals and organizations representing the software industry.

The Eclipse Foundation oversees and directs ongoing development of Eclipse. The foundation serves the community, but the open source developers, called committers, who essentially work on Eclipse projects, are not on its staff. Typically, Eclipse committers are members of some organization or are independent developers who volunteer their time to work on an open source project.

Now that we've looked at the theoretical, historical, and political aspects of Eclipse, let's look at the product itself.

Eclipse workspace

When you first launch Eclipse, you will see a Welcome page inside the workspace (see Figure 1). An Eclipse user has several options to navigate to the overview page, which is what I recommend doing (see Figure 2). Next, you can get acquainted with information on new functions, study some examples, or take a training course.

Figure 2. Eclipse overview page

The Eclipse workspace consists of several panels called views, such as navigation or outline views. A set of such representations is called perspective. One of the most common perspectives is the Resource perspective, which is a basic set of views for managing projects and viewing and editing project files.

I recommend that most first-time users start with the overview page shown in Figure 2 and learn more about Eclipse. The workbench basics section contains a lot of useful initial information about various components Eclipse and how they interact with each other. Take a few minutes to read this, and then let's dive into Eclipse's Java Development Tools (JDT). The best way to learn something is to try it in practice.

Continuing this short tour of Eclipse, we'll create a new project in Java. Select File > New > Java Project and enter Hello when prompted for the project name, then click Finish.

Now let's look at the "Java" perspective (if you're not already in it). Depending on how you prefer to control your screen, you can either change the perspective in the current window by selecting Window > Open Perspective > Java (Window > Open Perspective > Java), or open a new window by selecting Window > New Window, and choose a new perspective.

As you might expect, the Java perspective has a set of views designed to guide Java development. One of them, located on the left top corner, is a hierarchy containing various Java packages, classes, JAR archives and various files. This view is called Package Explorer. Please note that two new items have been added to the main menu: Source and Refactor.

Java Development Tools (JDT)

To try out the Java development environment, we will create and run an application called "Hello World". While in the Java perspective, right-click on the folder with the project's source test "Hello" (src) and select New > Class, as shown in Figure 3. In the dialog box that appears, enter Hello as the class name. Below is the inscription Which method stubs would you like to create? (What method stubs do you want to create?) note public static void main(String args) and click Finish.

Figure 3. Creating a new class in the Java perspective

This will create a .java file with the Hello class and an empty main() method in the editor area, as shown in Figure 4. Let's add the following code to the method (note that the description for i has been deliberately omitted).

Figure 4. Hello class in the Java editor

As you type, you'll notice some of the Eclipse editor's features, including syntax checking and automatic code completion. Also, when you enter the opening parenthesis or double quotes, Eclipse automatically inserts a closing pair for them and places the cursor in the middle.

In other cases, you can cause automatic code completion using the combination Ctrl+1. The code completion function provides a context-sensitive list of options from which you can select using the keyboard or mouse. Options can be a list of methods specific to a particular object, or a piece of code based on various keywords, such as for or while .

Syntax checking depends on incremental compilation. As you save your code, it is compiled in the background and checked for syntax errors. By default, syntax errors are underlined in red, and a red dot with a white X appears in the left margin. Other errors are marked in the editor's margin with a symbol light bulb; these are problems that the editor could fix for you (a feature called Quick Fix).

In the code above, the light bulb sign appears next to the for statement because the description for i was omitted. Double tap mouse on the light bulb will cause a list of suggested fixes to appear. In our case, we will be asked to create a class field i, a local variable i, or a parameter i for a method; selecting any of these options with the mouse will show the code that will be generated. Figure 5 shows the list of suggested options and the code suggested in the case of a local variable.

Figure 5: Quick Fix options

Double-clicking on a sentence inserts the code into the desired place in the program.

If the program compiles without errors, you can run it by selecting Run in the Eclipse menu. (Note that there is no separate step for compilation because compilation occurs as you save the code. If your code has no syntax errors, it is ready to run.) The Launch Configurations dialog appears with the desired defaults; click Run bottom right. Appears in the bottom panel new panel with tabs (Console), displaying the result of the program, as shown below.

Figure 6. Result of the program

You can also run the program in the Java debugger. First you need to set a breakpoint in main() System.out.println() by double-clicking the gray box on the left side of the edit window next to the System.out.println() call. A blue dot will appear. On the menu Run select team Debug. As described earlier, the "Launch Configurations" dialog will appear. Select a team Run. The perspective will automatically change to the Debug perspective containing whole line interesting new ideas as shown below.

Figure 7. Debug Perspective

Notice the Debug view in the top left corner of the perspective. This view shows the call stack and contains a toolbar in the title bar that allows you to control program execution. The panel has buttons to continue, pause or end the program, move to the next statement, step over the next statement, or return from a method. The panel at the top right contains a number of tabbed views, including Variables, Breakpoints, Expressions, and Display. The Variables tab is now selected, so we can see the current value of the i variable.

More detailed information about any of the views can be obtained using the context tooltip; To do this, click on the view title and press F1.

Additional plugins

In addition to JDT-type plugins for editing, compiling, and debugging applications, there are plugins that support the entire development process: modeling, build automation, unit testing, performance testing, versioning and configuration management.

Eclipse includes a plugin for working with the Concurrent Versions System (CVS) for source code management. The Team plugin connects to the CVS server, allowing members of a development team to work with a set of files containing source code without interfering with changes made by others. We will not explore management in more detail here. source texts from Eclipse, as this will require installing a CVS server, although the ability to support a development team rather than just self-development is an important and integral part of Eclipse.

Plugins that are maintained and distributed by the Eclipse Foundation can be found on the Eclipse Web site. Most full list available plugins is available on the Eclipse Plug-in Central page, which serves as a plugin directory.

Eclipse Platform Architecture

The Eclipse platform contains a powerful set of plugins (see Figure 8) that support projects such as JDT and PDE.

Figure 8. Simplified architecture of the Eclipse platform

The dark blue blocks represent components that are central to the Rich Client Platform (RCP) in Eclipse. The concept of RCP itself is beyond the scope of this article, but let's assume that RCP is simply a set of plugins from Eclipse that people can use in application development, for example Lotus Notes® 8. Light blue blocks represent optional (although recommended) components for inclusion in RCP-based applications. And the gray blocks are completely optional. The platform consists of several components, we will look at some of them:

Runtime Runtime is the code that defines the Eclipse plugin model, based on the OSGi specification and the idea of ​​extensions and extension points. Runtime also provides additional services, such as syslogging and concurrency. JFace/SWT The Standard Widget Toolkit (SWT) is a set of widgets responsible for user interface and Eclipse functions. JFace is simply a superset of SWT that provides several Model-View-Controller (MVC) classes to make developing graphical applications easier. Workbench The workspace gives Eclipse its personality. It is at this level that the concept of views, perspectives, and things like editing windows is implemented. Help (User Support) This Eclipse component allows you to provide support to your users. This can be done via help system, which will allow users to search for help documentation, or through "cheat sheets", which can be presented as interactive task lists to end users. Update The update component provides a means for Eclipse to update applications from one version to another. Team The team component is an infrastructure that allows development companies to connect their own version control systems. A sample provider implementation is the CVS plugin built into Eclipse.

Conclusion

From initial code written by IBM, Eclipse has grown into a full-featured open source ecosystem with more than 100 participating companies. Portable, extensible, open source infrastructure - no longer new idea, but thanks to its well-thought-out, robust and elegant design, the Eclipse takes on a whole new dynamic.

Welcome to the Eclipse ecosystem. Our goal was to help you get up to speed on the Eclipse platform. We've achieved this through an introductory text and a simple practice exercise. Use the knowledge you gain from reading this article and become an active member of the Eclipse ecosystem.

Using Eclipse plugins for editing, compiling, debugging, and as a basis for your applications

This update to David Gallardo's article offers new information regarding Eclipse V3.3.

What is Eclipse?

Eclipse is a Java-based, open source, extensible development platform. In essence, it is simply a development environment and a set of services for building applications based on embedded components (plugins). Fortunately, Eclipse comes with a standard set of plugins, including the well-known Java Development Tools (JDT).

While most users who use Eclipse as a Java integrated development environment (IDE) are happy with it, there's much more to it than that. Eclipse also includes a plugin development environment (PDE), which will primarily be of interest to those who want to extend Eclipse itself, as it allows you to create your own tools that are built into the Eclipse environment. Because Eclipse is made entirely of plugins, all toolkit developers have the opportunity to offer their own extensions to Eclipse and provide users with a consistent and seamless integrated development environment (IDE).

This integrity and consistency is not unique to Java development tools. Although Eclipse is written in Java, it can be used with other languages. For example, plugins are already available (or are being developed) that support programming languages ​​such as C/C++ and COBOL. The Eclipse framework can also be used as a basis for other types of applications unrelated to software development, such as content management systems.

An excellent example of an Eclipse-based application is IBM® Rational® Software Architect (see ), which forms the basis of IBM's family of Java development tools.

Eclipse is open source

Open source software is released under a license designed to guarantee certain rights to users. The most obvious of them, of course, is that the source code must be provided to users, and they have every right to modify and distribute the software themselves. This protection of user rights is achieved through a mechanism called "copyleft": The software license is copyright protected and prohibits distribution of the software unless the user is granted such rights. A copyleft license also requires that all software distributed by users be covered by the original license without modification. Thus, the meaning of copyright is essentially turned upside down, and a copyleft license, which uses copyright to give rights to the user rather than to retain them for the software developer, is often jokingly said “all rights are perverted” (all rights reversed).

Much of the common fear, uncertainty, and doubt about open source software is based on the so-called viral nature of some copyleft licenses. The idea is that if you use open source software as part of a program you develop yourself, you will lose your intellectual property because the license will contaminate your private parts of the program. In other words, the license may require that all open source software, including any newly created software, be distributed under the same license. While this is true for the most famous copyleft license, the GNU General Public License (under which, for example, Linux® is distributed), there are other licenses that provide a different balance of commercial and public interests.

Open Software Initiative - OSI (Open Software Initiative) is a non-profit organization that clearly defines what constitutes open source and certifies licenses that meet its criteria. Eclipse is distributed under the EPL - Eclipse Public License V1.0, an OSI-approved license designed to facilitate commercial acceptance of Eclipse while maintaining credit to the original code authors.

Those who create plugins for Eclipse or use Eclipse as a base for software development are required to publish any Eclipse code they use or modify under the EPL, but are free to license their own add-ons as they like. Native code bundled with software from Eclipse does not need to be licensed as open source, and the source code itself does not need to be made publicly available.

While most programmers wouldn't use Eclipse to develop plugins or create new products based on it, the open source nature of Eclipse is significant not only because it makes Eclipse available completely free of charge (and despite its commercially oriented nature). the license implies that plugins may cost money). Open source promotes innovation and creates an incentive for developers (even commercial ones) to contribute their source code to the community. There are several reasons for this, but perhaps the most significant is that the more developers contribute to the project, the more meaningful it becomes for everyone. And when a project becomes useful, more developers will use it and create a community around it, similar to those that have formed around Apache and Linux. (For more information about licenses, see the section.)

What is Eclipse?

Eclipse is an open source community of developers whose projects aim to build an open development platform consisting of an extensible development environment, tooling, and runtime libraries for building, deploying, and managing software throughout its lifecycle. The Eclipse Foundation is a non-profit, member-supported organization that hosts Eclipse projects and helps improve the open source community and ecosystem of complementary products and services.

The Eclipse project was created in November 2001 by IBM and supported by a consortium of software vendors. The Eclipse Foundation was created in January 2004 as an independent, non-profit organization serving as a steward of the Eclipse community. It was created to help a vendor-neutral, open, and transparent community grow around Eclipse. Today's Eclipse community consists of individuals and organizations representing the software industry.

The Eclipse Foundation oversees and directs ongoing development of Eclipse. The foundation serves the community, but open source developers called committers and, as such, those working on Eclipse projects are not on his staff. Typically, Eclipse committers are members of some organization or are independent developers who volunteer their time to work on an open source project.

Now that we've looked at the theoretical, historical, and political aspects of Eclipse, let's look at the product itself.

Eclipse workspace

When you first launch Eclipse, you will see a Welcome page inside the workspace (see Figure 1). An Eclipse user has several options to navigate to the overview page, which is what I recommend doing (see Figure 2). Next, you can get acquainted with information on new functions, study some examples, or take a training course.

Figure 1. Eclipse Welcome Page
Figure 2. Eclipse overview page

The Eclipse workspace consists of several panels called representations, such as navigation or outline views. The set of such representations is called perspective. One of the most common perspectives is the Resource perspective, which is a basic set of views for managing projects and viewing and editing project files.

I recommend that most first-time users start with the overview page shown in Figure 2 and learn more about Eclipse. The workbench basics section contains a lot of useful initial information about the various components of Eclipse and how they interact with each other. Take a few minutes to read this, and then let's dive into Eclipse's Java Development Tools (JDT). The best way to learn something is to try it in practice.

Continuing this short tour of Eclipse, we'll create a new project in Java. Select File > New > Java Project and enter Hello when prompted for the project name, then click Finish.

Now let's look at the "Java" perspective (if you're not already in it). Depending on how you prefer to control your screen, you can either change the perspective in the current window by selecting Window > Open Perspective > Java (Window > Open Perspective > Java), or open a new window by selecting Window > New Window, and choose a new perspective.

As you might expect, the Java perspective has a set of views designed to guide Java development. One of them, located in the upper left corner, is a hierarchy containing various Java packages, classes, JAR archives and various files. This view is called Package Explorer. Please note that two new items have been added to the main menu: Source and Refactor.

Java Development Tools (JDT)

To try out the Java development environment, we will create and run an application called "Hello World". While in the Java perspective, right-click on the folder with the project's source test "Hello" (src) and select New > Class, as shown in Figure 3. In the dialog box that appears, enter Hello as the class name. Below is the inscription Which method stubs would you like to create? (What method stubs do you want to create?) note public static void main(String args) and click Finish.

Figure 3. Creating a new class in the Java perspective

This will create a .java file with a Hello class and an empty main() method in the editor area, as shown in Figure 4. Let's add the following code to the method (note that the description is for i was deliberately omitted).

Figure 4. Hello class in the Java editor

As you type, you'll notice some of the Eclipse editor's features, including syntax checking and automatic code completion. Additionally, when you enter an opening parenthesis or double quotes, Eclipse automatically inserts a closing pair for them and places the cursor in the middle.

In other cases, you can cause automatic code completion using the combination Ctrl+1. The code completion function provides a context-sensitive list of options from which you can select using the keyboard or mouse. The options can be a list of methods specific to a particular object, or a piece of code based on various keywords, such as for or while .

Syntax checking depends on incremental compilation. As you save your code, it is compiled in the background and checked for syntax errors. By default, syntax errors are underlined in red and a red dot with a white X appears in the left margin. Other errors are marked in the editor's margin with a light bulb symbol; these are problems that the editor could fix for you (a feature called Quick Fix).

In the code above, the light bulb sign appears next to the for statement because the description for i was omitted. Double-clicking on the light bulb will cause a list of suggested fixes to appear. In our case, we will be asked to create a class field i, a local variable i, or a parameter i for a method; selecting any of these options with the mouse will show the code that will be generated. Figure 5 shows the list of suggested options and the code suggested in the case of a local variable.

Figure 5: Quick Fix options

Double-clicking on a sentence inserts the code into the desired place in the program.

If the program compiles without errors, you can run it by selecting Run in the Eclipse menu. (Note that there is no separate step for compilation because compilation occurs as you save the code. If your code has no syntax errors, it is ready to run.) The Launch Configurations dialog appears with the desired defaults; click Run bottom right. A new panel with tabs (Console) appears in the bottom panel, displaying the result of the program, as shown below.

Figure 6. Result of the program

You can also run the program in the Java debugger. First you need to set a breakpoint in main() System.out.println() by double-clicking the gray box on the left side of the edit window next to the System.out.println() call. A blue dot will appear. On the menu Run select team Debug. As described earlier, the "Launch Configurations" dialog will appear. Select a team Run. The perspective will automatically change to the Debug perspective, which contains a number of interesting new views, as shown below.

Figure 7. Debug Perspective

Notice the Debug view in the top left corner of the perspective. This view shows the call stack and contains a toolbar in the title bar that allows you to control program execution. The panel has buttons to continue, pause or end the program, move to the next statement, step over the next statement, or return from a method. The panel at the top right contains a number of tabbed views, including Variables, Breakpoints, Expressions, and Display. The Variables tab is now selected, so we can see the current value of the i variable.

More detailed information about any of the views can be obtained using the context tooltip; To do this, click on the view title and press F1.

Additional plugins

In addition to JDT-type plugins for editing, compiling, and debugging applications, there are plugins that support the entire development process: modeling, build automation, unit testing, performance testing, versioning and configuration management.

Eclipse includes a plugin for working with the Concurrent Versions System (CVS) for source code management. The Team plugin connects to the CVS server, allowing members of a development team to work with a set of files containing source code without interfering with changes made by others. We won't explore source management from Eclipse in more detail here since that would require installing a CVS server, although the ability to support a team of developers rather than just self-development is an important and integral part of Eclipse.

Plugins that are maintained and distributed by the Eclipse Foundation can be found on the Eclipse Web site. The most comprehensive list of available plugins is available on the Eclipse Plug-in Central page, which serves as a plugin directory.

Eclipse Platform Architecture

The Eclipse platform contains a powerful set of plugins (see Figure 8) that support projects such as JDT and PDE.

Figure 8. Simplified architecture of the Eclipse platform

The dark blue blocks represent components that are central to the Rich Client Platform (RCP) in Eclipse. The concept of RCP itself is beyond the scope of this article, but let's consider RCP to be simply a set of plugins from Eclipse that people can use in developing applications such as Lotus Notes® 8. The light blue blocks represent optional (though recommended) components to include into RCP-based applications. And the gray blocks are completely optional. The platform consists of several components, we will look at some of them:

Runtime Runtime is the code that defines the Eclipse plugin model, based on the OSGi specification and the idea of ​​extensions and extension points. Runtime also provides additional services such as syslogging and concurrency. JFace/SWT The Standard Widget Toolkit (SWT) is a collection of widgets that provide the user interface and functionality of Eclipse. JFace is simply a superset of SWT that provides several Model-View-Controller (MVC) classes to make developing graphical applications easier. Workbench The workspace gives Eclipse its personality. It is at this level that the concept of views, perspectives, and things like editing windows is implemented. Help (User Support) This Eclipse component allows you to provide support to your users. This can be done through a help system, which allows users to search for help documentation, or through "cheat sheets", which can be presented as interactive task lists to end users. Update The update component provides a means for Eclipse to update applications from one version to another. Team The team component is an infrastructure that allows development companies to connect their own version control systems. A sample provider implementation is the CVS plugin built into Eclipse.

Conclusion

From initial code written by IBM, Eclipse has grown into a full-featured open source ecosystem with more than 100 participating companies. Portable, extensible, open source infrastructure is no longer a new idea, but with a well-thought-out, robust and elegant design, Eclipse takes on a whole new dynamic.

Welcome to the Eclipse ecosystem. Our goal was to help you get up to speed on the Eclipse platform. We've achieved this through an introductory text and a simple practice exercise. Use the knowledge you gain from reading this article and become an active member of the Eclipse ecosystem.

- free framework for developing modular cross-platform applications.

The project was initially developed in IBM as a corporate IDE standard for development in different languages ​​for IBM platforms. The project was then renamed and provided to the community for further development.

First of all, complete Java IDE , aimed at group development, equipped with tools for working with version control systems (CVS support is included in the Eclipse distribution, several versions of SVN modules are actively being developed, there is support for VSS and others). Due to free In many organizations, Eclipse is the corporate standard for application development.

Second appointment- serve as a platform for developing new extensions (which is why it has gained popularity - any developer can expand Eclipse with his own modules). So they became C/C++ Development Tools(CDT), developed by QNX engineers together with IBM, COBOL, FORTRAN, PHP tools from various developers. Many extensions complement Eclipse with managers for working with databases, application servers, etc.

Since version 3.0, Eclipse has become a collection of extensions rather than a monolithic IDE that supports extensions. It is based on the OSGi and SWT/JFace framework, on the basis of which the next layer has been developed - a platform for developing full-fledged client applications RCP (Rich Client Platform - (English rich-client applications). The RCP platform serves as the basis for RCP applications such as Azareus and File Arranger. The next layer is the Eclipse platform, which is a set of RCP extensions - editors, panels, perspectives, the CVS module and the Java Development Tools (JDT) module.

Written on Java, therefore it is a platform-independent product, with the exception of the SWT library, which is developed for all common platforms. The SWT library is used instead of the "slow" Swing and is completely dependent on the underlying platform ( operating system), which ensures fast and natural appearance user interface.

The basis of Eclipse is the rich client platform (RCP). It consists of the following components:


  • OSGi (standard package delivery environment);
  • SWT (portable widget toolkit);
  • JFace (file buffers, working with text, );
  • Eclipse work environment (panels, editors, projections, wizards).
  • The GUI is written using the SWT toolkit. The latter, unlike Swing (which only emulates individual graphic elements platform being used) actually uses the graphical components of that system. The Eclipse user interface also depends on a GUI middleware called JFace, which makes it easy to build an SWT-based user interface.

    Flexibility is ensured by plug-ins, which makes it possible to develop not only in Java, but also in other languages, such as C/C++, Perl, Ruby, Python, PHP, ErLang and others.

    Localization

    Since version 3.1.1, a language pack for Russification has been released. Both the graphical interface and documentation have been translated into Russian.

    There are a number of free and commercial modules available for the environment. The environment was originally designed for Java language, but there are now numerous extensions to support other languages, such as

    • C/C++ - CDT Eclipse’s C/C++ Development Tooling
    • Perl - EPIC module, Eclipse Perl Integration
    • PHP - PDT PHP Development Tools
    • JavaScript - JSEclipse Javascript plugin for the Eclipse environment
    • Python - Pydev, Python Development Environment
    • Ruby - RDT, Ruby Development Tools

    There are also modules for creating graphical interfaces.

    To develop and receive reports and develop analytical BI applications, there is en:BIRT_Projec t.

    There is a built-in function for installing and updating modules via .

    Aptana(aptana.com) - Eclipse distribution and plugin that supports development with using JavaScript(all main JS Ajax libraries are included in the distribution), HTML, CSS, Ruby on rails, Adobe AIR.

    Leave your comment!

    In this article I wanted to talk about how to create applications using Eclipse RCP (Rich Client Platform). The reason for writing was the fact that there are absolutely no articles on Habré describing this platform. As an example, we'll create a custom input form; The correctness of the data will be checked using the JFace Data Binding framework. For starters, I’ll give below a screenshot of what we should get.

    What is Eclipse RCP

    To begin with, it is still necessary to say what Eclipse RCP is. Eclipse is a development environment written in Java, developed and supported by the Eclipse Foundation (whose members include IBM, SAP, Oracle, companies offering products based on Eclipse RCP and participating in the development of the ecosystem Google, RedHat, Adobe, Cisco, Intel). Eclipse RCP is a set of plugins for creating so-called rich client applications. Everything that the user sees when opening the Eclipse IDE is a plugin created on the basis of this platform. The user can create his own plugins based on a huge number of existing ones; also, if necessary, you can find most popular frameworks, such as Hibernate, Google Guice, Google Guava, JUnit, TestNG in the form of plugins. It's also worth noting that the runtime architecture is based on the service platform specification OSGI, this specification describes how to create and operate modular applications. Eclipse, as mentioned above, is written in Java and is positioned as a cross-platform product (in 90% of cases, the RCP application will be built on Windows, Linux and Mac). All plugins that make up the core of the platform, and most third-party plugins, are distributed under the EPL (Eclipse Public License). The user interface of RCP applications is based on the visual components of the SWT and JFace frameworks, as well as native Eclipse widgets. The figures below show what components an application based on the RCP platform consists of, and the structure of the Eclipse platform itself.


    Figure 1 - Components used in the RCP application (figure taken from this site)


    Figure 2 – Eclipse Architecture (picture taken from this site)

    Pros and cons of the platform
    The main question is why this platform is so good and why use it to develop desktop applications (by the way, it is possible to develop web applications and applications for mobile platforms). Modularity, cross-platform, multilingual support, free, a huge number of existing plugins, libraries and frameworks. All this allows you to create commercial-grade applications (link to list existing applications developed on this platform is given at the end of the article). The disadvantages include quite high level entries, since to develop a serious application you need to know at least in general terms how the OSGI framework works, and be able to work with SWT and JFace components and widgets. Also, for Russian-speaking developers, the problem will be to find any materials or books about the frameworks and libraries mentioned above (links to the resources found, including Russian-language ones, are given at the end of the article), although conferences are periodically held in Europe and the USA, organized by participants Eclipse Foundation, published in Germany special magazine, which talks about new plugins and contains a lot of examples of their use, and there is also a whole series of books in German that describes all the nuances and subtleties of development. In English you can find a special series of books, the eclipse series, from Addison-Wesley, and you can also find a couple of books from Apress. But there are negligibly few materials and books in our native language.

    Let's get started

    Installing the necessary plugins
    Let's move on to creating our first RCP application. To work, we need to download the assembly: Eclipse for RCP and RAP Developers from the official website. If Eclipse IDE is already installed, you can use the update manager. Select Help->Install New Software from the main menu. In the Install window that appears at the top, select the site with updates we need from the drop-down list - download.eclipse.org/releases/indigo, if there is no such site in the list, then click the Add button on the right, in the Name field write - Indigo Update Site, in the Location field - the address given above, click OK (if when adding an address a message appears - Duplicate location, then the address already exists in list of Available Software Sites, the list of update sites can be viewed in the previous Install window by clicking on the Available Software Sites link, which is located under the drop-down list). After selecting the update site, a tree-like list will appear below (if the Group items by category checkbox is checked), open the General Purpose Tools item and select Eclipse Plug-in Development Environment, then open the EclipseRT Target Platform Components item and mark the plugin - Eclipse RCP Plug-in Developer Resources, these are the two plugins we need to create our project. Next, click Next twice, accept the license agreement and click on the Finish button; That's it, the installation of the necessary plugins will begin. After installation, we will be asked to restart Eclipse, which we will do.


    Figure 3 – Plugin installation window

    Creating a Project
    After the reboot, select File->New->Other in the main menu, select Plug-in Development, then select Plug-in Project in the drop-down menu.


    Figure 4 – Menu for selecting the type of project to be created

    Click Next, we need to give a name to our project, let it be called first.rcp.application, click Next again. In the next window we need to specify the name of the application; in the Name field we will write First RCP Application. Uncheck the Generate an activator, a Java class that controls the plug-in’s life cycle; for our simple application the activator class is not needed. Let's leave the checkbox on the item - This plug-in will make contributions to the UI, since our application will contain the user interface. Let's leave the third item Enable API Analysis unchecked. To the question - Would you like to create a rich client application? Let's answer Yes.


    Figure 5 – Plugin creation window

    Click Next, we will be asked to select a template for the future application, select - Hello RCP and click Next.


    Figure 6 - RCP project template selection window

    In the last window, in the Application window title field write - User Form, in the Application class field - MyApplication. Leave the Add branding checkbox inactive. Click the Finish button. We will be asked to switch to the Plug-in Development perspective, we will agree with this proposal.


    Figure 7 - RCP project template configuration window

    Project structure
    So we have the structure of the newly created project.


    Figure 8 – Project structure

    The contents of the five classes in the first.rcp.application package are not of interest to us at the moment, I will only say that the class MyApplication This is in some way the main() method of a regular Java program, this class is responsible for how our plugin will be launched and how it will be stopped. In class ApplicationWorkbenchWindowAdvisor, we can set the application window size using next line code:
    configurer.setInitialSize(new Point(400, 300));
    We can also see that the toolbar and status bar will not be shown by default:
    configurer.setShowCoolBar(false);
    configurer.setShowStatusLine(false);
    The last line sets the title of the main window:
    configurer.setTitle("User Form");
    Class ApplicationActionBarAdvisor is responsible for customizing the menu bar of our application. Class Perspective is responsible for the location and size of editors and views that are located in a given perspective; an RCP application must have at least one perspective.

    Launch of the project
    In order to run the application we just created, we need to go to the META-INF folder and open the file MANIFEST.MF, if you suddenly closed it (this file is opened by default when creating a project).


    Figure 9 – RCP application properties editor

    This file allows us to change many project settings, connect additional plugins, connect and manage extensions, configure the build of our plugin, and much more. We are on the Overview tab, in the Testing section we click on the link - Launch an Eclipse application, after a moment our application window will appear on the screen, close it and move on to the next stage.


    Figure 10 – Our application window

    Adding a view

    Adding an extension
    Our task is to create a view on which we can place elements GUI. Let's go back to the file MANIFEST.MF, select the tab at the bottom – Extensions. We can see that by default we have two extensions: org.eclipse.core.runtime.applications and org.eclipse.ui.perspectives. The first extension is associated with our application class MyApplication if we choose this extension and expand the tree list to the first.rcp.application.MyApplication (run) node, we will see that the class field contains the name of this particular class. Returning to the root node this list, on the right in the Extension Details section we will see two fields, the values ​​of which we can also change (we won’t do this now): ID – application identifier and Name – application name.

    The second extension is responsible for setting the perspective of our application. File MANIFEST.MF allows us, without looking into the code of the Perspective class, to specify which views and/or editors this perspective will contain, their position, size and ratio. By clicking on this extension and going to the child item we can see that in the Extension Element Details section we can specify the perspective class, ID and name. It should be noted that such changes, as mentioned above, can be made by directly editing the class code that is associated with this extension and editing the file plugin.xml, but I wouldn’t want to complicate the creation of our first project.


    Figure 11 – Tab with extensions of our project

    We need to add a new extension to create the view. To do this, click on the Add button and in the window that appears, enter views in the Extension Point filter field, there should be only one extension left - org.eclipse.ui.views, select it and click Finish.


    Figure 12 – New extension selection window

    We should have one more, third extension in the list of extensions.

    Setting the view
    Let's right-click on the extension we added, a context menu will appear, select New->view in it, thereby we will add an element to our extension (this element is the view we need). Settings will appear on the right side of this element. First, let's create a class for our view. We can do this by clicking on the class* link.


    Figure 13 – View settings

    A standard dialog for creating a Java class will open, give it a name – MainView; as we can see, this class inherits from the class org.eclipse.ui.part.ViewPart, parent class for all types. Let's complete the creation of the class by clicking on the Finish button. There is very little left, after creating a class for our view, its code will open in front of us, we will create a static variable that will contain the identifier of this view, we will set the canonical name of this class as the identifier. Let's write the following:

    public class MainView extends ViewPart (
    public static final String ID = MainView.class.getCanonicalName();

    }
    Let's go back to the file MANIFEST.MF, open the Extension tab, copy the contents of the class* field and paste it into the ID field. Now the class name and the identifier of this type are the same, this technique is a good practice, as it always allows you to quickly find the right type and find out its ID. In the name* field we will write – User Form. The entire view has been created; it remains to connect it with our perspective, since the view itself cannot be used, in other words, it must belong to some perspective.

    Setting the view position
    We can perform further manipulations while remaining in the extension editor or open the code of the perspective class - Perspective.java, which is what we will do. In class Perspective, let's go to the method – createInitialLayout(), this method specifies the initial position of views and editors. In the method we will write the following two lines of code:
    layout.setEditorAreaVisible(false);
    layout.addStandaloneView(MainView.ID, true, IPageLayout.LEFT, 1.0f, layout.getEditorArea());
    The first line tells the layout object that we don't need an editable area since we only have one view and no editors. The second line adds our view, and as a standalone one. The first parameter is our view ID. The second parameter is a Boolean value that determines whether the title of our view (User Form) will be shown or not. The third parameter is intended to indicate the orientation of the perspective view, since we have one view and will occupy the entire perspective space, then given value could be anything. The fourth parameter determines the position of this view in relation to other views or editors, since, in our case, one view should occupy the entire perspective space. The last fifth parameter is the editor area identifier. Let's save our changes.
    Running an application with an added view
    Let's go back to the file MANIFEST.MF and launch our application again, to do this, go to the Overview tab, in the Testing section, click on the Launch an Eclipse application link. We won’t see much difference with how the form looked during the previous launch; only a tab with our view has been added – User Form.


    Figure 14 – Our application window with an added view

    That's all for today, to be continued in the next article.