First, add the following plug-in dependencies to your project ( Require-Bundle in your Manifest.MF):
Then, you can use the following discoverer classes:
For example, to discover a UML model from a Java project:
DiscoverUmlModelWithBidirectionalAssociationsFromJavaProject discoverer = new DiscoverUmlModelWithBidirectionalAssociationsFromJavaProject(); discoverer.discoverElement(javaProject, monitor); Resource umlModel = discoverer.getTargetModel();
To have a monitor to pass to the discoverElement
method, you can either call the discoverer in an Eclipse Job, or pass a new NullProgressMonitor if you don't need progress reporting.