Namespace: Consultingwerk.Studio.SmartRefactor
Class 
RefactorSession Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:RefactorSession
Purpose:Supports refactoring in the sense of replacing the text
of individual JPNode's with a provided text. The utility
keeps track of replaced line breaks etc. so that multiple
replacements within the same files do not cause the
Parse Tree to be out of sync with the file contents.
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Mon Oct 12 22:42:08 CEST 2015
Notes:Supports only processing of JPNode's within a single source
file, A single RefactorSession instance can only refactor
once



Top Method Summary
Options Name Purpose
+ InsertAfterNode (JPNode, character) Inserts the given text before the given JPNode
+ InsertBeforeNode (JPNode, character, logical) Inserts the given text before the given JPNode
# InsertRefactorTask (integer, integer, character, logical) Registers a location in the source for replacement
# PerformRefactor () Performs the modifications of the file contents
+ ReplaceAllNodeContent (JPNode, character) Replaces the contents of the given JPNode instance including all it's Children
+ ReplaceNodeContent (JPNode, character) Replaces the contents of the given JPNode instance
+ LOGICAL Save () Saves the contents of the RefactSession to the original file name
+ LOGICAL Save (character) Saves the contents of the RefactSession to a file

Top Constructor Summary
Options Name Purpose
+ RefactorSession (ParseUnit) Constructor for the RefactorSession class

Top Property Summary
Options Name Purpose
+ CHARACTER FileName
+ LOGICAL HasTasks
+ org.prorefactor.treeparser.ParseUnit ParseUnit
+ LOGICAL Refactored


Method Detail
Top

PUBLIC InsertAfterNode (JPNode, character)

Purpose: Inserts the given text before the given JPNode
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to replace
pcNewText CHARACTER
The new text for the node
Top

PUBLIC InsertBeforeNode (JPNode, character, logical)

Purpose: Inserts the given text before the given JPNode
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to replace
pcNewText CHARACTER
The new text for the node
plStartOfLine LOGICAL
Logical value indicating if the text should be inserted at the beginning of the line or just before the JPNode position
Top

PROTECTED InsertRefactorTask (integer, integer, character, logical)

Purpose: Registers a location in the source for replacement
Notes:

Parameters:
piOffsetFrom INTEGER
The starting offset to rpelace
piOffsetTo INTEGER
The ending offset to replace
pcNewText CHARACTER
The new text to insert
plReplaceOrInsert LOGICAL
Logical value if text should be replace the offset (true) or be insertted at the offset (false)
Top

PROTECTED PerformRefactor ()

Purpose: Performs the modifications of the file contents
Notes:

Top

PUBLIC ReplaceAllNodeContent (JPNode, character)

Purpose: Replaces the contents of the given JPNode instance including all it's
Children
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to replace
pcNewText CHARACTER
The new text for the node
Top

PUBLIC ReplaceNodeContent (JPNode, character)

Purpose: Replaces the contents of the given JPNode instance
Notes:

Parameters:
poNode org.prorefactor.core.JPNode
The JPNode to replace
pcNewText CHARACTER
The new text for the node
Top

PUBLIC LOGICAL Save ()

Purpose: Saves the contents of the RefactSession to the original file name
Notes:

Returns LOGICAL
Logical value indicating the success of the method
Top

PUBLIC LOGICAL Save (character)

Purpose: Saves the contents of the RefactSession to a file
Notes:

Parameters:
pcFileName CHARACTER
The name of the file to save to
Returns LOGICAL
Logical value indicating the success of the method


Constructor Detail
Top

PUBLIC RefactorSession (ParseUnit)

Purpose: Constructor for the RefactorSession class
Notes:

Parameters:
poParseUnit org.prorefactor.treeparser.ParseUnit
The ProParse Unit to refactor


Property Detail
Top

PUBLIC CHARACTER FileName


Returns CHARACTER
Top

PUBLIC LOGICAL HasTasks


Returns LOGICAL
Top

PUBLIC org.prorefactor.treeparser.ParseUnit ParseUnit


Returns org.prorefactor.treeparser.ParseUnit
Top

PUBLIC LOGICAL Refactored


Returns LOGICAL


©2006-2020 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       04.02.2020 23:38:17