Save multi-page editor

Source: Internet
Author: User

Take the multi-page editor inherited from the formeditor class as an example.

Inherit from the save of formeditor Editor, where formediotr inherits from multipageeditorpart

In fact, it still needs to call the save of every page, as shown in figure

Public void dosave (iprogressmonitor Monitor ){

Tagpage. dosave (MONITOR );

// Omitting the dosave (MONITOR) Call of other pages

Editordirtystatechanged ();

}

 

 

 

The tagpage is one of the pages of the Multi-page editor, inherited from formpage. In fact, formpage is also an editor that inherits from editorpage and implements the iformpage interface.

 

 

In formpage, the editor is usually saved like this. You can define a variable in the editor that indicates whether the editor is dirty:

① Private Boolean isdirty = false; // The initial value is false. If it is not rewritten, The isdirty method returns isdirty.

② Set the isdirty value where the event needs to be monitored and modified, and notify the event, such:

Isdirty = true;

Geteditor (). editordirtystatechanged (); // pay special attention to the geteditor () method.

③ Complete the save in the dosave method and set isdirty to false, for example:

Public void dosave (iprogressmonitor Monitor ){

Writefieldstotag ();

Id3taginfo. savemp3file ();

Isdirty = false; // reset to false

}

 

 

Note: in fact, the isdirty () method in formeditor traverses all the formpage contained in it to determine which modifications are made.

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.