Skip to content

Commit

Permalink
Improve services examples (JetBrains#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad authored and ignatov committed Jan 23, 2017
1 parent 146e1d5 commit 56c484a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions basics/plugin_structure/plugin_services.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ To clarify the service declaration procedure, consider the following fragment of
```xml
<extensions defaultExtensionNs="com.intellij">
<!-- Declare the application level service -->
<applicationService serviceInterface="Mypackage.MyServiceInterfaceClass" serviceImplementation="Mypackage.MyServiceImplClass" />
<applicationService serviceInterface="Mypackage.MyApplicationService" serviceImplementation="Mypackage.MyApplicationServiceImpl" />

<!-- Declare the project level service -->
<projectService serviceInterface="Mypackage.MyProjectServiceInterfaceClass" serviceImplementation="Mypackage.MyProjectServiceImplClass" />
<projectService serviceInterface="Mypackage.MyProjectService" serviceImplementation="Mypackage.MyProjectServiceImpl" />
</extensions>
```

Expand All @@ -44,7 +44,11 @@ To clarify the service declaration procedure, consider the following fragment of
To instantiate your service, in Java code, use the following syntax:

```java
MyServiceImplClass service = ServiceManager.getService(MyServiceImplClass.class);
MyApplicationService applicationService = ServiceManager.getService(MyApplicationService.class);

MyProjectService projectService = ServiceManager.getService(project, MyProjectService.class);

MyModuleService moduleService = ModuleServiceManager.getService(module, MyModuleService.class);
```

### Sample Plugin
Expand Down

0 comments on commit 56c484a

Please sign in to comment.