Java Code Examples for org.eclipse.ui.IWorkbench#getEditorRegistry()

The following examples show how to use org.eclipse.ui.IWorkbench#getEditorRegistry() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SVNConflictResolver.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: OpenJavaSourceAction.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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$
}
 
Example 3
Source File: OpenXMLResultsAction.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static String getEditorId(File file) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorRegistry editorRegistry = workbench.getEditorRegistry();
    IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(file.getName(), getContentType(file));
    if (descriptor != null) {
        return descriptor.getId();
    }
    return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}