public class ApplyPatchOperation extends Object implements Runnable
IStorage
(note: input must be in unified diff
format), an IResource
target to apply the patch to and can provide CompareConfiguration
elements to supply the label and images used on the preview page and hunk merge page. Finally, the
user can also supply a title and image to override the default ones provided by the Apply Patch Wizard.
Note that the Apply Patch Wizard does not require any particular set of inputs, and in the absence of
any user supplied values, it will work in default mode.Constructor and Description |
---|
ApplyPatchOperation(IWorkbenchPart targetPart,
IResource resource)
Create an operation for the given part and resource.
|
ApplyPatchOperation(IWorkbenchPart part,
IStorage patch,
IResource target,
CompareConfiguration configuration)
Creates a new ApplyPatchOperation with the supplied compare configuration, patch and target.
|
Modifier and Type | Method and Description |
---|---|
protected Shell |
getShell()
Return the parent shell to be used when the wizard is opened.
|
static boolean |
isPatch(IStorage storage)
Return whether the given storage contains a patch.
|
void |
openWizard()
Open the Apply Patch wizard using the values associated with this operation.
|
static IFilePatch[] |
parsePatch(IStorage storage)
Parse the given patch and return the set of file patches that it contains.
|
void |
run() |
protected void |
saveAllEditors()
This method will save all dirty editors.
|
void |
setPatchWizardImageDescriptor(ImageDescriptor descriptor)
Sets the image descriptor to use in the patch wizard.
|
void |
setPatchWizardTitle(String title)
Sets the title of the patch wizard.
|
public ApplyPatchOperation(IWorkbenchPart part, IStorage patch, IResource target, CompareConfiguration configuration)
part
- an IWorkbenchPart or null
patch
- an IStorage containing a patch in unified diff format or null
target
- an IResource which the patch is to be applied to or null
configuration
- a CompareConfiguration supplying the labels and images for the preview patch pagepublic ApplyPatchOperation(IWorkbenchPart targetPart, IResource resource)
ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration)
with appropriate defaults for the other parameters.targetPart
- an IResource which the patch is to be applied to or null
resource
- an IResource which the patch is to be applied to or null
ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration)
public static boolean isPatch(IStorage storage) throws CoreException
storage
- the storageCoreException
- if an error occurs reading the contents from the storagepublic static IFilePatch[] parsePatch(IStorage storage) throws CoreException
storage
- the storage that contains the patchCoreException
- if an error occurs reading the contents from the storagepublic void openWizard()
protected Shell getShell()
protected void saveAllEditors()
false
. Clients can use this or provide their own
implementation.public void setPatchWizardTitle(String title)
openWizard()
is called.title
- a string to display in the title barpublic void setPatchWizardImageDescriptor(ImageDescriptor descriptor)
openWizard()
is called.descriptor
- an image descriptor
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.