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


Java IWorkbenchPage.getActivePart方法代码示例

本文整理汇总了Java中org.eclipse.ui.IWorkbenchPage.getActivePart方法的典型用法代码示例。如果您正苦于以下问题:Java IWorkbenchPage.getActivePart方法的具体用法?Java IWorkbenchPage.getActivePart怎么用?Java IWorkbenchPage.getActivePart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.IWorkbenchPage的用法示例。


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

示例1: getEditor

import org.eclipse.ui.IWorkbenchPage; //导入方法依赖的package包/类
protected AvroSchemaEditor getEditor() {
	
	IWorkbench workbench = PlatformUI.getWorkbench();
       IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();

       if (window != null) {
           IWorkbenchPage workbenchPage = window.getActivePage();
           if (workbenchPage != null) {
           	IWorkbenchPart activePart = workbenchPage.getActivePart();                
               if (activePart instanceof IWithAvroSchemaEditor) {
               	return ((IWithAvroSchemaEditor) activePart).getEditor();
               }
           }
       }
       
       return null;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:18,代码来源:SchemaEditorPropertyTester.java

示例2: execute

import org.eclipse.ui.IWorkbenchPage; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	if (null == activeWorkbenchWindow) {
		return null;
	}
	IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
	if (null == activePage) {
		return null;
	}
	IWorkbenchPart activePart = activePage.getActivePart();
	if (!(activePart instanceof CommonNavigator)) {
		return null;
	}

	CommonNavigator navigator = (CommonNavigator) activePart;
	CommonViewer commonViewer = navigator.getCommonViewer();

	Tree navigatorTree = commonViewer.getTree();
	List<TreeItem> visibleItems = new ArrayList<>();
	collectChildren(navigatorTree.getItems(), visibleItems);

	List<Object> visibleData = visibleItems.stream().map(i -> i.getData()).collect(Collectors.toList());

	commonViewer.setSelection(new StructuredSelection(visibleData), false);

	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:SelectAllProjectExplorerHandler.java

示例3: test

import org.eclipse.ui.IWorkbenchPage; //导入方法依赖的package包/类
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if ("gluonMobileFound".equals(property)) {
        try {
            IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (activeWorkbenchWindow == null) {
                return false;
            }
            IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
            if (activePage == null) {
                return false;
            }
            IWorkbenchPart activePart = activePage.getActivePart();
            if (activePart == null || ! (activePart instanceof CompilationUnitEditor)) {
                return false;
            }
            IEditorPart editor = activePage.getActiveEditor();
            if (editor == null) {
                return false;
            }
            IEditorInput input = editor.getEditorInput();
            if (input == null || ! (input instanceof FileEditorInput)) {
                return false;
            }
            IFile file = ((FileEditorInput) input).getFile();
            if (file != null && file.getType() == IResource.FILE && file.getFileExtension().equals("java")) {
                ProjectUtils utils = new ProjectUtils(file.getProject());
            return utils.isGluonMobileProject();
            }
        } catch (Exception e) { }
    }
    return false;
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:34,代码来源:InsertFunctionTester.java

示例4: getActivePart

import org.eclipse.ui.IWorkbenchPage; //导入方法依赖的package包/类
private IWorkbenchPart getActivePart()
{
	IWorkbenchWindow activeWindow = getWorkbench().getActiveWorkbenchWindow();
	if( activeWindow != null )
	{
		IWorkbenchPage activePage = activeWindow.getActivePage();
		if( activePage != null )
		{
			return activePage.getActivePart();
		}
	}
	return null;
}
 
开发者ID:equella,项目名称:Equella,代码行数:14,代码来源:NewPluginWizard.java


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