Package org.eclipse.ui.editors.text
Class FileBufferOperationHandler
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.core.commands.AbstractHandler
-
- org.eclipse.ui.editors.text.FileBufferOperationHandler
-
public class FileBufferOperationHandler extends AbstractHandler
Operation handler for a file buffer.This class may be instantiated or be subclassed.
- Since:
- 3.1
-
-
Constructor Summary
Constructors Constructor Description FileBufferOperationHandler(IFileBufferOperation fileBufferOperation)
Creates a new file buffer operation handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IFile[]
collectFiles(IResource[] resources)
Collects the files out of the given resources.protected void
computeSelectedResources()
Computes the selected resources.protected void
doRun(IFile[] files, IPath location, IFileBufferOperation fileBufferOperation)
Runs the given operation.Object
execute(ExecutionEvent event)
Executes with the map of parameter values by name.protected IPath[]
generateLocations(IFile[] files, IProgressMonitor progressMonitor)
Generates the file buffer locations out of the given files.protected ISelection
getSelection()
Returns the selection of the active workbench window.protected Shell
getShell()
Returns the shell of the active workbench window.protected IWorkbenchWindow
getWorkbenchWindow()
Returns the active workbench window.void
initialize(IResource[] resources, IPath location)
Initializes this file buffer operation handler with the given resources and the given location.protected boolean
isAcceptableLocation(IPath location)
Tells whether the given location is accepted by this handler.-
Methods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, dispose, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled, setEnabled
-
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
-
-
-
Constructor Detail
-
FileBufferOperationHandler
public FileBufferOperationHandler(IFileBufferOperation fileBufferOperation)
Creates a new file buffer operation handler.- Parameters:
fileBufferOperation
- the file buffer operation
-
-
Method Detail
-
initialize
public void initialize(IResource[] resources, IPath location)
Initializes this file buffer operation handler with the given resources and the given location. The array of resources is adopted by this handler and may not be modified by clients after that method has been called.- Parameters:
resources
- the resources to be adoptedlocation
- the location
-
computeSelectedResources
protected final void computeSelectedResources()
Computes the selected resources.
-
getSelection
protected final ISelection getSelection()
Returns the selection of the active workbench window.- Returns:
- the current selection in the active workbench window or
null
-
getWorkbenchWindow
protected final IWorkbenchWindow getWorkbenchWindow()
Returns the active workbench window.- Returns:
- the active workbench window or
null
if not available
-
collectFiles
protected IFile[] collectFiles(IResource[] resources)
Collects the files out of the given resources.- Parameters:
resources
- the resources from which to get the files- Returns:
- an array of files
-
doRun
protected final void doRun(IFile[] files, IPath location, IFileBufferOperation fileBufferOperation)
Runs the given operation.- Parameters:
files
- the file on which to run this operationlocation
- the file buffer locationfileBufferOperation
- the operation to run
-
getShell
protected final Shell getShell()
Returns the shell of the active workbench window.- Returns:
- the shell
-
generateLocations
protected final IPath[] generateLocations(IFile[] files, IProgressMonitor progressMonitor)
Generates the file buffer locations out of the given files.- Parameters:
files
- an array of filesprogressMonitor
- the progress monitor- Returns:
- an array with the generated locations
-
isAcceptableLocation
protected boolean isAcceptableLocation(IPath location)
Tells whether the given location is accepted by this handler.- Parameters:
location
- a file buffer location- Returns:
true
if the given location is acceptable
-
execute
public Object execute(ExecutionEvent event) throws ExecutionException
Description copied from interface:IHandler
Executes with the map of parameter values by name.- Parameters:
event
- An event containing all the information about the current state of the application; must not benull
.- Returns:
- the result of the execution. Reserved for future use, must be
null
. - Throws:
ExecutionException
- if an exception occurred during execution.
-
-