Example usage for org.eclipse.jdt.core IJavaProject getOpenable

List of usage examples for org.eclipse.jdt.core IJavaProject getOpenable

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IJavaProject getOpenable.

Prototype

IOpenable getOpenable();

Source Link

Document

Returns the first openable parent.

Usage

From source file:org.eclipse.team.svn.resource.ignore.rules.jdt.JDTIgnoreRecommendations.java

License:Open Source License

public boolean isOutput(IResource resource) throws CoreException {
    IProject project = resource.getProject();
    if (project == null) {
        return false;
    }//  w ww  .j  a  v a  2  s  .  c  o  m
    IJavaProject javaProject = JavaCore.create(project);
    IPath output = javaProject.getOutputLocation();
    // if this resource not in the output folder or the project itself is the output folder then no need to ignore it
    if (!output.isPrefixOf(resource.getFullPath()) || output.equals(project.getFullPath())) {
        return false;
    }
    if (!"bin".equals(output.lastSegment())) { //default folder name used in eclipse while creating project with separate source and binary folders
        IOpenable openable = javaProject.getOpenable();
        if (openable.isOpen()) { // do not start any time consuming process
            IPackageFragmentRoot[] roots = JavaCore.create(project).getPackageFragmentRoots();
            for (int i = 0; i < roots.length; i++) {
                if (output.isPrefixOf(roots[i].getPath())) {
                    return false;
                }
            }
        }
    }
    return true;
}