"Eclipse plug-in Development" based on WTP development of custom JSP editors (eight)

Source: Internet
Author: User

Custom Structuredtexteditor automatic Prompts

The previous introduction focuses on two points: the Structuredtexteditor framework and the WTP data model, in this section you can customize one of our most common WTP structuredtexteditor features, which is automatic prompting.

"WTP Structuredtexteditor prompt function Implementation Analysis"

For a brief knowledge of the Eclipse Text Editor framework, JFace Text framework, and WTP Structuredtexteditor, see:

"Eclipse plug-in Development" based on WTP Development Custom JSP Editor (ii): Create your own jspeditor based on WTP Structuredtexteditor

"Sourceviewer Prompt policy Configuration"

In chapter two, we said that if you want to customize a isourceviewer to automatically prompt the policy, you can configure it in the isourceviewer corresponding sourceviewerconfiguration. For WTP JSP Structuredtexteditor, the isourceviewer here is Structuredtextviewer, the sourceviewerconfiguration here is Structuredtextviewerconfigurationjsp. Let's take a look at the configuration of the auto prompt policy in WTP structuredtextviewerconfigurationjsp:

(The following code extracts the subclass structuredtextviewerconfigurationjsp Class):

protected icontentassistprocessor[] Getcontentassistprocessors (isourceviewer sourceviewer, String Partitiontype) {
icontentassistprocessor[] processors = NULL;
//other code omitted ...
Else if (partitiontype = ixmlpartitions.xml_default) | | (Partitiontype = = Ihtmlpartitions.html_default) | | (Partitiontype = = ihtmlpartitions.html_comment) | | (Partitiontype = = Ijsppartitions.jsp_default) | | (Partitiontype = = ijsppartitions.jsp_directive) | | (Partitiontype = = Ijsppartitions.jsp_content_delimiter) | | (Partitiontype = = Ijsppartitions.jsp_content_javascript) | | (Partitiontype = = ijsppartitions.jsp_comment)) {
//JSP
processors = new icontentassistprocessor[]{new jspcontentassistprocessor ()};
}
Else if (partitiontype = ixmlpartitions.xml_cdata) | | (Partitiontype = = Ijsppartitions.jsp_content_java)) {
//JSP java
processors = new icontentassistprocessor[]{new jspjavacontentassistprocessor ()};
}
//other code omitted ...
return processors;
}

The above code, as we can see, icontentassistprocessor is associated with a specific partition type (partition type). To understand the problem, you need to see how this particular partition type (partition type) is computed.

PS: partition type is the concept of jface text framework, the relevant knowledge you are interested in further to understand the JFace text framework.

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.