Skip to content

Latest commit

 

History

History
251 lines (173 loc) · 9.51 KB

_ScoutTooling.adoc

File metadata and controls

251 lines (173 loc) · 9.51 KB

Scout Tooling

This chapter presents the Scout SDK tooling that is included with the Eclipse Scout. The Scout SDK provides wizards to create new project and application components, adds code assistance to the Java Editor and comes with a NLS editor to manage all translated text entries of the application.

The chapter is organized as follows. Motivation for the Tooling describes the goals and benefits of the tooling included. Because the Scout Tooling is based on the Eclipse IDE, Eclipse IDE tooling provides a short overview of frequently used Eclipse features. A high level description of the Scout tooling is provided in Scout SDK Overview. Scout Wizards, Scout Content Assistance and Scout NLS Tooling then provide detailed descriptions of the functionality offered by the Scout SDK.

Motivation for the Tooling

Eclipse IDE tooling

The Scout tooling is an extension of the Eclipse IDE. The goal of this section is not to provide a complete overview on the features contained in the Eclipse IDE. It provides a short overview of the important eclipse features, frequently used during the development of a Scout Application. Experienced Eclipse IDE users might skip this section.

Start the New Wizard

To start the New Wizard wizard press Ctrl+N or use menu File  New  Other…​. In the first wizard step type the name of the object you want to create into the Wizards field as shown in "New" Wizard.

eclipse new wizard
Figure 1. "New" Wizard

Create a new Java class

Start the New Wizard and type Class in the Wizards field. Select Class Click on Next to open the New class wizard

eclipse new class
Figure 2. "New Java Class" Wizard

You can choose define the following properties:

  • Source folder: Click on Browse to choose the project where the class belongs.

  • Package: Click on Browse to choose the package in the given project. If the package does not exist it will be created a new one automatically.

  • Name: Type the class name

  • Modifiers: Choose public or default. Or abstract and/or final.

  • Superclass: Choose the parent class clicking on Browse

  • Interfaces: Click on Add to add the list of interfaces your class implements.

  • Method stubs: Include methods in your class.

  • Comments: Generate predefine comments.

Click on Finish when you are done with the class definition. The java editor will open and you can start editing.

Create a new Java package

Start the New Wizard and type Package in the Wizards field. Select Package Click on Next to open the New package wizard

create new package wizard

In the New package wizard you can define the following properties:

  • Source folder: Click on Browse to choose the project where the package belongs.

  • Name: Write the name of the package.

  • Package info: Choose the checkbox if you want package-info

Click on Next to create the project. The Project Browser

Organize Java imports

The import section of a java class needs to be kept up-to-date. New imports need to be added and no longer used ones should be removed. Eclipse offers a the shortcut Ctrl+Shift+O to accomplish this task.

In case an import cannot be resolved because several candidates exist, a selection list is displayed.

Rename a class

Renaming a class without SDK support is not so easy. The class and possibly the compilation unit need to be renamed. Then every reference to the class within the workspace needs to be updated.

All this work is accomplished by using the Class rename Wizard.

  1. Open the Wizard using one of the following methods

    • Alt+Shift+R

    • Context Menu  Refactor  Rename…​

    • Select the class in the tree and press F2

  2. Choose the new name for the class

  3. Specify which references need to be updated

  4. Click [Finish] or [Next] to continue

Alternative Method

A class can be renamed by select the class name anywhere in code and pressing Ctrl+1. The option [Rename in Workspace] will rename the class without using a the wizard.

Rename a package

Renaming a package without SDK support would be a tedious undertaking. All classes in the package and its subpackages would have to be modified as well as the directory structure on disk. Then every reference to the package within the workspace needs to be updated.

All this work is accomplished by using the Package rename Wizard.

  1. Open the Wizard using one of the following methods

    • Alt+Shift+R

    • Context Menu  Refactor  Rename…​

    • Select the package in the tree and press F2

  2. Choose the new name for the package

  3. Specify which references need to be updated

  4. Click [OK] or [Prview] to continue

Scout SDK Overview

The Scout SDK tooling helps the Scout developer to quickly create frequently used Scout components. This Scout Tooling is implemented as extensions of the Eclipse IDE in the form of wizards, content assist extension to the Eclipse Java editor and support for dealing with translated texts called NLS support.

Scout Wizards

The Scout SDK tooling includes a number of wizards for the creation of frequently used Scout components. In many cases the execution of such wizards involves the creation/editing of several source files. In the case of the creation of a new Scout form this includes the form class in the client module of the Scout application, a form data class and a service that communicates Descriptions for the individual wizards are provided in Scout Wizards.

Content Assist

In the Scout framework the hierarchical organization of Scout components if frequently reflected in the form of inner classes. This allows the Scout tooling to provide context specific proposals in the form of content assist proposals offered in the Java editor of the Eclipse IDE. Examples for this form of the tooling includes the creation of form fields or adding columns and context menus to tables. Content assist support is described in detail in Scout Content Assistance.

NLS Tooling

Eclipse Scout comes with NLS (National Language Support). To support Scout developers in using Scout’s NLS (National Language Support) the Scout SDK offers corresponding tooling to work with translated texts. This tooling is described in Scout NLS Tooling.

Scout Wizards

The Scout SDK provides a set of wizards to create new Scout projects and various components for your Scout applications.

To start any of these wizards press Ctrl+N or use menu File  New  Other…​. In the first wizard step type "Scout" into the Wizards field as shown in Selecting Scout Wizards in the Eclipse wizard dialog.

sdk new wizard
Figure 3. Selecting Scout Wizards in the Eclipse wizard dialog

The wizards provided by the Scout SDK are introduced and described in the sections listed below.

Scout Content Assistance

Scout NLS Tooling

Adding a new Translated Text Entry

Translated text entries are most frequently added when working in the Java editor view.

Adding a translated text can then be done in the New Entry wizard provided by the Scout SDK as shown in [img-new_text_entry_wizard].

The NLS Editor

To manage translated application texts for different languages the Scout SDK includes a NLS editor. This editor helps to efficiently deal to edit all the property files that are used with the default setup of Scout.

The NLS editor can be accessed for each text provider service of a Scout application via the *.nls files of the shared Maven modules of the application. In the case of the "Hello World" application you will find the Texts.nls file in module org.eclipse.scout.helloworld.shared. To open the editor for the "Hello World" application select the Texts.nls file first and then use context menu Open With  NLS Editor.