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.