mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not save defaults — WebBrowserManager / FeatureUsageTrackerImpl / ActionScriptProfileSettings
This commit is contained in:
@@ -4,6 +4,7 @@ import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.application.ex.PathManagerEx
|
||||
import com.intellij.openapi.application.impl.ApplicationImpl
|
||||
import com.intellij.openapi.components.impl.ServiceManagerImpl
|
||||
import com.intellij.openapi.components.stateStore
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.testFramework.ProjectRule
|
||||
@@ -35,6 +36,13 @@ class DoNotSaveDefaultsTest {
|
||||
val directory = app.stateStore.stateStorageManager.expandMacros(APP_CONFIG)
|
||||
val dirPath = Paths.get(directory)
|
||||
val useModCountOldValue = System.getProperty("store.save.use.modificationCount")
|
||||
|
||||
// wake up
|
||||
ServiceManagerImpl.processAllImplementationClasses(app, { clazz, pluginDescriptor ->
|
||||
app.picoContainer.getComponentInstance(clazz.name)
|
||||
true
|
||||
})
|
||||
|
||||
try {
|
||||
System.setProperty("store.save.use.modificationCount", "false")
|
||||
app.doNotSave(false)
|
||||
|
||||
@@ -56,6 +56,7 @@ public class FeatureUsageTrackerImpl extends FeatureUsageTracker implements Pers
|
||||
myRegistry = productivityFeaturesRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isToBeShown(String featureId, Project project) {
|
||||
return isToBeShown(featureId, project, DAY);
|
||||
}
|
||||
@@ -114,6 +115,7 @@ public class FeatureUsageTrackerImpl extends FeatureUsageTracker implements Pers
|
||||
return FIRST_RUN_TIME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(final Element element) {
|
||||
List featuresList = element.getChildren(FEATURE_TAG);
|
||||
for (Object aFeaturesList : featuresList) {
|
||||
@@ -147,6 +149,7 @@ public class FeatureUsageTrackerImpl extends FeatureUsageTracker implements Pers
|
||||
SHOW_IN_COMPILATION_PROGRESS = Boolean.valueOf(element.getAttributeValue(ATT_SHOW_IN_COMPILATION, Boolean.toString(true))).booleanValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element getState() {
|
||||
Element element = new Element("state");
|
||||
ProductivityFeaturesRegistry registry = ProductivityFeaturesRegistry.getInstance();
|
||||
@@ -175,6 +178,7 @@ public class FeatureUsageTrackerImpl extends FeatureUsageTracker implements Pers
|
||||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void triggerFeatureUsed(String featureId) {
|
||||
ProductivityFeaturesRegistry registry = ProductivityFeaturesRegistry.getInstance();
|
||||
FeatureDescriptor descriptor = registry.getFeatureDescriptor(featureId);
|
||||
@@ -186,6 +190,7 @@ public class FeatureUsageTrackerImpl extends FeatureUsageTracker implements Pers
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void triggerFeatureShown(String featureId) {
|
||||
FeatureDescriptor descriptor = ProductivityFeaturesRegistry.getInstance().getFeatureDescriptor(featureId);
|
||||
if (descriptor != null) {
|
||||
|
||||
@@ -110,30 +110,32 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
|
||||
state.setAttribute("showHover", "false");
|
||||
}
|
||||
|
||||
for (ConfigurableWebBrowser browser : browsers) {
|
||||
Element entry = new Element("browser");
|
||||
entry.setAttribute("id", browser.getId().toString());
|
||||
entry.setAttribute("name", browser.getName());
|
||||
entry.setAttribute("family", browser.getFamily().name());
|
||||
if (!browsers.equals(PREDEFINED_BROWSERS)) {
|
||||
for (ConfigurableWebBrowser browser : browsers) {
|
||||
Element entry = new Element("browser");
|
||||
entry.setAttribute("id", browser.getId().toString());
|
||||
entry.setAttribute("name", browser.getName());
|
||||
entry.setAttribute("family", browser.getFamily().name());
|
||||
|
||||
String path = browser.getPath();
|
||||
if (path != null && !path.equals(browser.getFamily().getExecutionPath())) {
|
||||
entry.setAttribute("path", path);
|
||||
}
|
||||
|
||||
if (!browser.isActive()) {
|
||||
entry.setAttribute("active", "false");
|
||||
}
|
||||
|
||||
BrowserSpecificSettings specificSettings = browser.getSpecificSettings();
|
||||
if (specificSettings != null) {
|
||||
Element settingsElement = new Element("settings");
|
||||
XmlSerializer.serializeInto(specificSettings, settingsElement, new SkipDefaultValuesSerializationFilters());
|
||||
if (!JDOMUtil.isEmpty(settingsElement)) {
|
||||
entry.addContent(settingsElement);
|
||||
String path = browser.getPath();
|
||||
if (path != null && !path.equals(browser.getFamily().getExecutionPath())) {
|
||||
entry.setAttribute("path", path);
|
||||
}
|
||||
|
||||
if (!browser.isActive()) {
|
||||
entry.setAttribute("active", "false");
|
||||
}
|
||||
|
||||
BrowserSpecificSettings specificSettings = browser.getSpecificSettings();
|
||||
if (specificSettings != null) {
|
||||
Element settingsElement = new Element("settings");
|
||||
XmlSerializer.serializeInto(specificSettings, settingsElement, new SkipDefaultValuesSerializationFilters());
|
||||
if (!JDOMUtil.isEmpty(settingsElement)) {
|
||||
entry.addContent(settingsElement);
|
||||
}
|
||||
}
|
||||
state.addContent(entry);
|
||||
}
|
||||
state.addContent(entry);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
@@ -269,7 +271,7 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
|
||||
|
||||
@NotNull
|
||||
public List<WebBrowser> getBrowsers() {
|
||||
return Collections.<WebBrowser>unmodifiableList(browsers);
|
||||
return Collections.unmodifiableList(browsers);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -284,7 +286,7 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
|
||||
|
||||
@NotNull
|
||||
public List<WebBrowser> getActiveBrowsers() {
|
||||
return getBrowsers(Conditions.<WebBrowser>alwaysTrue(), true);
|
||||
return getBrowsers(Conditions.alwaysTrue(), true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -338,10 +340,10 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
/**
|
||||
* @param idOrFamilyName UUID or, due to backward compatibility, browser family name or JS debugger engine ID
|
||||
*/
|
||||
@Nullable
|
||||
public WebBrowser findBrowserById(@Nullable String idOrFamilyName) {
|
||||
if (StringUtil.isEmpty(idOrFamilyName)) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user