Package com.iizigo.java
Class JavaManager
java.lang.Object
com.iizigo.project.FileChangesCollection
com.iizigo.java.JavaManager
- All Implemented Interfaces:
- IFolderFileChangeListener,- IResourceDeltaVisitor,- IResourceVisitor
Class used to listen to workspace changes file in any Java project.
- Author:
- Christopher Mindus
- Field SummaryFields- Fields inherited from class com.iizigo.project.FileChangesCollection- description, monitor, projectManager
- Method SummaryModifier and TypeMethodDescription- booleanAdds a resource change listener for Java projects.- void- addParser- (IJavaSourceParser<?> parser) Adds a parser.- void- clean- (IJavaProject javaProject) Cleans a project, called by the Java Compilation participant.- void- dispose()Called when disposed of.- boolean- doesJavaProjectNeedRebuild- (IProject project) Checks if a Java project needs rebuild or not, i.e.- voidCall causing entering of refactoring operation, called from operations that perform "workspace threaded" operation such as moving resources affecting refactoring.- voidExiting a refactor-hold operation (after a call to "enterRefactorHold").- voidA JavaSource flags the requirement for a refactoring operation.Gets a new array of all ParsedJavaSource files containing a TypeFileProcessor and are valid.- getAvailableMethods- (IType clazz, String instanceAnnotation, String staticAnnotation) Gets the list of methods that can match the specified annotations.- getFullyQualifiedName- (IContainer folder) Gets the fully qualified package name for a folder.- getFullyQualifiedName- (IPath rootPath) From a full path (from the workspace root), get the fully qualified name of the package.- static JavaManagerGets the instance of the singleton.- getJavaProject- (IProject project) Gets or creates new Java project for a project.- IFolder[]- getJavaSourceFolders- (IProject project) Gets the cached Java source folders for a project.- getParsedJavaSource- (IResource resource) Gets a ParsedJavaSource instance from a resource.- getParsedJavaSource- (IType type) Gets a ParsedJavaSource instance from a type.- String[]Gets the parser plug-in IDs.Gets all the JavaClasses available in all projects that are parsed.Gets the pure Java projects, i.e.- protected boolean- isFileProcessed- (IFile file) Checks if file is processed.- void- loadJavaState- (ModuleModel model, IProgressMonitor monitor) Called when a Module project is loading, to load the Java parsed files.- voidCalled from ProjectManager when a project has been closed.- void- onFileAdded- (IFile file) File has been added.- void- onFileChanged- (IFile file, int flags) File has been changed (markers, contents, etc).- void- onFileMoved- (IFile newFile, IFile oldFile) File has been moved.- void- onFileRemoved- (IFile file) File has been removed.- void- onFolderAdded- (IFolder folder) Folder has been added.- void- onFolderMoved- (IFolder newFolder, IFolder oldFolder) File has been moved.- void- onFolderRemoved- (IFolder folder) File has been removed.- void- onOpen- (ModuleModel model) Called when a Module project is opened, to register itself in the JavaProject.- void- onOpen- (IProject project, IProgressMonitor monitor) Called when a project is a Java project, assigns the root and Java containers.- void- onRefactoringChange- (IFile file, String classFQN, String oldFQN, String newFQN) Called from Refactoring Rename for classes or methods.- void- onRefactoringChange- (IPath oldName, IPath newName) Called from Refactoring Move or Rename or compilation units.- booleanRemoves a resource change listener for Java projects.- boolean- visitResource- (IResourceDelta delta) Processes a resource when called from ProjectManager or ModuleModel visiting...- Methods inherited from class com.iizigo.project.FileChangesCollection- getFolders, getMultiStatus, isProcessed, onNewFolders, process, setMultiStatus, setNewFolders, setProgressMonitor, visit, visit
- Field Details- DEBUGpublic static boolean DEBUGDebug output.
 
- Method Details- getInstanceGets the instance of the singleton.
- onCloseCalled from ProjectManager when a project has been closed.
- disposepublic void dispose()Called when disposed of.
- doesJavaProjectNeedRebuildChecks if a Java project needs rebuild or not, i.e. when first opened.- Returns:
- true if a full build is required, false otherwise.
 
- addParserAdds a parser. This should be done as soon as possible.
- getParserPluginIDsGets the parser plug-in IDs.
- addJavaResourceChangeListenerAdds a resource change listener for Java projects. If the listener also implements the interface- com.iizigo.java.IClasspathChangeListener, it will receive notifications when the classpath is changed.- Parameters:
- listener- The listener.
- Returns:
- true if successful, false for already added.
 
- removeJavaResourceChangeListenerRemoves a resource change listener for Java projects.- Parameters:
- listener- The listener.
- Returns:
- true if successful, false for already added.
 
- getJavaProjectGets or creates new Java project for a project.- Returns:
- null if not a Java project or project is not open.
 
- getPureJavaProjectsGets the pure Java projects, i.e. excluding Module projects.- Returns:
- The array of projects, never null.
 
- getJavaSourceFoldersGets the cached Java source folders for a project.- Parameters:
- project- The project.
- Returns:
- null if not a Java project.
 
- visitResourceProcesses a resource when called from ProjectManager or ModuleModel visiting...- Returns:
- true if the resource and children has been processed, false otherwise.
 
- isFileProcessedChecks if file is processed.- Overrides:
- isFileProcessedin class- FileChangesCollection
- Parameters:
- file- The file.
- Returns:
- true if file is a Java source file, false otherwise.
 
