use of org.eclipse.ui.actions.ActionContext in project erlide_eclipse by erlang.
the class ReferencesSearchGroup method addWorkingSetAction.
private void addWorkingSetAction(final IWorkingSet[] workingSets, final IMenuManager manager) {
FindAction action;
if (fEditor != null) {
action = new WorkingSetFindAction(fEditor, new FindReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets));
} else {
action = new WorkingSetFindAction(fSite, new FindReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets));
}
final ActionContext context = getContext();
if (context != null) {
action.update(context.getSelection());
}
addAction(action, manager);
}
use of org.eclipse.ui.actions.ActionContext in project n4js by eclipse.
the class N4JSNavigatorActionProvider method setContext.
@Override
public void setContext(final ActionContext context) {
super.setContext(context);
projectGroup.setContext(context);
// context is null if disposal of the provider is triggered
if (null != context) {
StructuredSelection selection = (StructuredSelection) context.getSelection();
List<Object> selectedElements = Arrays.asList(selection.toArray());
selectionContainsWorkingSet = selectedElements.stream().anyMatch(element -> element instanceof WorkingSet);
// try to minimize number of context updates for working set action provider
if (selectionContainsWorkingSet) {
workingSetActionProvider.setContext(context);
}
assignWorkingSetsAction.selectionChanged(selection);
}
}
use of org.eclipse.ui.actions.ActionContext in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerView method handleSelectionChanged.
protected void handleSelectionChanged(IStructuredSelection selection) {
List<?> list = selection.toList();
if (list.size() == 0)
return;
ActionContext actionContext = new ActionContext(selection);
actionGroup.setContext(actionContext);
// show the properties for this item
Object item = list.get(0);
if (item instanceof WorkflowElement) {
WorkflowElement workflowElement = (WorkflowElement) item;
selectionProvider.setSelection(workflowElement);
// set the schema owner static qualifier
if (workflowElement.getProject() != null)
DBMappingUtil.setSchemaOwner(workflowElement.getProject().getMdwDataSource().getSchemaOwner());
}
}
use of org.eclipse.ui.actions.ActionContext in project polymap4-core by Polymap4.
the class CommonNavigatorManager method selectionChanged.
/**
* @param anEvent
* An event indicating the current selection of the
* {@link CommonViewer}
*
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
*/
public void selectionChanged(SelectionChangedEvent anEvent) {
if (anEvent.getSelection() instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) anEvent.getSelection();
actionService.setContext(new ActionContext(structuredSelection));
actionService.fillActionBars(commonNavigator.getViewSite().getActionBars());
}
}
use of org.eclipse.ui.actions.ActionContext in project polymap4-core by Polymap4.
the class CommonNavigatorManager method fillContextMenu.
/**
* <p>
* Fills aMenuManager with menu contributions from the
* {@link NavigatorActionService}.
* </p>
*
* @param aMenuManager
* A popup menu
* @see NavigatorActionService#fillContextMenu(IMenuManager)
*/
protected void fillContextMenu(IMenuManager aMenuManager) {
ISelection selection = commonNavigator.getCommonViewer().getSelection();
actionService.setContext(new ActionContext(selection));
actionService.fillContextMenu(aMenuManager);
}
Aggregations