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


Java OpenFileAction类代码示例

本文整理汇总了Java中org.eclipse.ui.actions.OpenFileAction的典型用法代码示例。如果您正苦于以下问题:Java OpenFileAction类的具体用法?Java OpenFileAction怎么用?Java OpenFileAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OpenFileAction类属于org.eclipse.ui.actions包,在下文中一共展示了OpenFileAction类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: NewTextSearchActionGroup

import org.eclipse.ui.actions.OpenFileAction; //导入依赖的package包/类
public NewTextSearchActionGroup(IViewPart part) {
    Assert.isNotNull(part);
    IWorkbenchPartSite site = part.getSite();
    fSelectionProvider = site.getSelectionProvider();
    fPage = site.getPage();
    fOpenPropertiesDialog = new PropertyDialogAction(site, fSelectionProvider);
    fOpenAction = new OpenFileAction(fPage);
    ISelection selection = fSelectionProvider.getSelection();

    if (selection instanceof IStructuredSelection) {
        fOpenPropertiesDialog.selectionChanged((IStructuredSelection) selection);
    } else {
        fOpenPropertiesDialog.selectionChanged(selection);
    }

}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:NewTextSearchActionGroup.java

示例2: fillContextMenu

import org.eclipse.ui.actions.OpenFileAction; //导入依赖的package包/类
@Override
protected void fillContextMenu(IMenuManager menuManager) {
	super.fillContextMenu(menuManager);

	final IStructuredSelection selectedItems = getSelectedItems();
	if (selectedItems.isEmpty()) {
		return;
	}

	IWorkbenchPage activePage = getActivePage();
	if (activePage == null) {
		return;
	}

	menuManager.add(new Separator());

	// Add 'Open' menu item
	OpenFileAction openFileAction = new OpenFileAction(activePage) {
		@Override
		public void run() {
			okPressed();
		}
	};
	openFileAction.selectionChanged(selectedItems);
	if (openFileAction.isEnabled()) {
		menuManager.add(openFileAction);

		IAdaptable selectedAdaptable = getSelectedAdaptable();
		if (selectedAdaptable != null) {

			// Add 'Open With' sub-menu
			MenuManager subMenu = new MenuManager("Open with");
			OpenWithMenu openWithMenu = new ResourceOpenWithMenu(activePage, selectedAdaptable);
			subMenu.add(openWithMenu);
			menuManager.add(subMenu);
		}
	}

}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:40,代码来源:OpenGradleResourceDialog.java

示例3: init

import org.eclipse.ui.actions.OpenFileAction; //导入依赖的package包/类
@Override
public void init(final ICommonActionExtensionSite aConfig) {
	if (aConfig.getViewSite() instanceof ICommonViewerWorkbenchSite) {
		viewSite = (ICommonViewerWorkbenchSite) aConfig.getViewSite();
		openFileAction = new OpenFileAction(viewSite.getPage());
		contribute = true;
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:9,代码来源:OpenActionProvider.java

示例4: fillContextMenu

import org.eclipse.ui.actions.OpenFileAction; //导入依赖的package包/类
@Override
protected void fillContextMenu(IMenuManager menuManager) {
	super.fillContextMenu(menuManager);

	IStructuredSelection selectedItems = getSelectedItems();
	if (selectedItems.isEmpty()) {
		return;
	}
	
	IWorkbenchPage activePage = getActivePage();
	if (activePage == null) {
		return;
	}

	// Add 'Open' menu item
	OpenFileAction openFileAction = new OpenFileAction(activePage) {
		@Override
		public void run() {
			okPressed();
		}
	};
	openFileAction.selectionChanged(selectedItems);
	if (!openFileAction.isEnabled()) {
		return;
	}
	menuManager.add(new Separator());
	menuManager.add(openFileAction);

	IAdaptable selectedAdaptable = getSelectedAdaptable();
	if (selectedAdaptable == null) {
		return;
	}

	// Add 'Open With...'  sub-menu
	MenuManager subMenu = new MenuManager(IDEWorkbenchMessages.OpenResourceDialog_openWithMenu_label);
	OpenWithMenu openWithMenu = new OpenWithMenu(activePage, selectedAdaptable) {
		/*
		 * (non-Javadoc)
		 * @see org.eclipse.ui.actions.OpenWithMenu#openEditor(org.eclipse.ui.IEditorDescriptor, boolean)
		 */
		@Override
		protected void openEditor(IEditorDescriptor editorDescriptor, boolean openUsingDescriptor) {
			computeResult();
			setResult(Collections.EMPTY_LIST);
			close();
			super.openEditor(editorDescriptor, openUsingDescriptor);
		}
	};
	subMenu.add(openWithMenu);
	menuManager.add(subMenu);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:52,代码来源:EnsembleOpenResourceDialog.java


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