use of org.eclipse.ui.internal.navigator.actions.CommonActionProviderDescriptor in project polymap4-core by Polymap4.
the class NavigatorActionService method addCommonActionProviderMenu.
/**
* @param aMenu
*/
private void addCommonActionProviderMenu(final IMenuManager aMenu) {
final CommonActionProviderDescriptor[] providerDescriptors = CommonActionDescriptorManager.getInstance().findRelevantActionDescriptors(contentService, getContext());
if (providerDescriptors.length > 0) {
for (int i = 0; i < providerDescriptors.length; i++) {
final CommonActionProviderDescriptor providerDescriptorLocal = providerDescriptors[i];
SafeRunner.run(new NavigatorSafeRunnable() {
public void run() throws Exception {
if (!filterActionProvider(providerDescriptorLocal)) {
CommonActionProvider provider = getActionProviderInstance(providerDescriptorLocal);
provider.setContext(getContext());
provider.fillContextMenu(aMenu);
}
}
});
}
}
}
use of org.eclipse.ui.internal.navigator.actions.CommonActionProviderDescriptor in project polymap4-core by Polymap4.
the class NavigatorActionService method fillActionBars.
/**
* Request that the service invoke extensions to fill the given IActionBars with retargetable
* actions or view menu contributions from Action Providers that are interested in the given
* selection.
*
* @param theActionBars
* The action bars in use by the current view site.
* @see ActionGroup#fillActionBars(IActionBars)
*/
public void fillActionBars(final IActionBars theActionBars) {
Assert.isTrue(!disposed);
theActionBars.clearGlobalActionHandlers();
ActionContext context = getContext();
if (context == null) {
context = new ActionContext(StructuredSelection.EMPTY);
}
final CommonActionProviderDescriptor[] providerDescriptors = CommonActionDescriptorManager.getInstance().findRelevantActionDescriptors(contentService, context);
if (providerDescriptors.length > 0) {
for (int i = 0; i < providerDescriptors.length; i++) {
final CommonActionProviderDescriptor providerDesciptorLocal = providerDescriptors[i];
final ActionContext actionContextLocal = context;
SafeRunner.run(new NavigatorSafeRunnable() {
public void run() throws Exception {
if (!filterActionProvider(providerDesciptorLocal)) {
CommonActionProvider provider = null;
provider = getActionProviderInstance(providerDesciptorLocal);
provider.setContext(actionContextLocal);
provider.fillActionBars(theActionBars);
provider.updateActionBars();
}
}
});
}
}
theActionBars.updateActionBars();
theActionBars.getMenuManager().update();
}
Aggregations