org.jtool.jxplatform.repository
Class JxProjectRepository

java.lang.Object
  extended byorg.jtool.jxplatform.event.JxEventSource
      extended byorg.jtool.jxplatform.repository.JxProjectRepository

public class JxProjectRepository
extends JxEventSource

Stores information about each project within the workspace.

Author:
Katsuhisa Maruyama

Field Summary
 
Fields inherited from class org.jtool.jxplatform.event.JxEventSource
alertListeners, changedListeners, logListeners
 
Method Summary
 JxCompilationUnit[] createXML()
          Creates DOM document objects from all of the compilation units stored in this repository.
 JxCompilationUnit createXML(org.eclipse.jdt.core.ICompilationUnit cu)
          Creates a DOM document object from a compilation unit.
 JxCompilationUnit createXML(org.eclipse.core.resources.IFile file)
          Creates a DOM document object from a file resource.
 void delete()
          Deletes information stored in this repository.
 boolean fullBuild()
          Compiles and builds every file within this project.
 JxCompilationUnit get(org.eclipse.jdt.core.ICompilationUnit cu)
          Returns a compilation unit containing a DOM document object generated from it.
 JxCompilationUnit get(java.lang.String pathname)
          Returns a compilation unit containing the DOM document object generated from it.
 JxCompilationUnit[] getCompilationUnits()
          Obtains all compilation units stored in this repository.
 org.w3c.dom.Document[] getDocuments()
          Obtains all DOM document objects stored in this repository.
 org.eclipse.jdt.core.IJavaProject getJavaProject()
          Returns a Java project corresponding to this repository.
 org.eclipse.core.resources.IProject getProject()
          Returns a project corresponding to this repository.
 java.lang.String getProjectDir()
          Returns the directory name of the project corresponding to this repository.
 java.lang.String getProjectName()
          Returns the name of a project corresponding to this repository.
 java.lang.String getRelativePath(java.lang.String pathname)
          Returns a path name relative to a given path name.
 TypeInformation getTypeInformation()
          Returns type information about source code within this project.
 boolean incrementalBuild()
          Compiles and incrementally builds every file within this project.
 org.w3c.dom.Document parse(JxCompilationUnit unit)
          Parses source code and generates DOM document object.
 void refresh()
          Refreshes compilation unit information stored in this repository.
 void update()
          Updates information of all compilation units in this project.
 
Methods inherited from class org.jtool.jxplatform.event.JxEventSource
addChangedEventListener, addEventListener, addEventListener, fire, fire, fire, removeChangedEventListener, removeEventListener, removeEventListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

delete

public void delete()
Deletes information stored in this repository.


getJavaProject

public org.eclipse.jdt.core.IJavaProject getJavaProject()
Returns a Java project corresponding to this repository.

Returns:
The Java project.

getProject

public org.eclipse.core.resources.IProject getProject()
Returns a project corresponding to this repository.

Returns:
The project.

getProjectDir

public java.lang.String getProjectDir()
Returns the directory name of the project corresponding to this repository.

Returns:
The directory of the project.

getProjectName

public java.lang.String getProjectName()
Returns the name of a project corresponding to this repository.

Returns:
The name of the project.

getTypeInformation

public TypeInformation getTypeInformation()
Returns type information about source code within this project.

Returns:
The type information.

get

public JxCompilationUnit get(org.eclipse.jdt.core.ICompilationUnit cu)
Returns a compilation unit containing a DOM document object generated from it.

Parameters:
cu - A compilation unit to be retrieved.
Returns:
The retrived compilation unit, or null if the retrived compilation unit does not exists in this repository.

get

public JxCompilationUnit get(java.lang.String pathname)
Returns a compilation unit containing the DOM document object generated from it.

Parameters:
pathname - The pathname of a compilation unit to be retrieved.
Returns:
The retrived compilation unit, or null if the retrived compilation unit does not exists in this repository.

getRelativePath

public java.lang.String getRelativePath(java.lang.String pathname)
Returns a path name relative to a given path name.

Parameters:
pathname - A path name.
Returns:
The relative path name.

refresh

public void refresh()
Refreshes compilation unit information stored in this repository.


getCompilationUnits

public JxCompilationUnit[] getCompilationUnits()
Obtains all compilation units stored in this repository.

Returns:
The collection of compilation unit objects.

getDocuments

public org.w3c.dom.Document[] getDocuments()
Obtains all DOM document objects stored in this repository.

Returns:
The collection of DOM document objects.

createXML

public JxCompilationUnit createXML(org.eclipse.core.resources.IFile file)
Creates a DOM document object from a file resource.

Parameters:
file - A file resource.
Returns:
The compilaton unit infomation, null if such information cannot be found.

createXML

public JxCompilationUnit createXML(org.eclipse.jdt.core.ICompilationUnit cu)
Creates a DOM document object from a compilation unit.

Parameters:
cu - A compilation unit.
Returns:
The compilaton unit information, null if such information cannot be found.

createXML

public JxCompilationUnit[] createXML()
Creates DOM document objects from all of the compilation units stored in this repository.

Returns:
The collection of the updated compilaton unit information. JxCompilationUnit#getDocument() == null if the created DOM document object is invalid.
Throws:
JxException - If the creation fails.

parse

public org.w3c.dom.Document parse(JxCompilationUnit unit)
Parses source code and generates DOM document object.

Parameters:
unit - A compilation unit.
Returns:
true if the binding succeeds, otherwise false.

fullBuild

public boolean fullBuild()
Compiles and builds every file within this project.

Returns:
true if the build has succeed, otherwise false.

incrementalBuild

public boolean incrementalBuild()
Compiles and incrementally builds every file within this project.

Returns:
true if the build has succeed, otherwise false.

update

public void update()
Updates information of all compilation units in this project.