"Eclipse plug-in Development" based on WTP development of Custom JSP editor (ix)

Source: Internet
Author: User

Custom Structuredtexteditor source code instant Check

In the previous section we customized the WTP structuredtexteditor feature, and this section will customize another feature feature for instant source verification. The so-called source of real-time verification, is in the user's editing process (not saved), for user-edited content changes to do real-time verification, and give users instant feedback related to the error or other types of message. In this section, we'll take the label's instant check as an example to demonstrate how to customize the WTP Structuredtexteditor's source-code just-in-time verification.

Before customizing, let's take a look at the WTP structuredtexteditor existing source code instant Check function:

We see that when we delete the </jsp:text>, WTP Structuredtexteditor's instant checksum gives the wrong hint. In fact, we are in many other editors, such as the Java source Editor, and so on, we can see a similar real-time verification function.

"Related content in JFace Text framework"

Frankly speaking, our source code edit corresponding control is isourceviewer, then this check also should be isourceviewer provided a service. The JFace Text Framework does provide the appropriate mechanism for real-time verification of source code, and we look at the corresponding interface and operating principle.

"Related Interface"

1, Ireconciler (Org.eclipse.jface.text.reconciler.IReconciler), mediator, when the document changes, according to the partition type (if the concept is forgotten, Turn over the previous article to provide a corresponding mediation strategy (directly described as a validation strategy bar ^_^). public interface Ireconciler {
/**
* Installs the Reconciler Text Viewer. After this method has been
* finished, the Reconciler are operational, i.e., it works without requesting
* further Client actions until <code>uninstall</code> is called.
*
* @param textviewer the viewer on which the Reconciler is installed
*/
Void Install (Itextviewer textvie WER);
/**
* Removes the Reconciler from the text viewer it has
* previously been in installed on.
*/
void Unin Stall ();
/**
* Returns The reconciling strategy registered with the Reconciler
* for the specified content type.
*
* @param contentType the content type for which to determine the reconciling strategy
* @return The reconciling s Trategy registered for the given content type, or
* <code>null</code> If there is no such strategy
*/< br> ireconcilingstrategy getreconcilingstrategy (String contentType);
}

Related Article

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.