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);
}