Extending UI via plugin

I got a problem with creating plugin for my language. I looked up to MPS source and did the same way. I created an action:

action ShowTemplateDebuggerHelper {       
  mnemonic: <no mnemonic>  
  execute outside command: false          
  also available in: << ... >>            
            
  caption: Show Template Debugger         
  description: <no description>           
  keystroke: <no keystroke>
  icon: <no icon> [JComponent javax.swing.JButton[,311,154,43x26,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1c84885,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=...,defaultCapable=true] ]
            
  construction parameters  
    << ... >>              
            
  action context parameters ( always visible = false )   
    Project project key: PROJECT required 
            
  <update block>           
            
  execute(event)->void { 
  this.project.tool<TemplateDebuggerHelper>.openToolLater(true); 
}         
            
  additional methods       
            
  << ... >> 
}           
prettyPrint();

Then I created a tool:

tool TemplateDebuggerHelper {            
  caption: <use name>     
  number: 7 ( show keystroke:  Alt-7 )   
  icon: <no icon> [JComponent javax.swing.JButton[,155,64,43x26,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@1c84885,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=...,defaultCapable=true] ]
           
  private JComponent component;          
           
  init(project)->void { 
  this.component = new TemplateDebuggerHelper(project); 
}   
           
  <no toolDisposeBlock>   
           
  getComponent()->JComponent { 
  this.component; 
}    
           
  << ... >>
}          
prettyPrint();

And a class TemplateDebuggerHelper that extends JPanel. I've tried regeneration file of my language and creating seperate projectm that uses it, and even restarting MPS, but "Tools" menu is not updated with specified action and I can't see my tool in UI.

I can't understand what is wrong, please help me. I'm wondering is it supported in MPS 1.5.1? Can anybody provide a simple working example?
1 comment
Comment actions Permalink
Hi Gleb,

have a look at https://github.com/mpSamples and especially https://github.com/mpSamples/mps.samples.plugin for your case.
Hope that helps.

Regards, Mirko
0

Please sign in to leave a comment.