Development of a system for automatically searching for objects in an image. Getting started with the Eclipse platform

04/19/2005 Natalya Dubova

The Open Source community has several key projects, including, along with the Linux OS, the creation of the Eclipse development platform. Released several years ago from IBM, today this open platform for integrating application development tools is freely distributed in open source and developed by a community of users.

Without going into a discussion of the question of whether programming is an art or a craft, we admit: in both cases, a programmer cannot do without tools for creating programs. Along with the evolution of the programming process (from “witchcraft” over machine instructions to the use high-level languages) the ability to automate the hard work of programmers has also improved. Early development environments were limited to running compilers, linkers, loaders, and debuggers sequentially using an interface command line. In the 80s, along with personal computers, a market for software products of a new class appeared - integrated development environments (IDEs) for algorithmic (Pascal, etc.) and then object-oriented (Smalltalk, C++) programming languages. Real flourishing this area achieved thanks to active adaptation by Java language developers; The most well-known integrated environments for creating programs in this language are Borland JBuilder, Symantec Visual Cafe, Microsoft J++, IBM VisualAge and Oracle JDeveloper.

The main purpose of an IDE is to increase developer productivity. The first development environments that combined the functionality of program text editors, compilers and debuggers primarily freed consumers from routine operations. Over time, the IDE's feature set became richer. It included step-by-step compilers, browsers for a more logical presentation of programs, automatic code generation tools, and visual editors for creating graphical user interfaces. Following the trends of the times, development environments have transformed from tools for increasing programmer productivity into means of supporting all stages of collective work on a software project. Latest trend- transformation of the IDE into ALM (application lifecycle management), an integrated application lifecycle management system - from requirements definition and modeling to configuration and software version management, deployment and maintenance of the finished solution.

Each new stage in the evolution of IDEs has made development environments more complex. However, users of such products were still forced to resort to tools not integrated into the IDE, if only because creating an application is not limited to writing and debugging programs in a single programming language. The need to use, for example, HTML pages, schemas in the application system relational databases data or pieces of code in other languages ​​(like Cobol or PL/1) forces developers to use the corresponding tools that were not originally included in the IDE.

This is why many commercial development environment vendors strive to make them as open as possible and provide special mechanisms for integrating external tools. But no single environment can satisfy all possible user requirements. To do this, it must be completely neutral to the programming language and support the maximum set of functions. Eclipse is not such an environment, but it is a base, a platform with which you can build multifunctional and multilingual development environments.

Platform

As the initiators of the Eclipse project explain, its idea was to create an “Apache for development tools” - an open platform that provides maximum basic capabilities for development environments and providing mechanisms for integrating various tools. The first version of this platform was developed by IBM and released as open source at the end of 2001. Commercial implementations based on Eclipse soon began to emerge, pioneered by WebSphere Studio Application Developer 4.0. There is now an entire open source development ecosystem around Eclipse, bringing together tool vendors and users, research organizations and individual developers.

