本文整理汇总了Java中org.eclipse.ui.actions.ActionContext类的典型用法代码示例。如果您正苦于以下问题:Java ActionContext类的具体用法?Java ActionContext怎么用?Java ActionContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionContext类属于org.eclipse.ui.actions包,在下文中一共展示了ActionContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setContext
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@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);
}
}
示例2: contextMenuAboutToShow
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
protected void contextMenuAboutToShow(IMenuManager mgr) {
if (mgr.isEmpty()) {
mgr.add(new GroupMarker(ICommonMenuConstants.GROUP_GOTO));
mgr.add(new Separator(ICommonMenuConstants.GROUP_EDIT));
mgr.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
mgr.add(new Separator(ICommonMenuConstants.GROUP_PROPERTIES));
mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_COPY));
mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_CUT));
mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_PASTE));
mgr.appendToGroup(ICommonMenuConstants.GROUP_EDIT, actions.get(ACTION_DELETE));
}
actionGroups.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
actionGroups.fillContextMenu(mgr);
}
示例3: editorContextMenuAboutToShow
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
public void editorContextMenuAboutToShow(IMenuManager menu) {
super.editorContextMenuAboutToShow(menu);
menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));
ActionContext context = new ActionContext(getSelectionProvider().getSelection());
fContextMenuGroup.setContext(context);
fContextMenuGroup.fillContextMenu(menu);
fContextMenuGroup.setContext(null);
// Quick views
IAction action = getAction(ITypeScriptEditorActionDefinitionIds.SHOW_OUTLINE);
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
action = getAction(ITypeScriptEditorActionDefinitionIds.OPEN_IMPLEMENTATION);
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, action);
}
示例4: fillCallHierarchyViewerContextMenu
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
protected void fillCallHierarchyViewerContextMenu(IMenuManager menu) {
JavaPlugin.createStandardGroups(menu);
menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, fRefreshSingleElementAction);
menu.appendToGroup(IContextMenuConstants.GROUP_SHOW, new Separator(GROUP_FOCUS));
if (fFocusOnSelectionAction.canActionBeAdded()) {
menu.appendToGroup(GROUP_FOCUS, fFocusOnSelectionAction);
}
if (fExpandWithConstructorsAction.canActionBeAdded()) {
menu.appendToGroup(GROUP_FOCUS, fExpandWithConstructorsAction);
}
if (fRemoveFromViewAction.canActionBeAdded()){
menu.appendToGroup(GROUP_FOCUS, fRemoveFromViewAction);
}
fActionGroups.setContext(new ActionContext(getSelection()));
fActionGroups.fillContextMenu(menu);
fActionGroups.setContext(null);
if (fCopyAction.canActionBeAdded()) {
menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, fCopyAction);
}
}
示例5: createViewer
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
protected BreadcrumbViewer createViewer(Composite composite) {
fViewer= new ProblemBreadcrumbViewer(composite, SWT.HORIZONTAL);
fViewer.setLabelProvider(createLabelProvider());
fViewer.setToolTipLabelProvider(createToolTipLabelProvider());
fViewer.setContentProvider(createContentProvider());
fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
fBreadcrumbActionGroup.setContext(new ActionContext(fViewer.getSelection()));
}
});
fBreadcrumbActionGroup= new JavaEditorBreadcrumbActionGroup(getJavaEditor(), fViewer);
fElementChangeListener= new ElementChangeListener();
JavaCore.addElementChangedListener(fElementChangeListener);
JavaUIHelp.setHelp(fViewer, IJavaHelpContextIds.JAVA_EDITOR_BREADCRUMB);
return fViewer;
}
示例6: fillContextMenu
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
protected void fillContextMenu(IMenuManager mgr) {
super.fillContextMenu(mgr);
addSortActions(mgr);
fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
fActionGroup.fillContextMenu(mgr);
AbstractPythonSearchQuery query = (AbstractPythonSearchQuery) getInput().getQuery();
if (query.getSearchString().length() > 0) {
IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
if (!selection.isEmpty()) {
ReplaceAction replaceSelection = new ReplaceAction(getSite().getShell(),
getInput(), selection.toArray(), true);
replaceSelection.setText(SearchMessages.ReplaceAction_label_selected);
mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelection);
}
ReplaceAction replaceAll = new ReplaceAction(getSite().getShell(), getInput(),
null, true);
replaceAll.setText(SearchMessages.ReplaceAction_label_all);
mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll);
}
}
示例7: fillContextMenu
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
public void fillContextMenu(IMenuManager menu) {
ActionContext con = getContext();
IStructuredSelection selection = (IStructuredSelection) con
.getSelection();
List<INavigationElement<?>> elements = Viewers.getAll(selection);
if (showDbCreate(elements)) {
menu.add(new DbCreateAction());
menu.add(new DbImportAction());
}
if (elements.size() == 1) {
registerSingleActions(elements.get(0), menu, actions);
} else if (elements.size() > 1) {
registerMultiActions(elements, menu, actions);
}
addCloudMenu(elements, menu);
}
示例8: setContext
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
public void setContext(final ActionContext context) {
super.setContext(context);
selection = null == context ? null : context.getSelection();
if (inViewPart) {
openGroup.setContext(context);
}
}
示例9: setContext
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
public void setContext(final ActionContext context) {
super.setContext(context);
if (inViewPart) {
manageGroup.setContext(context);
editGroup.setContext(context);
newWizardsGroup.setContext(context);
importExportGroup.setContext(context);
}
}
示例10: setContext
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
public void setContext(ActionContext context) {
super.setContext(context);
if (fGroups == null)
return;
for (int i= 0; i < fGroups.length; i++) {
fGroups[i].setContext(context);
}
}
示例11: setContext
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
public void setContext(ActionContext context) {
fReferencesGroup.setContext(context);
// fDeclarationsGroup.setContext(context);
//// fImplementorsGroup.setContext(context);
// fReadAccessGroup.setContext(context);
// fWriteAccessGroup.setContext(context);
// fOccurrencesGroup.setContext(context);
}
示例12: setContext
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
public void setContext(ActionContext context) {
super.setContext(context);
if (fGroups == null)
return;
for (int i= 0; i < fGroups.length; i++) {
fGroups[i].setContext(context);
}
}
示例13: setContext
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
public void setContext(ActionContext context) {
if (context == null) {
return;
}
selection = getRealSelection((IStructuredSelection) context.getSelection());
copyQualifiedNameAction.update(selection);
super.setContext(context);
}
示例14: fillContextMenu
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@SuppressWarnings("restriction")
private void fillContextMenu(IMenuManager manager) {
JavaPlugin.createStandardGroups(manager);
IStructuredSelection selection = selectionProvider.getSelection();
actionGroups.setContext(new ActionContext(selection));
actionGroups.fillContextMenu(manager);
actionGroups.setContext(null);
// manager.add(new Separator());
// drillDownAdapter.addNavigationActions(manager);
// Other plug-ins can contribute there actions here
// manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
示例15: setContext
import org.eclipse.ui.actions.ActionContext; //导入依赖的package包/类
@Override
public void setContext(ActionContext context) {
fReferencesGroup.setContext(context);
fDeclarationsGroup.setContext(context);
fImplementorsGroup.setContext(context);
fReadAccessGroup.setContext(context);
fWriteAccessGroup.setContext(context);
fOccurrencesGroup.setContext(context);
}