Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ltk.core.refactoring.participants
Class ProcessorBasedRefactoring


java.lang.Object
  extended by 

org.eclipse.core.runtime.PlatformObject
      extended by 

org.eclipse.ltk.core.refactoring.Refactoring
          extended by 
org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring
All Implemented Interfaces:
IAdaptable
Direct Known Subclasses:
CopyRefactoring, DeleteRefactoring, MoveRefactoring, RenameRefactoring

public class ProcessorBasedRefactoring
extends Refactoring

An base implementation for refactorings that are split into one refactoring processor and 0..n participants.

This class can be subclassed by clients wishing to provide a special refactoring which uses a processor/participant architecture.

Since 3.4, this class is non abstract and can be instantiated. getProcessor() will return the processor passed in ProcessorBasedRefactoring(RefactoringProcessor) or the processor set by setProcessor(RefactoringProcessor).

Since:
3.0

Constructor Summary
protected ProcessorBasedRefactoring ()
          Deprecated. use ProcessorBasedRefactoring(RefactoringProcessor) instead
  ProcessorBasedRefactoring ( RefactoringProcessor processor)
          Creates a new processor based refactoring.
 
Method Summary
  RefactoringStatus checkFinalConditions ( IProgressMonitor pm)
          After checkInitialConditions has been performed and the user has provided all input necessary to perform the refactoring this method is called to check the remaining preconditions.
  RefactoringStatus checkInitialConditions ( IProgressMonitor pm)
          Checks some initial conditions based on the element to be refactored.
  Change createChange ( IProgressMonitor pm)
          Creates a Change object that performs the actual workspace transformation.
  Object getAdapter ( Class clazz)
          Adapts the refactoring to the given type.
  String getName ()
          Returns the refactoring's name.
  RefactoringProcessor getProcessor ()
          Return the processor associated with this refactoring.
  TextChange getTextChange ( Object element)
          Returns the text change for the given element or null if a text change doesn't exist.
 boolean isApplicable ()
          Checks whether the refactoring is applicable to the elements to be refactored or not.
 void setProcessor ( RefactoringProcessor processor)
          Sets the processor associated with this refactoring.
  String toString ()
           
 
Methods inherited from class org.eclipse.ltk.core.refactoring. Refactoring
checkAllConditions, doGetRefactoringTickProvider, getRefactoringTickProvider, getValidationContext, setValidationContext
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessorBasedRefactoring

protected ProcessorBasedRefactoring()
Deprecated. use ProcessorBasedRefactoring(RefactoringProcessor) instead

Creates a new processor based refactoring. Clients must override getProcessor() to return a processor or set the processor with setProcessor(RefactoringProcessor).


ProcessorBasedRefactoring

public ProcessorBasedRefactoring(
RefactoringProcessor processor)
Creates a new processor based refactoring.

Parameters:
processor - the refactoring's main processor
Since:
3.4 public, was added in 3.1 as protected method
Method Detail

getProcessor

public 
RefactoringProcessor getProcessor()
Return the processor associated with this refactoring. The method must not return null. Implementors can override this method to return the processor to be used by this refactoring. Since 3.4, this method returns the processor passed in ProcessorBasedRefactoring(RefactoringProcessor) or by setProcessor(RefactoringProcessor).

Returns:
the processor associated with this refactoring

setProcessor

public void setProcessor(
RefactoringProcessor processor)
Sets the processor associated with this refactoring. The processor must not be null.

Parameters:
processor - the processor associated with this refactoring
Since:
3.4

isApplicable

public final boolean isApplicable()
                           throws 
CoreException
Checks whether the refactoring is applicable to the elements to be refactored or not.

This default implementation forwards the call to the refactoring processor.

Returns:
true if the refactoring is applicable to the elements; otherwise false is returned.
Throws:
CoreException - if the test fails

getName

public 
String getName()
Returns the refactoring's name.

Specified by:
getName in class Refactoring
Returns:
the refactoring's human readable name. Must not be null

checkInitialConditions

public 
RefactoringStatus checkInitialConditions(
IProgressMonitor pm)
                                         throws 
CoreException
Checks some initial conditions based on the element to be refactored. The method is typically called by the UI to perform an initial checks after an action has been executed.

The refactoring has to be considered as not being executable if the returned status has the severity of RefactoringStatus#FATAL.

This method can be called more than once.

Specified by:
checkInitialConditions in class Refactoring
Parameters:
pm - a progress monitor to report progress. Although initial checks are supposed to execute fast, there can be certain situations where progress reporting is necessary. For example rebuilding a corrupted index may report progress.
Returns:
a refactoring status. If the status is RefactoringStatus#FATAL the refactoring has to be considered as not being executable.
Throws:
CoreException - if an exception occurred during initial condition checking. If this happens then the initial condition checking has to be interpreted as failed
See Also:
Refactoring.checkFinalConditions(IProgressMonitor), RefactoringStatus.FATAL

checkFinalConditions

public 
RefactoringStatus checkFinalConditions(
IProgressMonitor pm)
                                       throws 
CoreException
After checkInitialConditions has been performed and the user has provided all input necessary to perform the refactoring this method is called to check the remaining preconditions.

The refactoring has to be considered as not being executable if the returned status has the severity of RefactoringStatus#FATAL.

This method can be called more than once.

Specified by:
checkFinalConditions in class Refactoring
Parameters:
pm - a progress monitor to report progress
Returns:
a refactoring status. If the status is RefactoringStatus#FATAL the refactoring is considered as not being executable.
Throws:
CoreException - if an exception occurred during final condition checking If this happens then the final condition checking is interpreted as failed
See Also:
Refactoring.checkInitialConditions(IProgressMonitor), RefactoringStatus.FATAL

createChange

public 
Change createChange(
IProgressMonitor pm)
                    throws 
CoreException
Creates a Change object that performs the actual workspace transformation.

Specified by:
createChange in class Refactoring
Parameters:
pm - a progress monitor to report progress
Returns:
the change representing the workspace modifications of the refactoring
Throws:
CoreException - if an error occurred while creating the change

getTextChange

public 
TextChange getTextChange(
Object element)
Returns the text change for the given element or null if a text change doesn't exist. This method only returns a valid result during change creation. Outside of change creation always null is returned.

Parameters:
element - the element to be modified for which a text change is requested
Returns:
the text change or null if no text change exists for the element
Since:
3.1

getAdapter

public 
Object getAdapter(
Class clazz)
Adapts the refactoring to the given type. The adapter is resolved as follows:
  1. the refactoring itself is checked whether it is an instance of the requested type.
  2. its processor is checked whether it is an instance of the requested type.
  3. the request is delegated to the super class.

Specified by:
getAdapter in interface IAdaptable
Overrides:
getAdapter in class Refactoring
Parameters:
clazz - the adapter class to look up
Returns:
the requested adapter or nullif no adapter exists.
See Also:
IAdaptable.getAdapter(Class)

toString

public 
String toString()
Overrides:
toString in class Refactoring

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire