Status and building/releases of slisson/mps-richtext and mps-multiline plugins on MPS 3.1.x

Hi.
I'm trying to use mps-richtext and/or mps-multiline in MPS 3.1.4.


So far no success.
Is it supported to work with MPS 3.1.x?
Is there a binary release compatible with MPS 3.1.x?


First I tried the binary release - https://github.com/slisson/mps-multiline/releases/download/1.0.1/mps-multiline-1.0.1.zip but it does not seem to work and it has been released on April 17th, so probably before MPS 3.1.

Second, downloaded source - https://github.com/slisson/mps-richtext/archive/builds/3.1/135.15.zip .

Ant build fails:

    ~/Downloads/mps-richtext-builds-3.1-135.15
    $  ant build
Buildfile: /Users/karol/Downloads/mps-richtext-builds-3.1-135.15/build.xml

fetchDependencies:

BUILD FAILED
/Users/karol/Downloads/mps-richtext-builds-3.1-135.15/build.xml:167: src '/Users/karol/Downloads/mps-multiline/build/artifacts/mps-multiline/mps-multiline.zip' doesn't exist.

Total time: 0 seconds
prettyPrint();
I've Tried to put something into that mps-multiline/mps-multiline.zip path. No success.

Then I tried opening mps-richtext-builds-3.1-135.15 in MPS GUI.

A lot of errors:

java.lang.UnsupportedClassVersionError : de/slisson/mps/editor/multiline/Language : Unsupported major.minor version 51.0
prettyPrint();
=> is Java 1.7 required? But I'm on a mac, so 1.6 seems recommended as per https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under .
Please comment on that. Has anyone worked on that on a mac (and java 1.7)?


dependency on a module not visible from current build project: b0f8641f-bd77-4421-8425-30d9088a82f7(org.apache.commons)
prettyPrint();

Please advise on possible ways to proceed.

I'm also thinking of becoming a contributor and/or helping to publish binary releases.

Thank you.

Best Wishes,
Karol Depka Pradzinski
24 comments
Hi again.
I've managed to fix some of the errors.

Remaining problem is: https://youtrack.jetbrains.com/issue/MPS-20627 - java.lang.NoSuchMethodError: jetbrains.mps.nodeEditor.EditorComponent.addCellDependentOnNodeProperty(Ljetbrains/mps/nodeEditor/cells/EditorCell_Property;Ljetbrains/mps/util/Pair;)V

Although such a method seems to exist in my installation:

public void addCellDependentOnNodeProperty(EditorCell cell, Pair<SNodeReference, String> pair) { /*compiled code*/ }
prettyPrint();

Alexander Shatalin suggests, in the bug comments:
recompile of the used code should solve this problem


But I'm just doing Build -> Rebuild Project, when the problem happens; so, one could think that it is recompiled; unless he means some other code to be recompiled.

Any help appreciated.

Best Wishes,
Karol Depka Pradzinski
0
I've changed approach to try to compile mps-multiline instead of mps-richtext.

Got blocked on this:


couldn't resolve reference 'baseMethodDeclaration' from [operation] InstanceMethodCallOperation <no ref>[6159071989902664631] in de.slisson.mps.editor.multiline.cells@0
 -- target model 'f:java_stub#1ed103c3-3aa6-49b7-9c21-6765ee11f224#jetbrains.mps.nodeEditor(MPS.Editor/jetbrains.mps.nodeEditor@java_stub)' doesn't contain node with id=~EditorComponent.addCellDependentOnNodeProperty(jetbrains.mps.nodeEditor.cells.EditorCell_Property,jetbrains.mps.util.Pair):void

couldn't resolve reference 'baseMethodDeclaration' from [operation] InstanceMethodCallOperation <no ref>[6159071989902664631] in de.slisson.mps.editor.multiline.cells@7_1
 -- target model 'f:java_stub#1ed103c3-3aa6-49b7-9c21-6765ee11f224#jetbrains.mps.nodeEditor(MPS.Editor/jetbrains.mps.nodeEditor@java_stub)' doesn't contain node with id=~EditorComponent.addCellDependentOnNodeProperty(jetbrains.mps.nodeEditor.cells.EditorCell_Property,jetbrains.mps.util.Pair):void

