Java Reference
In-Depth Information
here. Basically, the first class is a composite ActionBarContributor that han-
dles switching between pages where each has its own contributor. The
second class is a utility class used by the first. To use these classes, we need to
modify two methods—first, the getActionBarContributor() in Require-
mentsEditor :
/**
* Modified to support MultiPageActionBarContributor
*
* @generated NOT
*/
public EditingDomainActionBarContributor getActionBarContributor() {
return (RequirementsActionBarContributor)
((RequirementsMultiPageActionBarContributor) getEditorSite()
.getActionBarContributor()).getTreeSubActionBars().getContributor();
}
In RequirementsEditorPart , we need to modify menuAboutToShow()
as well:
public void menuAboutToShow(IMenuManager manager) {
// pass the request to show the context menu on to the parent editor
((RequirementsActionBarContributor)
((RequirementsMultiPageActionBarContributor) parentEditor
.getEditorSite().getActionBarContributor()).getTreeSubActionBars()
.getContributor()).menuAboutToShow(manager);
}
The new contributor needs to be registered in our editor contribution, replac-
ing the original:
<extension point="org.eclipse.ui.editors">
<editor
id="org.eclipse.requirements.presentation.RequirementsEditorID"
name="%_UI_RequirementsEditor_label"
icon="icons/full/obj16/RequirementsModelFile.gif"
extensions="requirements"
class =
"org.eclipse.requirements.presentation.RequirementsEditor"
contributorClass=" org.eclipse.requirements.presentation.
RequirementsMultiPageActionBarContributor ">
</editor>
</extension>
Our edit menu actions are still in need of repair. Again, we need to
“upgrade” the EMF-generated editor by having RequirementsEditor
Search WWH ::




Custom Search