mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-123615 (Proxy settings are not exported)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.util.net;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
@@ -40,6 +41,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.*;
|
||||
@@ -55,10 +57,13 @@ import java.util.*;
|
||||
@State(
|
||||
name = "HttpConfigurable",
|
||||
storages = {
|
||||
@Storage( file = StoragePathMacros.APP_CONFIG + "/other.xml")
|
||||
}
|
||||
@Storage( file = StoragePathMacros.APP_CONFIG + "/other.xml" ),
|
||||
@Storage( file = StoragePathMacros.APP_CONFIG + "/proxy.settings.xml" )
|
||||
},
|
||||
storageChooser = HttpConfigurable.StorageChooser.class
|
||||
)
|
||||
public class HttpConfigurable implements PersistentStateComponent<HttpConfigurable>, ApplicationComponent, JDOMExternalizable {
|
||||
public class HttpConfigurable implements PersistentStateComponent<HttpConfigurable>, ApplicationComponent, JDOMExternalizable,
|
||||
ExportableApplicationComponent {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.util.net.HttpConfigurable");
|
||||
public boolean PROXY_TYPE_IS_SOCKS = false;
|
||||
public boolean USE_HTTP_PROXY = false;
|
||||
@@ -329,7 +334,7 @@ public class HttpConfigurable implements PersistentStateComponent<HttpConfigurab
|
||||
}
|
||||
|
||||
/**
|
||||
* todo [all] It is NOT nessesary to call anything if you obey common IDEA proxy settings;
|
||||
* todo [all] It is NOT necessary to call anything if you obey common IDEA proxy settings;
|
||||
* todo if you want to define your own behaviour, refer to {@link com.intellij.util.proxy.CommonProxy}
|
||||
*
|
||||
* also, this method is useful in a way that it test connection to the host [through proxy]
|
||||
@@ -478,6 +483,32 @@ public class HttpConfigurable implements PersistentStateComponent<HttpConfigurab
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public File[] getExportFiles() {
|
||||
return new File[]{PathManager.getOptionsFile("proxy.settings")};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getPresentableName() {
|
||||
return "Proxy Settings";
|
||||
}
|
||||
|
||||
public static class StorageChooser implements StateStorageChooser<HttpConfigurable> {
|
||||
@Override
|
||||
public Storage[] selectStorages(Storage[] storages, HttpConfigurable component, StateStorageOperation operation) {
|
||||
if (operation == StateStorageOperation.WRITE) {
|
||||
for (Storage storage : storages) {
|
||||
if (storage.file().equals(StoragePathMacros.APP_CONFIG + "/proxy.settings.xml")) {
|
||||
return new Storage[] {storage};
|
||||
}
|
||||
}
|
||||
}
|
||||
return storages;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ProxyInfo {
|
||||
public boolean myStore;
|
||||
public String myUsername;
|
||||
|
||||
+2
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.openapi.components.StorageId;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.util.xmlb.Accessor;
|
||||
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
|
||||
@@ -93,11 +92,7 @@ class DefaultStateSerializer {
|
||||
//assert mergeInto == null;
|
||||
return (T)stateElement;
|
||||
}
|
||||
else if (JDOMExternalizable.class.isAssignableFrom(stateClass)) {
|
||||
if (mergeInto != null) {
|
||||
String elementText = JDOMUtil.writeElement(stateElement, "\n");
|
||||
LOG.error("State is " + stateClass.getName() + ", merge into is " + mergeInto.toString() + ", state element text is " + elementText);
|
||||
}
|
||||
else if (JDOMExternalizable.class.isAssignableFrom(stateClass) && mergeInto == null) {
|
||||
try {
|
||||
final T t = stateClass.newInstance();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user