io.sarl.apputils.uiextensions.classpath
Class SarlClassPathDetector
All Superinterfaces:
org.eclipse.core.resources.IResourceProxyVisitor
class SarlClassPathDetector
extends java.lang.Object
implements org.eclipse.core.resources.IResourceProxyVisitor
Detect the classpath entries according to the Java and SARL conventions.

Class mostly inspired from JDT. See ClassPathDetector. Unfortunately, the ClassPathDetector class cannot be overridden because most of its logic is defined in protected methods.
Maven Group Identifier:
io.sarl.apputils
Maven Artifact Identifier:
uiextensions
Since:
0.15
See:
ClassPathDetector
Property Summary
Modifier and type Property and description
org.eclipse.jdt.core.IClasspathEntry classpath
Replies the detected classpath.
java.util.Comparator<T> cPEntryComparator
Replies the comparator of classpath entries.
org.eclipse.core.runtime.IPath outputLocation
Replies the detected output location.
Constructor Summary
Constructor and description
new(IProject,SarlDefaultClassPathProvider,IProgressMonitor)
Constructor.
Action Summary
Modifier and type Action and description
protected static void addToMap(Map<K,V>,IPath,IPath)
Utility function for updating the given map.
protected void detectClasspath
Detect the classpath components.
protected void detectLibraries(List<E>,IPath)
Detect the libraries.
protected org.eclipse.core.runtime.IPath detectOutputFolder
Detect the output folder for binary files.
protected void detectSourceFolders(List<E>)
Detect the source folders according to the Java and SARL conventions.
protected org.eclipse.core.runtime.IPath findInSourceFolders(IPath)
Retrieve the source folder for the given path.
org.eclipse.jdt.core.IClasspathEntry getClasspath
Replies the detected classpath.
java.util.Comparator<T> getCPEntryComparator
Replies the comparator of classpath entries.
protected static org.eclipse.core.runtime.IPath getFolderPath(IPath,IPath)
Replies the folder path.
org.eclipse.core.runtime.IPath getOutputLocation
Replies the detected output location.
protected boolean isValidJavaCUName(String)
Replies if the given name is valid for a Java compilation unit.
protected boolean isValidSarlCUName(String)
Replies if the given name is valid for a SARL compilation unit.
boolean visit(IResourceProxy)
protected void visitJavaCompilationUnit(IFile)
Visit the given Java compilation unit.
protected void visitSarlCompilationUnit(IFile)
Visit the given SARL compilation unit.
Property Details
classpath
val classpath : org.eclipse.jdt.core.IClasspathEntry
Replies the detected classpath.

This property is an alias for the action: getClasspath

Returns:
the classpath.
cPEntryComparator
val cPEntryComparator : java.util.Comparator<T>
Replies the comparator of classpath entries.

This property is an alias for the action: getCPEntryComparator

Returns:
the comparator
outputLocation
val outputLocation : org.eclipse.core.runtime.IPath
Replies the detected output location.

This property is an alias for the action: getOutputLocation

Returns:
the output location.
Constructor Details
new(IProject,SarlDefaultClassPathProvider,IProgressMonitor)
new(IProject,SarlDefaultClassPathProvider,IProgressMonitor)

throws org.eclipse.core.runtime.CoreException

Constructor.
Parameters:
project - the project to scan.
monitor - the progress monitor.
defaultCPProvider - the provider of default classpath.
Throws exception:
  • org.eclipse.core.runtime.CoreException: if is it impossible to scan the project.
Action Details
addToMap(Map<K,V>,IPath,IPath)
protected def addToMap(Map<K,V>,IPath,IPath)
Utility function for updating the given map.
Parameters:
map - the map to update.
folderPath - the folder patth.
relPath - the sub path.
detectClasspath
protected def detectClasspath

throws org.eclipse.core.runtime.CoreException

Detect the classpath components.
Throws exception:
  • org.eclipse.core.runtime.CoreException: in case of any failure.
  • org.eclipse.core.runtime.OperationCanceledException: a runtime exception
detectLibraries(List<E>,IPath)
protected def detectLibraries(List<E>,IPath)
Detect the libraries.
Parameters:
cpEntries - the classpath entries to be updated with libraries.
outputLocation - the detected output location.
detectOutputFolder
protected def detectOutputFolder : org.eclipse.core.runtime.IPath

throws org.eclipse.core.runtime.CoreException

Detect the output folder for binary files.
Returns:
the detected output folder.
Throws exception:
  • org.eclipse.core.runtime.CoreException: in case of any failure.
detectSourceFolders(List<E>)
protected def detectSourceFolders(List<E>)
Detect the source folders according to the Java and SARL conventions.
Parameters:
resEntries - the list of entries that should be updated.
findInSourceFolders(IPath)
protected def findInSourceFolders(IPath) : org.eclipse.core.runtime.IPath
Retrieve the source folder for the given path.

This function assumes that the list of files in the source folders are known.
Parameters:
path - the path to check.
Returns:
the source folder or null if the path is not inside a source folder.
getClasspath
def getClasspath : org.eclipse.jdt.core.IClasspathEntry
Replies the detected classpath.
Returns:
the classpath.
getCPEntryComparator
def getCPEntryComparator : java.util.Comparator<T>
Replies the comparator of classpath entries.
Returns:
the comparator
getFolderPath(IPath,IPath)
protected def getFolderPath(IPath,IPath) : org.eclipse.core.runtime.IPath
Replies the folder path.
Parameters:
packPath - the path to path.
relpath - the relative path.
Returns:
the folder path or null if it cannot be computed.
getOutputLocation
def getOutputLocation : org.eclipse.core.runtime.IPath
Replies the detected output location.
Returns:
the output location.
isValidJavaCUName(String)
protected def isValidJavaCUName(String) : boolean
Replies if the given name is valid for a Java compilation unit.
Parameters:
name - the name to test.
Returns:
true if the name is valid.
isValidSarlCUName(String)
protected def isValidSarlCUName(String) : boolean
Replies if the given name is valid for a SARL compilation unit.
Parameters:
name - the name to test.
Returns:
true if the name is valid.
visit(IResourceProxy)
def visit(IResourceProxy) : boolean
visitJavaCompilationUnit(IFile)
protected def visitJavaCompilationUnit(IFile)
Visit the given Java compilation unit.
Parameters:
jfile - the compilation unit.
visitSarlCompilationUnit(IFile)
protected def visitSarlCompilationUnit(IFile)
Visit the given SARL compilation unit.
Parameters:
sfile - the compilation unit.