Files
openide/docs/getting-service.puml
Vladimir Krivosheev c2b2520994 new plugin descriptor format - full support on all levels
GitOrigin-RevId: 718c9401f22900c30029ec62c23f60f6f22278ee
2021-05-27 20:17:14 +00:00

55 lines
1.5 KiB
Plaintext

@startuml
!include jb-plantuml-theme.puml
: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 [[http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_services.html?search=ser#light-service Light Service]]) then (yes)
else (no)
if (Is [[http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_services.html?search=ser#how-to-declare-a-service 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