JBUILDER2005 write notes for creating a development document

Source: Internet
Author: User
Create Javadoc annotations that can be entered quickly through a code template, and you can also choose to enter Javadoc annotations in a visual manner through the Javadoc dialog box. In addition, JBuilder also offers a variety of Javadoc accessibility features, such as Javadocinsight induction entry, conflict reporting and corrections, special TODO tags, etc.

1, Javadoc dialog box

In the editor, place the cursor in the element definition at class, method, range, and so on, and select Add->javadoc for XXX in the pop-up menu to bring up the Javadoc dialog box.
Open the Person.java file, move the cursor to the constructor, and follow the steps above to bring up the Javadoc dialog box, as shown in the following illustration:


Figure 9 Javadoc dialog box

The description of the constructor is listed in description, and tags lists all the Javadoc annotation tags for the constructor. You can add, edit, and delete tags by using the buttons in the lower-right corner of the dialog box, or you can adjust their position.

Next, we add a new @see tag for the constructor, which is linked to the car.drive (int direction,int speed) function.

1. Click the Javadoc for constructor the "Person" dialog box, add ... button, the Add Javadoc tag dialog box pops up, as shown in Figure 10.

2. Select the view option from the tag drop-down box.

3. Input javadoc.tool.car#drive (int,int) in description.

4. Press OK to return to Javadoc for constructor The person dialog box, and then press OK to generate the new label in the editor.


Figure ADD Javadoc Tag dialog box

Practical experience:

Although you can use the Javadoc dialog box to create Javadoc annotations in an image, reducing the likelihood of conflict, you have poor typing speed and operational consistency due to the need to operate in multiple pop-up dialog boxes and to use the keyboard and mouse. The author in the development process almost never used this cumbersome method, since it is do unto others, of course, do not want to use the reader friend. But beginners can enhance their understanding of Javadoc tags through the Javadoc dialog.

2. Use Javadocinsight

Like Memberinsight, Parameterinsight, Javadocinsight help you to quickly enter the correct Javadoc tag in a way that is induced.

Because Javadoc tags have @ characters, when you enter @ character End-of-file javadocinsight Induced window automatically pop-up, delay time can be passed tools->perferences...->editor-> Codeinsight The Settings page, the default is 250ms. A typical Javadocinsight window is shown in the following illustration:


Figure Javadocinsight

In addition to the annotation block can be used javadocinsight Induction window, you can use the Ctrl+space memberinsight Induced window input class range or method, through the Ctrl+alt+space use Classinsight input class name. Javadocinsight, Memberinsight and classinsight are like musketeers, ensuring that the Javadoc annotation section is entered quickly and correctly.

Tips:

The Javadocinsight window is shown in bold style in addition to Todo, and the Todo label is not a label for Javadoc criteria, but a custom label for JBuilder. JBuilder allows you to define custom Javadoc tags, and all custom Javadoc tags appear as not bold styles. For more information on customizing the Javadoc tags and todo tags, see what follows in this article.
3, the custom Javadoc label

JBuilder allows you to customize the Extended Javadoc tab for special purposes. In this section, we define a custom label named notice.

1. Project->project Properties...->build->javadoc, all the custom Javadoc tags are listed in the Javadoc Settings page. Since the TODO tag is a custom label for the JBuilder itself, Todo appears in the list as shown in the following illustration:


Figure Javadoc Custom Label Settings page

2. Press New ... button to eject the Create Custom Tag dialog box, as shown in the following illustration:


Figure 13 Creating a Custom Javadoc Label dialog box

· Tag Name:notice, sign

· Heading Text: The caption that appears in the Javadoc document.

· Placement option: Select all options to indicate that the tag can annotate any type of element in your code.

3. Press OK to create this notice custom label.

Open Person.java Write Javadoc comments for the sex domain with notice tags:

1/** @notice This is a variable that is used to represent a gender, and the legal value can only be male and female*/
2) protected int sex;

The corresponding Javadoc document is the document shown in the following illustration:


Figure 14 Customizing the documentation generated by the Javadoc tag

where "note" for the Create Custom Tag dialog box heading text content, in the above figure we specifically identified.

4. Use code template

In the 4th chapter we have introduced code templates, you can also create a Javadoc template for commonly used annotation blocks, "fastest" to input Javadoc annotations.
In a customary way, each class needs a class annotation, and the class annotation is similar, so we'll create a class annotation code template that looks like this:

