public class ProjectsUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG |
static java.lang.String |
VALID_PROJECT_REGEX |
Modifier and Type | Method and Description |
---|---|
static void |
copyProject(java.lang.String oldProjectName,
java.lang.String newProjectName)
Copies the blocks file and JavaScript file with the given project name.
|
static java.lang.Boolean |
deleteProjects(java.lang.String[] projectNames)
Delete the blocks and JavaScript files for the given project names.
|
static void |
enableProject(java.lang.String projectName,
boolean enable)
Enables (or disables) the project with the given name.
|
static java.lang.String |
escapeDoubleQuotes(java.lang.String s) |
static java.lang.String |
escapeSingleQuotes(java.lang.String s) |
static java.lang.String |
fetchBlkFileContent(java.lang.String projectName)
Returns the content of the blocks file with the given project name.
|
static java.util.List<OpModeMeta> |
fetchEnabledProjectsWithJavaScript()
Returns the
OpModeMeta for existing blocks projects that have a JavaScript file and
are enabled. |
static java.lang.String |
fetchJsFileContent(java.lang.String projectName)
Returns the content of the JavaScript file with the given project name.
|
static void |
fetchProjectsForOfflineBlocksEditor(java.util.List<com.google.blocks.ftcrobotcontroller.util.OfflineBlocksProject> offlineBlocksProjects)
Collects information about the existing blocks projects, for the offline blocks editor.
|
static java.lang.String |
fetchProjectsWithBlocks()
Returns the names and last modified time of existing blocks projects that have a blocks file.
|
static java.lang.String |
fetchSampleNames()
Returns the names of blocks samples
|
static java.lang.String |
getBlocksJavaClassName(java.lang.String projectName) |
static boolean |
isValidProjectName(java.lang.String projectName)
Returns true if the given project name is not null and contains only valid characters.
|
static java.lang.String |
newProject(java.lang.String projectName,
java.lang.String sampleName)
Returns the content of the blocks file for a new project.
|
static void |
renameProject(java.lang.String oldProjectName,
java.lang.String newProjectName)
Renames the blocks file and JavaScript file with the given project name.
|
static void |
saveBlocksJava(java.lang.String relativeFileName,
java.lang.String javaContent)
Save the Java generated from blocks.
|
static void |
saveProject(java.lang.String projectName,
java.lang.String blkFileContent,
java.lang.String jsFileContent)
Save the blocks file and JavaScript file with the given project name.
|
public static final java.lang.String TAG
public static final java.lang.String VALID_PROJECT_REGEX
public static java.lang.String fetchProjectsWithBlocks()
public static java.lang.String escapeSingleQuotes(java.lang.String s)
public static java.lang.String escapeDoubleQuotes(java.lang.String s)
public static void fetchProjectsForOfflineBlocksEditor(java.util.List<com.google.blocks.ftcrobotcontroller.util.OfflineBlocksProject> offlineBlocksProjects) throws java.io.IOException
java.io.IOException
public static java.lang.String fetchSampleNames() throws java.io.IOException
java.io.IOException
public static java.util.List<OpModeMeta> fetchEnabledProjectsWithJavaScript()
OpModeMeta
for existing blocks projects that have a JavaScript file and
are enabled.public static boolean isValidProjectName(java.lang.String projectName)
public static java.lang.String fetchBlkFileContent(java.lang.String projectName) throws java.io.IOException
projectName
- the name of the projectjava.io.IOException
public static java.lang.String fetchJsFileContent(java.lang.String projectName) throws java.io.IOException
projectName
- the name of the projectjava.io.IOException
public static java.lang.String newProject(java.lang.String projectName, java.lang.String sampleName) throws java.io.IOException
projectName
- the name of the projectsampleName
- the name of the sample to copy.java.io.IOException
public static void saveProject(java.lang.String projectName, java.lang.String blkFileContent, java.lang.String jsFileContent) throws java.io.IOException
projectName
- the name of the projectblkFileContent
- the content to write to the blocks file.jsFileContent
- the content to write to the JavaScript file.java.io.IOException
public static void renameProject(java.lang.String oldProjectName, java.lang.String newProjectName) throws java.io.IOException
oldProjectName
- the old name of the projectnewProjectName
- the new name of the projectjava.io.IOException
public static void copyProject(java.lang.String oldProjectName, java.lang.String newProjectName) throws java.io.IOException
oldProjectName
- the old name of the projectnewProjectName
- the new name of the projectjava.io.IOException
public static void enableProject(java.lang.String projectName, boolean enable) throws java.io.IOException
projectName
- the name of the projectenable
- whether to enable (or disable) the projectjava.io.IOException
public static java.lang.Boolean deleteProjects(java.lang.String[] projectNames)
projectNames
- the names of the projects to deletepublic static java.lang.String getBlocksJavaClassName(java.lang.String projectName)
public static void saveBlocksJava(java.lang.String relativeFileName, java.lang.String javaContent) throws java.io.IOException
relativeFileName
- the name of the filejavaContent
- the content to write to the Java file.java.io.IOException