Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Custom Annotation Property Views
Contents
< To: Tigerstripe_APIs
Introduction
Annotation Framework support 4 ways to extend Annotation Property View: override properties section, add properties tabs, add annotation actions and register custom properties editors.
Custom Annotation Property Section
To replace annotation property section in the Annotation Property View we need to provide new section and annotation filter. Annotation Property View based on the tabbed properties, so customizing can be done using org.eclipse.ui.views.properties.tabbed.propertySections extension point:
<extension point="org.eclipse.ui.views.properties.tabbed.propertySections"> <propertySections contributorId="org.eclipse.tigerstripe.annotation.ui.properties"> <propertySection class="org.eclipse.tigerstripe.annotation.ui.example.customview.CustomSection" filter="org.eclipse.tigerstripe.annotation.ui.example.customview.CustomAnnotationFilter" id="property.section.CustomSection" tab="property.tab.PropertiesPropertySection"/> </propertySections> </extension>
- contributorId="org.eclipse.tigerstripe.annotation.ui.properties" - identifier of the annotation property page contributor.
- tab="property.tab.PropertiesPropertySection" - properties tab identifier which we want to override.
- class - annotation section class. This class should extend org.eclipse.tigerstripe.annotation.ui.core.properties.AnnotationPropertiesSection class:
public class CustomSection extends AnnotationPropertiesSection { public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { //create section controls ... } protected void updateSection(Annotation annotation) { //update section when selected annotation changed ... } }
- filter - annotation filter showing when annotation section should be overridden. Annotation filter should extend public class:
CustomAnnotationFilter extends AnnotationFilter { public boolean select(Annotation annotation) { //return true if section should be overridden for the specified annotation } }
- id - the unique identifier for the section
Add Annotation Property Tab
TODO: add content
Contribute Annotation Actions
Custom actions can be contributed to the Annotation Property View using standard org.eclipse.ui.popupMenus extension point with "annotationProperties" as menubar path and org.eclipse.tigerstripe.annotation.core.Annotation as selection:
<extension point="org.eclipse.ui.popupMenus"> <objectContribution ... objectClass="org.eclipse.tigerstripe.annotation.core.Annotation"> <action ... menubarPath="annotationProperties"/> </objectContribution> <extension/>
Register Properties Editors
TODO: add content