edu.rice.cs.drjava.project
Class DocFile
java.lang.Object
java.io.File
edu.rice.cs.drjava.project.DocFile
- All Implemented Interfaces:
- Serializable, Comparable<File>
public class DocFile
- extends File
- See Also:
- Serialized Form
Constructor Summary |
DocFile(File f)
Creates a docfile that has the same path as the given file, with default values for everything else. |
DocFile(File f,
Pair<Integer,Integer> selection,
Pair<Integer,Integer> scroll,
boolean active,
String srcRoot)
|
DocFile(String pathname)
Creates a docfile from the given pathname with default values for everything else. |
DocFile(String pathname,
Pair<Integer,Integer> selection,
Pair<Integer,Integer> scroll,
boolean active,
String srcRoot)
|
DocFile(String parent,
String child)
Creates a docfile from the given parent and child with default values for everything else. |
DocFile(String parent,
String child,
Pair<Integer,Integer> selection,
Pair<Integer,Integer> scroll,
boolean active,
String srcRoot)
|
Methods inherited from class java.io.File |
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsolutePath, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL |
DocFile
public DocFile(File f)
- Creates a docfile that has the same path as the given file, with default values for everything else.
DocFile
public DocFile(String pathname)
- Creates a docfile from the given pathname with default values for everything else.
DocFile
public DocFile(String parent,
String child)
- Creates a docfile from the given parent and child with default values for everything else.
DocFile
public DocFile(String pathname,
Pair<Integer,Integer> selection,
Pair<Integer,Integer> scroll,
boolean active,
String srcRoot)
DocFile
public DocFile(File f,
Pair<Integer,Integer> selection,
Pair<Integer,Integer> scroll,
boolean active,
String srcRoot)
DocFile
public DocFile(String parent,
String child,
Pair<Integer,Integer> selection,
Pair<Integer,Integer> scroll,
boolean active,
String srcRoot)
getAbsoluteFile
public DocFile getAbsoluteFile()
- Overrides:
getAbsoluteFile
in class File
getCanonicalFile
public DocFile getCanonicalFile()
throws IOException
- Overrides:
getCanonicalFile
in class File
- Throws:
IOException
getSelection
public Pair<Integer,Integer> getSelection()
- Returns:
- the selection with the start and ending locations paired together. The cursor location is at the second
location in the pair while the selection is defined between the two.
setSelection
public void setSelection(Pair<Integer,Integer> sel)
- Parameters:
sel
- the pair to set the selection to
setSelection
public void setSelection(int start,
int end)
- Parameters:
start
- the start of the selectionend
- the end of the selection (and the cursor position)
getScroll
public Pair<Integer,Integer> getScroll()
- Returns:
- the selection with the first element being the vertical scroll and the second being the horizontal scroll.
setScroll
public void setScroll(Pair<Integer,Integer> scroll)
- Parameters:
scroll
- the pair to set the selection to
setScroll
public void setScroll(int vert,
int horiz)
- Parameters:
vert
- the vertical scroll of the scroll panehoriz
- the horizonal scroll of the scroll pane
isActive
public boolean isActive()
- Returns:
true
if this file is supposed to be the active document when opened.
setActive
public void setActive(boolean active)
- Parameters:
active
- Whether this file should be the active document when opened.
getPackage
public String getPackage()
- Returns:
- the package of the document stored in this file
setPackage
public void setPackage(String pkg)
- Parameters:
pkg
- The name of the package defined in the document text.
setSavedModDate
public void setSavedModDate(long mod)
- Sets lastModified for this file to the time the including project file was saved. The
lastModified
date any documents saved after the project file was written will not match the date recorded in the project file.
- Parameters:
mod
- the last known modification date when the project was saved.
getSavedModDate
public long getSavedModDate()
- Returns:
- The modification date of this file at the time the project file was generated.