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


Java IWorkbench.getActiveWorkbenchWindow方法代码示例

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


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

示例1: execute

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

示例2: getEditor

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

示例3: execute

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

示例4: search

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

示例5: unsafeGetWorkbenchPage

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

示例6: getActivePage

import org.eclipse.ui.IWorkbench; //导入方法依赖的package包/类
/***/
@SuppressWarnings("restriction")
protected IWorkbenchPage getActivePage() {
	IWorkbenchPage page = null;
	if (org.eclipse.ui.internal.Workbench.getInstance() != null) {
		IWorkbench wb = PlatformUI.getWorkbench();
		IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
		// Could be null if using Timeout test rule and does not run on main thread.
		if (null != window) {
			page = window.getActivePage();
		}
	}
	return page;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:AbstractBuilderTest.java

示例7: getActiveWorkbenchWindow

import org.eclipse.ui.IWorkbench; //导入方法依赖的package包/类
/**
 * Returns the active workbench window.
 * @return the active workbench window
 */
public IWorkbenchWindow getActiveWorkbenchWindow() {
	IWorkbench iwb = this.getWorkbench();
	if (iwb!=null) {
		return iwb.getActiveWorkbenchWindow();
	}
	return null;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:12,代码来源:UiBridge.java

示例8: getActiveWorkbenchShell

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

示例9: getActiveWorkbenchWindow

import org.eclipse.ui.IWorkbench; //导入方法依赖的package包/类
public static IWorkbenchWindow getActiveWorkbenchWindow() {
	IWorkbench workbench = getWorkbench();
	if (workbench == null) {
		return null;
	}
	IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();

	if (workbenchWindow != null) {
		return workbenchWindow;
	}
	/* fall back - try to execute in UI */
	WorkbenchWindowRunnable wwr = new WorkbenchWindowRunnable();
	getSafeDisplay().syncExec(wwr);
	return wwr.workbenchWindowFromUI;
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:16,代码来源:EclipseUtil.java

示例10: run

import org.eclipse.ui.IWorkbench; //导入方法依赖的package包/类
@Override
public void run() {
	IWorkbench workbench = getWorkbench();
	if (workbench == null) {
		return;
	}
	workbenchWindowFromUI = workbench.getActiveWorkbenchWindow();
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:9,代码来源:EclipseUtil.java

示例11: addListeners

import org.eclipse.ui.IWorkbench; //导入方法依赖的package包/类
public void addListeners() {
	try {
		IWorkbench workbench = PlatformUI.getWorkbench();
		
		// Add a WorkbenchListener
		workbenchListener = new ConvertigoWorkbenchListener();
		workbench.addWorkbenchListener(workbenchListener);
		
		// Add a WindowListener
		windowListener = new ConvertigoWindowListener();
		workbench.addWindowListener(windowListener);
		
		IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); 
		if (activeWorkbenchWindow != null) {
			// Add a PerspectiveListener
			if (perspectiveListener == null) {
				perspectiveListener = new ConvertigoPerspectiveListener();
				activeWorkbenchWindow.addPerspectiveListener(perspectiveListener);
			}
			// Add a PartListener
			if (partListener == null) {
				partListener = new ConvertigoPartListener();
				IPartService partService = activeWorkbenchWindow.getPartService(); 
				partService.addPartListener(partListener);
			}
		} 
		
	}
	catch (IllegalStateException e) {
		studioLog.error("Could not add listeners to plugin."+ e.getMessage());
	}
	
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:34,代码来源:ConvertigoPlugin.java

示例12: clean

import org.eclipse.ui.IWorkbench; //导入方法依赖的package包/类
/**
 * Clean plug-in
 * 
 * @param context
 * @throws Exception
 */
private void clean(BundleContext context) throws Exception {
	if (consolePipes != null)
		consolePipes.stopConsoleThreads();
	
	stderrConsoleStreamColor.dispose();
	
	disposeImages();
	
	cacheIProject.clear();
	
	// Removes listeners
	try {
		IWorkbench workbench = PlatformUI.getWorkbench();
		if (windowListener != null)
			workbench.removeWindowListener(windowListener);
		if (workbenchListener != null)
			workbench.removeWorkbenchListener(workbenchListener);
		
		IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); 
		if (activeWorkbenchWindow != null) {
			if (perspectiveListener != null)
				activeWorkbenchWindow.removePerspectiveListener(perspectiveListener);
			if (partListener != null)
				activeWorkbenchWindow.getPartService().removePartListener(partListener);
		}			
	}
	catch (IllegalStateException e) {}
	
	if (embeddedTomcat != null)
		embeddedTomcat.stop();
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:38,代码来源:ConvertigoPlugin.java

示例13: getActivePage

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

import org.eclipse.ui.IWorkbench; //导入方法依赖的package包/类
/**
 * @return IWorkbenchPage
 */
public static IWorkbenchPage getActivePage() {
	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,代码行数:11,代码来源:Util.java

示例15: resetWorkbench

import org.eclipse.ui.IWorkbench; //导入方法依赖的package包/类
private void resetWorkbench() {
	try {
		IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
		for (IViewReference iViewReference : views) {
			 if ( iViewReference.getTitle().equals( "Welcome" ) ) {
				 	iViewReference.getPage().hideView(iViewReference);
					break;
			}
		}
		
		IWorkbench workbench = PlatformUI.getWorkbench();
		IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
		IWorkbenchPage page = workbenchWindow.getActivePage();
		Shell activeShell = Display.getCurrent().getActiveShell();
		if ( activeShell != null && activeShell != workbenchWindow.getShell() ) {
			activeShell.close();
		}
		page.closeAllEditors( false );
		page.resetPerspective();
		String defaultPerspectiveId = workbench.getPerspectiveRegistry().getDefaultPerspective();
		workbench.showPerspective( defaultPerspectiveId, workbenchWindow );
		page.resetPerspective();
	}
	catch ( WorkbenchException e ) {
		throw new RuntimeException( e );
	}

}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:29,代码来源:FilterTests.java


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