Class FileBufferOperationHandler

  • All Implemented Interfaces:
    IHandler, IHandler2

    public class FileBufferOperationHandler
    extends AbstractHandler
    Operation handler for a file buffer.

    This class may be instantiated or be subclassed.

    Since:
    3.1
    • 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 adopted
        location - 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 operation
        location - the file buffer location
        fileBufferOperation - 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 files
        progressMonitor - 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 be null.
        Returns:
        the result of the execution. Reserved for future use, must be null.
        Throws:
        ExecutionException - if an exception occurred during execution.