Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364088

Summary: Content assistant for Modeling Units
Product: z_Archived Reporter: Davy Meers <davymeers>
Component: MylynAssignee: Project Inbox <mylyn.intent-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 Flags: alex.lagarde: juno+
Version: unspecified   
Target Milestone: 0.7   
Hardware: All   
OS: All   
Whiteboard:

Description Davy Meers CLA 2011-11-17 17:40:16 EST
Currently content assist is available for the structural concepts.
It would be very useful if the content assistant was also available inside a modeling unit.
Comment 1 Alex Lagarde CLA 2011-11-18 03:59:00 EST
Could not agree more.

Actually it's already planned in our roadmap http://www.eclipse.org/intent/pages/transcripts/2011_EclipseConEurope/img24.html .

This completion will work in 2 steps : 

Case 1 : empty modeling unit (@M M@) : we do not know yet what kind of model you are using, so we will propose contribution for all elements already defined elsewhere.

For example, if you defined an EPackage called myEPackage and a EClass called myEClass, inside an empty modeling unit you will have myEPackage and myEClass proposed. Selecting one of them will create a contribution instruction : 
@M 
     myEPackage {

     }
M@

Step 2 : the modeling unit is not empty : then we will propose a "standard" code completion : 

@M
     myEPackage {
         [1] eClassifers += [2] new EClass {
               [3] eSuperTypes += [4] myEClass;
          };
     }
M@

asking for completion in [1] will return all available references/attributes of myEPackage (eClassifiers, nsURI...). 
[2] will return all already definied EClassifiers (myEClass...) and all types that match the type of the eClassifiers reference(EClass, EDatatype...).
[3] will return the same thing as 1 exept that it's computed on EClass instead of EPackage (eSuperTypes, isAbstract...)
[4] will return the same thing as 2 but computed on the eSuperTypes reference instead of EClassifers
Comment 2 Davy Meers CLA 2011-11-18 04:49:46 EST
In addition i would expect the following in case of an empty modeling unit:

* new declaration

	This would result for example in a completion block like:
	new [type] [name]{
		field = value;
	}
	where type provides completion for the available types
	and field provides completion as in [1]

* resource declaration
* maybe other declaration of the intent models

In short: if you ctrl + space in an empty modeling unit i want to get completion which contains all the actions i can do at that moment.

I understand that this is very easy to say and probably not so easy to create but as someone who learns by exploring it would be a great help if i could see the possible actions at any given moment.
Comment 3 Alex Lagarde CLA 2011-11-18 05:15:28 EST
You're right, I forgot to mention it in my answer.

Just keep in mind that for the "new" declarations, as we do not you which resource/element you are going to contribute to, we will propose all [types] available in the Package Registry, which may be way too much information.

But we'll display them anyway, as if user starts to type a [type] name the list will quickly reduce.
Comment 4 Davy Meers CLA 2011-11-28 04:52:31 EST
I do not think the problem of too much information will happen frequently or for a long time.

If it turns out to be a problem you can look into ways to make the content assistance smart:
If for example a user starts typing in a section where most model units are related to certain elements of their model, f.e. acceptancetests, propose those related elements first before the more general element.
Comment 5 Alex Lagarde CLA 2012-01-10 07:10:38 EST
Part of this feature request is covered by commit 851e3f9caa78c9016043d3273f91fdd8b4d653f5

A prototype of completion proposal has been defined. You can test it by downloading the update site produced by Intent nightly builds (https://hudson.eclipse.org/hudson/job/mylyn-docs-intent-0.7-nightly/).
Comment 6 Alex Lagarde CLA 2012-05-25 11:58:08 EDT
Content assistent for Modeling Unit has been defined.