couldn't resolve reference 'baseMethodDeclaration' from [expression] StaticMethodCall <no ref>[9030445917800605079] in de.slisson.mps.editor.multiline.cellProviders@0
 -- target model 'r:c3548bac-30eb-4a2a-937c-0111d5697309(jetbrains.mps.lang.smodel.generator.smodelAdapter)' doesn't contain node with id=1287809918884497391

No input. Skipping optional target.
No input. Skipping optional target.
Model de.slisson.mps.editor.multiline.sandbox.sandbox uses language de.slisson.mps.editor.multiline.demolang which is missing (likely is not yet generated or is a bootstrap dependency)
skip model "de.slisson.mps.editor.multiline.sandbox.sandbox@0" : no generator available

"textGen" target execution time: 2489 ms
prettyPrint();

Any help appreciated.
Karol
0
Here you can download a collection of editor plugins for MPS 3.1.4 that contains multiline and richtext: https://github.com/slisson/mps-all/releases/download/v2.0.0/mps-sl-all-2.0.0.zip

Extract this zip into your MPS plugins folder.
0
Thank you very much. It seems to work.
I will test this some more.
I'm also happy to see some more goodies there - will check them out.
Maybe this link could be put into the wiki on github?

Anyway, I hope to gradually learn more to be able to build all that from source, and hopefully also contribute.
Do you accept contributors?

Have a nice weekend,
Karol
0
Because I have multiple plugins with dependencies between them, there is one parent build project for all of them. I don't maintain the the build script inside the multiline and richtext projects anymore and have delete them now. To build from source checkout the project from https://github.com/slisson/mps-all.git and run the build script in it:

git clone https://github.com/slisson/mps-all.git
cd mps-all
git submodule update --init --recursive
ant
prettyPrint();

If you have done a valuable change, you can send me pull request on github.
0
Hi Sascha.
Thank you very much!

This info about build script helps me understand why I've run at the initial ant build problems described.
I was suspecting that there might be some crucial outer-level dir layout required (makes sense and I had such thing as well in some modular projects).
I appreciate that you deleted the older script.

Tried out your instructions. Went fine until "ant". Error:

BUILD FAILED
/A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build.xml:2011: srcdir "/A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/mps-math/solutions/de.itemis.mps.editor.math.runtime/source_gen" does not exist!

I've mkdir-ed a series of such directories and it went through till:


declare-mps-tasks:
  [taskdef] Could not load definitions from resource jetbrains/mps/build/ant/antlib.xml. It could not be found.

assemble:
    [mkdir] Created dir: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/artifacts/mps-sl-all
    [mkdir] Created dir: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/tmp/mps-sl-all/default/mps-sl-all.zip
    [mkdir] Created dir: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/tmp/mps-sl-all/default/mps-sl-all.zip/de.slisson.mps.all
    [mkdir] Created dir: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/tmp/mps-sl-all/default/mps-sl-all.zip/de.slisson.mps.all/META-INF
    [mkdir] Created dir: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/tmp/mps-sl-all/default/mps-sl-all.zip/de.slisson.mps.all/languages
    [mkdir] Created dir: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/tmp/mps-sl-all/default/mps-sl-all.zip/de.slisson.mps.all/languages/de.slisson.mps.all
    [mkdir] Created dir: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/tmp/mps-sl-all/default/de.slisson.mps.all.build.jar
    [mkdir] Created dir: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/tmp/mps-sl-all/default/de.slisson.mps.all.build.jar/META-INF
      [jar] Building jar: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/tmp/mps-sl-all/default/mps-sl-all.zip/de.slisson.mps.all/languages/de.slisson.mps.all/de.slisson.mps.all.build.jar

BUILD FAILED
/A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build.xml:58: Problem: failed to create task or type copyModels
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.


Total time: 0 seconds



And I'm not an ant expert [yet] ;), so how do I handle the missing "jetbrains/mps/build/ant/antlib.xml" ?
I understand, that antlib.xml is somewhere in MPS [repo], but how do I point to it?

