Fix updater by removing non-working channel switching ability and always resorting...
[fedora-idea.git] / platform / platform-impl / src / com / intellij / openapi / updateSettings / impl / UpdateSettings.java
blob06d96d2d9f3bdbf1360ed28a78c1274e9724833c
1 /*
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;
29 /**
30 * @author yole
32 @State(
33 name = "UpdatesConfigurable",
34 storages = {
35 @Storage(
36 id ="other",
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");
59 try {
60 DefaultJDOMExternalizer.writeExternal(this, element);
62 catch (WriteExternalException e) {
63 LOG.info(e);
65 return element;
68 public void loadState(final Element state) {
69 try {
70 DefaultJDOMExternalizer.readExternal(this, state);
72 catch (InvalidDataException e) {
73 LOG.info(e);