Example usage for org.eclipse.jdt.core.search TypeNameMatch getPackageFragmentRoot

List of usage examples for org.eclipse.jdt.core.search TypeNameMatch getPackageFragmentRoot

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.search TypeNameMatch getPackageFragmentRoot.

Prototype

public IPackageFragmentRoot getPackageFragmentRoot() 

Source Link

Document

Returns the package fragment root of the stored type.

Usage

From source file:org.eclipse.ajdt.internal.corext.util.OpenTypeHistory.java

License:Open Source License

private long getContainerTimestamp(TypeNameMatch match) {
    try {/* w w  w .  j  a  v  a2 s .  com*/
        IType type = match.getType();
        IResource resource = type.getResource();
        if (resource != null) {
            URI location = resource.getLocationURI();
            if (location != null) {
                IFileInfo info = EFS.getStore(location).fetchInfo();
                if (info.exists()) {
                    // The element could be removed from the build path. So check
                    // if the Java element still exists.
                    IJavaElement element = JavaCore.create(resource);
                    if (element != null && element.exists())
                        return info.getLastModified();
                }
            }
        } else { // external JAR
            IPackageFragmentRoot root = match.getPackageFragmentRoot();
            IFileInfo info = EFS.getLocalFileSystem().getStore(root.getPath()).fetchInfo();
            if (info.exists()) {
                return info.getLastModified();
            }
        }
    } catch (CoreException e) {
        // Fall through
    }
    return IResource.NULL_STAMP;
}

From source file:org.nuxeo.ide.sdk.server.ui.OpenClassAction.java

License:Open Source License

@Override
public void acceptTypeNameMatch(TypeNameMatch match) {
    if (this.match == null) {
        this.match = match;
    } else if (!match.getPackageFragmentRoot().isArchive()) {
        this.match = match;
    }/*w  ww  .  j  av a2  s . c o m*/
}