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

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
Class TextEditBasedChange

java.lang.Object
  extended by 

org.eclipse.ltk.core.refactoring.Change
      extended by 
org.eclipse.ltk.core.refactoring.TextEditBasedChange
All Implemented Interfaces:
IAdaptable
Direct Known Subclasses:
MultiStateTextFileChange, TextChange

public abstract class TextEditBasedChange
extends Change

An abstract base implementation of a change which is based on text edits.

Since:
3.2

Constructor Summary
protected TextEditBasedChange ( String name)
          Creates a new abstract text edit change with the specified name.
 
Method Summary
 void addChangeGroup ( TextEditBasedChangeGroup group)
          Adds a text edit change group.
 void addTextEditGroup ( TextEditGroup group)
          Adds a text edit group.
  TextEditBasedChangeGroup[] getChangeGroups ()
          Returns the text edit change groups managed by this buffer change.
abstract   String getCurrentContent ( IProgressMonitor pm)
          Returns the current content of the document this text change is associated with.
abstract   String getCurrentContent ( IRegion region, boolean expandRegionToFullLine, int surroundingLines, IProgressMonitor pm)
          Returns the current content of the text edit change clipped to a specific region.
 boolean getKeepPreviewEdits ()
          Returns whether preview edits are remembered for further region tracking or not.
  String getName ()
          Returns the human readable name of this change.
abstract   String getPreviewContent ( IProgressMonitor pm)
          Returns the preview content as a string.
abstract   String getPreviewContent ( TextEditBasedChangeGroup[] changeGroups, IRegion region, boolean expandRegionToFullLine, int surroundingLines, IProgressMonitor pm)
          Returns a preview of the text edit change clipped to a specific region.
  String getTextType ()
          Returns the text edit change's text type.
 boolean hasOneGroupCategory ( List groupCategories)
          Returns true if the change has one of the given group categories.
 void setEnabled (boolean enabled)
          Sets whether this change is enabled or not.
 void setKeepPreviewEdits (boolean keep)
          Controls whether the text edit change should keep executed edits during preview generation.
 void setTextType ( String type)
          Sets the text type.
 
Methods inherited from class org.eclipse.ltk.core.refactoring. Change
dispose, getAdapter, getAffectedObjects, getDescriptor, getModifiedElement, getParent, initializeValidationData, isEnabled, isValid, perform, setEnabledShallow
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextEditBasedChange

protected TextEditBasedChange(
String name)
Creates a new abstract text edit change with the specified name. The name is a human-readable value that is displayed to users. The name does not need to be unique, but it must not be null.

The text type of this text edit change is set to txt.

Parameters:
name - the name of the text edit change
See Also:
setTextType(String)
Method Detail

addChangeGroup

public void addChangeGroup(
TextEditBasedChangeGroup group)
Adds a text edit change group. The edits managed by the given text edit change group must be part of the change's root edit.

Parameters:
group - the text edit change group to add

addTextEditGroup

public void addTextEditGroup(
TextEditGroup group)
Adds a text edit group. This method is a convenience method for calling change.addChangeGroup(new TextEditBasedChangeGroup(change, group));.

Parameters:
group - the text edit group to add

hasOneGroupCategory

public boolean hasOneGroupCategory(
List groupCategories)
Returns true if the change has one of the given group categories. Otherwise false is returned.

Parameters:
groupCategories - the group categories to check
Returns:
whether the change has one of the given group categories
Since:
3.2

getChangeGroups

public final 
TextEditBasedChangeGroup[] getChangeGroups()
Returns the text edit change groups managed by this buffer change.

Returns:
the text edit change groups

getCurrentContent

public abstract 
String getCurrentContent(
IProgressMonitor pm)
                                  throws 
CoreException
Returns the current content of the document this text change is associated with.

Parameters:
pm - a progress monitor to report progress or null if no progress reporting is desired
Returns:
the current content of the text edit change
Throws:
CoreException - if the content can't be accessed