But probably building using MPS UI (to be able to make modifications to the source) will give me much more benefit than ant, right?

So... building in MPS 3.1.4 UI also fails for me as of now:

cannot calculate type for closure literal
-- -- was input node: [actualArgument] ClosureLiteral <no ref>[8417783717434296442] in de.itemis.mps.editor.diagram.runtime.model@0
-- was template node: r:00000000-0000-4000-0000-011c8959033a(jetbrains.mps.baseLanguage.closures.generator.baseLanguage.template.main@generator)/349397194808798475
error invocation method: "referenceMacro_GetReferent_349397194808798636" in jetbrains.mps.baseLanguage.closures.generator.baseLanguage.template.main.QueriesGenerated
(java.lang.RuntimeException): error invocation method: "referenceMacro_GetReferent_349397194808798636" in jetbrains.mps.baseLanguage.closures.generator.baseLanguage.template.main.QueriesGenerated
cannot evaluate reference macro, exception was thrown
-- -- was input node: [actualArgument] ClosureLiteral <no ref>[8417783717434296442] in de.itemis.mps.editor.diagram.runtime.model@0
model "de.itemis.mps.editor.diagram.runtime.model@0" has been generated with errors
generation completed with errors in 1119 ms
Error executing target jetbrains.mps.lang.core.Generate.generate
"generate" target execution time: 1121 ms
Other targets execution time: 10 ms; preloadModels: 7 ms, configure: 3 ms, checkParameters: 0 ms
Make failed. See previous messages for details.
prettyPrint();

Reported something related as well, just in case it is a bug in MPS itself: https://youtrack.jetbrains.com/issue/MPS-20654 .


Any help appreciated.
0
While I still hope for some help regarding my previous post, here is another post:
regarding contributions, I was thinking of improving the font of the selected text in mps-multiline/richtext. The font appears different from the rest of the text and is not antialiased. At least on the Mac - screenshot attached - /_persistent/Screenshot%202014-10-20%2018.27.07.png?file=29-3928&v=0&c=true . Maybe this is not a show stopper, but it is very user-facing so it could become annoying/distracting, perhaps lowering the confidence in that component.
Would you think that this is suitable to "get my feet wet" on a "lower-hanging fruit"?
Perhaps you have some list of other "lower hanging fruit" that I could consider tackling?
I have a lot of Swing experience and, [I believe,] deep experience with Java, plus big interest in MPS.
I believe in scratching one's own itch, but I could accept any task as a warm-up.
I've taken a look at https://github.com/slisson/mps-richtext/issues and https://github.com/slisson/mps-multiline/issues , but I think it would be better if you make an explicit suggestion.
Another potential thing is support for mouse-dragging-to-select-text range; although this seems somewhat more difficult.

I'm writing all this, because:
  • I would like to contribute out of appreciation and to help the project(s). I would be honored and excited to be able to contribute.
  • this could provide a gentle opportunity towards becoming MPS contributor in general
  • my company, under my "stewardship", is now expanding its use of MPS, and part of that expansion implies getting more comfortable with mps-multiline and/or mps-richtext. We hope to use mps-richtext for interlinked documentation for our DSL-ized communication protocol schemas. Noting here, that I'm very interested in MPS on my own anyway, working with MPS on the weekends as well.

Any comments appreciated.

Thank you again.

Best Wishes,
Karol Depka Pradzinski
0
Sorry, that's my fault. You have to pass the path to your MPS folder to ant:

ant -Dmps.home=/path/to/mps
prettyPrint();
0
I managed to build it in MPS 3.1.4 UI, after removing some modules which were causing build problems (the graph-related things, I think).


Where is the drawing code for EditorCell_Word (so that I can see how the selection is drawn and why the font is different) ?
So far I haven't found anything with "draw" or "Graphics" in it...
0
Thank you!
It worked with "ant -Dmps.home=/Applications/MPS\ 3.1.4.app/Contents/" :


...

      [zip] Building zip: /A/Sync/A/PerDevice/MacOblong/Repos/MPS/mps-all/build/artifacts/mps-sl-all/mps-sl-all.zip

build:

