How to invoke ModelChecker from plugin

Hi,

I am trying to force the ModelChecker to be executed before my plugin runs. Is there any way to do this?

Cheers
Yann
0
3 comments
Yann,

Plugin does not "run". It just registers some extensions in MPS. So, correct answer is "no". But, I think, you may need something different. Could you please describe what do you want to make in more details?

Mihail
0
He is probably trying to Check whether a Model is correct before invoking his Plugin/Action. Or at the start of his Plugin.

Like:

CONTEXT_MODEL mdl

execute(event) {
    boolean modelCorrect = ModelChecker.checkModel(mdl);
    
    if(modelCorrect) {
       doSomething();
    } else {
       error "Model incorrect"
    }
}


How to use the MPS ModelChecker (The one MPS invokes when you Rightclick a Model -> Check Model)?
0
Simon,

before invoking his Plugin

There's no any "plugin invocation". No event for that. In some cases, plugins even  work through their xml-descriptor, without any "main plugin class".

before invoking his Action

Sure you can do this. Depending on what you want, you can use ModelChecker class (probably surrounding it with ProgressManager.getInstance().runTask()) or ModelCheckerViewer.prepareAndCheckModels() to perform everything automatically.

But I think the question was not about "how to run", but about "how to do it before some-event-like-plugin-startup", and I'm now trying to recognize which event Yann really needs.
0

Please sign in to leave a comment.