getCurrentContent

public abstract 
String getCurrentContent(
IRegion region,
                                         boolean expandRegionToFullLine,
                                         int surroundingLines,
                                         
IProgressMonitor pm)
                                  throws 
CoreException
Returns the current content of the text edit change clipped to a specific region. The region is determined as follows:
  • if expandRegionToFullLine is false then the parameter region determines the clipping.
  • if expandRegionToFullLine is true then the region determined by the parameter region is extended to cover full lines.
  • if surroundingLines > 0 then the given number of surrounding lines is added. The value of surroundingLines is only considered if expandRegionToFullLine is true

Parameters:
region - the starting region for the text to be returned
expandRegionToFullLine - if true is passed the region is extended to cover full lines
surroundingLines - the number of surrounding lines to be added to the clipping region. Is only considered if expandRegionToFullLine is true
pm - a progress monitor to report progress or null if no progress reporting is desired
Returns:
the current content of the text edit change clipped to a region determined by the given parameters.
Throws:
CoreException - if an exception occurs while accessing the current content

getKeepPreviewEdits

public boolean getKeepPreviewEdits()
Returns whether preview edits are remembered for further region tracking or not.

Returns:
true if executed text edits are remembered during preview generation; otherwise false

getName

public 
String getName()
Returns the human readable name of this change. The name MUST not be null.

Specified by:
getName in class Change
Returns:
the human readable name of this change

getPreviewContent

public abstract 
String getPreviewContent(
TextEditBasedChangeGroup[] changeGroups,
                                         
IRegion region,
                                         boolean expandRegionToFullLine,
                                         int surroundingLines,
                                         
IProgressMonitor pm)
                                  throws 
CoreException
Returns a preview of the text edit change clipped to a specific region. The preview is created by applying the text edits managed by the given array of text edit change groups. The region is determined as follows:
  • if expandRegionToFullLine is false then the parameter region determines the clipping.
  • if expandRegionToFullLine is true then the region determined by the parameter region is extended to cover full lines.
  • if surroundingLines > 0 then the given number of surrounding lines is added. The value of surroundingLines is only considered if expandRegionToFullLine is true

Parameters:
changeGroups - a set of change groups for which a preview is to be generated
region - the starting region for the clipping
expandRegionToFullLine - if true is passed the region is extended to cover full lines
surroundingLines - the number of surrounding lines to be added to the clipping region. Is only considered if expandRegionToFullLine is true
pm - a progress monitor to report progress or null if no progress reporting is desired
Returns:
the current content of the text change clipped to a region determined by the given parameters.
Throws:
CoreException - if an exception occurs while generating the preview
See Also:
getCurrentContent(IRegion, boolean, int, IProgressMonitor)

getPreviewContent

public abstract 
String getPreviewContent(
IProgressMonitor pm)
                                  throws 
CoreException
Returns the preview content as a string.

Parameters:
pm - a progress monitor to report progress or null if no progress reporting is desired
Returns:
the preview
Throws:
CoreException - if the preview can't be created

getTextType

public 
String getTextType()
Returns the text edit change's text type.

Returns:
the text edit change's text type

setEnabled

public void setEnabled(boolean enabled)
Sets whether this change is enabled or not.

Overrides:
setEnabled in class Change
Parameters:
enabled - true to enable this change; false otherwise

setKeepPreviewEdits

public void setKeepPreviewEdits(boolean keep)
Controls whether the text edit change should keep executed edits during preview generation.

Parameters:
keep - if true executed preview edits are kept

setTextType

public void setTextType(
String type)
Sets the text type. The text type is used to determine the content merge viewer used to present the difference between the original and the preview content in the user interface. Content merge viewers are defined via the extension point org.eclipse.compare.contentMergeViewers.

The default text type is txt.

Parameters:
type - the text type. If null is passed the text type is reseted to the default text type txt.

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