当前位置: 首页>>代码示例>>Java>>正文


Java ActionContext类代码示例

本文整理汇总了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);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:N4JSNavigatorActionProvider.java

示例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);
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:17,代码来源:MkOutlinePage.java

示例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);

}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:19,代码来源:TypeScriptEditor.java

示例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);
}
  }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:CallHierarchyViewPart.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavaEditorBreadcrumb.java

示例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);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:23,代码来源:FileSearchPage.java

示例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);
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:18,代码来源:NavigationActionProvider.java

示例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);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:N4JSOpenActions.java

示例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);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:N4JSWorkingSetActionProvider.java

示例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);
	}
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:10,代码来源:CompositeActionGroup.java

示例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);
	}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:9,代码来源:TypeScriptSearchActionGroup.java

示例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);
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:9,代码来源:CompositeActionGroup.java

示例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);
}
 
开发者ID:iloveeclipse,项目名称:datahierarchy,代码行数:10,代码来源:JavaActionsGroup.java

示例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));
}
 
开发者ID:iloveeclipse,项目名称:datahierarchy,代码行数:13,代码来源:DataHierarchyView.java

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:JavaSearchActionGroup.java


注:本文中的org.eclipse.ui.actions.ActionContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。