mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
simplify — it is not a persistent component, default state just loaded
This commit is contained in:
+17
-26
@@ -19,9 +19,9 @@ import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.components.NamedComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.BuildNumber;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -45,7 +45,7 @@ import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExternalizable, NamedComponent {
|
||||
public class ApplicationInfoImpl extends ApplicationInfoEx {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.application.impl.ApplicationInfoImpl");
|
||||
|
||||
private String myCodeName = null;
|
||||
@@ -187,6 +187,19 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
|
||||
private static final String DEFAULT_PLUGINS_HOST = "http://plugins.jetbrains.com";
|
||||
|
||||
ApplicationInfoImpl() {
|
||||
try {
|
||||
Document doc = JDOMUtil.loadDocument(ApplicationInfoImpl.class, IDEA_PATH + ApplicationNamesInfo.getComponentName() + XML_EXTENSION);
|
||||
loadState(doc.getRootElement());
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
LOG.error("Resource is not in classpath or wrong platform prefix: " + System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY), e);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Calendar getBuildDate() {
|
||||
return myBuildDate;
|
||||
@@ -536,22 +549,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
public static ApplicationInfoEx getShadowInstance() {
|
||||
if (ourShadowInstance == null) {
|
||||
ourShadowInstance = new ApplicationInfoImpl();
|
||||
try {
|
||||
Document doc = JDOMUtil.loadDocument(ApplicationInfoImpl.class, IDEA_PATH + ApplicationNamesInfo.getComponentName() + XML_EXTENSION);
|
||||
ourShadowInstance.readExternal(doc.getRootElement());
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
LOG.error("Resource is not in classpath or wrong platform prefix: " + System.getProperty(PlatformUtils.PLATFORM_PREFIX_KEY), e);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
return ourShadowInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element parentNode) throws InvalidDataException {
|
||||
private void loadState(Element parentNode) {
|
||||
Element versionElement = parentNode.getChild(ELEMENT_VERSION);
|
||||
if (versionElement != null) {
|
||||
myMajorVersion = versionElement.getAttributeValue(ATTRIBUTE_MAJOR);
|
||||
@@ -845,11 +847,6 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
return new Color((int)rgb, rgb > 0xffffff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
throw new WriteExternalException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PluginChooserPage> getPluginChooserPages() {
|
||||
return myPluginChooserPages;
|
||||
@@ -860,12 +857,6 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
return PluginManagerCore.CORE_PLUGIN_ID.equals(pluginId) || ArrayUtil.contains(pluginId, myEssentialPluginsIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return ApplicationNamesInfo.getComponentName();
|
||||
}
|
||||
|
||||
private static class UpdateUrlsImpl implements UpdateUrls {
|
||||
private String myCheckingUrl;
|
||||
private String myPatchesUrl;
|
||||
|
||||
Reference in New Issue
Block a user