Getting Project inside Intention's execute section [without using IOperationContext since it is deprecated]

I am trying to get hold of Project object inside execute section of an Intention. Currently I am using editorContext.getOperationContext().getProject(); for getting project.
But IOperationContext is deprecated(going to be removed). Is there a new way for accomplishing the same?

1
4 comments

Write an action instead and add it to ActionsAsIntentions group.

1

As far as I understand, intentions are designed to be project-independent, editor-only code that manipulates the model and changes the selection, not much else. If you want to do things that involve projects, modules, windows, background tasks and so on, you should use actions. I believe mbeddr's framework will still group your action if you prefix its name with the group name and a colon, e.g. "My Group: My Action".

1

Thanks for the response @Sergej Koščejev . It's working. But is there a way to do the same using Intentions?. Because Intentions can be grouped using mbeddr's frame work. If we use ActionsAsIntentions, we cannot do it.

0

Will check it. Thank you @Sergej Koščejev . 

0

Please sign in to leave a comment.