mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not write empty XDebuggerManager state
XCollection — v2 style like Tag
This commit is contained in:
@@ -18,7 +18,6 @@ import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.containers.hash.LinkedHashMap;
|
||||
import com.intellij.util.xmlb.SkipDefaultsSerializationFilter;
|
||||
import com.intellij.util.xmlb.XmlSerializer;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.Transient;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import org.jdom.Element;
|
||||
@@ -202,8 +201,7 @@ public class DebuggerSettings implements Cloneable, PersistentStateComponent<Ele
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Tag("capture-points")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "capture-points")
|
||||
public List<CapturePoint> getCapturePoints() {
|
||||
return myCapturePoints;
|
||||
}
|
||||
|
||||
+3
-7
@@ -8,7 +8,6 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.ui.classFilter.ClassFilter;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.xmlb.annotations.OptionTag;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -27,8 +26,7 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
|
||||
private boolean INSTANCE_FILTERS_ENABLED = false;
|
||||
private InstanceFilter[] myInstanceFilters;
|
||||
|
||||
@Tag("instance-filters")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "instance-filters")
|
||||
public InstanceFilter[] getInstanceFilters() {
|
||||
return myInstanceFilters != null ? myInstanceFilters : InstanceFilter.EMPTY_ARRAY;
|
||||
}
|
||||
@@ -49,8 +47,7 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
|
||||
}
|
||||
}
|
||||
|
||||
@Tag("class-filters")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "class-filters")
|
||||
public final ClassFilter[] getClassFilters() {
|
||||
return myClassFilters != null ? myClassFilters : ClassFilter.EMPTY_ARRAY;
|
||||
}
|
||||
@@ -68,8 +65,7 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
|
||||
return Comparing.equal(a, b);
|
||||
}
|
||||
|
||||
@Tag("class-exclusion-filters")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "class-exclusion-filters")
|
||||
public ClassFilter[] getClassExclusionFilters() {
|
||||
return myClassExclusionFilters != null ? myClassExclusionFilters : ClassFilter.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
+2
-5
@@ -6,7 +6,6 @@ package org.jetbrains.java.debugger.breakpoints.properties;
|
||||
import com.intellij.ui.classFilter.ClassFilter;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import com.intellij.util.xmlb.annotations.OptionTag;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -66,8 +65,7 @@ public class JavaExceptionBreakpointProperties extends JavaBreakpointProperties<
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Tag("catch-class-filters")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "catch-class-filters")
|
||||
public final ClassFilter[] getCatchClassFilters() {
|
||||
return myCatchClassFilters != null ? myCatchClassFilters : ClassFilter.EMPTY_ARRAY;
|
||||
}
|
||||
@@ -78,8 +76,7 @@ public class JavaExceptionBreakpointProperties extends JavaBreakpointProperties<
|
||||
return changed;
|
||||
}
|
||||
|
||||
@Tag("catch-class-exclusion-filters")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "catch-class-exclusion-filters")
|
||||
public ClassFilter[] getCatchClassExclusionFilters() {
|
||||
return myCatchClassExclusionFilters != null ? myCatchClassExclusionFilters : ClassFilter.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ public class JsonSchemaMappingsProjectConfiguration implements PersistentStateCo
|
||||
}
|
||||
|
||||
static class MyState {
|
||||
@Tag("state") @XCollection
|
||||
@Tag("state")
|
||||
@XCollection
|
||||
public Map<String, UserDefinedJsonSchemaConfiguration> myState = new TreeMap<>();
|
||||
|
||||
public MyState() {
|
||||
|
||||
@@ -12,16 +12,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PluginBean {
|
||||
@Tag(APPLICATION_COMPONENTS)
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = APPLICATION_COMPONENTS)
|
||||
public OldComponentConfig[] applicationComponents;
|
||||
|
||||
@Tag(PROJECT_COMPONENTS)
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = PROJECT_COMPONENTS)
|
||||
public OldComponentConfig[] projectComponents;
|
||||
|
||||
@Tag(MODULE_COMPONENTS)
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = MODULE_COMPONENTS)
|
||||
public OldComponentConfig[] moduleComponents;
|
||||
|
||||
@NonNls public static final String APPLICATION_COMPONENTS = "application-components";
|
||||
|
||||
@@ -22,8 +22,7 @@ public class PushSettings implements PersistentStateComponent<PushSettings.State
|
||||
private State myState = new State();
|
||||
|
||||
public static class State {
|
||||
@XCollection
|
||||
@Tag("force-push-targets")
|
||||
@XCollection(propertyElementName = "force-push-targets")
|
||||
public List<ForcePushTargetInfo> FORCE_PUSH_TARGETS = ContainerUtil.newArrayList();
|
||||
}
|
||||
|
||||
|
||||
+7
-18
@@ -10,38 +10,27 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 10/30/2014
|
||||
*/
|
||||
@Tag("activation")
|
||||
public class TaskActivationState {
|
||||
@Tag("before_run")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name", propertyElementName = "before_run")
|
||||
public List<String> beforeRunTasks = new ArrayList<>();
|
||||
|
||||
@Tag("before_sync")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name", propertyElementName = "before_sync")
|
||||
public List<String> beforeSyncTasks = new ArrayList<>();
|
||||
|
||||
@Tag("after_sync")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name", propertyElementName = "after_sync")
|
||||
public List<String> afterSyncTasks = new ArrayList<>();
|
||||
|
||||
@Tag("before_compile")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name", propertyElementName = "before_compile")
|
||||
public List<String> beforeCompileTasks = new ArrayList<>();
|
||||
|
||||
@Tag("after_compile")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name", propertyElementName = "after_compile")
|
||||
public List<String> afterCompileTasks = new ArrayList<>();
|
||||
|
||||
@Tag("after_rebuild")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name", propertyElementName = "after_rebuild")
|
||||
public List<String> afterRebuildTask = new ArrayList<>();
|
||||
|
||||
@Tag("before_rebuild")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name")
|
||||
@XCollection(elementName = "task", valueAttributeName = "name", propertyElementName = "before_rebuild")
|
||||
public List<String> beforeRebuildTask = new ArrayList<>();
|
||||
|
||||
public boolean isEmpty() {
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.intellij.util.xmlb.annotations.Property;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
|
||||
public class Artifacts {
|
||||
|
||||
@Property(surroundWithTag = false)
|
||||
@XCollection
|
||||
public Artifact[] myVersions;
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class ProjectStartupConfigurationBase implements PersistentStateComponent<ProjectStartupConfigurationBase> {
|
||||
@Tag("configurations")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "configurations")
|
||||
private final List<ConfigurationDescriptor> myList;
|
||||
|
||||
protected ProjectStartupConfigurationBase() {
|
||||
|
||||
+1
-2
@@ -49,8 +49,7 @@ public class DisabledAutodetectionByTypeElement {
|
||||
return myFacetTypeId;
|
||||
}
|
||||
|
||||
@Tag("modules")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "modules")
|
||||
public List<DisabledAutodetectionInModuleElement> getModuleElements() {
|
||||
return myModuleElements;
|
||||
}
|
||||
|
||||
+1
-4
@@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package com.intellij.framework.detection.impl.exclude.old;
|
||||
|
||||
import com.intellij.util.containers.SortedList;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -18,8 +16,7 @@ import java.util.List;
|
||||
public class DisabledAutodetectionInfo {
|
||||
private List<DisabledAutodetectionByTypeElement> myElements = new SortedList<>(DisabledAutodetectionByTypeElement.COMPARATOR);
|
||||
|
||||
@Tag("autodetection-disabled")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "autodetection-disabled")
|
||||
public List<DisabledAutodetectionByTypeElement> getElements() {
|
||||
return myElements;
|
||||
}
|
||||
|
||||
+1
-3
@@ -13,7 +13,6 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.util.ModificationTracker;
|
||||
import com.intellij.util.containers.SortedList;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -96,8 +95,7 @@ public class ProjectViewFileNestingService implements PersistentStateComponent<P
|
||||
}
|
||||
|
||||
public static class MyState {
|
||||
@Tag("nesting-rules")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "nesting-rules")
|
||||
public List<NestingRule> myRules = new SortedList<>(Comparator.comparing(o -> o.getParentFileSuffix()));
|
||||
|
||||
public MyState() {
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.intellij.openapi.module.ModuleDescription
|
||||
import com.intellij.openapi.module.ModuleManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.ui.configuration.ConfigureUnloadedModulesDialog
|
||||
import com.intellij.util.xmlb.annotations.Tag
|
||||
import com.intellij.util.xmlb.annotations.XCollection
|
||||
import com.intellij.xml.util.XmlStringUtil
|
||||
|
||||
@@ -154,8 +153,7 @@ class AutomaticModuleUnloader(private val project: Project) : PersistentStateCom
|
||||
}
|
||||
|
||||
class LoadedModulesListStorage {
|
||||
@Tag("loaded-modules")
|
||||
@XCollection(elementName = "module", valueAttributeName = "name")
|
||||
@get:XCollection(elementName = "module", valueAttributeName = "name", propertyElementName = "loaded-modules")
|
||||
var modules: MutableList<String> = ArrayList()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package com.intellij.ide.ui;
|
||||
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.ui.SplitterProportionsData;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.text.StringTokenizer;
|
||||
import com.intellij.util.xmlb.Converter;
|
||||
@@ -29,7 +14,6 @@ import com.intellij.util.xmlb.annotations.Tag;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
@@ -54,8 +38,7 @@ public class SplitterProportionsDataImpl implements SplitterProportionsData {
|
||||
proportions.add(prop);
|
||||
}
|
||||
if (root instanceof Container) {
|
||||
Component[] children = ((Container)root).getComponents();
|
||||
for (Component child : children) {
|
||||
for (Component child : ((Container)root).getComponents()) {
|
||||
doSaveSplitterProportions(child);
|
||||
}
|
||||
}
|
||||
@@ -100,7 +83,7 @@ public class SplitterProportionsDataImpl implements SplitterProportionsData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
public void readExternal(Element element) {
|
||||
proportions.clear();
|
||||
String prop = element.getAttributeValue(ATTRIBUTE_PROPORTIONS);
|
||||
String version = element.getAttributeValue(ATTRIBUTE_VERSION);
|
||||
@@ -114,7 +97,7 @@ public class SplitterProportionsDataImpl implements SplitterProportionsData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
public void writeExternal(Element element) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
String sep = "";
|
||||
for (Float proportion : proportions) {
|
||||
@@ -127,7 +110,7 @@ public class SplitterProportionsDataImpl implements SplitterProportionsData {
|
||||
}
|
||||
|
||||
public static final class SplitterProportionsConverter extends Converter<SplitterProportionsDataImpl> {
|
||||
@Nullable
|
||||
@NotNull
|
||||
@Override
|
||||
public SplitterProportionsDataImpl fromString(@NotNull String value) {
|
||||
SplitterProportionsDataImpl data = new SplitterProportionsDataImpl();
|
||||
|
||||
@@ -77,8 +77,7 @@ public class MasterDetailsStateService implements PersistentStateComponent<Maste
|
||||
public static class States {
|
||||
private List<ComponentState> myStates = new ArrayList<>();
|
||||
|
||||
@Tag("states")
|
||||
@XCollection
|
||||
@XCollection(style = XCollection.Style.v2)
|
||||
public List<ComponentState> getStates() {
|
||||
return myStates;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,6 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
@@ -22,7 +9,6 @@ import org.jetbrains.annotations.NonNls;
|
||||
import java.awt.*;
|
||||
|
||||
public interface SplitterProportionsData extends JDOMExternalizable {
|
||||
|
||||
void saveSplitterProportions(Component root);
|
||||
|
||||
void restoreSplitterProportions(Component root);
|
||||
|
||||
@@ -37,6 +37,12 @@ abstract class BaseState : SerializationFilter, ModificationTracker {
|
||||
return result
|
||||
}
|
||||
|
||||
fun <T : Any> bean(defaultValue: T): StoredPropertyBase<T> {
|
||||
val result = ObjectStoredProperty(defaultValue)
|
||||
properties.add(result)
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty string is always normalized to null.
|
||||
*/
|
||||
@@ -52,6 +58,12 @@ abstract class BaseState : SerializationFilter, ModificationTracker {
|
||||
return result
|
||||
}
|
||||
|
||||
fun storedProperty(defaultValue: Long = 0): StoredPropertyBase<Long> {
|
||||
val result = LongStoredProperty(defaultValue)
|
||||
properties.add(result)
|
||||
return result
|
||||
}
|
||||
|
||||
fun storedProperty(defaultValue: Float = 0f): StoredPropertyBase<Float> {
|
||||
val result = FloatStoredProperty(defaultValue)
|
||||
properties.add(result)
|
||||
@@ -221,6 +233,35 @@ private class IntStoredProperty(override val defaultValue: Int) : StoredProperty
|
||||
}
|
||||
}
|
||||
|
||||
private class LongStoredProperty(override val defaultValue: Long) : StoredPropertyBase<Long>() {
|
||||
override var value = defaultValue
|
||||
|
||||
override operator fun getValue(thisRef: BaseState, property: KProperty<*>) = value
|
||||
|
||||
override fun setValue(thisRef: BaseState, property: KProperty<*>, value: Long) {
|
||||
if (this.value != value) {
|
||||
thisRef.ownModificationCount++
|
||||
this.value = value
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?) = this === other || (other is LongStoredProperty && value == other.value)
|
||||
|
||||
override fun hashCode() = value.hashCode()
|
||||
|
||||
override fun toString() = if (value == defaultValue) "" else value.toString()
|
||||
|
||||
override fun setValue(other: StoredProperty): Boolean {
|
||||
val newValue = (other as LongStoredProperty).value
|
||||
if (newValue == value) {
|
||||
return false
|
||||
}
|
||||
|
||||
value = newValue
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
private class FloatStoredProperty(override val defaultValue: Float) : StoredPropertyBase<Float>() {
|
||||
override var value = defaultValue
|
||||
|
||||
|
||||
+11
-15
@@ -18,20 +18,20 @@ package com.intellij.tasks.context;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.util.xmlb.Accessor;
|
||||
import com.intellij.util.xmlb.SerializationFilter;
|
||||
import com.intellij.util.xmlb.XmlSerializer;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.impl.BreakpointManagerState;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.intellij.configurationStore.XmlSerializer.deserialize;
|
||||
import static com.intellij.configurationStore.XmlSerializer.serialize;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class XDebuggerBreakpointsContextProvider extends WorkingContextProvider {
|
||||
|
||||
private final XBreakpointManagerImpl myBreakpointManager;
|
||||
|
||||
public XDebuggerBreakpointsContextProvider(XDebuggerManager xDebuggerManager) {
|
||||
@@ -52,21 +52,17 @@ public class XDebuggerBreakpointsContextProvider extends WorkingContextProvider
|
||||
|
||||
@Override
|
||||
public void saveContext(Element toElement) throws WriteExternalException {
|
||||
XBreakpointManagerImpl.BreakpointManagerState state = myBreakpointManager.getState();
|
||||
Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {
|
||||
@Override
|
||||
public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
|
||||
return accessor.read(bean) != null;
|
||||
}
|
||||
});
|
||||
toElement.addContent(serialize.removeContent());
|
||||
BreakpointManagerState state = new BreakpointManagerState();
|
||||
myBreakpointManager.saveState(state);
|
||||
Element serialize = serialize(state);
|
||||
if (serialize != null) {
|
||||
toElement.addContent(serialize.removeContent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadContext(Element fromElement) throws InvalidDataException {
|
||||
XBreakpointManagerImpl.BreakpointManagerState state =
|
||||
XmlSerializer.deserialize(fromElement, XBreakpointManagerImpl.BreakpointManagerState.class);
|
||||
myBreakpointManager.loadState(state);
|
||||
myBreakpointManager.loadState(deserialize(fromElement, BreakpointManagerState.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
-15
@@ -17,20 +17,20 @@ package com.intellij.tasks.context;
|
||||
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.util.xmlb.Accessor;
|
||||
import com.intellij.util.xmlb.SerializationFilter;
|
||||
import com.intellij.util.xmlb.XmlSerializer;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.impl.WatchesManagerState;
|
||||
import com.intellij.xdebugger.impl.XDebuggerManagerImpl;
|
||||
import com.intellij.xdebugger.impl.XDebuggerWatchesManager;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.intellij.configurationStore.XmlSerializer.deserialize;
|
||||
import static com.intellij.configurationStore.XmlSerializer.serialize;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class XDebuggerWatchesProvider extends WorkingContextProvider {
|
||||
|
||||
private final XDebuggerWatchesManager myWatchesManager;
|
||||
|
||||
public XDebuggerWatchesProvider(XDebuggerManager xDebuggerManager) {
|
||||
@@ -51,26 +51,23 @@ public class XDebuggerWatchesProvider extends WorkingContextProvider {
|
||||
|
||||
@Override
|
||||
public void saveContext(Element toElement) throws WriteExternalException {
|
||||
XDebuggerWatchesManager.WatchesManagerState state = myWatchesManager.getState();
|
||||
Element serialize = XmlSerializer.serialize(state, new SerializationFilter() {
|
||||
@Override
|
||||
public boolean accepts(@NotNull Accessor accessor, @NotNull Object bean) {
|
||||
return accessor.read(bean) != null;
|
||||
}
|
||||
});
|
||||
toElement.addContent(serialize.removeContent());
|
||||
WatchesManagerState state = new WatchesManagerState();
|
||||
myWatchesManager.saveState(state);
|
||||
Element serialize = serialize(state);
|
||||
if (serialize != null) {
|
||||
toElement.addContent(serialize.removeContent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadContext(Element fromElement) throws InvalidDataException {
|
||||
XDebuggerWatchesManager.WatchesManagerState state =
|
||||
XmlSerializer.deserialize(fromElement, XDebuggerWatchesManager.WatchesManagerState.class);
|
||||
WatchesManagerState state = deserialize(fromElement, WatchesManagerState.class);
|
||||
myWatchesManager.loadState(state);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearContext() {
|
||||
myWatchesManager.loadState(null);
|
||||
myWatchesManager.clearContext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package com.intellij.util.xmlb;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.AbstractCollection;
|
||||
@@ -57,11 +58,20 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
|
||||
return newAnnotation == null && (annotation == null || annotation.surroundWithTag());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Class<?>[] getElementTypes() {
|
||||
if (newAnnotation != null) {
|
||||
return newAnnotation.elementTypes();
|
||||
}
|
||||
return annotation == null ? ArrayUtil.EMPTY_CLASS_ARRAY : annotation.elementTypes();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private synchronized List<Binding> getElementBindings() {
|
||||
if (itemBindings == null) {
|
||||
Binding binding = serializer.getBinding(itemType);
|
||||
if (annotation == null || annotation.elementTypes().length == 0) {
|
||||
Class<?>[] elementTypes = getElementTypes();
|
||||
if (elementTypes.length == 0) {
|
||||
itemBindings = binding == null ? Collections.<Binding>emptyList() : Collections.singletonList(binding);
|
||||
}
|
||||
else {
|
||||
@@ -70,7 +80,7 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
|
||||
itemBindings.add(binding);
|
||||
}
|
||||
|
||||
for (Class aClass : annotation.elementTypes()) {
|
||||
for (Class<?> aClass : elementTypes) {
|
||||
Binding b = serializer.getBinding(aClass);
|
||||
if (b != null && !itemBindings.contains(b)) {
|
||||
itemBindings.add(b);
|
||||
|
||||
@@ -457,6 +457,11 @@ public class BeanBinding extends NotNullDeserializeBinding {
|
||||
return new AccessorBindingWrapper(accessor, binding, inline);
|
||||
}
|
||||
|
||||
XCollection xCollection = accessor.getAnnotation(XCollection.class);
|
||||
if (xCollection != null && (xCollection.propertyElementName().length() != 0 || xCollection.style() == XCollection.Style.v2)) {
|
||||
return new TagBinding(accessor, xCollection.propertyElementName());
|
||||
}
|
||||
|
||||
return new OptionTagBinding(accessor, accessor.getAnnotation(OptionTag.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.util.xmlb;
|
||||
|
||||
@@ -33,6 +21,12 @@ class TagBinding extends BasePrimitiveBinding implements MultiNodeBinding {
|
||||
myTextIfEmpty = tagAnnotation.textIfEmpty();
|
||||
}
|
||||
|
||||
public TagBinding(@NotNull MutableAccessor accessor, @NotNull String suggestedName) {
|
||||
super(accessor, suggestedName, null);
|
||||
|
||||
myTextIfEmpty = "";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object serialize(@NotNull Object o, @Nullable SerializationFilter filter) {
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Experimental.
|
||||
*
|
||||
* ```xml
|
||||
* <option value="$value" />
|
||||
* ... n item elements
|
||||
@@ -26,6 +24,12 @@ import java.lang.annotation.Target;
|
||||
@Target({ElementType.FIELD, ElementType.METHOD})
|
||||
@ApiStatus.Experimental
|
||||
public @interface XCollection {
|
||||
/**
|
||||
* The property element name. Defaults to property name if `style = v2`.
|
||||
* If not specified and `style` is not specified — property serialized using option tag.
|
||||
*/
|
||||
String propertyElementName() default "";
|
||||
|
||||
/**
|
||||
* Value of primitive type wrapped into element named `option`. This option allows you to customize element name.
|
||||
* For example, for `elementName = "module"`:
|
||||
@@ -49,13 +53,26 @@ public @interface XCollection {
|
||||
*/
|
||||
String valueAttributeName() default Constants.VALUE;
|
||||
|
||||
Class<?>[] elementTypes() default {};
|
||||
|
||||
enum Style {
|
||||
/**
|
||||
* Old style as AbstractCollection(surroundWithTag = false).
|
||||
* <p>
|
||||
* <option value="$value" />
|
||||
*
|
||||
* <option name="propertyName">
|
||||
* <option value="$value" />
|
||||
* </option>
|
||||
*/
|
||||
v1
|
||||
v1,
|
||||
|
||||
/**
|
||||
* Wrap not using option tag (OptionTag), but simple tag (Tag).
|
||||
*
|
||||
* <propertyName>
|
||||
* <option value="$value" />
|
||||
* </propertyName>
|
||||
*/
|
||||
v2,
|
||||
}
|
||||
|
||||
Style style() default Style.v1;
|
||||
|
||||
@@ -70,8 +70,7 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
|
||||
public boolean SHELVE_DETAILS_PREVIEW_SHOWN = false;
|
||||
public boolean RELOAD_CONTEXT = true;
|
||||
|
||||
@XCollection(elementName = "path")
|
||||
@Tag("ignored-roots")
|
||||
@XCollection(elementName = "path", propertyElementName = "ignored-roots")
|
||||
public List<String> IGNORED_UNREGISTERED_ROOTS = ContainerUtil.newArrayList();
|
||||
|
||||
public enum StandardOption {
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl;
|
||||
|
||||
@@ -1005,12 +993,12 @@ public class XDebugSessionImpl implements XDebugSession {
|
||||
return getSessionName();
|
||||
}
|
||||
|
||||
public void setWatchExpressions(@NotNull XExpression[] watchExpressions) {
|
||||
public void setWatchExpressions(@NotNull List<XExpression> watchExpressions) {
|
||||
mySessionData.setWatchExpressions(watchExpressions);
|
||||
myDebuggerManager.getWatchesManager().setWatches(getConfigurationName(), watchExpressions);
|
||||
}
|
||||
|
||||
XExpression[] getWatchExpressions() {
|
||||
List<XExpression> getWatchExpressions() {
|
||||
return myDebuggerManager.getWatchesManager().getWatches(getConfigurationName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl;
|
||||
|
||||
@@ -28,7 +16,10 @@ import com.intellij.execution.ui.RunContentManager;
|
||||
import com.intellij.execution.ui.RunContentWithExecutorListener;
|
||||
import com.intellij.notification.NotificationGroup;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.components.StoragePathMacros;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.markup.GutterIconRenderer;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter;
|
||||
@@ -42,7 +33,6 @@ import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.xmlb.annotations.Property;
|
||||
import com.intellij.xdebugger.*;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointListener;
|
||||
@@ -53,7 +43,6 @@ import com.intellij.xdebugger.impl.evaluate.quick.common.ValueLookupManager;
|
||||
import com.intellij.xdebugger.impl.settings.XDebuggerSettingManagerImpl;
|
||||
import com.intellij.xdebugger.impl.ui.ExecutionPointHighlighter;
|
||||
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -67,11 +56,8 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
@State(name = XDebuggerManagerImpl.COMPONENT_NAME, storages = @Storage(StoragePathMacros.WORKSPACE_FILE))
|
||||
public class XDebuggerManagerImpl extends XDebuggerManager
|
||||
implements NamedComponent, PersistentStateComponent<XDebuggerManagerImpl.XDebuggerState> {
|
||||
|
||||
@NonNls public static final String COMPONENT_NAME = "XDebuggerManager";
|
||||
@State(name = "XDebuggerManager", storages = @Storage(StoragePathMacros.WORKSPACE_FILE))
|
||||
public class XDebuggerManagerImpl extends XDebuggerManager implements PersistentStateComponent<XDebuggerState> {
|
||||
public static final NotificationGroup NOTIFICATION_GROUP =
|
||||
NotificationGroup.toolWindowGroup("Debugger messages", ToolWindowId.DEBUG, false);
|
||||
|
||||
@@ -82,6 +68,8 @@ public class XDebuggerManagerImpl extends XDebuggerManager
|
||||
private final ExecutionPointHighlighter myExecutionPointHighlighter;
|
||||
private final AtomicReference<XDebugSessionImpl> myActiveSession = new AtomicReference<>();
|
||||
|
||||
private XDebuggerState myState = new XDebuggerState();
|
||||
|
||||
public XDebuggerManagerImpl(final Project project, final StartupManager startupManager, MessageBus messageBus) {
|
||||
myProject = project;
|
||||
myBreakpointManager = new XBreakpointManagerImpl(project, this, startupManager);
|
||||
@@ -172,12 +160,6 @@ public class XDebuggerManagerImpl extends XDebuggerManager
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return COMPONENT_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public XDebugSession startSession(@NotNull ExecutionEnvironment environment, @NotNull XDebugProcessStarter processStarter) throws ExecutionException {
|
||||
@@ -327,7 +309,10 @@ public class XDebuggerManagerImpl extends XDebuggerManager
|
||||
|
||||
@Override
|
||||
public XDebuggerState getState() {
|
||||
return new XDebuggerState(myBreakpointManager.getState(), myWatchesManager.getState());
|
||||
XDebuggerState state = myState;
|
||||
myBreakpointManager.saveState(state.getBreakpointManagerState());
|
||||
myWatchesManager.saveState(state.getWatchesManagerState());
|
||||
return state;
|
||||
}
|
||||
|
||||
public boolean isFullLineHighlighter() {
|
||||
@@ -336,48 +321,12 @@ public class XDebuggerManagerImpl extends XDebuggerManager
|
||||
|
||||
@Override
|
||||
public void loadState(@NotNull XDebuggerState state) {
|
||||
myBreakpointManager.loadState(state.myBreakpointManagerState);
|
||||
myWatchesManager.loadState(state.myWatchesManagerState);
|
||||
myState = state;
|
||||
myBreakpointManager.loadState(state.getBreakpointManagerState());
|
||||
myWatchesManager.loadState(state.getWatchesManagerState());
|
||||
}
|
||||
|
||||
public void showExecutionPosition() {
|
||||
myExecutionPointHighlighter.navigateTo();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public static class XDebuggerState {
|
||||
@NotNull
|
||||
private XBreakpointManagerImpl.BreakpointManagerState myBreakpointManagerState;
|
||||
@NotNull
|
||||
private XDebuggerWatchesManager.WatchesManagerState myWatchesManagerState;
|
||||
|
||||
public XDebuggerState() {
|
||||
this(new XBreakpointManagerImpl.BreakpointManagerState(), new XDebuggerWatchesManager.WatchesManagerState());
|
||||
}
|
||||
|
||||
public XDebuggerState(@NotNull XBreakpointManagerImpl.BreakpointManagerState breakpointManagerState, @NotNull XDebuggerWatchesManager.WatchesManagerState watchesManagerState) {
|
||||
myBreakpointManagerState = breakpointManagerState;
|
||||
myWatchesManagerState = watchesManagerState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Property(surroundWithTag = false)
|
||||
public XBreakpointManagerImpl.BreakpointManagerState getBreakpointManagerState() {
|
||||
return myBreakpointManagerState;
|
||||
}
|
||||
|
||||
public void setBreakpointManagerState(@NotNull final XBreakpointManagerImpl.BreakpointManagerState breakpointManagerState) {
|
||||
myBreakpointManagerState = breakpointManagerState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Property(surroundWithTag = false)
|
||||
public XDebuggerWatchesManager.WatchesManagerState getWatchesManagerState() {
|
||||
return myWatchesManagerState;
|
||||
}
|
||||
|
||||
public void setWatchesManagerState(@NotNull XDebuggerWatchesManager.WatchesManagerState watchesManagerState) {
|
||||
myWatchesManagerState = watchesManagerState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-65
@@ -3,37 +3,28 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl;
|
||||
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import com.intellij.util.xmlb.annotations.Property;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XExpressionState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class XDebuggerWatchesManager implements PersistentStateComponent<XDebuggerWatchesManager.WatchesManagerState> {
|
||||
private final Map<String, XExpression[]> watches = ContainerUtil.newConcurrentMap();
|
||||
public class XDebuggerWatchesManager {
|
||||
private final Map<String, List<XExpression>> watches = ContainerUtil.newConcurrentMap();
|
||||
|
||||
@NotNull
|
||||
public XExpression[] getWatches(String confName) {
|
||||
XExpression[] expressions = watches.get(confName);
|
||||
if (expressions == null) {
|
||||
return new XExpression[0];
|
||||
}
|
||||
return expressions;
|
||||
public List<XExpression> getWatches(String confName) {
|
||||
return ContainerUtil.notNullize(watches.get(confName));
|
||||
}
|
||||
|
||||
public void setWatches(String configurationName, XExpression[] expressions) {
|
||||
if (expressions != null && expressions.length > 0) {
|
||||
public void setWatches(String configurationName, List<XExpression> expressions) {
|
||||
if (expressions != null && expressions.size() > 0) {
|
||||
watches.put(configurationName, expressions);
|
||||
}
|
||||
else {
|
||||
@@ -41,61 +32,29 @@ public class XDebuggerWatchesManager implements PersistentStateComponent<XDebugg
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WatchesManagerState getState() {
|
||||
WatchesManagerState state = new WatchesManagerState();
|
||||
for (Map.Entry<String, XExpression[]> entry : watches.entrySet()) {
|
||||
state.expressions.add(new ConfigurationState(entry.getKey(), entry.getValue()));
|
||||
@NotNull
|
||||
public WatchesManagerState saveState(@NotNull WatchesManagerState state) {
|
||||
List<ConfigurationState> expressions = new SmartList<>();
|
||||
for (Map.Entry<String, List<XExpression>> entry : watches.entrySet()) {
|
||||
expressions.add(new ConfigurationState(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
state.setExpressions(expressions);
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(WatchesManagerState state) {
|
||||
public void clearContext() {
|
||||
watches.clear();
|
||||
if (state != null) {
|
||||
for (ConfigurationState expressionState : state.expressions) {
|
||||
WatchState[] expressionStates = expressionState.myExpressionStates;
|
||||
if (expressionStates != null) {
|
||||
watches.put(expressionState.myName, ContainerUtil.mapNotNull(expressionStates, XExpressionState::toXExpression, new XExpression[0]));
|
||||
}
|
||||
}
|
||||
|
||||
public void loadState(@NotNull WatchesManagerState state) {
|
||||
clearContext();
|
||||
|
||||
for (ConfigurationState expressionState : ContainerUtil.notNullize(state.getExpressions())) {
|
||||
List<WatchState> expressionStates = expressionState.getExpressionStates();
|
||||
if (expressionStates != null) {
|
||||
watches.put(expressionState.getName(), ContainerUtil.mapNotNull(expressionStates, XExpressionState::toXExpression));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Tag("watches-manager")
|
||||
public static class WatchesManagerState {
|
||||
@Property(surroundWithTag = false)
|
||||
@XCollection
|
||||
public List<ConfigurationState> expressions = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Tag("configuration")
|
||||
public static class ConfigurationState {
|
||||
@Attribute("name")
|
||||
public String myName;
|
||||
|
||||
@Property(surroundWithTag = false)
|
||||
@XCollection
|
||||
public WatchState[] myExpressionStates;
|
||||
|
||||
public ConfigurationState() {
|
||||
}
|
||||
|
||||
public ConfigurationState(String name, XExpression[] expressions) {
|
||||
myName = name;
|
||||
myExpressionStates = new WatchState[expressions.length];
|
||||
for (int i = 0; i < expressions.length; i++) {
|
||||
myExpressionStates[i] = new WatchState(expressions[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Tag("watch")
|
||||
public static class WatchState extends XExpressionState {
|
||||
public WatchState() {}
|
||||
|
||||
public WatchState(XExpression expression) {
|
||||
super(expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-88
@@ -5,7 +5,6 @@ package com.intellij.xdebugger.impl.breakpoints;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
@@ -16,14 +15,14 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.ex.http.HttpFileSystem;
|
||||
import com.intellij.openapi.vfs.ex.http.HttpVirtualFileListener;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
|
||||
import com.intellij.util.xmlb.XmlSerializer;
|
||||
import com.intellij.util.xmlb.annotations.AbstractCollection;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import com.intellij.xdebugger.XDebuggerUtil;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.breakpoints.*;
|
||||
import com.intellij.xdebugger.impl.BreakpointManagerState;
|
||||
import com.intellij.xdebugger.impl.XDebuggerManagerImpl;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jdom.Element;
|
||||
@@ -36,7 +35,7 @@ import java.util.*;
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class XBreakpointManagerImpl implements XBreakpointManager, PersistentStateComponent<XBreakpointManagerImpl.BreakpointManagerState> {
|
||||
public class XBreakpointManagerImpl implements XBreakpointManager {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl");
|
||||
public static final SkipDefaultValuesSerializationFilters SERIALIZATION_FILTER = new SkipDefaultValuesSerializationFilters();
|
||||
private final MultiValuesMap<XBreakpointType, XBreakpointBase<?,?,?>> myBreakpoints = new MultiValuesMap<>(true);
|
||||
@@ -333,34 +332,41 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
|
||||
myLineBreakpointManager.queueBreakpointUpdate(breakpoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BreakpointManagerState getState() {
|
||||
@NotNull
|
||||
public BreakpointManagerState saveState(@NotNull BreakpointManagerState state) {
|
||||
myDependentBreakpointManager.saveState();
|
||||
BreakpointManagerState state = new BreakpointManagerState();
|
||||
|
||||
List<BreakpointState<?, ?, ?>> defaultBreakpoints = new SmartList<>();
|
||||
for (XBreakpointBase<?, ?, ?> breakpoint : myDefaultBreakpoints.values()) {
|
||||
final BreakpointState breakpointState = breakpoint.getState();
|
||||
if (differsFromDefault(breakpoint.getType(), breakpointState)) {
|
||||
state.getDefaultBreakpoints().add(breakpointState);
|
||||
defaultBreakpoints.add(breakpointState);
|
||||
}
|
||||
}
|
||||
for (XBreakpointBase<?,?,?> breakpoint : myBreakpoints.values()) {
|
||||
state.getBreakpoints().add(breakpoint.getState());
|
||||
}
|
||||
|
||||
List<BreakpointState<?, ?, ?>> breakpoints = new SmartList<>();
|
||||
for (XBreakpointBase<?,?,?> breakpoint : myBreakpoints.values()) {
|
||||
breakpoints.add(breakpoint.getState());
|
||||
}
|
||||
|
||||
List<BreakpointState<?, ?, ?>> breakpointsDefaults = new SmartList<>();
|
||||
for (Map.Entry<XBreakpointType, BreakpointState<?,?,?>> entry : myBreakpointsDefaults.entrySet()) {
|
||||
if (statesAreDifferent(entry.getValue(), createBreakpointDefaults(entry.getKey()))) {
|
||||
state.getBreakpointsDefaults().add(entry.getValue());
|
||||
breakpointsDefaults.add(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
state.setDefaultBreakpoints(defaultBreakpoints);
|
||||
state.setBreakpoints(breakpoints);
|
||||
state.setBreakpointsDefaults(breakpointsDefaults);
|
||||
|
||||
state.setBreakpointsDialogProperties(myBreakpointsDialogSettings);
|
||||
state.setTime(myTime);
|
||||
state.setDefaultGroup(myDefaultGroup);
|
||||
return state;
|
||||
}
|
||||
|
||||
private <P extends XBreakpointProperties> boolean differsFromDefault(XBreakpointType<?, P> type,
|
||||
BreakpointState state) {
|
||||
private <P extends XBreakpointProperties> boolean differsFromDefault(XBreakpointType<?, P> type, BreakpointState state) {
|
||||
final XBreakpoint<P> defaultBreakpoint = createDefaultBreakpoint(type);
|
||||
if (defaultBreakpoint == null) {
|
||||
return false;
|
||||
@@ -376,7 +382,6 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
|
||||
return !JDOMUtil.areElementsEqual(elem1, elem2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(@NotNull BreakpointManagerState state) {
|
||||
myBreakpointsDialogSettings = state.getBreakpointsDialogProperties();
|
||||
|
||||
@@ -385,15 +390,15 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
|
||||
myBreakpointsDefaults.clear();
|
||||
|
||||
ApplicationManager.getApplication().runReadAction(() -> {
|
||||
state.getDefaultBreakpoints().forEach(breakpointState -> loadBreakpoint(breakpointState, true));
|
||||
ContainerUtil.notNullize(state.getDefaultBreakpoints()).forEach(breakpointState -> loadBreakpoint(breakpointState, true));
|
||||
|
||||
XBreakpointUtil.breakpointTypes().remove(myDefaultBreakpoints::containsKey).forEach(this::addDefaultBreakpoint);
|
||||
|
||||
myBreakpoints.values().forEach(this::doRemoveBreakpoint);
|
||||
|
||||
state.getBreakpoints().forEach(breakpointState -> loadBreakpoint(breakpointState, false));
|
||||
ContainerUtil.notNullize(state.getBreakpoints()).forEach(breakpointState -> loadBreakpoint(breakpointState, false));
|
||||
|
||||
for (BreakpointState defaults : state.getBreakpointsDefaults()) {
|
||||
for (BreakpointState defaults : ContainerUtil.notNullize(state.getBreakpointsDefaults())) {
|
||||
XBreakpointType<?, ?> type = XBreakpointUtil.findType(defaults.getTypeId());
|
||||
if (type != null) {
|
||||
myBreakpointsDefaults.put(type, defaults);
|
||||
@@ -504,73 +509,4 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
|
||||
state.setSuspendPolicy(type.getDefaultSuspendPolicy());
|
||||
return state;
|
||||
}
|
||||
|
||||
@Tag("breakpoint-manager")
|
||||
public static class BreakpointManagerState {
|
||||
private List<BreakpointState> myDefaultBreakpoints = new ArrayList<>();
|
||||
private List<BreakpointState> myBreakpoints = new ArrayList<>();
|
||||
private List<BreakpointState> myBreakpointsDefaults = new ArrayList<>();
|
||||
private XBreakpointsDialogState myBreakpointsDialogProperties;
|
||||
|
||||
private long myTime;
|
||||
private String myDefaultGroup;
|
||||
|
||||
@Tag("default-breakpoints")
|
||||
@XCollection
|
||||
public List<BreakpointState> getDefaultBreakpoints() {
|
||||
return myDefaultBreakpoints;
|
||||
}
|
||||
|
||||
@Tag("breakpoints")
|
||||
@AbstractCollection(surroundWithTag = false,
|
||||
elementTypes = {BreakpointState.class, LineBreakpointState.class})
|
||||
public List<BreakpointState> getBreakpoints() {
|
||||
return myBreakpoints;
|
||||
}
|
||||
|
||||
@Tag("breakpoints-defaults")
|
||||
@AbstractCollection(surroundWithTag = false,
|
||||
elementTypes = {BreakpointState.class, LineBreakpointState.class})
|
||||
public List<BreakpointState> getBreakpointsDefaults() {
|
||||
return myBreakpointsDefaults;
|
||||
}
|
||||
|
||||
@Tag("breakpoints-dialog")
|
||||
public XBreakpointsDialogState getBreakpointsDialogProperties() {
|
||||
return myBreakpointsDialogProperties;
|
||||
}
|
||||
|
||||
public void setBreakpoints(final List<BreakpointState> breakpoints) {
|
||||
myBreakpoints = breakpoints;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public void setDefaultBreakpoints(List<BreakpointState> defaultBreakpoints) {
|
||||
myDefaultBreakpoints = defaultBreakpoints;
|
||||
}
|
||||
|
||||
public void setBreakpointsDefaults(List<BreakpointState> breakpointsDefaults) {
|
||||
myBreakpointsDefaults = breakpointsDefaults;
|
||||
}
|
||||
|
||||
public void setBreakpointsDialogProperties(XBreakpointsDialogState breakpointsDialogProperties) {
|
||||
myBreakpointsDialogProperties = breakpointsDialogProperties;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return myTime;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
myTime = time;
|
||||
}
|
||||
|
||||
public String getDefaultGroup() {
|
||||
return myDefaultGroup;
|
||||
}
|
||||
|
||||
public void setDefaultGroup(String defaultGroup) {
|
||||
myDefaultGroup = defaultGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-19
@@ -1,25 +1,14 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints;
|
||||
|
||||
import com.intellij.openapi.util.MultiValuesMap;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointListener;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -94,20 +83,20 @@ public class XDependentBreakpointManager {
|
||||
}
|
||||
|
||||
public void saveState() {
|
||||
Map<XBreakpointBase<?,?,?>, String> breakpoint2Id = new HashMap<>();
|
||||
Map<XBreakpointBase<?,?,?>, String> breakpointToId = new THashMap<>();
|
||||
int id = 0;
|
||||
for (XBreakpointBase breakpoint : myMaster2Info.keySet()) {
|
||||
breakpoint2Id.put(breakpoint, String.valueOf(id++));
|
||||
breakpointToId.put(breakpoint, String.valueOf(id++));
|
||||
}
|
||||
|
||||
for (XDependentBreakpointInfo info : mySlave2Info.values()) {
|
||||
XBreakpointDependencyState state = new XBreakpointDependencyState(breakpoint2Id.get(info.mySlaveBreakpoint),
|
||||
breakpoint2Id.get(info.myMasterBreakpoint),
|
||||
XBreakpointDependencyState state = new XBreakpointDependencyState(breakpointToId.get(info.mySlaveBreakpoint),
|
||||
breakpointToId.get(info.myMasterBreakpoint),
|
||||
info.myLeaveEnabled);
|
||||
info.mySlaveBreakpoint.setDependencyState(state);
|
||||
}
|
||||
|
||||
for (Map.Entry<XBreakpointBase<?, ?, ?>, String> entry : breakpoint2Id.entrySet()) {
|
||||
for (Map.Entry<XBreakpointBase<?, ?, ?>, String> entry : breakpointToId.entrySet()) {
|
||||
if (!mySlave2Info.containsKey(entry.getKey())) {
|
||||
entry.getKey().setDependencyState(new XBreakpointDependencyState(entry.getValue()));
|
||||
}
|
||||
|
||||
+8
-21
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.frame;
|
||||
|
||||
@@ -32,7 +20,7 @@ import com.intellij.ui.DoubleClickListener;
|
||||
import com.intellij.ui.ListenerUtil;
|
||||
import com.intellij.ui.border.CustomLineBorder;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
@@ -257,10 +245,10 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private XExpression[] getExpressions() {
|
||||
private List<XExpression> getExpressions() {
|
||||
XDebuggerTree tree = getTree();
|
||||
XDebugSession session = getSession(tree);
|
||||
XExpression[] expressions;
|
||||
List<XExpression> expressions;
|
||||
if (session != null) {
|
||||
expressions = ((XDebugSessionImpl)session).getSessionData().getWatchExpressions();
|
||||
}
|
||||
@@ -268,11 +256,11 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
|
||||
XDebuggerTreeNode root = tree.getRoot();
|
||||
List<? extends WatchNode> current = root instanceof WatchesRootNode
|
||||
? ((WatchesRootNode)tree.getRoot()).getWatchChildren() : Collections.emptyList();
|
||||
List<XExpression> list = ContainerUtil.newArrayList();
|
||||
List<XExpression> list = new SmartList<>();
|
||||
for (WatchNode child : current) {
|
||||
list.add(child.getExpression());
|
||||
}
|
||||
expressions = list.toArray(new XExpression[list.size()]);
|
||||
expressions = list;
|
||||
}
|
||||
return expressions;
|
||||
}
|
||||
@@ -326,13 +314,12 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
|
||||
}
|
||||
|
||||
public void updateSessionData() {
|
||||
List<XExpression> watchExpressions = ContainerUtil.newArrayList();
|
||||
List<XExpression> expressions = new SmartList<>();
|
||||
List<? extends WatchNode> children = myRootNode.getWatchChildren();
|
||||
for (WatchNode child : children) {
|
||||
watchExpressions.add(child.getExpression());
|
||||
expressions.add(child.getExpression());
|
||||
}
|
||||
XDebugSession session = getSession(getTree());
|
||||
XExpression[] expressions = watchExpressions.toArray(new XExpression[watchExpressions.size()]);
|
||||
if (session != null) {
|
||||
((XDebugSessionImpl)session).setWatchExpressions(expressions);
|
||||
}
|
||||
|
||||
+1
-2
@@ -119,8 +119,7 @@ public class XDebuggerSettingManagerImpl extends XDebuggerSettingsManager implem
|
||||
}
|
||||
|
||||
public static class SettingsState {
|
||||
@Tag("debuggers")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "debuggers")
|
||||
public List<SpecificSettingsState> specificStates = new SmartList<>();
|
||||
private XDebuggerDataViewSettings myDataViewSettings = new XDebuggerDataViewSettings();
|
||||
private XDebuggerGeneralSettings myGeneralSettings = new XDebuggerGeneralSettings();
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl
|
||||
|
||||
import com.intellij.openapi.components.BaseState
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import com.intellij.util.xmlb.annotations.Property
|
||||
import com.intellij.util.xmlb.annotations.Tag
|
||||
import com.intellij.util.xmlb.annotations.XCollection
|
||||
import com.intellij.xdebugger.XExpression
|
||||
import com.intellij.xdebugger.impl.breakpoints.BreakpointState
|
||||
import com.intellij.xdebugger.impl.breakpoints.LineBreakpointState
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointsDialogState
|
||||
import com.intellij.xdebugger.impl.breakpoints.XExpressionState
|
||||
import java.util.*
|
||||
|
||||
@Tag("breakpoint-manager")
|
||||
class BreakpointManagerState : BaseState() {
|
||||
@get:XCollection(propertyElementName = "default-breakpoints")
|
||||
var defaultBreakpoints by storedProperty<List<BreakpointState<*, *, *>>>(SmartList())
|
||||
|
||||
@get:XCollection(elementTypes = arrayOf(BreakpointState::class, LineBreakpointState::class), style = XCollection.Style.v2)
|
||||
var breakpoints by storedProperty<List<BreakpointState<*, *, *>>>(SmartList())
|
||||
|
||||
@get:XCollection(propertyElementName = "breakpoints-defaults", elementTypes = arrayOf(BreakpointState::class, LineBreakpointState::class))
|
||||
var breakpointsDefaults by storedProperty<List<BreakpointState<*, *, *>>>(SmartList())
|
||||
|
||||
@get:Tag("breakpoints-dialog")
|
||||
var breakpointsDialogProperties: XBreakpointsDialogState? = null
|
||||
|
||||
var time by storedProperty(0L)
|
||||
var defaultGroup by string()
|
||||
}
|
||||
|
||||
@Tag("watches-manager")
|
||||
class WatchesManagerState : BaseState() {
|
||||
@get:Property(surroundWithTag = false)
|
||||
@get:XCollection
|
||||
var expressions by storedProperty<List<ConfigurationState>>(SmartList())
|
||||
}
|
||||
|
||||
@Tag("configuration")
|
||||
class ConfigurationState : BaseState {
|
||||
@get:Attribute
|
||||
var name by string()
|
||||
|
||||
@Suppress("MemberVisibilityCanPrivate")
|
||||
@get:Property(surroundWithTag = false)
|
||||
@get:XCollection
|
||||
var expressionStates by storedProperty<List<WatchState>>(SmartList())
|
||||
|
||||
@Suppress("unused")
|
||||
constructor()
|
||||
|
||||
constructor(name: String, expressions: List<XExpression>) {
|
||||
this.name = name
|
||||
val list = ArrayList<WatchState>(expressions.size)
|
||||
expressionStates = list
|
||||
for (i in expressions.indices) {
|
||||
list.set(i, WatchState(expressions[i]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Tag("watch")
|
||||
class WatchState : XExpressionState {
|
||||
@Suppress("unused")
|
||||
constructor() : super()
|
||||
|
||||
constructor(expression: XExpression) : super(expression)
|
||||
}
|
||||
|
||||
internal class XDebuggerState : BaseState() {
|
||||
@get:Property(surroundWithTag = false)
|
||||
var breakpointManagerState by bean(BreakpointManagerState())
|
||||
|
||||
@get:Property(surroundWithTag = false)
|
||||
var watchesManagerState by bean(WatchesManagerState())
|
||||
}
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.ui;
|
||||
|
||||
@@ -20,6 +8,8 @@ import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.xdebugger.XExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
@@ -27,21 +17,21 @@ public class XDebugSessionData extends UserDataHolderBase {
|
||||
public static final DataKey<XDebugSessionData> DATA_KEY = DataKey.create("XDebugSessionData");
|
||||
|
||||
@NotNull
|
||||
private XExpression[] myWatchExpressions;
|
||||
private List<XExpression> myWatchExpressions;
|
||||
private final String myConfigurationName;
|
||||
private boolean myBreakpointsMuted = false;
|
||||
|
||||
public XDebugSessionData(@NotNull XExpression[] watchExpressions, @NotNull String configurationName) {
|
||||
public XDebugSessionData(@NotNull List<XExpression> watchExpressions, @NotNull String configurationName) {
|
||||
myWatchExpressions = watchExpressions;
|
||||
myConfigurationName = configurationName;
|
||||
}
|
||||
|
||||
public void setWatchExpressions(@NotNull XExpression[] watchExpressions) {
|
||||
public void setWatchExpressions(@NotNull List<XExpression> watchExpressions) {
|
||||
myWatchExpressions = watchExpressions;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public XExpression[] getWatchExpressions() {
|
||||
public List<XExpression> getWatchExpressions() {
|
||||
return myWatchExpressions;
|
||||
}
|
||||
|
||||
|
||||
+6
-15
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.ui.tree.nodes;
|
||||
|
||||
@@ -32,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.tree.TreeNode;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -42,15 +31,17 @@ public class WatchesRootNode extends XValueContainerNode<XValueContainer> {
|
||||
private final XWatchesView myWatchesView;
|
||||
private final List<WatchNodeImpl> myChildren;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
// required for com.google.gct.core
|
||||
public WatchesRootNode(@NotNull XDebuggerTree tree,
|
||||
@NotNull XWatchesView watchesView,
|
||||
@NotNull XExpression[] expressions) {
|
||||
this(tree, watchesView, expressions, null, false);
|
||||
this(tree, watchesView, Arrays.asList(expressions), null, false);
|
||||
}
|
||||
|
||||
public WatchesRootNode(@NotNull XDebuggerTree tree,
|
||||
@NotNull XWatchesView watchesView,
|
||||
@NotNull XExpression[] expressions,
|
||||
@NotNull List<XExpression> expressions,
|
||||
@Nullable XStackFrame stackFrame,
|
||||
boolean watchesInVariables) {
|
||||
super(tree, null, new XValueContainer() {
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger;
|
||||
|
||||
@@ -22,8 +10,10 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointListener;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.JDOMException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -153,7 +143,7 @@ public class XBreakpointManagerTest extends XBreakpointsTestCase {
|
||||
assertEmpty(myBreakpointManager.getBreakpoints(MY_LINE_BREAKPOINT_TYPE));
|
||||
}
|
||||
|
||||
public void testConditionConvert() {
|
||||
public void testConditionConvert() throws IOException, JDOMException {
|
||||
String condition = "old-style condition";
|
||||
String logExpression = "old-style expression";
|
||||
String oldStyle =
|
||||
@@ -167,13 +157,7 @@ public class XBreakpointManagerTest extends XBreakpointsTestCase {
|
||||
"</breakpoints>" +
|
||||
"<option name=\"time\" value=\"1\" />" +
|
||||
"</breakpoint-manager>";
|
||||
try {
|
||||
load(JdomKt.loadElement(oldStyle));
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
load(JdomKt.loadElement(oldStyle));
|
||||
XLineBreakpoint<MyBreakpointProperties> breakpoint = assertOneElement(myBreakpointManager.getBreakpoints(MY_LINE_BREAKPOINT_TYPE));
|
||||
assertEquals(condition, breakpoint.getCondition());
|
||||
assertEquals(logExpression, breakpoint.getLogExpression());
|
||||
|
||||
@@ -1,26 +1,14 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger;
|
||||
|
||||
import com.intellij.configurationStore.XmlSerializer;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.TempFiles;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType;
|
||||
import com.intellij.xdebugger.impl.BreakpointManagerState;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
|
||||
import org.jdom.Element;
|
||||
@@ -29,6 +17,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.configurationStore.XmlSerializer.deserialize;
|
||||
import static com.intellij.configurationStore.XmlSerializer.serialize;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
@@ -50,11 +41,14 @@ public abstract class XBreakpointsTestCase extends XDebuggerTestCase {
|
||||
}
|
||||
|
||||
protected void load(@Nullable Element element) {
|
||||
myBreakpointManager.loadState(element == null ? new XBreakpointManagerImpl.BreakpointManagerState() : XmlSerializer.deserialize(element, XBreakpointManagerImpl.BreakpointManagerState.class));
|
||||
myBreakpointManager.loadState(element == null ? new BreakpointManagerState() : deserialize(element, BreakpointManagerState.class));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Element save() {
|
||||
return XmlSerializer.serialize(myBreakpointManager.getState());
|
||||
BreakpointManagerState state = new BreakpointManagerState();
|
||||
myBreakpointManager.saveState(state);
|
||||
return serialize(state);
|
||||
}
|
||||
|
||||
protected List<XBreakpoint<?>> getAllBreakpoints() {
|
||||
|
||||
@@ -1,21 +1,8 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.xdebugger;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
@@ -64,9 +51,13 @@ public abstract class XDebuggerTestCase extends PlatformTestCase {
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
getBreakpointTypes().unregisterExtension(MY_LINE_BREAKPOINT_TYPE);
|
||||
getBreakpointTypes().unregisterExtension(MY_SIMPLE_BREAKPOINT_TYPE);
|
||||
super.tearDown();
|
||||
try {
|
||||
getBreakpointTypes().unregisterExtension(MY_LINE_BREAKPOINT_TYPE);
|
||||
getBreakpointTypes().unregisterExtension(MY_SIMPLE_BREAKPOINT_TYPE);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
public static class MyLineBreakpointType extends XLineBreakpointType<MyBreakpointProperties> {
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ public class AntArtifactExtensionProperties {
|
||||
@Attribute("enabled")
|
||||
public boolean myEnabled;
|
||||
|
||||
@Tag("build-properties")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "build-properties")
|
||||
public List<BuildFileProperty> myUserProperties = new ArrayList<>();
|
||||
}
|
||||
|
||||
+1
-4
@@ -1,15 +1,12 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.idea.maven.dom.converters.repositories.beans;
|
||||
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
|
||||
public class RepositoriesBean {
|
||||
@Tag("repositories")
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "repositories")
|
||||
public RepositoryBeanInfo[] myRepositories;
|
||||
|
||||
public RepositoryBeanInfo[] getRepositories() {
|
||||
|
||||
+1
-5
@@ -11,8 +11,6 @@ import com.intellij.tasks.Task;
|
||||
import com.intellij.tasks.impl.TaskUtil;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.Property;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import com.intellij.util.xmlb.annotations.XCollection;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -86,9 +84,7 @@ public abstract class SelectorBasedResponseHandler extends ResponseHandler {
|
||||
));
|
||||
}
|
||||
|
||||
@Tag("selectors")
|
||||
@Property(surroundWithTag = false)
|
||||
@XCollection
|
||||
@XCollection(propertyElementName = "selectors")
|
||||
@NotNull
|
||||
public List<Selector> getSelectors() {
|
||||
return new ArrayList<>(mySelectors.values());
|
||||
|
||||
Reference in New Issue
Block a user