2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.openapi
.updateSettings
.impl
;
18 import com
.intellij
.openapi
.components
.PersistentStateComponent
;
19 import com
.intellij
.openapi
.components
.ServiceManager
;
20 import com
.intellij
.openapi
.components
.State
;
21 import com
.intellij
.openapi
.components
.Storage
;
22 import com
.intellij
.openapi
.diagnostic
.Logger
;
23 import com
.intellij
.openapi
.util
.DefaultJDOMExternalizer
;
24 import com
.intellij
.openapi
.util
.InvalidDataException
;
25 import com
.intellij
.openapi
.util
.JDOMExternalizableStringList
;
26 import com
.intellij
.openapi
.util
.WriteExternalException
;
27 import org
.jdom
.Element
;
33 name
= "UpdatesConfigurable",
37 file
= "$APP_CONFIG$/other.xml"
40 public class UpdateSettings
implements PersistentStateComponent
<Element
> {
41 private static final Logger LOG
= Logger
.getInstance("#com.intellij.openapi.updateSettings.impl.UpdateSettings");
43 @SuppressWarnings({"WeakerAccess", "CanBeFinal"})
44 public JDOMExternalizableStringList myPluginHosts
= new JDOMExternalizableStringList();
46 @SuppressWarnings({"WeakerAccess", "CanBeFinal"})
47 public JDOMExternalizableStringList myKnownUpdateChannels
= new JDOMExternalizableStringList();
49 public boolean CHECK_NEEDED
= true;
50 public String CHECK_PERIOD
= UpdateSettingsConfigurable
.WEEKLY
;
51 public long LAST_TIME_CHECKED
= 0;
53 public static UpdateSettings
getInstance() {
54 return ServiceManager
.getService(UpdateSettings
.class);
57 public Element
getState() {
58 Element element
= new Element("state");
60 DefaultJDOMExternalizer
.writeExternal(this, element
);
62 catch (WriteExternalException e
) {
68 public void loadState(final Element state
) {
70 DefaultJDOMExternalizer
.readExternal(this, state
);
72 catch (InvalidDataException e
) {