org.eclipse.emf.edit.ui.util
Class EditUIUtil

java.lang.Object
  extended by org.eclipse.emf.edit.ui.util.EditUIUtil

public class EditUIUtil
extends java.lang.Object

Since:
2.2.0

Constructor Summary
EditUIUtil()
           
 
Method Summary
static IEditorDescriptor getDefaultEditor(java.io.InputStream contents, java.lang.String fileName)
          Returns the default editor for a given contents and file name.
static IEditorDescriptor getDefaultEditor(java.lang.String fileName)
          Returns the default editor for a given file name.
static IEditorDescriptor getDefaultEditor(URI uri, URIConverter uriConverter)
          Returns the default editor for a given URI.
static IEditorDescriptor[] getEditors(java.io.InputStream contents, java.lang.String fileName, boolean defaultsOnly)
          Returns the editors for a given contents and file name.
static IEditorDescriptor[] getEditors(java.lang.String fileName, boolean defaultsOnly)
          Returns the editors for a given file name.
static IEditorDescriptor[] getEditors(URI uri, URIConverter uriConverter, boolean defaultsOnly)
          Returns the editors for a given URI.
static URI getURI(IEditorInput editorInput)
           
static boolean openEditor(EObject eObject)
          Opens the default editor for the resource that contains the specified EObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditUIUtil

public EditUIUtil()
Method Detail

openEditor

public static boolean openEditor(EObject eObject)
                          throws PartInitException
Opens the default editor for the resource that contains the specified EObject. This method only works if the resource's URI is a platform resource URI.

Throws:
PartInitException

getURI

public static URI getURI(IEditorInput editorInput)

getDefaultEditor

public static IEditorDescriptor getDefaultEditor(java.lang.String fileName)
Returns the default editor for a given file name. This method is like IEditorRegistry.getDefaultEditor(String), but it will not return null unless all applicable content types have no associated editor.

Parameters:
fileName - the file name in the system
Returns:
the descriptor of the default editor, or null if not found
Since:
2.4

getDefaultEditor

public static IEditorDescriptor getDefaultEditor(java.io.InputStream contents,
                                                 java.lang.String fileName)
Returns the default editor for a given contents and file name.

If a file name is not provided, the entire content type registry will be queried. For performance reasons, it is highly recommended to provide a file name if available.

Parameters:
contents - an input stream
fileName - the file name associated to the contents, or null
Returns:
the descriptor of the default editor, or null if not found
Since:
2.4

getDefaultEditor

public static IEditorDescriptor getDefaultEditor(URI uri,
                                                 URIConverter uriConverter)
Returns the default editor for a given URI. This method actually attempts to open an input stream for the URI and uses its contents, along with the filename (the URI's last segment), to obtain appropriate content types.

If a URI converter is specified, it is used to open the stream. Otherwise, the global default instance is used.

Parameters:
uri - a URI
uriConverter - URI converter from which to obtain an input stream, or null
Returns:
the descriptor of the default editor, or null if not found
Since:
2.4

getEditors

public static IEditorDescriptor[] getEditors(java.lang.String fileName,
                                             boolean defaultsOnly)
Returns the editors for a given file name. This method is like IEditorRegistry.getEditors(String), but its result will include editors for all applicable content types.

Parameters:
fileName - the file name in the system
defaultsOnly - if true, only the default editor for each content type will be included in the result
Returns:
the descriptors of the editors
Since:
2.4

getEditors

public static IEditorDescriptor[] getEditors(java.io.InputStream contents,
                                             java.lang.String fileName,
                                             boolean defaultsOnly)
Returns the editors for a given contents and file name.

If a file name is not provided, the entire content type registry will be queried. For performance reasons, it is highly recommended to provide a file name if available.

Parameters:
contents - an input stream
fileName - the file name associated to the contents, or null
defaultsOnly - if true, only the default editor for each content type will be included in the result
Returns:
the descriptors of the editors
Since:
2.4

getEditors

public static IEditorDescriptor[] getEditors(URI uri,
                                             URIConverter uriConverter,
                                             boolean defaultsOnly)
Returns the editors for a given URI. This method actually attempts to open an input stream for the URI and uses its contents, along with the filename (the URI's last segment), to obtain appropriate content types.

If a URI converter is specified, it is used to open the stream. Otherwise, the global default instance is used.

Parameters:
uri - a URI
uriConverter - a URI converter from which to obtain an input stream, or null
defaultsOnly - if true, only the default editor for each content type will be included in the result
Returns:
the descriptors of the editors
Since:
2.4

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.