Eclipse practice (3)

xiaoxiao2021-03-06  93

Chapter 1 ???? Learning Eclipse Workbench

There are the following contents in this chapter:

L ???????? Download, install Eclipse

L ???????? Workbench concept, including perspective, view, editor

l ???????? Created, run and debug a Java program

l ???????? Customized Eclipse options and settings, including code layout and path variables

l ???????? Create and modify the code generation template

Everything is difficult, usually this is not necessarily a real obstacle, but we would rather return it to a habit. It is very easy to start, even though you know that it is full of hardships. Eclipse is a new mainland that we need to explore here. If you downloaded Eclipse and worked hard, you will find that you will be on track, easily encode and eliminate defects.

2.1 get Eclipse

The first step we first download the Eclipse installation package from the Eclipse.org website download page. Here you will find the latest and most complete versions, and some older versions of Eclipse. Basically, there are four versions available:

n ???????? Release Eclipse Development Organization Open a major, stable version. It is a continuous and thorough test and adds some very good features. It is equivalent to a simple version of a commercial software product. While writing this book, in March 2003, I have just released version 2.1, which is the version used in our entire book.

n ???????? Stable This is a release prior to Release, which has been tested by the development team and considered to be stable. New features often appear in this intermediate version. This version is equivalent to the Beta version of the commercial software product.

n ???????? INTEGRATION If the Eclipse developer thinks that a separate Eclipse component is stable, he will release an intergation. But they don't guarantee that all components are integrated together will work well. If you can integrate your work together, you will upgrade it into a Stable version.

n ???????? Nightly This is a package that extracts the latest code from the source code base every night. As you guess, there is absolutely no guarantee about this package, in fact, you can encounter serious problems because it.

If you don't want to adventure (perhaps your work is tight, or you can't bear the smaller disaster), you'd better use the Release version. If you have a little adventure, or you must use the latest features, you can try a Stable version, and a stable version that is about to be included in the publishing plan usually has a good performance risk ratio. As long as you certify your backup your Workspace directory, this is a quite safe bet. You can find the Eclipse team development plan and development schedule on http://www.eclipse.org/eclipse/development/main.html.

?????? If you choose and download the Eclipse version that is best for you, the Eclipse installation is to extract the download file to your hard drive. Eclipse installation does not change registration information in your system, nor will you change your environment variables, and you will not restart your machine. I believe you will be very happy. The only shortcoming is that if you start Eclipse to go to the Eclipse executable each time you go to a specific directory, you can create a shortcut or define its path.

Eclipse overview

When you start Eclipse for the first time, it will prompt you to wait to complete the installation. This step (only a little time) will create a Workspace folder under the Eclipse folder. In the default, all your work will be saved under this folder. If you want to back up your job normally, this is the folder you have to back up. This folder will be retained when you upgrade your Eclipse.

When you use the new Eclipse version, you need to check the version information to confirm if the new version supports the previous Workspace, and if there is any incompatibility. (Note that all your parameter settings and perspectives are still available, because you save it under your Workspace folder) 1.2.1 ?? Projects and folders

I know that your file is very important on the hard disk, in case you want to manual operation, such as copy, or want to know the space they take up. In any case, the local file system is diversified for different operating systems, which has a problem that must maintain the consistency of the code for different operating systems. Eclipse solves this problem by solving the problem of a high abstraction of the local file system. That is, Eclipse is not using a hierarchical folder and subfolder, and contains the structure of the corresponding file, which uses the project in the top-level project using the folder located under the project.

By default, the project is equivalent to the subfolder under the Workspace folder, and the folder is equivalent to the subfolder under the project folder. Typically, when you use Eclipse, you don't know the file system structure, for example, if you don't use export file capabilities, you don't use traditional files to open the dialog window. All files in the Eclipse project are included in a self-contained, platform-independent system.

1.2.2 ?? Eclipse Workbench

The Eclipse workbench consists of components, and the basic part is the Eclipse Workbench. This is the main window displayed by Eclipse. The workbench has a simple job: allowing you to work on the project. It is not responsible for editing, running, and debugging Java programs, which is only responsible for projects and resources navigation. It does not deal with any task, it delegates it to other components such as JDT.

Perspective, try and editor

The Eclipse Workbench is a single application window that includes a range of different types of view small windows and a special window - editor. A single window may contain multiple views in a tab book. In a perspective, a small window may contain a Windows Navigator, or the current selection of the project. The most important part of each perspective is the editor.

It seems that there are different document types, there are also different editors. When you open or create a document in Eclipse, Eclipse selects the most suitable editor to open this document. If it is a simple text document, this document will open with the eclipse built-in text editor. If it is a Java source file, you will open the Java editor of JDT, which has many special features, such as it can check the input syntax errors. If the document type is Microsoft's word, and Word is also installed on the machine, it will open in Eclipse, which means that Eclipse opens using embedded OLE objects.

You don't need to directly select each different view in the workshop and how to arrange them. Eclipse presets several sets of schemes through a scheduled manner, and they are called perspective, they can be customized to use your needs.

Each perspective is designed to perform a particular task. For example, writing or commissioning a Java program, each view in the perspective is responsible for different aspects in this task. For example, in a commissioning perspective, a view may display the source code, and another view may be used to display the current value of the program variable, but another one of the possibilities may be displayed.

When you first launch Eclipse, Eclipse will display resource perspective (see Figure 2.1). You may think that this is a Home perspective. This view is very useful for establishing, looking and managing all types of resources, whether it is a Java project, or a Word document, there is no impact on this perspective.

?????? The upper left corner is a navigation view, which shows the level display and all items in your Workspace. Of course, the navigator you see now is empty, but this is where you use Eclipse to build projects and work. ?????? In the workbench, you can choose a different perspective and open the perspective by selecting Window - ". When appropriate, if you select a debugger through a menu, change the Java view to the debugging view, Eclipse can also change the perspective.

?????? menu and toolbar

????? In addition to perspective, view and editor, some functions of the Workbenal User Interface (UI) also need to pay attention: Main menus, main toolbars, and shortcut toolbars. Like the views and editors in perspective, the menu and toolbar of the workbench varies depending on the functionality of the task.

?????? Eclipse's main menu is displayed at the top of the workbench window, below the title bar. You can use the main menu and its submenu to call most of the features of Eclipse. For example, if helloWorld.java file is being edited, you can select File - "Save to save the HelloWorld.java file.

?????? The toolbar under the main menu is the main toolbar, which contains some shortcut buttons for ordinary features. For example, there is a button of a floppy disk icon above, its function is to save the file currently editing. When you move the mouse above the icon, it will display this button prompt tab, prompt the function of this button.

????? The other toolbar on the left side of the screen is a shortcut toolbar. The button here provides a shortcomings to create a perspective, or switch between perspective. The topmost button is to open a perspective, equivalent to the window - "Open the menu function of the perspective. It is below the resource perspective shortcut.

转载请注明原文地址:https://www.9cbs.com/read-122155.html

New Post(0)