How can i display only substring of a property?


in order to remove the "set" from Setter-Methods, i created an attribute concept with a reference to the setter-Method (InstanceMethodDeclaration). In this attribute concept i used a constraint and changed the presentation there as follows:

link {methodDeclaration}
  referent set handler:<none>
  search scope:
    (model, scope, referenceNode, linkTarget, enclosingNode)->join(ISearchScope | sequence<node< >>) {
  presentation :
    (parameterNode, visible, smartReference, inEditor, model, scope, referenceNode, linkTarget, enclosingNode)->string {, 4).toLowerCase() +;

However, this does only change the presentation in the code completion menu - but not in the final editor. i.e. i removed the "set" in the code completion menu, but after selecting a method, the "set" appears again in the editor ...

Any ideas,
Comment actions Permalink
Hi Dan,

Are you extending the BaseLanguage? What is your setup?
I don't know what you want to do.

The way you need to go, is to define the visualization in the editor.
Or to override the property that is used in the editor for visualisation at the constraints.

If you have a Reference concept (a concept with just one reference to the thing you want to reference e.g. the methoddeclaration) you can define the editor for that concept and use a "read only model access" to only show the substring.

I hope I could help.
Comment actions Permalink
Hi Michael,

thanks for your answer. Yes i m extending the BaseLanguage in order to set properties of java classes more easily. One should simply be able to use text = "test" instead of setText("test"). It does work perfectly, except that i can not remove the set in the editor.

For code completion i use the "presentation" hook in the concept constraints. Work s perfect. (code above) But after selection with code completion (e.g. "text"), the concept editor displays "setText" again.

Where can i define the "read only model access" in the editor? Is it the right solution for me?

Comment actions Permalink
Hi Dan,

the read only model access is available here:

btw. I'm using MPS2.0 but should be availabe in 1.x too.

As far as I understand what you are trying to do, this is already possible in MPS.
When you use MPS's baselang's properties, you can use sth. like
Blub blub = new Blub(); 
blub.someString = "someString";

and generate is

Why do you want to reinvent this?
Comment actions Permalink
Hi Michael,

i m going the opposite direction. I read some apache pivot ClassConcept from stubs and access their properties in a apache pivot editor, without displaying set/get for the accessors ...

From the that editor i generate xml files, but they are also without set/get when accessing properties ..


Please sign in to leave a comment.