}
// get editor for this file
IWorkbench workbench = workbenchWindow.getWorkbench();
IEditorRegistry editorRegistry = workbench.getEditorRegistry();
IEditorDescriptor descriptor = editorRegistry.getDefaultEditor( file.getName() );
if ( descriptor == null )
{
String msg = MessageFormat.format(
Messages.getString( "OpenFileAction.No_appropriate_editor_found_for_x" ), new Object[] //$NON-NLS-1$
{ file.getName() } );
MessageDialog.openWarning( workbenchWindow.getShell(), Messages
.getString( "OpenFileAction.Warning_message" ), msg ); //$NON-NLS-1$
return;
}
// create IEdiorInput
IPath location = new Path( file.getAbsolutePath() );
ImageDescriptor imageDescriptor = descriptor.getImageDescriptor();
IPathEditorInput input = new PathEditorInput( location, imageDescriptor );
// activate editor
IWorkbenchPage page = workbenchWindow.getActivePage();
String editorId = descriptor.getId();
try
{
page.openEditor( input, editorId );
}
catch ( PartInitException e )