forked from magento/magento2-phpstorm-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.java
40 lines (34 loc) · 1.04 KB
/
Settings.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Copyright © Dmytro Kvashnin. All rights reserved.
* See COPYING.txt for license details.
*/
package com.magento.idea.magento2plugin.project;
import com.intellij.openapi.components.*;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@State(
name = "Magento2PluginSettings",
storages = {
@Storage("magento2plugin.xml")
}
)
public class Settings implements PersistentStateComponent<Settings> {
public boolean pluginEnabled = false;
@Nullable
@Override
public Settings getState() {
return this;
}
@Override
public void loadState(Settings settings) {
XmlSerializerUtil.copyBean(settings, this);
}
public static Settings getInstance(Project project) {
return ServiceManager.getService(project, Settings.class);
}
public static boolean isEnabled(@NotNull Project project) {
return getInstance(project).pluginEnabled;
}
}