How to check pattern in TransformationMenu properly? Follow
I want to check user's input and use for this e.g. pattern.equalsIgnoreCase("string") method
But this condition is always false. I check with message info what pattern is and it is "string". But condition does not work
where is error?
Btw the following works fine for me in another TransformationMenu
Please sign in to leave a comment.
so, your "text" action part is invoked for each keystroke. Since you return "null", MPS will not continue matching and abort the side transformation, is my understanding.
In other words, you don't have to match the input yourself, you just provide the string that MPS should match against. So, your text action part should return "string".
While the user is typing in the editor within the context of your side transformation, the input is matched against your "string" as long as the user types 's' 't' 'r' 'i' and so forth. You can see the input in the editor as long as it does not fully match.
As soon as the input matches the string you return, the "execute" action part is invoked.
By default, the match MPS performs seems to be case sensitive. To make it ignore casing, maybe try this:
small correction on my part: in my demo it does work if I return "null" instead of "string" as the default case.But I have to type a "space" first before my input is being recognized by the side transformation. So maybe this was your problem: returning "null" in the text action part instead of "string"?
In text function just return pattern.
And in "can execute" function check the pattern for matching
Thank you, I will try some variations