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

Source: Internet
Author: User

strucutured Document analysis View

In the previous article, we described in detail one of the most important data models in WTP istructureddocument (we'll call it WTP document, and another core data model, WTP model----Istructuredmodel), In this section we will develop ourselves a tool to analyze istrucutreddocument.

PS: Do not worry, the following article will be WTP Structuredtexteditor features customized, before the real customization must be clear WTP Document (istructureddocument) and WTP Model (Istructuredmodel), not even the core data models are familiar with, later on what customization ^_^

"Properteis view extensions provided by WTP"

Description: The Properteis view is intrinsic to eclipse, allowing the user to customize the content in the properties view through the appropriate type extension mechanism, including the following key knowledge points:

1, Eclipse's adapter mechanism (iadaptable, iadapterfactory, Adaptermanager), about the type adaptation extension mechanism in Eclipse, another article in the blog was analyzed:

Analysis of type extension mechanism in Eclipse plug-in development eclipse

2, the Properties view related to several important interfaces:

Org.eclipse.ui.views.properties.IPropertySource.class

Org.eclipse.ui.views.properties.PropertySheetPage

...

3, WTP is the use of Eclipse type extension mechanism to achieve the corresponding function. Let's take a look at the extension service provided in the Getadapter method in the Structuredtexteditor of WTP (Iworkbenchpart itself is declared as iadaptable):

1 /*
2 * (non-Javadoc)
3 *
4 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
5 */
6 public Object getAdapter(Class required) {
7 //
8 else if (IPropertySheetPage.class.equals(required) && isEditable()) {
9 if (fPropertySheetPage == null || fPropertySheetPage.getControl() == null || fPropertySheetPage.getControl().isDisposed()) {
10 PropertySheetConfiguration cfg = createPropertySheetConfiguration();
11 if (cfg != null) {
12 ConfigurablePropertySheetPage propertySheetPage = new ConfigurablePropertySheetPage();
13 propertySheetPage.setConfiguration(cfg);
14 fPropertySheetPage = propertySheetPage;
15 }
16 }
17 result = fPropertySheetPage;
18 }
19 //.
20 }

Configurablepropertysheetpage ^_^ (org.eclipse.wst.sse.ui.internal.properties.ConfigurablePropertySheetPage).

The main function of the WTP Properties view is to display the corresponding label content in the properties view based on the user's cursor position in the editor, and to support user editing, for example:

In the current editor, the user cursor is located within the jsp:directive.page tag, and the attribute view enumerates the corresponding label contents, allowing the user to edit.

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.