In the official Eclipse Foundation docs ( www.eclipse.org The Eclipse Platform is defined as a vendor-neutral, open development platform that provides framework and exemplary capabilities as well as extensible tools. The toolkit within the Eclipse Platform is standard in the sense that it verifies the applicability of the basic capabilities of the platform, illustrates typical situations of their use, and supports the development and maintenance of the Eclipse platform itself. The toolkit is extensible because its functionality is accessible through documented software interfaces. Basic principles, which guided the creators of the Eclipse Platform and in accordance with which it continues to develop, are as follows:

  • support for the construction of application development tools;
  • support for an unlimited number of tool vendors, including independent software developers;
  • support for tools for working with arbitrary types content, including HTML, Java, C, JavaServer Pages, EJB, XML, GIF, etc.;
  • ensuring “seamless” integration of tools for working with various types of content different manufacturers;
  • support for application development environments with regular and graphical user interfaces;
  • providing the ability to run a development environment based on different operating systems (today, Eclipse-based tools are implemented for Linux, HP-UX, IBM AIX, Sun Solaris, QNX, Mac OS X, Windows);
  • taking into account the popularity of the Java language when creating development tools in the interests of platform development.

Eclipse Platform is written in Java environment development of the most general purpose, the architecture of which provides for the solution different tasks integration of various tools and programming languages. Mechanisms of such integration allow you to use the Eclipse Platform to build advanced development environments and free you from the writing routine basic funds in favor of creating complex, specialized functions. This not only solves the problem of supporting multifunctional and multilingual development environments, but also lays the foundation for simplifying the transition from one type of environment to another in the process of their evolution. Developed by a community of developers, the Eclipse platform will accumulate the latest advances, making them available to developers of specific products and eliminating the need to fundamentally redesign their systems.

Eclipse development environment

The basis of the Eclipse Platform architecture is the principle of using plug-ins. The platform implements mechanisms for detecting, integrating and executing such modules (see figure). A developer who wants to take advantage of the capabilities of the Eclipse Platform writes his toolkit in Java as a separate plug-in module. This module will work with files in a workspace, which is implemented using the workspace component. And its user interface is based on the workbench component, which defines the general structure of the interface and the possibility of its expansion.

Typically, a single plug-in implements the simplest functionality of an Eclipse Platform-based IDE, while more complex tools are composed of multiple modules. At the same time, almost all the built-in functionality of the Eclipse Platform is also implemented using such modules - with the exception of the small Platform Runtime kernel. Each plug-in module has its own manifest file, which describes the connections of this module with others. When you start an Eclipse Platform-based development environment, the Platform Runtime component determines the set of available plug-ins, reads their manifest files, and builds a plug-in registry. Once the system has started, additional modules can no longer be added. The Eclipse project has implemented a special environment for creating plug-ins - Plug-In Development Environment (PDE).

Using special modules, the components of the workspace and user interface (workbench) of the Eclipse platform are implemented. Working space contains files created by users of tools implemented by plug-ins. The workbench component provides a general structure and tools that allow you to expand the capabilities of the user interface of the development environment based on the Eclipse Platform, and includes two components for implementing tools for providing information to the user.

  • Standard Widget Toolkit (SWT) is a set of interface elements and a graphics library that have mechanisms for integration with the window system of a specific operating platform, but implement APIs that are independent of the OS. This makes it possible to build user interfaces of the development environment according to uniform principles, which correspond to the window environment familiar to the consumer, but are intended for the widest possible range of operating systems;
  • JFace - a toolkit for implementing a series common tasks related to interface programming using SWT tools.

Based on the APIs provided by the SWT and JFace components, a personalized user interface is built that determines the structure of consumer interaction with the development tools. The Eclipse Platform interface is organized using editors, views, and perspectives.

The purpose of editors is to open, edit and save workspace objects. The platform has a built-in editor for text resources, and other features must be implemented as plug-ins. Views provide information about the object the user is currently working with. Finally, the perspective engine allows you to select and organize the desired editors and views that will be displayed on the screen.

Organization

There are a number of benefits to running open source projects. Thus, one of the tasks of such a platform is to provide developers with tools from a common base, invariant for different development environments. Why does every manufacturer need to re-write something that can be written once? But in order to build their developments on such a platform, the manufacturer must completely trust the one who created it. And this is only possible if he is able to try out everything that is included in it, that is, get an open source platform.

Developing a product in accordance with Open Source principles improves the quality of the code, since it is polished together by many interested developers. Debugging becomes easier and better - thanks to access to the source code of the program and, again, the involvement of a distributed team in the work. Collaborative work allows us to share the risks of creating complex technologies. And the collective development body of the platform ensures its support regardless of the vicissitudes that may occur with suppliers of specific development environments. Finally, using an open source development platform with a flexible plug-in mechanism to implement additional functionality opens up unlimited possibilities for its improvement.

Eclipse Platform Architecture

However, it will not be possible to realize the benefits of the open source development model by simply releasing a technical platform “free-floating.” We need to organize the process. With the release of the first version of Eclipse in 2001, a consortium organized by IBM along with a number of leading market players took on this responsibility, and in February 2004, the Eclipse Board of Directors decided to transform the Eclipse Foundation into a non-profit, independent corporation.

The Eclipse Foundation, a consortium of more than 60 companies, coordinates efforts to improve the Eclipse platform and other open source projects.

The Eclipse project is completely open and any interested developer can participate in it, who does not have to be an employee of any company. In principle, everyone can not only be interested in the details of development and contribute to identifying errors, but also take part in writing code and the overall design of the next version of the platform. However, Eclipse follows the principle of putting professionalism first. A developer with a proven professional reputation can count on additional responsibility and the opportunity to actively implement their skills in Eclipse projects. Some developers are defined as “committers” because they are responsible for the source code and only they have the right to create new versions in the open source code repository. Typically, these developers are employees of companies that pay them for their work on Eclipse projects.

The development process is iterative, aimed at maximizing the involvement of members of the Eclipse community in working on the project. The release of the next release is preceded by several stages of a fixed duration (about several weeks), each of which represents a complete cycle, including planning, development, testing and intermediate release of the version. The completion of the next cycle is accompanied by open publication descriptions of new system capabilities, which stimulates community members to discuss, use and make recommendations for improvement. As a result, in the next stages of development it becomes possible to take into account the community's reaction to the interim release. This is an open process to continuously improve the Eclipse platform and develop other initiatives based on it.

The mission of the Eclipse technology project is to coordinate the efforts of developers, researchers, members of scientific and educational organizations to determine the prospects for the Eclipse Platform and other open source developments. Some of the most notable research subprojects in this area include the development of aspect-oriented software (AspectJ and AJDT), the creation of an alternative kernel to the Eclipse Runtime (Equinox), the creation of a collaborative development platform (Koi), software configuration management (Stellation), toolkit for XML Schema Definition and for model-based development (Generative Model Transformer).

Community

Use of all materials generated by Eclipse projects is subject to the Common Public License (CPL) as approved by the Open Source Initiative. Under the CPL, anyone can use and redistribute Eclipse free of charge for commercial and non-commercial purposes. The following are freely available on eclipse.org:

  • current versions of the Eclipse Platform for direct use (in binary form);
  • a source code repository in which anyone can view the contents and revision history of any source file, as well as obtain scripts for recompiling and building the Eclipse platform from source codes;
  • open discussion forums to discuss the Eclipse Platform;
  • bug database to track defects and issues in current versions of the platform. Using this database, users can identify known defects in their Eclipse-based developments and publish new problems they discover;
  • development plans and contacts for developers involved in Eclipse projects.

Today on eclipse.org freely available - more than a hundred plug-ins in source code for the Eclipse platform. Eclipse's open source projects total more than 2 million lines of code.

Key to market development software development has participation in the Eclipse project of commercial companies. With the Eclipse Platform, they have pre-built core development environment services that are language- and operating-platform-neutral and can focus their efforts and investments on developing the complex functionality that will make their solutions competitive. There are examples of Eclipse-based implementations of both full-featured development environments that promote the most advanced solutions in this area, as well as specialized tools aimed at a specific range of tasks.

Thus, all products of the IBM Rational family run on the Eclipse platform. Borland intends to migrate all of its application lifecycle support to Eclipse. There is an Eclipse version of QNX's embedded application development tools; Wind River is implementing a similar project. In turn, Hewlett-Packard offers an Eclipse-based component development environment for its Internet Usage Manager system, target audience which are telecom operators. Nokia has announced support for Eclipse as a mobile application development platform. IBM has implemented a special toolkit, Autonomic Computing Toolkit, based on Eclipse, designed to support autonomous computing technologies in developed applications. Of all the world's leading software manufacturers, only Sun Microsystems and Microsoft do not cooperate with the Eclipse Foundation.

Vendors of commercial Eclipse-based environments allow independent development companies to sell plug-ins for their IDE, and it is common for a company to sell the same proprietary plug-in for different Eclipse-based environments. This is not only a method of developing new markets, but also another way to increase the significance of the project. Users value freedom of choice: if they are not satisfied with the existing functionality of an environment based on an open source platform, they can expand it through self-development or by purchasing commercial solutions of the same format.

These groups use Eclipse developments in different ways, but they all contribute to their development. The trend is to use the Eclipse platform to build non-IDE applications. This is possible because there are not many development environment-specific elements in the Eclipse Platform technology solution. In the third version of Eclipse, there is an evolution from a platform for development environments to a platform for implementing full-featured client workstations (Rich Client Platform). It is no coincidence that IBM is implementing its promising environment collaboration Workplace is based on Eclipse.

Literature

  1. Marc R. Erickson, Angus McIntyre. , 2001, November.
  2. J. dea Rivieres, J. Wiegand. Eclipse. A platform for integrating development tools. IBM Systems Journal, 2004, No. 2.

Eclipse Organization Structure

Coordination of Eclipse development and participation in open source projects of various organizations and individual developers is carried out by the non-profit independent consortium Eclipse Foundation

The Eclipse Foundation Board of Directors is composed of four main categories of members:

  • strategic developers (Strategic Developers) - companies Actuate, Borland, IBM, Computer Associates, Intel, QNX, Wind River, Sybase, Scapa Technologies, BEA Systems;
  • strategic consumers (Strategic Consumers) - HP, Montavista Software, SAP, Serena Software;
  • included suppliers (Add-in Providers);
  • Open Source project leads.

All strategic developers and strategic consumers are on the board of directors, and the other two groups delegate their representatives to it. Strategic members of the consortium also have certain rights to participate in project management committees and Councils that coordinate development processes.

The consortium runs several basic open source projects, which include a varying number of subprojects. The base project is managed by the Project Management Committee (PMC). To manage the development as a whole, three main councils are created - the Requirements Council, the Architecture Council and the Planning Council.

The Requirements Board analyzes and structures project requirements. They combine requirements aimed at achieving the general goals of the Eclipse Foundation and the specific goals of the project, solving the problems of key consortium members and developing the Eclipse ecosystem. Based on the analysis, a list of topics and priorities is formulated that will determine the course of development. The Architecture Board is responsible for developing the architecture of the Eclipse Platform, defining it clearly, communicating it to development teams, and protecting them from inadvertent misrepresentation. The Planning Council creates a coordinated platform release plan.

Projects are implemented by development teams led by project managers and including developers and responsible developers. The former are engaged in writing code, identifying errors, testing and documenting programs, and also perform other tasks within the framework of the project. Responsible developers have the right to add to the source code repository and must influence the progress of development within the project. Companies designated as Strategic Developers by the Eclipse Foundation are required to lead at least one project. They are also encouraged to lead committees.



Eclipse is a framework that allows you to develop cross-platform modular applications. Eclipse is the development environment most commonly used to create various desktop applications. The architecture of the platform is simple - a kernel for loading the framework, an environment for delivering dynamic components, text editors and file buffers, a working environment for writing, compiling and running code.

The framework implies the creation of open source software, so the license is free and you can download Eclipse for free. The platform, thanks to the connection of various modules, allows you to develop almost any client application in all popular programming languages ​​- Java, C++, Python, etc. You can connect a separate module for working with graphical interfaces. The created applications work under different operating systems - they are suitable for Windows, Linux and Mac OS, Android is also supported. Programs created in Eclipse are individual modules, which connect to the main application. Some applications, combined into libraries, for Eclipse can be downloaded in the public domain, which will greatly simplify the work on your own program.

Eclipse is a Windows-independent framework, with the exception of the standard Swing library for Java, replaced by SWT, which is built for all known and used programming platforms. The library is based on the operating system, so graphical elements of the OS are used. This feature may make the application incompatible with other operating systems. You can download Eclipse in Russian, which will greatly simplify working with applications for different OSes. In addition, there is a lot of reference information and forums dedicated to the framework on the Internet.

Advantages of the Eclipse development environment:

  • support for all popular programming languages;
  • development of applications for different operating systems;
  • the ability to download the necessary modules for free;
  • plugins provide framework flexibility;
  • free license and open source.

If you've ever kept a close eye on what's going on in the open-source or Java technology world, you've never heard all the fuss going on around Eclipse. Eclipse is an extensible, open-source integrated development environment (IDE, Integrated Development Environment). The project began in November 2001 when IBM sourced the $40 million Websphere Studio Workbench and formed the Eclipse Consortium to manage development of the tool.

The original goal was to "develop a stable, full-featured, industrial quality platform commercial product, for the development of integrated tools." On currently The Eclipse Consortium focuses on the following projects:

  1. The Eclipse Project (http://www.eclipse.org/eclipse/index.html) - responsible for the development of the Eclipse IDE itself (a platform for building other Eclipse tools), Java Development Tools (JDT) and Plug-In Development Environment (PDE) ), used to provide extensibility to the platform itself.
  2. The Eclipse Tools Project (http://www.eclipse.org/tools/index.html) is dedicated to creating optimal tools for the Eclipse platform. Current subprojects include: Cobol IDE, C/C++ IDE, and EMF modeling tool.
  3. The Eclipse Technology Project (http://www.eclipse.org/technology/index.html) – provides technology research, incubation, and education related to the use of the Eclipse platform.

Together with JDT, the Eclipse platform provides many various possibilities that you may have seen in commercial IDEs: syntax highlighting in the editor, code compilation, a source-level debugger with support for threads, a class navigator, a file and project manager, interfaces to standard source code control systems such as eg CVS and ClearCase.

In addition, Eclipse contains a number of unique features, for example, code refactoring (http://www.refactoring.com/), automatic update and code building (via Update Manager), task list, support for unit testing using JUnit (http://www.junit.org/), and integration with the Jakarta Ant application build tool (http://jakarta.apache. org/ant/index.html).

Despite a large number of standard feature set, Eclipse differs from traditional IDEs in several fundamental ways. Perhaps the most interesting feature of Eclipse is its absolute platform and language neutrality. In addition to the eclectic set of programming languages ​​supported by the Eclipse Consortium (Java, C/C++, Cobol), there are many third-party projects that can help you bring Eclipse support for your programming language. Today there are implementations of the following popular programming languages: Python, Eiffel, PHP, Ruby, and C#.

The Eclipse platform is provided, thanks to the Eclipse Consortium, as precompiled executables for Windows, Linux, Solaris, HP-UX, AIX, QNX, and Mac OS X. Much attention has been focused on the plug-in architecture of this platform, and Also the "rich" APIs (Application Programming Interface) provided with the Plug-in Development Environment for extending Eclipse Adding support for a new type of editor, viewer (panel) or programming language is incredibly easy, thanks to the well-designed APIs and building blocks that Eclipse provides. .

With approximately a hundred plug-in development projects, the resources provided by industry giants such as IBM, HP and Rational (which was recently acquired by IBM), and the Erich Gamma design that helps quickly understand the development process - the future of Eclipse will have to be very bright, interesting and promising.

Installation

I bet that all you are thinking right now is where to get a copy of this very Eclipse for your platform and how to install it? :) The first thing you need to take care of first is to make sure that you have a suitable, working JRE (Java Runtime Environment). Although Eclipse was designed to be able to compile code for both JVM (Java Virtual Machine) version 1.3 and version 1.4, current versions of Eclipse were designed to run on JVM version 1.3. If you're not sure where to get a Java "virtual" machine (JVM) for your platform, you can find detailed instructions and more information about it on the website

Once you have verified that you have a JVM or have installed the appropriate version, you are ready to install Eclipse. To do this, visit the download section of the Eclipse project website (http://www.eclipse.org/downloads/) and download from there the latest release, compiled specifically for the platform you are using. All distributions are .zip archives. Unpack the downloaded archive into a suitable directory and spend a little time studying all the files contained in the readme directory.

Believe it or not, the installation is complete. If you have correctly installed the JVM and correctly unpacked the archive with Eclipse, you can begin the process of launching this IDE for the first time. All distributions containing a compiled version of the platform provide programs to run, which are located in the main directory: eclipse. The name of this launcher changes depending on the platform you downloaded the distribution for: eclipse.exe on Windows, eclipse on Solaris, and so on. When you first launch the Eclipse application, it will perform some remaining installation tasks (such as creating a workspace directory to store project files) before the application is finally ready to run.

Interface

So, now that you have Eclipse installed and running, it's time to start using it. Once you've launched Eclipse, you should see something like this:

Picture 1

As you can see, the Eclipse IDE has quite standard menu content:

Figure 2

In addition to the menu, the similarity of the toolbar and bookmark system with those in other application development environments is clearly visible here.

Sample Application

Panels File Navigator, Code Outline And Task List are displayed but do not currently contain any data. To continue our exploration of Eclipse, we'll create a simple Swing calculator application. Let's describe the actions step by step:

1. Select a menu item File->New->Project..., to start creating your first Java project. In the wizard window, select Java among the proposed project types from the left list and Java Project in the right list, then click the button Next.


Figure 3

2. Enter Calculator as the project name and continue creating the project by clicking the button Next.


Figure 4

3. And finally, at the final stage, the “wizard” for creating a new project gives you the opportunity to determine the directories where the source code files and class files will be stored, define subprojects that can be used by the current project we are creating, as well as any libraries, which we intend to use in our application. Set the switch to Use source folder contained in the project, then press the button Create New Folder.... Enter src as the name of the new source directory. Click Yes when Eclipse asks you whether to change the directory where the application is being built to Calculator/bin.


Figure 5

4. Press the button Finish to allow Eclipse to finish creating the new project.

Once you have created a new project, you may notice that appearance Eclipse has changed a bit (to be expected): panel Outline moved to another part of the window, panel Navigator was replaced by a panel Package Explorer etc.

This is what the Eclipse window looked like after we created a new project:


Figure 6

This layout is called Java Perspective. "View", in the Eclipse concept, defines any stored order of arrangement of any number of different editor panels and viewers. Eclipse comes with a number of default "views" ( Resource, Java, Debug and others), which can be modified to suit your needs, or you can create your own angles. Views are controlled using menu items Window or a special toolbar, which is usually located along the left border of the Eclipse window.

Figure 7

The next step in creating our Java project is to create directories that will contain all of our source code. To do this, switch to perspective Resource using the menu item Window->Open Perspective->Resource. In the panel Navigator Expand the folder structure tree nodes so that you can see the src folder node. Select this node, and then execute the menu item File->New->Folder. In the dialog box that appears, make sure that the src directory is selected and then enter as the name of the new one in the field Folder Name, Name com.

Create a large number of folders using a dialog New Folder it would be inconvenient and tiring. Fortunately, Eclipse can give you the ability to create the directories you want using your favorite file manager: the command line, Windows Explorer and others. Using one of the suggested methods, create in the folder com folder devious, and in it a folder calculator. Once you have created these folders, select any folder node in the Navigator panel and, using the menu item File->Refresh, update the contents of this panel. This way Eclipse will perform a lookup file system and will update the project panel in accordance with the changes you made (created new directories). At this point, your Eclipse window should look something like this:


Figure 8

One more note about creating files: in the early stages of creating a project, you will most likely be running your applications quite often, creating new files and folders, adding new code, compiling, and testing your code again. It is important to remember that the layout of menus in Eclipse depends on the view you are using. So, if you switch perspective Resource to create a new file or folder in the panel Navigator, you will find that the menu Run, for example, is fundamentally different from the menu Run in perspective Java. One solution to this common problem is to use a menu Windows->Show View to display the panel Navigator in perspective Java. If you are completely satisfied with the resulting angle, then use the menu item Window->Save Perspective As..., you can save your changes in a new view, or overwrite an existing view Java.

Adding code

Now that we have our directory structure created, we can start adding source code to our project. We will divide our calculator program into three classes (files): CalcModel.java, CalcPanel.jav a, and Calculator.java. Download the zip archive with the source code of this program from here http://www.onjava.com/onjava/2002/12/11/examples/calculator.zip. After that, unzip this archive and place the three files mentioned above in the directory com/devious/calculator. Let's use the menu item again File->Refresh to refresh the contents of the Project Manager panel. Here's what you should see after doing these steps:


Figure 9

CalcPanel.java represents the core of our calculator's user interface. Calculator.java performs preparatory initialization functions and launches the GUI (graphical user interface). The most important part of our program is in the file CalcModel.java, which deals directly with the implementation of the actual mathematics of our calculator: responding to events, executing mathematical calculations, updating the displayed information, etc. The easiest way to view the source code is to switch from view Java V Java Browsing. To do this use Open Perspective from the menu Window or click on the button Open, which is located on the toolbar for working with angles.

While you navigate through the source code in the panel Package Explorer, you may notice that the panel Outline becomes unnecessary to you at this stage. You can temporarily remove it from the screen by clicking on the cross in the right corner of this panel. When you need it, you can use the menu item Window->Show View->Outline to display it again.


Figure 10

Running and Debugging Code

So you've downloaded and installed Eclipse, created a new Java project, and added the necessary files and folders for your simple application. It's time to test this application in action by launching it. To do this you need to set the angle Java to follow the steps required to run the application:

1. From the main menu Run select element Run...

2. In the launch wizard dialog that appears, select "Java Application" from the list Launch Configurations and press the button New


Figure 11

3. For the name of the new configuration, enter Calculator

4. Press the button Search... and select the class as the main class Calculator in field Main class, or simply enter the full class name in the input field: com.devious.calculator.Calculator.


Figure 12


Figure 13

Once you have created the launch configuration for your application, you can launch it again using the menu Run->Run History or buttons Run on the toolbar. If you spend enough time "playing" with this calculator, you will find that it works mostly correctly, but with one catch: it doesn't want to do the subtraction operation correctly! Time to use the Eclipse source code debugger and find this unfortunate bug. If you followed all the instructions given above in this article, then you can run this application with the debugger with the same configuration that we defined for normal launch. To do this, select the menu item Run->Debug History->Calculator.

When you run your application along with the debugger, Eclipse automatically switches to the view Debug:


Figure 14

Since the problem we discovered is centered around the subtraction function, we will set a breakpoint in the event handler for the "-" and "=" buttons. First, we need to switch to the class editor tab CalcPanel. (If you don't have the source code bookmarked for this class, you'll need to open a file called CalcPanel.java, having previously switched to the angle Java or Resource and then return back to perspective Debug).

Use the panel Outline to locate the method actionPerformed. Move a little lower until you find the expression case for the "-" sign (line 126). If you double-click on the left edge of this line, Eclipse will automatically set a breakpoint there. Move a little lower and set another breakpoint on the method call model.calculate() in the "=" button event handler (line 138).


Figure 15

Now switch to the calculator window and click a few buttons. For example, "2", "4", "6" and "-". Once the debugger hits a breakpoint, you can see the buttons appear on the toolbar Debug, which serve to walk step-by-step through the source code, and you can take steps through the code and, without going inside the methods, execute them automatically, or, going inside, go through their source code.

Figure 16

If we go inside the method setOperation(), it will become clear that it performs a rather trivial function: it stores the operation code in the field pendingOp. Now click the button Resume on the toolbar Debug to continue program execution.

Note: The main mistake new Eclipse users make is that they sometimes press buttons Debug or Run on the main toolbar (which launches another copy of the application) instead of clicking Resume.

Now press a couple more buttons (for example, “1”, “2”, “3”) and then the “=" button. This way we find ourselves inside the method calculate(), the problem turned out to be obvious: someone copied the code from the OP_ADD variant, but forgot to replace the + sign with -. Problem solved! :)

Fixing the error using the HotSwap method

If you used JVM version 1.4 to run the application, then we only have one final step left to fix this error in our example. Instead of exiting the calculator program, making changes to the source code, recompiling the entire project, and only then starting a new debugger session, we can change everything on the fly. While the debugger is still running, change the line in your source code to:

SetDisplay(previousValue + currentValue); // to: setDisplay(previousValue - currentValue);

Save this file, then click the button Resume to “release” the application and continue working with it. Using the button C to reset it and repeat the steps we did earlier. Now everything works as expected!

What we have now demonstrated is Eclipse's support for a new feature (called HotSwap) of the JVM version 1.4. The Java Platform Debugger Architecture (JPDA) now supports the ability to replace the source code of a running application. This is especially useful when running an application or finding places where it “collapses” takes a lot of time.

Interesting features in upcoming versions of Eclipse

One very interesting feature of Eclipse is the speed with which bugs are caught and with which developers respond to the various needs and wishes of users. The Eclipse Consortium releases the latest releases monthly, which include stable versions of various features that users are interested in (such releases contain the identifiers M1, M2, M3, etc.) Among the features included in the 2.1 M3 release are the following, the most significant:

  • - customizable hotkey combinations, including a set of associations similar to those found in Emacs;
  • - possibility of automatic insertion TODO, FIXME and other tag comments in Java code, in various elements and task lists;
  • - improved CVS support, including the ability to define "working sets" that limit the number of projects displayed in the panel CVS Repositories;
  • - new templates in the Java editor that can be used to display source code, Javadoc, detailed error messages for each line of code or expression in a “drop-down” (tooltip) window;
  • - support for several new refactorings;
  • - new panel Threads and Monitors in the debugger, which allow you to determine which of the “threads” (threads) are blocking resources, which of them are waiting, and other useful information for debugging multi-threaded applications;
  • - tighter integration with the Jakarta Ant build tool;

This last feature is what makes Eclipse a well-built environment for developing Java applications and, in particular, developing Web applications. Eclipse combines all the tools a developer needs to successfully develop Web applications: an extensible IDE, a standard compiler, remote debugging, Ant support, testing with JUnit, plug-ins for interaction with almost all application servers, as well as an EJB container.

Resources

  • eclipse.org (http://www.eclipse.org/)
  • Eclipse Project FAQ (http://www.eclipse.org/eclipse/faq/eclipse-faq.html)
  • Eclipse Platform Technical Overview (

- 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 a fast and natural-looking user interface.

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


  • OSGi (standard bundle 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 graphical elements of the platform used), actually uses the graphical components of this 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 for the environment. The framework was originally developed for the 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 using JavaScript (all major JS Ajax libraries are included in the distribution), HTML, CSS, Ruby on rails, Adobe AIR.

    Leave your comment!

    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'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 ( Open license Eclipse) V1.0, approved by OSI and aimed at facilitating commercial acceptance of Eclipse while maintaining loyalty to the source 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.

    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 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 represents basic set 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 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. 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. 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 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. 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() using double click mouse on the gray field on the left side of the editing window next to the call to System.out.println() . 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 top right panel contains a number of tabbed views, including Variables, Breakpoints ( Checkpoints), Expressions and Display. The Variables tab is now selected, so we can see the current value of the i variable.

    More detailed information any of the views can be obtained using context clues; 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 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 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 that allows users to search for help documentation, or through "cheat sheets" that end users can be presented as interactive task lists. 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.