本文整理汇总了Java中org.eclipse.ui.actions.CloseResourceAction类的典型用法代码示例。如果您正苦于以下问题:Java CloseResourceAction类的具体用法?Java CloseResourceAction怎么用?Java CloseResourceAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloseResourceAction类属于org.eclipse.ui.actions包,在下文中一共展示了CloseResourceAction类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ProjectActionGroup
import org.eclipse.ui.actions.CloseResourceAction; //导入依赖的package包/类
/**
* Creates a new <code>ProjectActionGroup</code>. The group requires
* that the selection provided by the given selection provider is of type
* {@link IStructuredSelection}.
*
* @param site the site that will own the action group.
* @param selectionProvider the selection provider used instead of the
* page selection provider.
*
* @since 3.4
*/
public ProjectActionGroup(IWorkbenchSite site, ISelectionProvider selectionProvider) {
fSelectionProvider= selectionProvider;
ISelection selection= selectionProvider.getSelection();
fCloseAction= new CloseResourceAction(site);
fCloseAction.setActionDefinitionId(IWorkbenchCommandConstants.PROJECT_CLOSE_PROJECT);
fCloseUnrelatedAction= new CloseUnrelatedProjectsAction(site);
fCloseUnrelatedAction.setActionDefinitionId(IWorkbenchCommandConstants.PROJECT_CLOSE_UNRELATED_PROJECTS);
fOpenAction= new OpenProjectAction(site);
fOpenAction.setActionDefinitionId(IWorkbenchCommandConstants.PROJECT_OPEN_PROJECT);
if (selection instanceof IStructuredSelection) {
IStructuredSelection s= (IStructuredSelection)selection;
fOpenAction.selectionChanged(s);
fCloseAction.selectionChanged(s);
fCloseUnrelatedAction.selectionChanged(s);
}
fSelectionChangedListener= new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection s= event.getSelection();
if (s instanceof IStructuredSelection) {
performSelectionChanged((IStructuredSelection) s);
}
}
};
selectionProvider.addSelectionChangedListener(fSelectionChangedListener);
IWorkspace workspace= ResourcesPlugin.getWorkspace();
workspace.addResourceChangeListener(fOpenAction);
workspace.addResourceChangeListener(fCloseAction);
workspace.addResourceChangeListener(fCloseUnrelatedAction);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:46,代码来源:ProjectActionGroup.java
注:本文中的org.eclipse.ui.actions.CloseResourceAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论