- onFileAddedFile has been added.- Specified by:
- onFileAddedin interface- IFolderFileChangeListener
- Overrides:
- onFileAddedin class- FileChangesCollection
- Parameters:
- file- The file.
- Throws:
- CoreException- For failures.
 
- onFileChangedFile has been changed (markers, contents, etc).- Subclasses should override to process the event, no need to call the - supermethod.- Specified by:
- onFileChangedin interface- IFolderFileChangeListener
- Overrides:
- onFileChangedin class- FileChangesCollection
- Parameters:
- file- The file.
- flags- How the file was changed, from IResourceDelta, where the important ones are CONTENT, MARKERS, ENCODING, LOCAL_CHANGE, DERIVED_CHANGED, REPLACED.
- Throws:
- CoreException- For failures.
 
- onFileMovedFile has been moved.- Specified by:
- onFileMovedin interface- IFolderFileChangeListener
- Overrides:
- onFileMovedin class- FileChangesCollection
- Parameters:
- newFile- The new file.
- oldFile- The old file.
- Throws:
- CoreException- For failures.
 
- onFileRemovedFile has been removed.- Specified by:
- onFileRemovedin interface- IFolderFileChangeListener
- Overrides:
- onFileRemovedin class- FileChangesCollection
- Parameters:
- file- The file.
- Throws:
- CoreException- For failures.
 
- getFullyQualifiedNameGets the fully qualified package name for a folder.- Parameters:
- folder- The folder name.
- Returns:
- The fully qualified package name, null if not inside a Java project source folder.
 
- getFullyQualifiedNameFrom a full path (from the workspace root), get the fully qualified name of the package.- Parameters:
- rootPath- The root path of a folder.
- Returns:
- The fully qualified package name, null if not inside a Java project source folder.
 
- onFolderAddedFolder has been added.- Subclasses should override to process the event, no need to call the - supermethod.- Specified by:
- onFolderAddedin interface- IFolderFileChangeListener
- Overrides:
- onFolderAddedin class- FileChangesCollection
- Parameters:
- folder- The folder.
- Throws:
- CoreException- For failures.
 
- onFolderMovedFile has been moved.- Specified by:
- onFolderMovedin interface- IFolderFileChangeListener
- Overrides:
- onFolderMovedin class- FileChangesCollection
- Parameters:
- newFolder- The new folder.
- oldFolder- The old folder.
- Throws:
- CoreException- For failures.
 
- onFolderRemovedFile has been removed.- Specified by:
- onFolderRemovedin interface- IFolderFileChangeListener
- Overrides:
- onFolderRemovedin class- FileChangesCollection
- Parameters:
- folder- The folder.
- Throws:
- CoreException- For failures.
 
- onOpenCalled when a Module project is opened, to register itself in the JavaProject.
- loadJavaStateCalled when a Module project is loading, to load the Java parsed files.
- onOpenCalled when a project is a Java project, assigns the root and Java containers.
- getAllParsedSourcesGets a new array of all ParsedJavaSource files containing a TypeFileProcessor and are valid. The array can be modified without affecting anything.
- onRefactoringChangeCalled from Refactoring Move or Rename or compilation units.- Parameters:
- oldName- Full path of old Java file.
- newName- Full path of new Java file.
 
- onRefactoringChangeCalled from Refactoring Rename for classes or methods. The "FQN" is for classes including packages, and enclosed classes are separated by '.' and not '$'. For methods, it's the name followed by ',' and "returnType(param1,..,paramN)" as JavaHelper.getSignature gives.- Parameters:
- file- Affected Java source file.
- classFQN- The class fully qualified name, null for classes (only for methods).
- oldFQN- The old fully qualified name or "oldName,signature".
- newFQN- The new fully qualified name or "newName,signature".
 
- cleanCleans a project, called by the Java Compilation participant.- Parameters:
- javaProject- The project to clean.
 
- enterRefactorHoldpublic void enterRefactorHold()Call causing entering of refactoring operation, called from operations that perform "workspace threaded" operation such as moving resources affecting refactoring.
- exitRefactorHoldpublic void exitRefactorHold()Exiting a refactor-hold operation (after a call to "enterRefactorHold").
- flagRefactoringRequiredA JavaSource flags the requirement for a refactoring operation. The refactoring requirement arises from a change in the references due to: - moved properties, using drag-drop or by dialog box (both int SWT-thread), - renamed and/or moved properties, from drag-drop or dialog box (runs in a "workspace" thread). When this is called, a refactoring operations is triggered in the- Parameters:
- js-
 
- getParsedJavaSourceGets a ParsedJavaSource instance from a type.- Parameters:
- type- The type.
- Returns:
- The ParsedJavaSource instance, or null if not found.
 
- getParsedJavaSourceGets a ParsedJavaSource instance from a resource.- Parameters:
- resource- The resource, should be an IFile, otherwise it returns null.
- Returns:
- The ParsedJavaSource instance, or null if not found.
 
- getPublicOrStaticClassesGets all the JavaClasses available in all projects that are parsed. Matching classes are public and public static inner classes.
- getAvailableMethodspublic List<String> getAvailableMethods- (IType clazz, String instanceAnnotation, String staticAnnotation) Gets the list of methods that can match the specified annotations.- Parameters:
- clazz- The class to search in for the- instanceAnnotation.
- instanceAnnotation- The instance annotation to search the class for, null for none.
- staticAnnotation- Static annotation to search classes for static methods.