Bug 494646 - Service methods completion in VSMs do not work if the service class is imported through Import-Package
Summary: Service methods completion in VSMs do not work if the service class is import...
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-05-26 08:46 EDT by Pierre-Charles David CLA
Modified: 2016-06-03 07:54 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Charles David CLA 2016-05-26 08:46:01 EDT
If a VSM depends on a service class which is provided by a different project (different from the VSP), of the dependency is declared with a plain Import-Package clause, completion (at least) does not work: the "Java extension" class is not found, causing a stack like this:

java.lang.RuntimeException
	at org.eclipse.sirius.common.tools.internal.interpreter.ServiceInterpreter$1.notFound(ServiceInterpreter.java:82)
	at org.eclipse.sirius.common.tools.api.interpreter.JavaExtensionsManager.notFound(JavaExtensionsManager.java:541)
	at org.eclipse.sirius.common.tools.api.interpreter.JavaExtensionsManager.loadJavaExtensions(JavaExtensionsManager.java:534)
	at org.eclipse.sirius.common.tools.api.interpreter.JavaExtensionsManager.reloadIfNeeded(JavaExtensionsManager.java:243)
	at org.eclipse.sirius.common.tools.internal.interpreter.ServiceInterpreter.getServices(ServiceInterpreter.java:269)
	at org.eclipse.sirius.common.ui.tools.internal.interpreter.ServiceProposalProvider.getProposals(ServiceProposalProvider.java:71)
	at org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter.getProposals(CompoundInterpreter.java:679)
	at org.eclipse.sirius.ui.tools.api.assist.TextContentProposalProvider.getProposals(TextContentProposalProvider.java:85)
	at org.eclipse.jface.fieldassist.ContentProposalAdapter.getProposals(ContentProposalAdapter.java:2005)

Changing the VSP's MANIFEST.MF to use a full Require-Bundle fixes the issue.

At first glance, it seems to be caused by org.eclipse.sirius.common.tools.internal.interpreter.BundleClassLoading.getBundleDependencies(String), which looks for dependencies only through BundleRevision.BUNDLE_NAMESPACE, but should probably look into BundleRevision.PACKAGE_NAMESPACE.

Steps to reproduce:
1. Create a new VSP.
2. Add a Viewpoint and a Diagram Description.
3. In the Viewpoint, declare a Java extension for org.eclipse.sirius.ext.emf.edit.EditingDomainServices
4. In the VSP's MANIFEST.MF, add an Import-Package for org.eclipse.sirius.ext.emf.edit.
5. In the VSM's Diagram Description, set the Domain Class to "ecore.EPackage", and in the "Precondition Expression" enter "service:"
6. Hit Ctrl-Space to trigger completion => the stack above appears in the error log and no completion is proposed.
7. In the VSP's MANIFEST.MF, remove the Import-Package and addd a Require-Bundle to org.eclipse.sirius.ext.emf.edit.
8. Got back to step 6: completion now finds all the services in EditingDomainServices.