mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
plugin_services.md: add flowgraph
This commit is contained in:
parent
2ecb61eca0
commit
5d5ac1796d
53
buildUML/basics/getting-service.puml
Normal file
53
buildUML/basics/getting-service.puml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
@startuml
|
||||||
|
:getService;
|
||||||
|
note right
|
||||||
|
In any thread.
|
||||||
|
Get on demand only.
|
||||||
|
Do not cache result.
|
||||||
|
Do not request in constructor unless needed.
|
||||||
|
end note
|
||||||
|
|
||||||
|
if (Is Light Service) then (yes)
|
||||||
|
else (no)
|
||||||
|
if (Is Service Declaration Found) then (yes)
|
||||||
|
else (no)
|
||||||
|
:Return ""null"";
|
||||||
|
detach
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (Is Created and Initialized?) then (yes)
|
||||||
|
else (no)
|
||||||
|
if (Is Container Active?) then (active)
|
||||||
|
partition "synchronized on service class" {
|
||||||
|
if (Is Created and Initialized?) then (yes)
|
||||||
|
else (no)
|
||||||
|
if (Is Initializing?) then (yes)
|
||||||
|
:Throw ""PluginException""
|
||||||
|
Cyclic Service Initialization;
|
||||||
|
detach
|
||||||
|
else (no)
|
||||||
|
partition "non cancelable" {
|
||||||
|
:Create Instance]
|
||||||
|
note right
|
||||||
|
Avoid getting other services to reduce initialization tree.
|
||||||
|
As less dependencies, as more faster and reliable.
|
||||||
|
end note
|
||||||
|
|
||||||
|
:Register to be Disposed on Container Dispose
|
||||||
|
if Implements ""Disposable""]
|
||||||
|
:Load Persistent State
|
||||||
|
if Implements ""PersistentStateComponent""]
|
||||||
|
}
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
}
|
||||||
|
else (disposed or dispose in progress)
|
||||||
|
:Throw ""ProcessCanceledException"";
|
||||||
|
detach
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
:Return Instance;
|
||||||
|
|
||||||
|
@enduml
|
150
images/basics/plugin_structure/img/getting_service.svg
Normal file
150
images/basics/plugin_structure/img/getting_service.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 22 KiB |
@ -99,6 +99,12 @@ val projectService = project.service<MyProjectService>()
|
|||||||
|
|
||||||
</tabs>
|
</tabs>
|
||||||
|
|
||||||
|
<procedure title="Getting Service Flow" initial-collapse-state="collapsed">
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
</procedure>
|
||||||
|
|
||||||
## Project Service Sample
|
## Project Service Sample
|
||||||
This minimal sample shows [Light Service](#light-services) `ProjectService` interacting with another project level service `AnotherService` (not shown here).
|
This minimal sample shows [Light Service](#light-services) `ProjectService` interacting with another project level service `AnotherService` (not shown here).
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user