Package org.eclipse.compare
Class CompareUI
java.lang.Object
org.eclipse.compare.CompareUI
The class
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.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name of the title property of a compare viewer.static final ImageDescriptor
Image descriptor for the normal icon of the 'Next' tool bar button.static final ImageDescriptor
Image descriptor for the normal icon of the 'Previous' tool bar button.static final ImageDescriptor
Image descriptor for the disabled icon of the 'Next' tool bar button.static final ImageDescriptor
Image descriptor for the disabled icon of the 'Previous' tool bar button.static final ImageDescriptor
Image descriptor for the roll-over icon of the 'Next' tool bar button.static final ImageDescriptor
Image descriptor for the roll-over icon of the 'Previous' tool bar button.static final String
Compare Plug-in ID (value"org.eclipse.compare"
).static final String
The id of the Compare Preference Page (value"org.eclipse.compare.internal.ComparePreferencePage"
). -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addStructureViewerAlias
(String type, String alias) Adds an alias for the given type.static IStreamMerger
createStreamMerger
(String type) Deprecated.static IStreamMerger
Deprecated.Clients should obtain anorg.eclipse.team.core.mapping.IStorageMerger
from theorg.eclipse.team.core.Team#createMerger(IContentType)
method.static IStructureCreator
createStructureCreator
(ITypedElement element) Create and return a structure creator for the given typed element.static void
disposeOnShutdown
(Image image) Registers the given image for being disposed when this plug-in is shutdown.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
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
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 returnnull
if no document has been registered for the input.static Image
Returns a shared image for the given type, or a generic image if none has been registered for the given type.static Image
getImage
(IAdaptable adaptable) Returns a shared image for the given adaptable.static AbstractUIPlugin
static ResourceBundle
Returns this plug-in's resource bundle.static void
Performs the comparison described by the given input and opens a modal compare dialog on the result.static void
Performs the comparison described by the given input and opens a compare editor on the result in the currently active workbench page.static void
openCompareEditor
(CompareEditorInput input, boolean activate) 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
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.
-
Field Details
-
PLUGIN_ID
Compare Plug-in ID (value"org.eclipse.compare"
).- Since:
- 2.0
- See Also:
-
PREFERENCE_PAGE_ID
The id of the Compare Preference Page (value"org.eclipse.compare.internal.ComparePreferencePage"
).- Since:
- 3.1
- See Also:
-
DESC_DTOOL_NEXT
Image descriptor for the disabled icon of the 'Next' tool bar button.- Since:
- 2.0
-
DESC_CTOOL_NEXT
Image descriptor for the normal icon of the 'Next' tool bar button.- Since:
- 2.0
-
DESC_ETOOL_NEXT
Image descriptor for the roll-over icon of the 'Next' tool bar button.- Since:
- 2.0
-
DESC_DTOOL_PREV
Image descriptor for the disabled icon of the 'Previous' tool bar button.- Since:
- 2.0
-
DESC_CTOOL_PREV
Image descriptor for the normal icon of the 'Previous' tool bar button.- Since:
- 2.0
-
DESC_ETOOL_PREV
Image descriptor for the roll-over icon of the 'Previous' tool bar button.- Since:
- 2.0
-
COMPARE_VIEWER_TITLE
Name of the title property of a compare viewer. If a property with this name is set on the top level SWT control of a viewer, it is used as a title in the pane's title bar.- See Also:
-
-
Method Details
-
getPlugin
-
getResourceBundle
Returns this plug-in's resource bundle.- Returns:
- the plugin's resource bundle
-
openCompareEditor
Performs the comparison described by the given input and opens a compare editor on the result in the currently active workbench page.- Parameters:
input
- the input on which to open the compare editor
-
openCompareEditor
Performs the comparison described by the given input and opens a compare editor on the result in the currently active workbench page.- Parameters:
input
- the input on which to open the compare editoractivate
- iftrue
the editor will be activated- Since:
- 3.5
- See Also:
-
openCompareEditorOnPage
Performs the comparison described by the given input and opens a compare editor on the result in the given workbench page.- Parameters:
input
- the input on which to open the compare editorpage
- the workbench page in which to open the compare editor- Since:
- 2.1
-
reuseCompareEditor
Performs the comparison described by the given input and shows the result in the given editor.- Parameters:
input
- the input on which to open the compare editoreditor
- the compare editor to reuse or null to create a new one- Since:
- 3.0
-
openCompareDialog
Performs the comparison described by the given input and opens a modal compare dialog on the result.- Parameters:
input
- the input on which to open the compare dialog
-
registerImageDescriptor
Registers an image descriptor for the given type.- Parameters:
type
- the typedescriptor
- the image descriptor
-
getImage
Returns a shared image for the given type, or a generic image if none has been registered for the given 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.
- Parameters:
type
- the type- Returns:
- the image
-
disposeOnShutdown
Registers the given image for being disposed when this plug-in is shutdown.- Parameters:
image
- the image to register for disposal
-
getImage
Returns a shared image for the given adaptable. This convenience method queries the given adaptable for itsIWorkbenchAdapter.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.
- Parameters:
adaptable
- the adaptable for which to find an image- Returns:
- an image
-
createStreamMerger
Deprecated.Clients should obtain anorg.eclipse.team.core.mapping.IStorageMerger
from theorg.eclipse.team.core.Team#createMerger(IContentType)
method.Creates a stream merger for the given content type. If no stream merger is registered for the given content typenull
is returned.- Parameters:
type
- the type for which to find a stream merger- Returns:
- a stream merger for the given type, or
null
if no stream merger has been registered
-
createStreamMerger
Deprecated.Clients should obtain anorg.eclipse.team.core.mapping.IStorageMerger
from theorg.eclipse.team.core.Team#createMerger(String)
method.Creates a stream merger for the given file extension. If no stream merger is registered for the file extensionnull
is returned.- Parameters:
type
- the type for which to find a stream merger- Returns:
- a stream merger for the given type, or
null
if no stream merger has been registered
-
findStructureViewer
public 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. If the old viewer is suitable for showing the input, the old viewer is returned. Otherwise, the input's type is used to find a viewer descriptor in the registry which in turn is used to create a structure compare viewer under the given parent composite. If no viewer descriptor can be foundnull
is returned.- Parameters:
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 viewer- Returns:
- the compare viewer which is suitable for the given input object or
null
-
findContentViewer
public 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. If the old viewer is suitable for showing the input the old viewer is returned. Otherwise the input's type is used to find a viewer descriptor in the registry which in turn is used to create a content compare viewer under the given parent composite. If no viewer descriptor can be foundnull
is returned.- Parameters:
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 viewer- Returns:
- the compare viewer which is suitable for the given input object or
null
-
findContentViewer
public 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. If the old viewer is suitable for showing the input the old viewer is returned. Otherwise the input's type is used to find a viewer descriptor in the registry which in turn is used to create a content compare viewer under the given parent composite. In order to determine the input's type, the input must either implement IStreamContentAccessor and ITypedElement or ICompareInput. If no viewer descriptor can be foundnull
is returned.- Parameters:
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 eitherIStreamContentAccessor
andITypedElement
orICompareInput
.parent
- the SWT parent composite under which the new viewer is createdconfiguration
- a configuration which is passed to a newly created viewer- Returns:
- the compare viewer which is suitable for the given input object or
null
-
addStructureViewerAlias
Adds an alias for the given type. Subsequent calls tofindStructureViewer
treat alias as a synonym for type and return the same viewer.- Parameters:
type
- a type name for which a viewer has been registeredalias
- a type name which should be treated as a synonym of type- Since:
- 2.0
- Restriction:
- This method is for internal use only. Clients should not call this method.
-
removeAllStructureViewerAliases
Remove all aliases for the given type. This method does not affect the initial binding between type and viewer. If no aliases exist for the given type this method does nothing.- Parameters:
type
- the type name for which all synonyms are removed.- Since:
- 2.0
- Restriction:
- This method is for internal use only. Clients should not call this method.
-
getDocument
Retrieve a document for the given input or returnnull
if no document has been registered for the input.- Parameters:
input
- the object for which to retrieve a document- Returns:
- a document or
null
if no document was registered for the input - Since:
- 3.1
-
registerDocument
Register a document for the given input.- Parameters:
input
- the object for which to register a documentdocument
- the document to register- Since:
- 3.1
-
unregisterDocument
Unregister the given document.- Parameters:
document
- the document to unregister- Since:
- 3.1
-
createStructureCreator
Create and return a structure creator for the given typed element. Returnnull
if an appropriate structure creator could not be obtained.- Parameters:
element
- the typed element- Returns:
- structure creator for the given typed element or
null
- Since:
- 3.4
-
org.eclipse.team.core.mapping.IStorageMerger
from theorg.eclipse.team.core.Team#createMerger(String)
method.