How to get an IResource from an ICompilationUnit

1

I'm doing a plugin in eclipse and when I select a java class in the Package Explorer I end up getting an object of type ICompilationUnit , but I need an IResource strong>, what can be done?

    
asked by anonymous 12.02.2014 / 21:31

1 answer

2

try the getUnderlyingResource() method:

  public IResource obterIResourceDe(ICompilationUnit unit) {
    return unit.getUnderlyingResource();
  }

of the documentation Javadoc .

    
13.02.2014 / 07:56