Code Listing 2 class annotation code template

1./**
2. * <pre>|</pre>
3. * @see
4. * @version $Version, 2005-04-|
5. * @author $Author
6. * @since JDK1.3
7. */

1) Tools->perferences...->editor->templates->common, click on the Common Settings page add ... button to eject the new Code template dialog, as shown in the following image:


Figure 15 Creating a new Code Template dialog box

· Name of Template name:clscmt template

· Description:class ' s Comment Template description information

2 Code to enter code Listing 2, where the logo with the $ prefix is a macro operator, after adjusting the template entry annotation block, the macro will be replaced by the specific value, you can pass macro ... button, select a macro in the Insert Macro dialog box, as shown in the following illustration:


Figure 16 Inserting a Macro dialog box

3 Enter the code template, press OK to return to the common Settings page, and then click OK to complete the creation of CLSCMT code template.

Once you've created the CLSCMT template, you can call the template in the editor with Ctrl+j, as shown in the following illustration:


Figure 17 Calling the CLSCMT code template

After entering the CLSCMT code template, a class annotation block is generated, and the original $author and $version macros have been replaced with the Project->project properties...->general Settings page's class Javadoc Fields the values set in the list, as shown in the following illustration:


Figure 18 Input Javadoc annotation block with code template

At this point, the general setting of the page's class Javadoc fields list is as shown in the following figure:


Diagram Javadoc field settings
5. Javadoc annotation Conflict

The Javadoc annotation is a description of the source code, so the annotation must be consistent with the source program. A comment conflict occurs when a method has two incoming parameters, but the corresponding Javadoc describes only one of the parameters in @param, which is inconsistent. JBuilder can check out this inconsistent conflict, a Javadoc conflicts folder appears in the Structure pane tree, reporting all the comment conflicts in the current Java file, as shown in the following illustration:


Graph Javadoc Conflict Report

Each conflicting annotation not only gives a brief description of the cause of the conflict, but also specifies where the conflict occurred. You can click on a conflicting item and select Fix Javadoc Conflict for "XXX" in the pop-up dialog box to fix the conflict. You can also right-click the Javadoc conflicts folder and choose Fix Javadoc conflicts to fix all conflicts in the pop-up menu.

Attention:

Javadoc conflicts are reported only if all of the syntax errors in the Errors folder have been resolved.

6. Todo Label

Todo is a jbuilder custom label, but it is not used to generate the contents of the Javadoc document. It is equivalent to a "mnemonic" that indicates that there is an unfinished job or a work to be done to facilitate the retrieval and processing of these outstanding things in the future.

All Todo tags in the current program file are attributed to the to do folder in the Structure pane. Let's say we add two todo tags to the Person.java, as follows:

1...
2. Public class Person implements Serializable
3. {
4. Public person (String name, int sex) throws Personargumentexception
5. {
6. If (sex!= MALE && sex!= FEMALE)
7. Throw new Personargumentexception ("Incorrect parameters");
8./** @todo also need to do more calibration * *
9. this.name = name;
This.sex = sex;
11.}
12...
13./**
14. * Setting Gender
* @param sex int
16. */
public void setsex (int sex)
18. {
/** @todo need to make a judgment on the incoming reference * *
This.sex = sex;
21.}
22.}

Add two Todo tags to line 8th and 19. Todo tags can be placed anywhere in the program, not as Javadoc tags must be placed in front of definition statements such as classes, interfaces, methods, and so on. At this point, the two TODO tags will appear in the To do folder in the Structure pane, as shown in the following illustration:


Figure to do folder

Click the item under the To do folder and the editor navigates to the appropriate location in the code.

If you insert Todo tags in many parts of the project, how do you view the retrieval to view them? With Search->view Todos, all the TODO tags in the project are listed in the information pane, as shown in the following illustration:


Fig. 22 All todo marks in engineering or engineering group

Not only contains the TODO annotation information, the result list also lists the program files and directories where the tags are located. You can filter the annotations of the TODO tag by typing keywords into the comment contains.

Tips:

An engineering software project, often due to the urgency of the project schedule, limited by time and human resources, you may have to discard some good solutions and use some easy to implement methods of emergency. You hope that in the future under the conditions of allowing the "back to the old mountains and rivers", as the saying goes, good memory is not as bad as the pen, if in the corresponding place with the TODO label as Wuling people from the peach blossom back to the same "everywhere Zhi", will not be "lost".


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.