Eclipse Platform
Release 3.1

org.eclipse.ui.editors.text
Class FileBufferOperationHandler

java.lang.Object
  extended byorg.eclipse.core.commands.AbstractHandler
      extended byorg.eclipse.ui.editors.text.FileBufferOperationHandler
All Implemented Interfaces:
IHandler

public class FileBufferOperationHandler
extends AbstractHandler

Operation handler for a file buffer.

This class may be instantiated or be subclassed.

Since:
3.1

Constructor Summary
FileBufferOperationHandler(IFileBufferOperation fileBufferOperation)
          Creates a new file buffer operation handler.
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.