Skip to content

Commit

Permalink
Add information on how to access the project from a tool window
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderpann committed Jul 12, 2024
1 parent 77a6978 commit 9d44157
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/doc/docs/platform_essentials/accessing_the_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Intentions always have the `editorContext` available and can access the project

The project expression is available in tests, although you should only need it when invoking the generator or resolving nodes through the global repository.

### Tool Window

val dataContext = DataManager.getInstance().getDataContext(toolWindow.component)
val project = MPSDataKeys.PROJECT.getData(dataContext)
val mpsProject = MPSDataKeys.MPS_PROJECT.getData(dataContext)

### Plugin Solution/Plugin Aspect

If you need access to the project object, you can use a project plugin with an MPSProject instance in the init and dispose block. You can pass the instance to other classes as well. To get the IntelliJ project use `#!java ProjectHelper.toIdeaProject(project)`.
Expand Down

0 comments on commit 9d44157

Please sign in to comment.