Bug 475176 - Remove the dependency to Acceleo MTL from Sirius Interpreter
Summary: Remove the dependency to Acceleo MTL from Sirius Interpreter
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 3.1.0   Edit
Assignee: Maxime Porhel CLA
QA Contact: Julien Dupont CLA
URL:
Whiteboard:
Keywords: triaged
Depends on: 475131
Blocks:
  Show dependency tree
 
Reported: 2015-08-17 10:59 EDT by Stephane Begaudeau CLA
Modified: 2015-10-16 09:10 EDT (History)
4 users (show)

See Also:


Attachments
interpreter view with only one contribution (94.68 KB, image/png)
2015-09-01 09:07 EDT, Maxime Porhel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane Begaudeau CLA 2015-08-17 10:59:44 EDT
The bundle org.eclipse.sirius.interpreter depends on org.eclipse.sirius.common.acceleo.aql.ide to provide some preferential treatment to the MTL interpreter. The problem comes from this method: org.eclipse.sirius.common.acceleo.interpreter.SiriusContentAssistProcessor.CompletionProposalConverter.apply(ContentProposal) which is using the classes AcceleoContentProposal and AcceleoCompletionProposal.

Using the new completion proposal API, ContentProposal2, the MTL interpreter can provide almost the same behavior using the new API but one issue remain: How can we return the image of the content proposal?

Removing this dependency to switch to the new API would also have several advantages. We could have the support for the Acceleo 3 Interpreter View without having to provide the Acceleo MTL interpreter (for those who only want to use the AQL one for example) and other interpreters (AQL, feature:, service:, var:) could provide images for their completion proposals.

Yet the class ContentProposal2 cannot depend on the user interface so we could improve it to support images using one of the following solutions:

1 - Add a method returning an Object like the EMF LabelProvider

public class ContentProposal2 {
    ...

    public Object getImage() {}
}

With such a solution, the SiriusContentAssistProcessor would have to figure out what kind of Object has been returned (URI, URL, Image, ImageDescription, EMF's URI, etc) and then load the image accordingly. It is easy to create the proposal but quite complicated to process it to retrieve the image for JFace (which want an Image). We could thus add another method indicating what kind of image object is provided.

public class ContentProposal2 {
    ...

    public Object getImage() {}

    public ImageKind getImageKind() {}

    public static enum ImageKind {
        JAVA_URI, EMF_URI, JAVA_URL, JFACE_IMAGE, JFACE_IMAGE_DESCRIPTOR
    }
}

This enumeration would make it easier to process the image returned and it would let the Acceleo MTL interpreter provide an image directly quite easily without having to make the ContentProposal depends on an UI bundle. This change would not have a major impact on the Acceleo MTL interpreter.


2 - Add a method with a specific type (URI? URL?)

We could also choose a specific type and impose it to everybody. We would just a to select a specific type.

public class ContentProposal2 {
    ...

    public java.net.URI getImage() {}
}


Any opinion?
Comment 1 Eclipse Genie CLA 2015-08-27 08:33:16 EDT
New Gerrit change created: https://git.eclipse.org/r/54689
Comment 3 Pierre-Charles David CLA 2015-08-31 09:59:02 EDT
Fixed by 78c1e69a8c11221ec03652dd2809dc0ede1e41e3.
Comment 4 Maxime Porhel CLA 2015-09-01 09:07:05 EDT
Created attachment 256287 [details]
interpreter view with only one contribution

The title interpreter view does not allow to choose between the Sirius Interpreter or the Acceleo Interpreter: this might be ok if there is only the Sirius interpreter installed. 

But the view's title (not the tab title, but the titles where we are used to see the interpreter selection combo) is "< > interpreter" -> it should be Sirius Interpreter or Interpreter. 

Furthermore the completion is not working anymore in the view on my environment (tested with var:, feature:, acceleo and aql)
Comment 5 Stephane Begaudeau CLA 2015-09-04 04:43:22 EDT
Maxime's issue was not a real bug but it has highlighted the fact that while the Sirius composed interpreter can be used without a dependency to the Sirius MTL integration, it still has a dependency to Acceleo IDE UI which contribute its own interpreter to the Acceleo Interpreter View.

A new bug detailing this issue can be found here: #476622
Comment 6 Pierre-Charles David CLA 2015-10-16 09:10:22 EDT
Available in Sirius 3.1.0.