Example usage for org.eclipse.jdt.internal.core PackageFragmentRootInfo setSourceMapper

List of usage examples for org.eclipse.jdt.internal.core PackageFragmentRootInfo setSourceMapper

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core PackageFragmentRootInfo setSourceMapper.

Prototype

protected void setSourceMapper(SourceMapper mapper) 

Source Link

Document

Sets the SourceMapper for this root.

Usage

From source file:org.eclipse.che.jdt.internal.core.PackageFragmentRoot.java

License:Open Source License

/**
 * @see org.eclipse.jdt.internal.core.JavaElement
 *//*from   w w  w .ja va  2s.  co  m*/
public SourceMapper getSourceMapper() {
    SourceMapper mapper;
    try {
        PackageFragmentRootInfo rootInfo = (PackageFragmentRootInfo) getElementInfo();
        mapper = rootInfo.getSourceMapper();
        if (mapper == null) {
            // first call to this method
            IPath sourcePath = getSourceAttachmentPath();
            IPath rootPath = getSourceAttachmentRootPath();
            if (sourcePath == null)
                mapper = createSourceMapper(getPath(), rootPath); // attach root to itself
            else
                mapper = createSourceMapper(sourcePath, rootPath);
            rootInfo.setSourceMapper(mapper);
        }
    } catch (JavaModelException e) {
        // no source can be attached
        mapper = null;
    }
    return mapper;
}