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


Java IWorkbenchWindow.getActivePage方法代码示例

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


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

示例1: search

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
protected void search(String pattern, SearchType type, boolean withRef) {    	    	
	IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    IEditorPart editorPart = workbenchPage.getActiveEditor();
    if (editorPart instanceof IWithAvroSchemaEditor) {
    	AvroSchemaEditor schemaEditor = ((IWithAvroSchemaEditor) editorPart).getEditor();        	
    	AvroContext masterContext = schemaEditor.getContext().getMaster();
    	SearchNodeContext searchNodeContext = masterContext.getSearchNodeContext();
    	if (pattern == null || pattern.trim().isEmpty()) {
    		searchNodeContext.reset();
    	} else if (searchNodeContext.searchNodes(type, pattern, withRef)) {
    		AvroNode node = searchNodeContext.next();
    		schemaEditor.getContentPart()
    			.getSchemaViewer(AvroContext.Kind.MASTER)
    			.setSelection(new StructuredSelection(node), true);
    	}
    	refreshCommands(editorPart, SearchNodePropertyTester.PROPERTIES);
    }
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:21,代码来源:SearchNodeControl.java

示例2: execute

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench==null){
		return null;
	}
	IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
	if (activeWorkbenchWindow==null){
		return null;
	}
	IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
	if (activePage==null){
		return null;
	}
	IEditorPart editor = activePage.getActiveEditor();
	
	if (editor instanceof BatchEditor){
		executeOnBatchEditor((BatchEditor) editor);
	}
	return null;
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:22,代码来源:AbstractBatchEditorHandler.java

示例3: openView

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
 * Opens the view with the given identifier.
 * 
 * @param viewId
 *            The view to open; must not be <code>null</code>
 * @throws PartInitException
 *             If the part could not be initialized.
 */
private final void openView ( final String viewId, final String secondaryId, final IWorkbenchWindow activeWorkbenchWindow ) throws PartInitException
{

    final IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage ();
    if ( activePage == null )
    {
        return;
    }
    if ( secondaryId != null )
    {
        activePage.showView ( viewId, secondaryId, IWorkbenchPage.VIEW_ACTIVATE );
    }
    else
    {
        activePage.showView ( viewId );
    }

}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:27,代码来源:ShowViewHandler.java

示例4: execute

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbench workbench = PlatformUI.getWorkbench();
	if (workbench==null){
		return null;
	}
	IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
	if (activeWorkbenchWindow==null){
		return null;
	}
	IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
	if (activePage==null){
		return null;
	}
	IEditorPart editor = activePage.getActiveEditor();
	
	if (editor instanceof BashEditor){
		executeOnBashEditor((BashEditor) editor);
	}
	return null;
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:22,代码来源:AbstractBashEditorHandler.java

示例5: closeEditorIfAlreadyOpen

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
private boolean closeEditorIfAlreadyOpen(IPath jobFilePath, String fileName) {

		String jobPathRelative = StringUtils.removeStart(jobFilePath.toString(), "..");
		jobPathRelative = StringUtils.removeStart(jobPathRelative, "/");
		String jobPathAbsolute = StringUtils.replace(jobPathRelative, "/", "\\");
		IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		if (activeWorkbenchWindow != null) {
			IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
			for (IEditorReference editorRefrence : activePage.getEditorReferences()) {
				if (StringUtils.equals(editorRefrence.getTitleToolTip(), jobPathRelative)
						|| StringUtils.equals(editorRefrence.getTitleToolTip(), jobPathAbsolute)
						|| fileName.equals(editorRefrence.getTitleToolTip())) {
					IEditorPart editor = editorRefrence.getEditor(true);
					if (!activePage.closeEditor(editor, true)) {
						LOGGER.debug("Editor not closed");
					}
					LOGGER.debug("Editor closed");
					return true;
				}
			}
		}
		return false;
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:24,代码来源:ExternalSchemaUpdaterHandler.java

示例6: unsafeGetWorkbenchPage

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
static private final IWorkbenchPage unsafeGetWorkbenchPage() {
	IWorkbenchPage page = null;
	if (PlatformUI.isWorkbenchRunning()) {
		IWorkbench wb = PlatformUI.getWorkbench();
		IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
		page = win.getActivePage();
	}
	return page;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:10,代码来源:EditorsUtil.java

示例7: execute

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的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

示例8: execute

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow == null) {
        return null;
    }
    IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
    if (activePage == null) {
        return null;
    }
    IEditorPart editor = activePage.getActiveEditor();
    if (editor == null) {
        return null;
    }
    IEditorInput input = editor.getEditorInput();
    if (input == null || ! (input instanceof FileEditorInput)) {
        return null;
    }
    IFile file = ((FileEditorInput) input).getFile();
    if (file != null && file.getType() == IResource.FILE && file.getFileExtension().equals("java")) {
        utils = new ProjectUtils(file.getProject());
        if (utils.isGluonMobileProject()) {
            ISelection selection = HandlerUtil.getCurrentSelection(event);
            Display.getDefault().asyncExec(() -> new JCode(utils, selection,  (JavaEditor) editor));
        }
    }
    return null;
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:29,代码来源:InsertGluonFunctionHandler.java

示例9: test

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的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

示例10: getActivePage

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
 * Returns active page or <code>null</code>
 * 
 * @return active page or <code>null</code>
 */
public static IWorkbenchPage getActivePage() {
	if (!PlatformUI.isWorkbenchRunning()) {
		return null;
	}
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	if (window == null) {
		return null;
	}
	return window.getActivePage();
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:16,代码来源:EclipseUtil.java

示例11: getActiveWorkbenchPage

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
protected final IWorkbenchPage getActiveWorkbenchPage() {
    IWorkbenchWindow workBenchWindow = getActiveWorkbenchWindow();
    if (workBenchWindow != null) {
        return workBenchWindow.getActivePage();
    }
    return null;
}
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:8,代码来源:BaseAction.java

示例12: findView

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
public static IViewPart findView(String viewId) {		
	IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();		
	if (activeWorkbenchWindow != null) {			
		IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();			
		if (activePage != null) {				
			return activePage.findView(viewId);			
		}		
	}		
	return null;		
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:11,代码来源:UIUtils.java

示例13: getActivePage

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
/**
 * @return IWorkbenchPage
 */
public static IWorkbenchPage getActivePage() {
	try {
		if (!PlatformUI.isWorkbenchRunning()) return null;
	} catch (Exception | NoClassDefFoundError ne) {
		return null;
	}
	final IWorkbench bench = PlatformUI.getWorkbench();
	if (bench==null) return null;
	final IWorkbenchWindow window = bench.getActiveWorkbenchWindow();
	if (window==null) return null;
	return window.getActivePage();
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:16,代码来源:PageUtil.java

示例14: openFileInEditor

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的package包/类
private ITextEditor openFileInEditor(IFile file) throws PartInitException {
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	IWorkbenchPage page = window.getActivePage();
	IEditorPart editor = IDE.openEditor(page, file, true);
	ITextEditor textEditor = editor.getAdapter(ITextEditor.class);
	return textEditor;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:8,代码来源:JavaBreakpointListener.java

示例15: getActivePart

import org.eclipse.ui.IWorkbenchWindow; //导入方法依赖的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.IWorkbenchWindow.getActivePage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。