public interface IEditorRegistry
An editor can be created in one of two ways:
The registry does not keep track of editors that are "implicitly" determined.
For example a bitmap (.bmp
) file will typically not have a
registered editor. Instead, when no registered editor is found, the
underlying OS is consulted.
This interface is not intended to be implemented by clients.
IWorkbench.getEditorRegistry()
Modifier and Type | Field and Description |
---|---|
static int |
PROP_CONTENTS
The property identifier for the contents of this registry.
|
static String |
SYSTEM_EXTERNAL_EDITOR_ID
The identifier for the system external editor descriptor.
|
static String |
SYSTEM_INPLACE_EDITOR_ID
The identifier for the system in-place editor descriptor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyListener(IPropertyListener listener)
Adds a listener for changes to properties of this registry.
|
IEditorDescriptor |
findEditor(String editorId)
Finds and returns the descriptor of the editor with the given editor id.
|
IEditorDescriptor |
getDefaultEditor()
Deprecated.
The system external editor is the default editor.
Use
findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)
instead. |
IEditorDescriptor |
getDefaultEditor(String fileName)
Returns the default editor for a given file name.
|
IEditorDescriptor |
getDefaultEditor(String fileName,
IContentType contentType)
Returns the default editor for a given file name and with the given content type.
|
IEditorDescriptor[] |
getEditors(String fileName)
Returns the list of file editors registered to work against the file with
the given file name.
|
IEditorDescriptor[] |
getEditors(String fileName,
IContentType contentType)
Returns the list of file editors registered to work against the file with
the given file name and with the given content type.
|
IFileEditorMapping[] |
getFileEditorMappings()
Returns a list of mappings from file type to editor.
|
ImageDescriptor |
getImageDescriptor(String filename)
Returns the image descriptor associated with a given file.
|
ImageDescriptor |
getImageDescriptor(String filename,
IContentType contentType)
Returns the image descriptor associated with a given file.
|
ImageDescriptor |
getSystemExternalEditorImageDescriptor(String filename)
Returns the image descriptor associated with the system editor that
would be used to edit this file externally.
|
boolean |
isSystemExternalEditorAvailable(String filename)
Returns whether the system has an editor that could handle a file
with the given name.
|
boolean |
isSystemInPlaceEditorAvailable(String filename)
Returns whether there is an in-place editor that could handle a file
with the given name.
|
void |
removePropertyListener(IPropertyListener listener)
Removes the given property listener from this registry.
|
void |
setDefaultEditor(String fileNameOrExtension,
String editorId)
Sets the default editor id for the files that match that
specified file name or extension.
|
static final int PROP_CONTENTS
static final String SYSTEM_EXTERNAL_EDITOR_ID
IPathEditorInput
.
Use findEditor
to access the editor descriptor for
this identifier.static final String SYSTEM_INPLACE_EDITOR_ID
IInPlaceEditorInput
. Use
findEditor
to access the editor descriptor for this
identifier.void addPropertyListener(IPropertyListener listener)
The properties ids are as follows:
PROP_CONTENTS
: Triggered when the file editor mappings in
the editor registry change.listener
- a property listenerIEditorDescriptor findEditor(String editorId)
editorId
- the editor idnull
if not
found@Deprecated IEditorDescriptor getDefaultEditor()
findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)
instead.IEditorDescriptor getDefaultEditor(String fileName)
The default editor is determined by taking the file extension for the file and obtaining the default editor for that extension.
fileName
- the file name in the systemnull
if
not foundIEditorDescriptor getDefaultEditor(String fileName, IContentType contentType)
The default editor is determined by taking the file extension for the file and obtaining the default editor for that extension.
fileName
- the file name in the systemcontentType
- the content type or null
for the unknown content typenull
if not
foundIEditorDescriptor[] getEditors(String fileName)
Note: Use getDefaultEditor(String)
if you only the need
the default editor rather than all candidate editors.
fileName
- the file name in the systemIEditorDescriptor[] getEditors(String fileName, IContentType contentType)
Note: Use getDefaultEditor(String)
if you only the need
the default editor rather than all candidate editors.
fileName
- the file name in the systemcontentType
- the content type or null
for the unknown
content typeIFileEditorMapping[] getFileEditorMappings()
Each mapping defines an extension and the set of editors that are available for that type. The set of editors includes those registered via plug-ins and those explicitly associated with a type by the user in the workbench preference pages.
ImageDescriptor getImageDescriptor(String filename)
The image is determined by taking the file extension of the file and obtaining the image for the default editor associated with that extension. A default image is returned if no default editor is available.
filename
- the file name in the systemImageDescriptor getImageDescriptor(String filename, IContentType contentType)
The image is determined by taking the file extension of the file and obtaining the image for the default editor associated with that extension. A default image is returned if no default editor is available.
filename
- the file name in the systemcontentType
- the content type of the file or null
for the
unknown content typevoid removePropertyListener(IPropertyListener listener)
listener
- a property listenervoid setDefaultEditor(String fileNameOrExtension, String editorId)
fileNameOrExtension
- the file name or extension pattern (e.g. "*.xml");editorId
- the editor id or null
for no defaultboolean isSystemInPlaceEditorAvailable(String filename)
filename
- the file nametrue
if an in-place editor is available, and
false
otherwiseboolean isSystemExternalEditorAvailable(String filename)
filename
- the file nametrue
if an external editor available, and
false
otherwiseImageDescriptor getSystemExternalEditorImageDescriptor(String filename)
filename
- the file namenull
if none
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.