| java.lang.Object javax.swing.tree.DefaultMutableTreeNode tide.sources.SourceFile
SourceFile | public class SourceFile extends DefaultMutableTreeNode implements FileItem(Code) | | Represents a single .java File or a directory (package).
Temporary stores the edited content before saving it ( temporaryEditedContent!=null)
Also contain a reference on the generated class (?? classeS ??)
Order: save changed files, and then look for the ones that must be compiled
|
Inner Class :public enum Kind | |
Method Summary | |
public void | addResourceFile(ResourceFile rf) Adds a resource associated to a folder text, pics, ... | public void | cancelExternalChanges() | public void | deleteAssociatedClassFiles() | public void | deleteCachedContent() | public void | fileHasBeenDeleted() Call after deletion. | public int | getCaretColumnPosition() | public int | getCaretLinePosition() | public SourceFile | getChildFileAt(int i) | public String | getContent() | public File | getFileOrDirectory() For java sources files, this method simply return the javaFile
for directories, the directory is returned, constructed from tree names. | public long | getFileSize() | public boolean | getHasBeenRemoved() | public SourcesTreeIcon.Ignored | getIgnoredType() | public int | getJavaChildsCount() Files and packages, but without the resources. | public String | getJavaName() | public String | getJavaPartName() Also the java part name or simple name, used for node sorting. | public long | getLastModified() the lastModified field of the file or directory. | public long | getLastModifiedJavaFile() Cached. | final public long | getLastStoredLastModifiedJavaFile() Is the date read when this was restored from vector rep. | public String | getName() Hello.java. | public String | getNodeNameToDisplayInTree() This is also the java part name, used for node sorting. | public String | getPackageName() | public ParserResult | getParserResultIfAlreadyMade() | public List<ResourceFile> | getResourceFiles() | public SimplifiedSyntaxTree2 | getSimplifiedSyntaxTreeIfAlreadyMade() | public StorageVector | getVectorRep() | public boolean | hasFileContentChangedOnDiskSinceLastGetContent() | public boolean | hasPackageDirectJavaChilds() | public boolean | hasTextRepresentation() | public boolean | isBeingEdited() | public boolean | isCompiled() | public boolean | isDirectory() | public boolean | isEditable() Looks on disk if the file can be written. | public boolean | isIgnored() | public boolean | isJavaFile() | public boolean | isSourceFile() | public void | liberateResourcesForGC() | public List<File> | lookForAssociatedClassFiles() Used in JLint classes analysis tool... | public boolean | lookIfJavaFileChangedAndTreat() Look if the date on disk has changed, if true, directly sets state to "not compiled". | public void | rename(String newSimpleName, boolean renameTypeNameInFile, boolean renameInProject) Sorting is NOT performed (todo?). | public void | renameAllOccurencesRegex(String oldStr, String newStr) Used in the rename. | public boolean | restoreFromVectorRepr(StorageVector rep, SourcesTreeModel model) should be called after all source files have been restored in the project. | public void | saveContentToFile() If has been edited, i.e. | public void | setBeingEdited(boolean is) | public void | setCaretPositionToRemember(int line, int column) | public void | setClassRoot(File classesRoot) | public void | setContentFromEditor(String txt, boolean allowChangesFromOutside) Sets the content edited.
Will be stored later. | public void | setIgnoredType(SourcesTreeIcon.Ignored a) | public void | setIsCompiled(boolean is) Called for folders based on child states. | public void | setParserResult(ParserResult st) | public void | setSimplifiedSyntaxTree(SimplifiedSyntaxTree2 st) Deletes the old syntax tree, if any. | public String | toString() |
isDirectory | final public boolean isDirectory(Code) | | |
isProjectMainClass | public boolean isProjectMainClass(Code) | | |
topKind | public Kind topKind(Code) | | |
visited | public boolean visited(Code) | | |
SourceFile | SourceFile(String name, String absolutePackageName)(Code) | | used for intermediate directories and the root (absolutePackageName="")
name = java9 absolutePackageName = hello.my.java9
|
addResourceFile | public void addResourceFile(ResourceFile rf)(Code) | | Adds a resource associated to a folder text, pics, ...
|
cancelExternalChanges | public void cancelExternalChanges()(Code) | | |
deleteAssociatedClassFiles | public void deleteAssociatedClassFiles()(Code) | | |
deleteCachedContent | public void deleteCachedContent()(Code) | | Data may be lost if not saved previously !
used to enforce reload from file !
|
fileHasBeenDeleted | public void fileHasBeenDeleted()(Code) | | Call after deletion.
|
getCaretColumnPosition | public int getCaretColumnPosition()(Code) | | |
getCaretLinePosition | public int getCaretLinePosition()(Code) | | |
getContent | public String getContent() throws Exception(Code) | | temporaryEditedContent if not null or the file content from disk.ASSERT: ONLY PLACE TO GET THE CONTENT ! |
getFileOrDirectory | public File getFileOrDirectory()(Code) | | For java sources files, this method simply return the javaFile
for directories, the directory is returned, constructed from tree names.
CAUTION: javaNama.replace('.', '/') is not robust, because the directory names
may contain "." (not valid for packages, but maybe for resources, also managed in the sources model)
|
getFileSize | public long getFileSize()(Code) | | |
getHasBeenRemoved | public boolean getHasBeenRemoved()(Code) | | |
getJavaChildsCount | public int getJavaChildsCount()(Code) | | Files and packages, but without the resources.
|
getJavaName | public String getJavaName()(Code) | | According to folder and file names (ATTENTION !)
private classes may have other names !!! (IGNORED HERE)
the javaname for source files or packages (".") separated |
getJavaPartName | public String getJavaPartName()(Code) | | Also the java part name or simple name, used for node sorting.
|
getLastModified | public long getLastModified()(Code) | | the lastModified field of the file or directory. SLOW. Direct call to file's lastModified routine, NOT cached. |
getLastModifiedJavaFile | public long getLastModifiedJavaFile()(Code) | | Cached. Set when call to setIsCompiled(*)
or lookIfJavaFileChanged().
|
getLastStoredLastModifiedJavaFile | final public long getLastStoredLastModifiedJavaFile()(Code) | | Is the date read when this was restored from vector rep.
Used to create human readable changes logs
|
getName | public String getName()(Code) | | Hello.java. ONLY USED IN VIEW (?)
|
getNodeNameToDisplayInTree | public String getNodeNameToDisplayInTree()(Code) | | This is also the java part name, used for node sorting.
|
hasFileContentChangedOnDiskSinceLastGetContent | public boolean hasFileContentChangedOnDiskSinceLastGetContent()(Code) | | |
hasPackageDirectJavaChilds | public boolean hasPackageDirectJavaChilds()(Code) | | |
hasTextRepresentation | public boolean hasTextRepresentation()(Code) | | |
isBeingEdited | public boolean isBeingEdited()(Code) | | |
isCompiled | public boolean isCompiled()(Code) | | |
isDirectory | public boolean isDirectory()(Code) | | |
isEditable | public boolean isEditable()(Code) | | Looks on disk if the file can be written.
|
isIgnored | public boolean isIgnored()(Code) | | Decision based on ignoredType
directories may be partially ignored, if they contain both ignored and not ignored childs
|
isJavaFile | public boolean isJavaFile()(Code) | | |
isSourceFile | public boolean isSourceFile()(Code) | | |
liberateResourcesForGC | public void liberateResourcesForGC()(Code) | | |
lookForAssociatedClassFiles | public List<File> lookForAssociatedClassFiles()(Code) | | Used in JLint classes analysis tool...
Classes are also removed when deleting a source file.
|
lookIfJavaFileChangedAndTreat | public boolean lookIfJavaFileChangedAndTreat()(Code) | | Look if the date on disk has changed, if true, directly sets state to "not compiled".
Automatically called at recreation and scan for external changes functions (manual sync, SVN, ...).
CALL ONLY ONCE, AFTER FIRST CALL, SETS THE lastModifiedJavaFile to the actual date and compiled to false.
|
rename | public void rename(String newSimpleName, boolean renameTypeNameInFile, boolean renameInProject) throws Exception(Code) | | Sorting is NOT performed (todo?).
|
renameAllOccurencesRegex | public void renameAllOccurencesRegex(String oldStr, String newStr) throws Exception(Code) | | Used in the rename. Called for dependencies.
BE CAREFUL !
|
restoreFromVectorRepr | public boolean restoreFromVectorRepr(StorageVector rep, SourcesTreeModel model) throws Exception(Code) | | should be called after all source files have been restored in the project.
because this also restore the dependencies
lookIfJavaFileChanged(); |
saveContentToFile | public void saveContentToFile() throws Exception(Code) | | If has been edited, i.e. setContentFromEditor() was called => writes the content to file (temporaryEditedContent)
And sets the file to not compiled.
Tail spaces are removed automatically.
|
setBeingEdited | public void setBeingEdited(boolean is)(Code) | | |
setCaretPositionToRemember | public void setCaretPositionToRemember(int line, int column)(Code) | | |
setClassRoot | public void setClassRoot(File classesRoot)(Code) | | This will set or update the classFile reference (or package directory)
look for all classes starting with this name.class ore name$
PROBLEM : classes that are not public are not constraint to carry the name of the java file !!!
TODO recognize in the source files (parse or maybe a simple regex search) the class names (several possible !!)
|
setContentFromEditor | public void setContentFromEditor(String txt, boolean allowChangesFromOutside)(Code) | | Sets the content edited.
Will be stored later. Here, it is stored in temporaryEditedContent.
Please check hasFileContentChangedOnDiskSinceLastGetContent() !
Parameters: allowChangesFromOutside - if false, and changes occured outside tIDE since last getContent() , throws a RuntimeException. |
setIsCompiled | public void setIsCompiled(boolean is)(Code) | | Called for folders based on child states.
Called for childs based on the compiler success.
Called at startup
and when the file has been edited and stored (sets comp to false).
|
toString | public String toString()(Code) | | Not really used, only for debug
|
|
|