org.eclipse.ui.IEditorRegistry#isSystemExternalEditorAvailable ( )源码实例Demo

下面列出了org.eclipse.ui.IEditorRegistry#isSystemExternalEditorAvailable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gef   文件: SyncGraphvizExportHandler.java
private void openFile(IFile file) {
	IEditorRegistry registry = PlatformUI.getWorkbench()
			.getEditorRegistry();
	if (registry.isSystemExternalEditorAvailable(file.getName())) {

		/**
		 * in case of opening the exported file from an other thread e.g. in
		 * case of listening to an IResourceChangeEvent
		 */
		Display.getDefault().asyncExec(new Runnable() {

			@Override
			public void run() {
				IWorkbenchPage page = PlatformUI.getWorkbench()
						.getActiveWorkbenchWindow().getActivePage();
				try {
					page.openEditor(new FileEditorInput(file),
							IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
				} catch (PartInitException e) {
					DotActivatorEx.logError(e);
				}
			}
		});
	}
}
 
源代码2 项目: APICloud-Studio   文件: SVNConflictResolver.java
private String getEditorId(IFileStore file) {
	IWorkbench workbench = PlatformUI.getWorkbench();
	IEditorRegistry editorRegistry= workbench.getEditorRegistry();
	IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

	// check the OS for in-place editor (OLE on Win32)
	if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
		descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
	
	// check the OS for external editor
	if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
		descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
	
	if (descriptor != null)
		return descriptor.getId();
	
	return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
 
源代码3 项目: birt   文件: OpenJavaSourceAction.java
private String getEditorId( IFileStore file )
{
	IWorkbench workbench = window.getWorkbench( );
	IEditorRegistry editorRegistry = workbench.getEditorRegistry( );
	IEditorDescriptor descriptor = editorRegistry.getDefaultEditor( file.getName( ),
			getContentType( file ) );

	// check the OS for in-place editor (OLE on Win32)
	if ( descriptor == null
			&& editorRegistry.isSystemInPlaceEditorAvailable( file.getName( ) ) )
	{
		descriptor = editorRegistry.findEditor( IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID );
	}

	// check the OS for external editor
	if ( descriptor == null
			&& editorRegistry.isSystemExternalEditorAvailable( file.getName( ) ) )
	{
		descriptor = editorRegistry.findEditor( IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID );
	}

	return ( descriptor == null ) ? "" : descriptor.getId( ); //$NON-NLS-1$
}