org.eclipse.mtl.ide.ui.resources
Class MTLProject

java.lang.Object
  extended by org.eclipse.mtl.ide.ui.resources.MTLProject

public class MTLProject
extends java.lang.Object

A MTL project represents a view of a project resource in terms of MTL elements. Each MTL project has a classpath, defining which folders contain source code and where templates are located. Each MTL project also has an output location. The extension of a template is '.mtl' and the extension of an output file is '.emtl'.


Constructor Summary
MTLProject(org.eclipse.core.resources.IProject project)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 java.util.List<org.eclipse.emf.common.util.URI> getAccessibleOutputFiles()
          Gets all the accessible output files (EMTL) of this project.
 org.eclipse.core.runtime.IPath getInputFilePath(org.eclipse.core.runtime.IPath fileEMTL)
          Gets the input file path (MTL) for the given EMTL file path.
 java.util.List<org.eclipse.core.resources.IFile> getInputFiles()
          Returns a list of existing MTL files (MTL files only) in this resource.
 org.eclipse.core.runtime.IPath getOutputFilePath(org.eclipse.core.resources.IFile fileMTL)
          Gets the output file path (EMTL) for the given MTL file.
 java.util.List<org.eclipse.emf.common.util.URI> getOutputFiles()
          Gets all the output files (EMTL) of this project.
 java.lang.String getPackageName(org.eclipse.core.resources.IFile fileMTL)
          Gets the full name of the package which contains the MTL file.
 java.util.List<MTLProject> getRecursivelyAccessibleMTLProjects()
          Gets all the accessible MTL projects.
 java.util.List<org.eclipse.core.runtime.IPath> getResolvedClasspath()
          This is a helper method returning the resolved classpath for the project as a list of simple classpath entries.
 int hashCode()
          
 org.eclipse.emf.ecore.resource.ResourceSet loadAccessibleOutputFiles()
          Gets in a single resource set all the accessible AST resources (EMTL).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTLProject

public MTLProject(org.eclipse.core.resources.IProject project)
Constructor.

Parameters:
project - is the project
Method Detail

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getInputFiles

public java.util.List<org.eclipse.core.resources.IFile> getInputFiles()
                                                               throws org.eclipse.core.runtime.CoreException
Returns a list of existing MTL files (MTL files only) in this resource.

Returns:
all the MTL files
Throws:
org.eclipse.core.runtime.CoreException - contains a status object describing the cause of the exception

getOutputFilePath

public org.eclipse.core.runtime.IPath getOutputFilePath(org.eclipse.core.resources.IFile fileMTL)
Gets the output file path (EMTL) for the given MTL file. For example :
'/MyProject/src/org/eclipse/mtl/file.mtl' becomes '/MyProject/bin/org/eclipse/mtl/file.emtl'

Parameters:
fileMTL - is the MTL file
Returns:
the output file path

getInputFilePath

public org.eclipse.core.runtime.IPath getInputFilePath(org.eclipse.core.runtime.IPath fileEMTL)
Gets the input file path (MTL) for the given EMTL file path. For example :
'/MyProject/bin/org/eclipse/mtl/file.emtl' becomes '/MyProject/src-gen/org/eclipse/mtl/file.mtl'

Parameters:
fileEMTL - is the EMTL file path
Returns:
the input file, or null if the given file isn't valid

getResolvedClasspath

public java.util.List<org.eclipse.core.runtime.IPath> getResolvedClasspath()
This is a helper method returning the resolved classpath for the project as a list of simple classpath entries.

Returns:
the classpath entries

getPackageName

public java.lang.String getPackageName(org.eclipse.core.resources.IFile fileMTL)
Gets the full name of the package which contains the MTL file. For example :
'/MyProject/src/org/eclipse/mtl/file.mtl' becomes 'org.eclipse.mtl'

Parameters:
fileMTL - is the MTL file
Returns:
the full name of the package, or an empty string if the file is not valid

getOutputFiles

public java.util.List<org.eclipse.emf.common.util.URI> getOutputFiles()
Gets all the output files (EMTL) of this project. It means the files of the project and not the files of the required plugins.

Returns:
the URIs of the output files, there are only 'workspace' URIs...

getAccessibleOutputFiles

public java.util.List<org.eclipse.emf.common.util.URI> getAccessibleOutputFiles()
Gets all the accessible output files (EMTL) of this project. It means the files of the project and the files of the required plugins.

Returns:
the URIs of the output files, there are 'plugin' URIs and 'workspace' URIs...

getRecursivelyAccessibleMTLProjects

public java.util.List<MTLProject> getRecursivelyAccessibleMTLProjects()
Gets all the accessible MTL projects. It means that the current project is included.

Returns:
the accessible MTL projects

loadAccessibleOutputFiles

public org.eclipse.emf.ecore.resource.ResourceSet loadAccessibleOutputFiles()
Gets in a single resource set all the accessible AST resources (EMTL). It means the files of the project and the files of the required plugins. You must unload the resources of the returned resource set by yourself.

Returns:
a resource set which contains all the accessible resources

Copyright 2008 Obeo
All Rights Reserved.