Class ProcessHelper
- java.lang.Object
-
- org.eclipse.cdt.core.templateengine.process.ProcessHelper
-
public class ProcessHelper extends Object
Acts as helper class for process the processes i.e., copy, replace and append files.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONDITION
static String
END_PATTERN
static String
EQUALS
static String
NOT_EQUALS
static String
START_PATTERN
-
Constructor Summary
Constructors Constructor Description ProcessHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
appendFile(String fileContents, File toFile)
This method is to append the given contents into a file.static void
copyBinaryFile(URL source, File dest)
This method reads contents from source, and writes the contents into destination file.static Set<String>
getReplaceKeys(String str)
This method returns a vector of all replace marker strings.static Set<String>
getReplaceKeys(String str, String startPattern, String endPattern)
This method returns a vector of all replace marker strings.static String
getReplaceMarker(String macro)
static String
getValueAfterExpandingMacros(String string, Set<String> macros, Map<String,String> valueStore)
static String
getValueAfterExpandingMacros(String string, Set<String> macros, Map<String,String> valueStore, String startPattern, String endPattern)
static void
mkdirs(org.eclipse.core.resources.IProject projectHandle, org.eclipse.core.resources.IFolder parentFolder)
This method creates the directories in the parent folder.static String
readFromFile(URL source)
This method takes a URL as parameter to read the contents, and to add into a string buffer.
-
-
-
Field Detail
-
CONDITION
public static final String CONDITION
- See Also:
- Constant Field Values
-
START_PATTERN
public static final String START_PATTERN
- See Also:
- Constant Field Values
-
END_PATTERN
public static final String END_PATTERN
- See Also:
- Constant Field Values
-
EQUALS
public static final String EQUALS
- See Also:
- Constant Field Values
-
NOT_EQUALS
public static final String NOT_EQUALS
- See Also:
- Constant Field Values
-
-
Method Detail
-
appendFile
public static void appendFile(String fileContents, File toFile) throws IOException
This method is to append the given contents into a file.- Parameters:
fileContents
- contents which are appended to the file.toFile
- a file to append contents.- Throws:
IOException
- exception while writing contents into a file- Since:
- 4.0
-
getReplaceKeys
public static Set<String> getReplaceKeys(String str)
This method returns a vector of all replace marker strings. (e.g., $(item), vector contains 'item' as one item) is the end pattern.- Parameters:
str
- A given string possibly containing markers.- Returns:
- the set of names occurring within markers
- Since:
- 4.0
-
getReplaceKeys
public static Set<String> getReplaceKeys(String str, String startPattern, String endPattern)
This method returns a vector of all replace marker strings. (e.g., $(item), vector contains 'item' as one item) is the end pattern.- Parameters:
str
- A given string possibly containing markers.startPattern
- token to start macro replacementendPattern
- token to end macro replacement- Returns:
- the set of names occurring within markers
- Since:
- 5.5
-
readFromFile
public static String readFromFile(URL source) throws IOException
This method takes a URL as parameter to read the contents, and to add into a string buffer.- Parameters:
source
- URL to read the contents.- Returns:
- string contents of a file specified in the URL source path.
- Throws:
IOException
- Since:
- 4.0
-
copyBinaryFile
public static void copyBinaryFile(URL source, File dest) throws IOException
This method reads contents from source, and writes the contents into destination file.- Parameters:
source
- URL to read the contents.dest
- destination file to write the contents.- Throws:
IOException
- Since:
- 4.0
-
mkdirs
public static void mkdirs(org.eclipse.core.resources.IProject projectHandle, org.eclipse.core.resources.IFolder parentFolder) throws org.eclipse.core.runtime.CoreException
This method creates the directories in the parent folder.- Parameters:
projectHandle
-parentFolder
-- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
getValueAfterExpandingMacros
public static String getValueAfterExpandingMacros(String string, Set<String> macros, Map<String,String> valueStore)
- Parameters:
string
-macros
-valueStore
-- Returns:
- the macro value after expanding the macros.
- Since:
- 4.0
-
getValueAfterExpandingMacros
public static String getValueAfterExpandingMacros(String string, Set<String> macros, Map<String,String> valueStore, String startPattern, String endPattern)
- Parameters:
string
-macros
-valueStore
-- Returns:
- the macro value after expanding the macros.
- Since:
- 5.5
-
-