How to get an Iresource from an Icompilationunit

Asked

Viewed 37 times

1

I am making a plugin in eclipse and when I select a java class in Package Explorer I end up receiving an object of the type Icompilationunit, but I need a Iresource, what can be done ?

1 answer

2


try the method getUnderlyingResource():

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

of documentation Javadoc.

  • Thank you very much, it worked perfectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.