BUILD SUCCESSFUL
Total time: 1 minute 15 seconds



Still please look at my question about where EditorCell_Word is being painted.

Good Night.
0
Could it be, that the incorrect font issue is originating in MPS's own EditorCell_Label ?
But I haven't noticed the issue in "vanilla" MPS...

Maybe it has something to do with this.getStyle() ?
0
The painting of the selection is done in MultilineSelection.paintSelection.

At the moment there is nothing to do in the multiline and richtext projects that we need. If you are interested in developing MPS extensions in general and not only in these two project, you can take a look at my other projects. There is a lot of work to do. For example the tables or the diagram editor. I am very active on the second project at the moment and help on that one is most valuable.
0
I've found a "paintLine" method. Not sure if this is relevant... ?

public void paintLine(Graphics g, int start, int end, Color color, boolean border) { 
  Rectangle rect = getCharacterBounds(start).union(getCharacterBounds(end)); 
  g.setColor(color); 
  g.fillRect(rect.x, rect.y, rect.width, rect.height); 
  if (border) { 
    g.setColor(color.darker()); 
    g.drawRect(rect.x, rect.y, rect.width, rect.height); 
  } 
     
  Shape originalClip = g.getClip(); 
  g.setClip(rect); 
  int wordStartPos = 0; 
  foreach word in getWordCells() { 
    int wordEndPos = wordStartPos + word.getTextLengthIncludingSeparator(); 
    if (wordEndPos >= start && wordStartPos <= end) { 
      // word.setSelectionEnd(0); 
      g.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 100)); 
      // NOTE MY CHANGE ABOVE 
      word.paint(g, ParentSettings.createSelectedSetting(true)); 
    } 
    wordStartPos = wordEndPos; 
  } 
  g.setClip(originalClip); 
     
     
}
prettyPrint();

My experimental change (marked with "NOTE MY CHANGE ABOVE" ) does not seem to have effect after rebuilding...
Is this the right place at all?
0
Yay, I managed to change selection color to red (experimentally), so it is that place... Not sure how to change font yet, though.
0
Yay, I've managed to set antialiasing there.
Via:
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 
// Antialiasing: http://www.javalobby.org/forums/thread.jspa?forumID=61&threadID=14179
prettyPrint();
Looks better now.

I think I'm gonna make a pull request tomorrow, right?
Screenshot with antialiasing: /_persistent/Screenshot%202014-10-20%2021.57.03.png?file=29-3934&v=0&c=true

Btw, the attached images seem to no longer show up in the forum, right? Is this a bug?
0
@slisson: Will you accept this as a pull request?
0
There is an option in Preferences -> IDE Settings -> Editor -> Use Antialiasing. We only want to set the rendering hint, if this option is enabled. If you do that, I will accept your pull request.
0
Sure, I will try to use that option.
Perhaps you have some hint or code snippet on how to read the value of that option (or any option by analogy)?

Thank you.
0
Just call this method before painting the selection:
jetbrains.mps.nodeEditor.EditorComponent.turnOnAliasingIfPossible(g);
prettyPrint();
0
turnOnAliasingIfPossible

Thank you.
Will try it.
Btw, shouldn't it be called turnOn**Anti**AliasingIfPossible ?
0
Hi.
I created the pull request.
Sorry it took so long (we are nearing a product release at my dayjob).

https://github.com/slisson/mps-multiline/pull/7 - Turning on antialiasing in MultilineSelection, via EditorComponent.turnOnAliasingIfPossible(g)

It's just a single-line change, so I hope there won't be any problem accepting this change.
0
@Sascha Lißon,
Hi.
Thank you for mentioning contribution opportunities in the tables and diagram editors.
Those are very interesting topics.
For now, to be honest I don't have an itch to scratch there, as I don't use them [yet].
I will keep them in mind.

By the way, Sascha are you on LinkedIn?

Best Regards,
Karol
0
If you could pick some task that would be easy to digest by a newcomer, in the diagram editor, I will take a look and will try to help.
Best,
Karol
0
Thanks again for your helpful hints about the build, repo structure and antialiasing.
0

Please sign in to leave a comment.