public final class CompareUI extends Object
CompareUI defines the entry point to initiate a configurable
compare operation on arbitrary resources. The result of the compare
is opened into a compare editor where the details can be browsed and
edited in dynamically selected structure and content viewers.
The Compare UI provides a registry for content and structure compare viewers, which is initialized from extensions contributed to extension points declared by this plug-in.
| Modifier and Type | Field and Description |
|---|---|
static String |
COMPARE_VIEWER_TITLE
Name of the title property of a compare viewer.
|
static ImageDescriptor |
DESC_CTOOL_NEXT
Image descriptor for the normal icon of the 'Next' tool bar button.
|
static ImageDescriptor |
DESC_CTOOL_PREV
Image descriptor for the normal icon of the 'Previous' tool bar button.
|
static ImageDescriptor |
DESC_DTOOL_NEXT
Image descriptor for the disabled icon of the 'Next' tool bar button.
|
static ImageDescriptor |
DESC_DTOOL_PREV
Image descriptor for the disabled icon of the 'Previous' tool bar button.
|
static ImageDescriptor |
DESC_ETOOL_NEXT
Image descriptor for the roll-over icon of the 'Next' tool bar button.
|
static ImageDescriptor |
DESC_ETOOL_PREV
Image descriptor for the roll-over icon of the 'Previous' tool bar button.
|
static String |
PLUGIN_ID
Compare Plug-in ID (value
"org.eclipse.compare"). |
static String |
PREFERENCE_PAGE_ID
The id of the Compare Preference Page
(value
"org.eclipse.compare.internal.ComparePreferencePage"). |
| Modifier and Type | Method and Description |
|---|---|
static void |
addStructureViewerAlias(String type,
String alias)
Adds an alias for the given type.
|
static IStreamMerger |
createStreamMerger(IContentType type)
Creates a stream merger for the given content type.
|
static IStreamMerger |
createStreamMerger(String type)
Creates a stream merger for the given file extension.
|
static void |
disposeOnShutdown(Image image)
Registers the given image for being disposed when this plug-in is shutdown.
|
static Viewer |
findContentViewer(Viewer oldViewer,
ICompareInput input,
Composite parent,
CompareConfiguration configuration)
Returns a content compare viewer based on an old viewer and an input object.
|
static Viewer |
findContentViewer(Viewer oldViewer,
Object input,
Composite parent,
CompareConfiguration configuration)
Returns a content compare viewer based on an old viewer and an input
object.
|
static Viewer |
findStructureViewer(Viewer oldViewer,
ICompareInput input,
Composite parent,
CompareConfiguration configuration)
Returns a structure compare viewer based on an old viewer and an input object.
|
static IDocument |
getDocument(Object input)
Retrieve a document for the given input or return
null if
no document has been registered for the input. |
static Image |
getImage(IAdaptable adaptable)
Returns a shared image for the given adaptable.
|
static Image |
getImage(String type)
Returns a shared image for the given type, or a generic image if none
has been registered for the given type.
|
static AbstractUIPlugin |
getPlugin() |
static ResourceBundle |
getResourceBundle()
Returns this plug-in's resource bundle.
|
static void |
openCompareDialog(CompareEditorInput input)
Performs the comparison described by the given input and opens a
modal compare dialog on the result.
|
static void |
openCompareEditor(CompareEditorInput input)
Performs the comparison described by the given input and opens a
compare editor on the result in the currently active workbench page.
|
static void |
openCompareEditorOnPage(CompareEditorInput input,
IWorkbenchPage page)
Performs the comparison described by the given input and opens a
compare editor on the result in the given workbench page.
|
static void |
registerDocument(Object input,
IDocument document)
Register a document for the given input.
|
static void |
registerImageDescriptor(String type,
ImageDescriptor descriptor)
Registers an image descriptor for the given type.
|
static void |
removeAllStructureViewerAliases(String type)
Remove all aliases for the given type.
|
static void |
reuseCompareEditor(CompareEditorInput input,
IReusableEditor editor)
Performs the comparison described by the given input and
shows the result in the given editor.
|
static void |
unregisterDocument(IDocument document)
Unregister the given document.
|
public static final String PLUGIN_ID
"org.eclipse.compare").public static final String PREFERENCE_PAGE_ID
"org.eclipse.compare.internal.ComparePreferencePage").public static final ImageDescriptor DESC_DTOOL_NEXT
public static final ImageDescriptor DESC_CTOOL_NEXT
public static final ImageDescriptor DESC_ETOOL_NEXT
public static final ImageDescriptor DESC_DTOOL_PREV
public static final ImageDescriptor DESC_CTOOL_PREV
public static final ImageDescriptor DESC_ETOOL_PREV
public static final String COMPARE_VIEWER_TITLE
public static AbstractUIPlugin getPlugin()
public static ResourceBundle getResourceBundle()
public static void openCompareEditor(CompareEditorInput input)
input - the input on which to open the compare editorpublic static void openCompareEditorOnPage(CompareEditorInput input, IWorkbenchPage page)
input - the input on which to open the compare editorpage - the workbench page in which to open the compare editorpublic static void reuseCompareEditor(CompareEditorInput input, IReusableEditor editor)
input - the input on which to open the compare editoreditor - the compare editor to reuse or null to create a new onepublic static void openCompareDialog(CompareEditorInput input)
input - the input on which to open the compare dialogpublic static void registerImageDescriptor(String type, ImageDescriptor descriptor)
type - the typedescriptor - the image descriptorpublic static Image getImage(String type)
Note: Images returned from this method will be automatically disposed of when this plug-in shuts down. Callers must not dispose of these images themselves.
type - the typepublic static void disposeOnShutdown(Image image)
image - the image to register for disposalpublic static Image getImage(IAdaptable adaptable)
IWorkbenchAdapter.getImageDescriptor, which it
uses to create an image if it does not already have one.
Note: Images returned from this method will be automatically disposed of when this plug-in shuts down. Callers must not dispose of these images themselves.
adaptable - the adaptable for which to find an imagepublic static IStreamMerger createStreamMerger(IContentType type)
null is returned.type - the type for which to find a stream mergernull if no
stream merger has been registeredpublic static IStreamMerger createStreamMerger(String type)
null is returned.type - the type for which to find a stream mergernull if no
stream merger has been registeredpublic static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent, CompareConfiguration configuration)
null is returned.oldViewer - a new viewer is only created if this old viewer cannot show the given inputinput - the input object for which to find a structure viewerparent - the SWT parent composite under which the new viewer is createdconfiguration - a configuration which is passed to a newly created viewernullpublic static Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent, CompareConfiguration configuration)
null is returned.oldViewer - a new viewer is only created if this old viewer cannot show the given inputinput - the input object for which to find a content viewerparent - the SWT parent composite under which the new viewer is createdconfiguration - a configuration which is passed to a newly created viewernullpublic static Viewer findContentViewer(Viewer oldViewer, Object input, Composite parent, CompareConfiguration configuration)
null is returned.oldViewer - a new viewer is only created if this old viewer cannot show the given inputinput - the input object for which to find a content viewer. Must
implement either IStreamContentAccessor and
ITypedElement or ICompareInput.parent - the SWT parent composite under which the new viewer is createdconfiguration - a configuration which is passed to a newly created viewernullpublic static void addStructureViewerAlias(String type, String alias)
findStructureViewer
treat alias as a synonym for type and return the same viewer.
Note: this method is for internal use only. Clients should not call this method.
type - a type name for which a viewer has been registeredalias - a type name which should be treated as a synonym of typepublic static void removeAllStructureViewerAliases(String type)
Note: this method is for internal use only. Clients should not call this method.
type - the type name for which all synonyms are removed.public static IDocument getDocument(Object input)
null if
no document has been registered for the input.input - the object for which to retrieve a documentnull if no document was registered for the inputpublic static void registerDocument(Object input, IDocument document)
input - the object for which to register a documentdocument - the document to registerpublic static void unregisterDocument(IDocument document)
document - the document to unregisterGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.