convert ShowUsagesSettings to kotlin

This commit is contained in:
Vladimir Krivosheev
2017-12-21 12:21:00 +01:00
parent 405223081d
commit 5c034551e3
@@ -1,40 +1,29 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.usages;
package com.intellij.usages
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.util.xmlb.XmlSerializerUtil
@State(name = "ShowUsagesSettings", storages = @Storage("usageView.xml"))
public class ShowUsagesSettings implements PersistentStateComponent<UsageViewSettings> {
private final UsageViewSettings myState = new UsageViewSettings();
@Nullable
@Override
public UsageViewSettings getState() {
return myState;
@State(name = "ShowUsagesSettings", storages = arrayOf(Storage("usageView.xml")))
class ShowUsagesSettings : PersistentStateComponent<UsageViewSettings> {
private val myState = UsageViewSettings(false, false, false, false, false)
override fun getState(): UsageViewSettings? {
return myState
}
@Override
public void loadState(@NotNull UsageViewSettings state) {
XmlSerializerUtil.copyBean(state, myState);
override fun loadState(state: UsageViewSettings) {
XmlSerializerUtil.copyBean(state, myState)
}
public static ShowUsagesSettings getInstance() {
return ServiceManager.getService(ShowUsagesSettings.class);
}
companion object {
public ShowUsagesSettings() {
myState.setGroupByFileStructure(false);
myState.setGroupByModule(false);
myState.setGroupByPackage(false);
myState.setGroupByUsageType(false);
myState.setGroupByScope(false);
val instance: ShowUsagesSettings
get() = ServiceManager.getService(ShowUsagesSettings::class.java)
}
}