public class Sketch
extends java.lang.Object
| Constructor and Description |
|---|
Sketch(java.lang.String path,
Editor editor)
path is location of the main .pde file, because this is also
simplest to use when opening the file from the finder/explorer.
|
Sketch(java.lang.String path,
Mode mode)
Used by the command-line version to create a sketch object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addFile(java.io.File sourceFile)
Add a file to the sketch.
|
static java.lang.String |
checkName(java.lang.String origName)
Convert to sanitized name and alert the user
if changes were made.
|
void |
ensureExistence()
Make sure the sketch hasn't been moved or deleted by some
nefarious user.
|
SketchCode[] |
getCode() |
SketchCode |
getCode(int index) |
int |
getCodeCount() |
java.io.File |
getCodeFolder()
Returns the location of the sketch's code folder.
|
int |
getCodeIndex(SketchCode who) |
SketchCode |
getCurrentCode() |
int |
getCurrentCodeIndex() |
java.io.File |
getDataFolder()
Returns the location of the sketch's data folder.
|
java.io.File |
getFolder()
Returns the sketch folder.
|
java.io.File |
getMainFile()
Returns a File object for the main .pde file for this sketch.
|
java.lang.String |
getMainFilePath()
Returns path to the main .pde file for this sketch.
|
java.lang.String |
getMainProgram() |
Mode |
getMode() |
java.lang.String |
getName()
Returns the name of this sketch.
|
void |
handleAddFile()
Prompt the user for a new file to the sketch, then call the
other addFile() function to actually add it.
|
void |
handleDeleteCode()
Remove a piece of code from the sketch and from the disk.
|
void |
handleNewCode()
Handler for the New Code menu option.
|
void |
handleNextCode()
Move to the next tab.
|
void |
handlePrevCode()
Move to the previous tab.
|
void |
handleRenameCode()
Handler for the Rename Code menu option.
|
boolean |
hasCodeFolder() |
boolean |
hasDataFolder() |
boolean |
isModified() |
boolean |
isReadOnly()
Returns true if this is a read-only sketch.
|
static boolean |
isSanitaryName(java.lang.String name)
Return true if the name is valid for a Processing sketch.
|
boolean |
isUntitled() |
java.io.File |
makeTempFolder()
Create a temporary folder that includes the sketch's name in its title.
|
java.io.File |
prepareCodeFolder()
Create the code folder if it does not exist already.
|
java.io.File |
prepareDataFolder()
Create the data folder if it does not exist already.
|
void |
reload()
Reload the current sketch.
|
static java.lang.String |
sanitizeName(java.lang.String origName)
Produce a sanitized name that fits our standards for likely to work.
|
boolean |
save()
Save all code in the current sketch.
|
void |
setCurrentCode(int which)
Change what file is currently being edited.
|
void |
setModified(boolean state)
Sets the modified value for the code in the frontmost tab.
|
void |
setUntitled(boolean untitled) |
public Sketch(java.lang.String path,
Mode mode)
path - location of the main .pde filemode - what flavor of sketch we're dealing with.public Sketch(java.lang.String path,
Editor editor)
throws java.io.IOException
java.io.IOExceptionpublic void reload()
public void handleNewCode()
public void handleRenameCode()
public void handleDeleteCode()
public void handlePrevCode()
public void handleNextCode()
public void setModified(boolean state)
public boolean isModified()
public boolean save()
throws java.io.IOException
java.io.IOExceptionpublic void handleAddFile()
public boolean addFile(java.io.File sourceFile)
public void setCurrentCode(int which)
public java.io.File makeTempFolder()
public void ensureExistence()
public boolean isReadOnly()
public java.lang.String getName()
public java.io.File getMainFile()
public java.lang.String getMainFilePath()
public java.io.File getFolder()
public java.io.File getDataFolder()
public boolean hasDataFolder()
public java.io.File prepareDataFolder()
public java.io.File getCodeFolder()
public boolean hasCodeFolder()
public java.io.File prepareCodeFolder()
public SketchCode[] getCode()
public int getCodeCount()
public SketchCode getCode(int index)
public int getCodeIndex(SketchCode who)
public SketchCode getCurrentCode()
public int getCurrentCodeIndex()
public java.lang.String getMainProgram()
public void setUntitled(boolean untitled)
public boolean isUntitled()
public static java.lang.String checkName(java.lang.String origName)
public static boolean isSanitaryName(java.lang.String name)
public static java.lang.String sanitizeName(java.lang.String origName)
public Mode getMode()