introduce XCollection annotation, get rid of custom getState for AppletConfiguration

This commit is contained in:
Vladimir Krivosheev
2017-12-11 11:11:37 +01:00
parent b018fed817
commit 4bfca85de9
60 changed files with 498 additions and 828 deletions
@@ -1,4 +1,6 @@
// 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.
/*
* 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.debugger.settings;
import com.intellij.debugger.impl.DebuggerUtilsEx;
@@ -16,9 +18,9 @@ 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.AbstractCollection;
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;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -201,7 +203,7 @@ public class DebuggerSettings implements Cloneable, PersistentStateComponent<Ele
}
@Tag("capture-points")
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<CapturePoint> getCapturePoints() {
return myCapturePoints;
}
@@ -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 org.jetbrains.java.debugger.breakpoints.properties;
@@ -19,9 +7,9 @@ import com.intellij.debugger.InstanceFilter;
import com.intellij.openapi.util.Comparing;
import com.intellij.ui.classFilter.ClassFilter;
import com.intellij.util.ArrayUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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;
@@ -40,7 +28,7 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
private InstanceFilter[] myInstanceFilters;
@Tag("instance-filters")
@AbstractCollection(surroundWithTag = false)
@XCollection
public InstanceFilter[] getInstanceFilters() {
return myInstanceFilters != null ? myInstanceFilters : InstanceFilter.EMPTY_ARRAY;
}
@@ -62,7 +50,7 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
}
@Tag("class-filters")
@AbstractCollection(surroundWithTag = false)
@XCollection
public final ClassFilter[] getClassFilters() {
return myClassFilters != null ? myClassFilters : ClassFilter.EMPTY_ARRAY;
}
@@ -81,7 +69,7 @@ public class JavaBreakpointProperties<T extends JavaBreakpointProperties> extend
}
@Tag("class-exclusion-filters")
@AbstractCollection(surroundWithTag = false)
@XCollection
public ClassFilter[] getClassExclusionFilters() {
return myClassExclusionFilters != null ? myClassExclusionFilters : ClassFilter.EMPTY_ARRAY;
}
@@ -1,25 +1,13 @@
/*
* 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 org.jetbrains.java.debugger.breakpoints.properties;
import com.intellij.ui.classFilter.ClassFilter;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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;
/**
@@ -79,7 +67,7 @@ public class JavaExceptionBreakpointProperties extends JavaBreakpointProperties<
}
@Tag("catch-class-filters")
@AbstractCollection(surroundWithTag = false)
@XCollection
public final ClassFilter[] getCatchClassFilters() {
return myCatchClassFilters != null ? myCatchClassFilters : ClassFilter.EMPTY_ARRAY;
}
@@ -91,7 +79,7 @@ public class JavaExceptionBreakpointProperties extends JavaBreakpointProperties<
}
@Tag("catch-class-exclusion-filters")
@AbstractCollection(surroundWithTag = false)
@XCollection
public ClassFilter[] getCatchClassExclusionFilters() {
return myCatchClassExclusionFilters != null ? myCatchClassExclusionFilters : ClassFilter.EMPTY_ARRAY;
}
@@ -1,4 +1,6 @@
// 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.
/*
* 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.execution.applet;
import com.intellij.application.options.ModulesComboBox;
@@ -17,6 +19,8 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.table.TableView;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
import org.jetbrains.annotations.NonNls;
@@ -29,7 +33,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class AppletConfigurable extends SettingsEditor<AppletConfiguration> implements CheckableRunConfigurationEditor<AppletConfiguration>,
@@ -60,25 +63,25 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
private static final ColumnInfo[] PARAMETER_COLUMNS = new ColumnInfo[]{
new MyColumnInfo(ExecutionBundle.message("applet.configuration.parameter.name.column")) {
public String valueOf(final AppletConfiguration.AppletParameter appletParameter) {
public String valueOf(final AppletParameter appletParameter) {
return appletParameter.getName();
}
public void setValue(final AppletConfiguration.AppletParameter appletParameter, final String name) {
public void setValue(final AppletParameter appletParameter, final String name) {
appletParameter.setName(name);
}
},
new MyColumnInfo(ExecutionBundle.message("applet.configuration.parameter.value.column")) {
public String valueOf(final AppletConfiguration.AppletParameter appletParameter) {
public String valueOf(final AppletParameter appletParameter) {
return appletParameter.getValue();
}
public void setValue(final AppletConfiguration.AppletParameter appletParameter, final String value) {
public void setValue(final AppletParameter appletParameter, final String value) {
appletParameter.setValue(value);
}
}
};
private final ListTableModel<AppletConfiguration.AppletParameter> myParameters;
private final ListTableModel<AppletParameter> myParameters;
private final TableView myTable;
@NonNls
protected static final String HTTP_PREFIX = "http:/";
@@ -153,9 +156,9 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
}
private void addParameter() {
final ArrayList<AppletConfiguration.AppletParameter> newItems =
final ArrayList<AppletParameter> newItems =
new ArrayList<>(myParameters.getItems());
final AppletConfiguration.AppletParameter parameter = new AppletConfiguration.AppletParameter("newParameter", "");
final AppletParameter parameter = new AppletParameter("newParameter", "");
newItems.add(parameter);
myParameters.setItems(newItems);
@@ -172,10 +175,10 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
return myPolicyFile.getComponent();
}
private static List<AppletConfiguration.AppletParameter> cloneParameters(final List<AppletConfiguration.AppletParameter> items) {
final List<AppletConfiguration.AppletParameter> params = new ArrayList<>();
for (AppletConfiguration.AppletParameter appletParameter : items) {
params.add(new AppletConfiguration.AppletParameter(appletParameter.getName(), appletParameter.getValue()));
private static List<AppletParameter> cloneParameters(@NotNull List<AppletParameter> items) {
List<AppletParameter> params = new SmartList<>();
for (AppletParameter appletParameter : items) {
params.add(new AppletParameter(appletParameter.getName(), appletParameter.getValue()));
}
return params;
}
@@ -192,11 +195,6 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
return myHtmlFile;
}
private static String toNull(String s) {
s = s.trim();
return s.length() == 0 ? null : s;
}
private static String toSystemFormat(String s) {
s = s.trim();
return s.length() == 0 ? null : s.replace(File.separatorChar, '/');
@@ -205,8 +203,7 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
public void applyEditorTo(@NotNull final AppletConfiguration configuration) {
checkEditorData(configuration);
myTable.stopEditing();
final List<AppletConfiguration.AppletParameter> params = cloneParameters(myParameters.getItems());
configuration.setAppletParameters(params);
configuration.getOptions().setAppletParameters(ContainerUtil.nullize(cloneParameters(myParameters.getItems())));
}
public void resetEditorFrom(@NotNull AppletConfiguration runConfiguration) {
@@ -225,13 +222,9 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
(configuration.getHtmlUsed() ? myURL : myMainClass).setSelected(true);
changePanel();
final AppletConfiguration.AppletParameter[] appletParameters = runConfiguration.getAppletParameters();
if (appletParameters != null) {
myParameters.setItems(cloneParameters(Arrays.asList(appletParameters)));
}
myParameters.setItems(cloneParameters(ContainerUtil.notNullize(configuration.getAppletParameters())));
myModuleSelector.reset(runConfiguration);
myJrePathEditor
.setPathOrName(configuration.getAlternativeJrePath(), configuration.getAlternativeJrePathEnabled());
myJrePathEditor.setPathOrName(configuration.getAlternativeJrePath(), configuration.getAlternativeJrePathEnabled());
}
private RawCommandLineEditor getVMParametersComponent() {
@@ -289,18 +282,18 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
myHtmlFileLabel.setAnchor(anchor);
}
private static abstract class MyColumnInfo extends ColumnInfo<AppletConfiguration.AppletParameter, String> {
private static abstract class MyColumnInfo extends ColumnInfo<AppletParameter, String> {
public MyColumnInfo(final String name) {
super(name);
}
public TableCellEditor getEditor(final AppletConfiguration.AppletParameter item) {
public TableCellEditor getEditor(final AppletParameter item) {
final JTextField textField = new JTextField();
textField.setBorder(BorderFactory.createLineBorder(Color.BLACK));
return new DefaultCellEditor(textField);
}
public boolean isCellEditable(final AppletConfiguration.AppletParameter appletParameter) {
public boolean isCellEditable(final AppletParameter appletParameter) {
return true;
}
}
@@ -16,13 +16,12 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JdkUtil;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.listeners.RefactoringElementListener;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.Transient;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -34,22 +33,15 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collection;
import java.util.List;
public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigurationModule> implements SingleClassConfiguration, RefactoringListenerProvider,
PersistentStateComponent<Element> {
private static final String NAME_ATTR = "name";
private static final String VALUE_ATTR = "value";
private static final String PARAMETER_ELEMENT_NAME = "parameter";
private AppletParameter[] myAppletParameters;
public AppletConfiguration(@NotNull Project project, @NotNull ConfigurationFactory factory) {
super(new JavaRunConfigurationModule(project, false), factory);
}
@Override
protected AppletConfigurationOptions getOptions() {
public AppletConfigurationOptions getOptions() {
return (AppletConfigurationOptions)super.getOptions();
}
@@ -129,42 +121,6 @@ public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
getOptions().setPolicyFile(ExternalizablePath.urlValue(localPath));
}
public static class AppletParameter {
public String myName;
public String myValue;
public AppletParameter(@NonNls final String name, final String value) {
myName = name;
myValue = value;
}
public String getName() {
return myName;
}
public void setName(final String name) {
myName = name;
}
public String getValue() {
return myValue;
}
public void setValue(final String value) {
myValue = value;
}
public boolean equals(final Object obj) {
if (!(obj instanceof AppletParameter)) return false;
final AppletParameter second = (AppletParameter)obj;
return Comparing.equal(myName, second.myName) && Comparing.equal(myValue, second.myValue);
}
public int hashCode() {
return Comparing.hashcode(myName, myValue);
}
}
@Override
public Collection<Module> getValidModules() {
return JavaRunConfigurationModule.getModulesForClass(getProject(), getOptions().getMainClassName());
@@ -174,35 +130,9 @@ public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
public Element getState() {
Element element = new Element("state");
super.writeExternal(element);
if (myAppletParameters != null) {
for (AppletParameter myAppletParameter : myAppletParameters) {
Element parameterElement = new Element(PARAMETER_ELEMENT_NAME);
element.addContent(parameterElement);
parameterElement.setAttribute(NAME_ATTR, myAppletParameter.getName());
parameterElement.setAttribute(VALUE_ATTR, myAppletParameter.getValue());
}
}
return element;
}
@Override
public void loadState(Element element) {
super.readExternal(element);
List<Element> paramList = element.getChildren(PARAMETER_ELEMENT_NAME);
if (paramList.isEmpty()) {
myAppletParameters = null;
}
else {
List<AppletParameter> parameters = new SmartList<>();
for (Element child : paramList) {
parameters.add(new AppletParameter(child.getAttributeValue(NAME_ATTR), child.getAttributeValue(VALUE_ATTR)));
}
myAppletParameters = parameters.toArray(new AppletParameter[parameters.size()]);
}
}
@Override
public RefactoringElementListener getRefactoringElementListener(final PsiElement element) {
if (getOptions().getHtmlUsed()) {
@@ -256,19 +186,6 @@ public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
throw new RuntimeConfigurationWarning("URL " + getOptions().getHtmlFileName() + " is not valid: " + ex.getLocalizedMessage());
}
@Transient
public AppletParameter[] getAppletParameters() {
return myAppletParameters;
}
public void setAppletParameters(AppletParameter[] appletParameters) {
myAppletParameters = appletParameters;
}
public void setAppletParameters(final List<AppletParameter> parameters) {
setAppletParameters(parameters.toArray(new AppletParameter[parameters.size()]));
}
private AppletHtmlFile getHtmlURL() throws CantRunException {
if (getOptions().getHtmlUsed()) {
if (getOptions().getHtmlFileName() == null) {
@@ -306,11 +223,8 @@ public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
"width=" + getOptions().getWidth() + "\n" +
"height=" + getOptions().getHeight() + "\n" +
"align=top>\n");
final AppletParameter[] appletParameters = getAppletParameters();
if (appletParameters != null) {
for (final AppletParameter parameter : appletParameters) {
writer.write("<param name=\"" + parameter.getName() + "\" value=\"" + parameter.getValue() + "\">\n");
}
for (AppletParameter parameter : ContainerUtil.notNullize(getOptions().getAppletParameters())) {
writer.write("<param name=\"" + parameter.getName() + "\" value=\"" + parameter.getValue() + "\">\n");
}
writer.write("</applet>\n</body>\n</html>\n");
}
@@ -3,20 +3,43 @@
*/
package com.intellij.execution.applet
import com.intellij.execution.ExternalizablePath
import com.intellij.execution.configurations.ModuleBasedConfigurationOptions
import com.intellij.util.xmlb.annotations.OptionTag
import com.intellij.openapi.application.PathManager
import com.intellij.util.xmlb.annotations.*
class AppletConfigurationOptions : ModuleBasedConfigurationOptions() {
@get:OptionTag("MAIN_CLASS_NAME") var mainClassName by string()
@get:OptionTag("HTML_FILE_NAME") var htmlFileName by string()
@get:OptionTag("HTML_USED") var htmlUsed by storedProperty(false)
@get:OptionTag("MAIN_CLASS_NAME")
var mainClassName by string()
@get:OptionTag("WIDTH") var width by storedProperty(400)
@get:OptionTag("HEIGHT") var height by storedProperty(300)
@get:OptionTag("HTML_FILE_NAME")
var htmlFileName by string()
@get:OptionTag("POLICY_FILE") var policyFile by string()
@get:OptionTag("VM_PARAMETERS") var vmParameters by string()
@get:OptionTag("HTML_USED")
var htmlUsed by storedProperty(false)
@get:OptionTag("ALTERNATIVE_JRE_PATH_ENABLED") var alternativeJrePathEnabled by storedProperty(false)
@get:OptionTag("ALTERNATIVE_JRE_PATH") var alternativeJrePath by string()
}
@get:OptionTag("WIDTH")
var width by storedProperty(400)
@get:OptionTag("HEIGHT")
var height by storedProperty(300)
@get:OptionTag("POLICY_FILE")
var policyFile by string(ExternalizablePath.urlValue("${PathManager.getHomePath()}/bin/appletviewer.policy"))
@get:OptionTag("VM_PARAMETERS")
var vmParameters by string()
@get:OptionTag("ALTERNATIVE_JRE_PATH_ENABLED")
var alternativeJrePathEnabled by storedProperty(false)
@get:OptionTag("ALTERNATIVE_JRE_PATH")
var alternativeJrePath by string()
@get:Property(surroundWithTag = false)
@get:XCollection()
var appletParameters by storedProperty<List<AppletParameter>?>()
}
@Tag("parameter")
data class AppletParameter(@get:Attribute("name") var name: String? = null, @get:Attribute("value") var value: String? = null)
@@ -1,27 +1,14 @@
/*
* 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.internal.statistic.libraryJar;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
public class LibraryJarDescriptors {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public LibraryJarDescriptor[] myDescriptors;
public LibraryJarDescriptor[] getDescriptors() {
@@ -1,23 +1,11 @@
/*
* Copyright 2000-2012 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 org.jetbrains.jps.model.serialization.artifact;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import java.util.ArrayList;
import java.util.List;
@@ -30,7 +18,7 @@ public class ArtifactManagerState {
private List<ArtifactState> myArtifacts = new ArrayList<>();
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<ArtifactState> getArtifacts() {
return myArtifacts;
}
@@ -1,29 +1,17 @@
/*
* Copyright 2000-2012 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 org.jetbrains.jps.model.serialization.artifact;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
/**
* @author nik
@@ -70,7 +58,7 @@ public class ArtifactState {
}
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<ArtifactPropertiesState> getPropertiesList() {
return myPropertiesList;
}
@@ -1,26 +1,13 @@
/*
* Copyright 2000-2012 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 org.jetbrains.jps.model.serialization.facet;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
/**
* @author nik
@@ -29,7 +16,7 @@ public class FacetManagerState {
private List<FacetState> myFacets = new ArrayList<>();
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<FacetState> getFacets() {
return myFacets;
}
@@ -1,29 +1,17 @@
/*
* Copyright 2000-2012 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 org.jetbrains.jps.model.serialization.facet;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jdom.Element;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
/**
* @author nik
@@ -57,7 +45,7 @@ public class FacetState {
}
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<FacetState> getSubFacets() {
return mySubFacets;
}
@@ -1,10 +1,16 @@
/*
* 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.jetbrains.jsonSchema;
import com.intellij.openapi.components.*;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import com.jetbrains.jsonSchema.ide.JsonSchemaService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -14,15 +20,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
/**
* @author Irina.Chernushina on 2/2/2016.
*/
@State(
name = "JsonSchemaMappingsProjectConfiguration",
storages = {
@Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/jsonSchemas.xml", scheme = StorageScheme.DIRECTORY_BASED)
}
)
@State(name = "JsonSchemaMappingsProjectConfiguration", storages = @Storage("jsonSchemas.xml"))
public class JsonSchemaMappingsProjectConfiguration implements PersistentStateComponent<JsonSchemaMappingsProjectConfiguration.MyState> {
public volatile MyState myState = new MyState();
@@ -39,7 +37,6 @@ public class JsonSchemaMappingsProjectConfiguration implements PersistentStateCo
return myState;
}
public void schemaFileMoved(@NotNull final Project project,
@NotNull final String oldRelativePath,
@NotNull final String newRelativePath) {
@@ -66,7 +63,7 @@ public class JsonSchemaMappingsProjectConfiguration implements PersistentStateCo
}
static class MyState {
@Tag("state") @AbstractCollection(surroundWithTag = false)
@Tag("state") @XCollection
public Map<String, UserDefinedJsonSchemaConfiguration> myState = new TreeMap<>();
public MyState() {
@@ -3,13 +3,19 @@
package com.intellij.configurationStore.xml
import com.intellij.configurationStore.deserialize
import com.intellij.ide.plugins.PluginBean
import com.intellij.openapi.util.JDOMExternalizableStringList
import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.assertions.Assertions.assertThat
import com.intellij.util.SmartList
import com.intellij.util.loadElement
import com.intellij.util.xmlb.SkipDefaultsSerializationFilter
import com.intellij.util.xmlb.XmlSerializationException
import com.intellij.util.xmlb.XmlSerializer
import com.intellij.util.xmlb.annotations.AbstractCollection
import com.intellij.util.xmlb.annotations.CollectionBean
import com.intellij.util.xmlb.annotations.Tag
import com.intellij.util.xmlb.annotations.XCollection
import org.assertj.core.api.Assertions.assertThatThrownBy
import org.jdom.Element
import org.junit.Test
@@ -83,7 +89,7 @@ internal class XmlSerializerCollectionTest {
val bean = BeanWithArrayWithoutTagName()
assertThatThrownBy({
doSerializerTest(
"<BeanWithArrayWithoutTagName><option name=\"V\"><option value=\"a\"/></option></BeanWithArrayWithoutTagName>",
"""<BeanWithArrayWithoutTagName><option name="V"><option value="a"/></option></BeanWithArrayWithoutTagName>""",
bean)
}).isInstanceOf(XmlSerializationException::class.java)
}
@@ -192,6 +198,101 @@ internal class XmlSerializerCollectionTest {
"<BeanWithSet>\n <option name=\"VALUES\">\n <set>\n <option value=\"1\" />\n <option value=\"2\" />\n <option value=\"3\" />\n </set>\n </option>\n</BeanWithSet>",
bean)
}
@Test fun testPropertyAndNoSurround() {
val bean = XmlSerializer.deserialize<PluginBean>(loadElement("""<idea-plugin>
<id>com.intellij.database.ide</id>
<name>DataGrip Customization</name>
<vendor>JetBrains</vendor>
<category>Database</category>
<depends>com.intellij.modules.datagrip</depends>
<depends>com.intellij.database</depends>
<extensions defaultExtensionNs="com.intellij">
<projectViewPane implementation="com.intellij.database.ide.DatabaseProjectViewPane"/>
<directoryProjectConfigurator implementation="com.intellij.database.ide.DatabaseProjectConfigurator"/>
<nonProjectFileWritingAccessExtension implementation="com.intellij.database.vfs.DbNonProjectFileWritingAccessExtension"/>
<applicationService serviceInterface="com.intellij.openapi.wm.impl.FrameTitleBuilder"
serviceImplementation="com.intellij.database.ide.DatabaseFrameTitleBuilder"
overrides="true"/>
<applicationService serviceInterface="com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter"
serviceImplementation="com.intellij.database.ide.DatabaseEditorEmptyTextPainter"
overrides="true"/>
<applicationService serviceInterface="com.intellij.ide.RecentProjectsManager"
serviceImplementation="com.intellij.database.ide.DatabaseRecentProjectManager"
overrides="true"/>
<projectService serviceInterface="com.intellij.ide.projectView.ProjectView"
serviceImplementation="com.intellij.database.ide.DatabaseProjectView"
overrides="true"/>
<projectService serviceInterface="com.intellij.psi.search.ProjectScopeBuilder"
serviceImplementation="com.intellij.database.ide.DatabaseProjectScopeBuilder"
overrides="true"/>
<goto.nonProjectScopeDisabler/>
</extensions>
<application-components>
<component>
<implementation-class>com.intellij.database.ide.DataGripInitialConfigurator</implementation-class>
<headless-implementation-class/>
</component>
</application-components>
<project-components>
<component>
<option name="overrides" value="true"/>
<interface-class>com.intellij.database.autoconfig.DatabaseConfigFileWatcher</interface-class>
<implementation-class/>
</component>
</project-components>
<actions>
<action id="DBE.AddContentRoot" class="com.intellij.database.ide.actions.AddContentRootAction" text="Attach Directory">
<add-to-group group-id="ProjectViewPopupMenu" anchor="before" relative-to-action="WeighingNewGroup"/>
<add-to-group group-id="FileOpenGroup" anchor="last"/>
</action>
<group id="NewProjectOrModuleGroup">
<action id="NewProject" class="com.intellij.database.ide.actions.NewProjectAction" text="Project..."/>
<separator/>
</group>
<action id="NewSqlFile" class="com.intellij.database.ide.actions.NewSqlFileAction">
<add-to-group group-id="DBE.NewFile" anchor="first"/>
</action>
<action overrides="true" id="GotoClass" class="com.intellij.ide.actions.GotoClassAction" text="Table/Class..."/>
<reference id="DatabaseView.PropertiesAction">
<add-to-group group-id="FileMainSettingsGroup" anchor="after" relative-to-action="ShowSettings"/>
</reference>
<action overrides="true" id="DatabaseView.ImportDataSources" class="com.intellij.openapi.actionSystem.EmptyAction"
text="Import from Sources..."/>
</actions>
</idea-plugin>"""), PluginBean::class.java)
assertThat(bean.actions.joinToString("\n") { JDOMUtil.writeElement(it) }).isEqualTo("""
<actions>
<action id="DBE.AddContentRoot" class="com.intellij.database.ide.actions.AddContentRootAction" text="Attach Directory">
<add-to-group group-id="ProjectViewPopupMenu" anchor="before" relative-to-action="WeighingNewGroup" />
<add-to-group group-id="FileOpenGroup" anchor="last" />
</action>
<group id="NewProjectOrModuleGroup">
<action id="NewProject" class="com.intellij.database.ide.actions.NewProjectAction" text="Project..." />
<separator />
</group>
<action id="NewSqlFile" class="com.intellij.database.ide.actions.NewSqlFileAction">
<add-to-group group-id="DBE.NewFile" anchor="first" />
</action>
<action overrides="true" id="GotoClass" class="com.intellij.ide.actions.GotoClassAction" text="Table/Class..." />
<reference id="DatabaseView.PropertiesAction">
<add-to-group group-id="FileMainSettingsGroup" anchor="after" relative-to-action="ShowSettings" />
</reference>
<action overrides="true" id="DatabaseView.ImportDataSources" class="com.intellij.openapi.actionSystem.EmptyAction" text="Import from Sources..." />
</actions>""".trimIndent())
}
}
@Tag("b")
@@ -207,6 +308,6 @@ private class Bean4 {
}
private class BeanWithArrayWithoutTagName {
@AbstractCollection(surroundWithTag = false)
@XCollection()
var V = arrayOf("a")
}
@@ -1,25 +1,10 @@
/*
* Copyright 2000-2015 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.plugins;
import com.intellij.openapi.components.OldComponentConfig;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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.*;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -28,15 +13,15 @@ import java.util.List;
public class PluginBean {
@Tag(APPLICATION_COMPONENTS)
@AbstractCollection(surroundWithTag = false)
@XCollection
public OldComponentConfig[] applicationComponents;
@Tag(PROJECT_COMPONENTS)
@AbstractCollection(surroundWithTag = false)
@XCollection
public OldComponentConfig[] projectComponents;
@Tag(MODULE_COMPONENTS)
@AbstractCollection(surroundWithTag = false)
@XCollection
public OldComponentConfig[] moduleComponents;
@NonNls public static final String APPLICATION_COMPONENTS = "application-components";
@@ -77,11 +62,11 @@ public class PluginBean {
public Element[] actions;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public PluginDependency[] dependencies;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public PluginHelpSet[] helpSets;
@Tag("category")
@@ -1,17 +1,5 @@
/*
* 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.
* 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.psi;
@@ -27,10 +15,10 @@ import com.intellij.patterns.StandardPatterns;
import com.intellij.util.KeyedLazyInstance;
import com.intellij.util.NullableFunction;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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 org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -54,7 +42,7 @@ public class PsiReferenceProviderBean extends AbstractExtensionPointBean impleme
public String description;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public ElementPatternBean[] patterns;
public String getDescription() {
@@ -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.dvcs.push;
@@ -20,9 +8,9 @@ import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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;
import org.jetbrains.annotations.Nullable;
@@ -34,7 +22,7 @@ public class PushSettings implements PersistentStateComponent<PushSettings.State
private State myState = new State();
public static class State {
@AbstractCollection(surroundWithTag = false)
@XCollection
@Tag("force-push-targets")
public List<ForcePushTargetInfo> FORCE_PUSH_TARGETS = ContainerUtil.newArrayList();
}
@@ -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.openapi.externalSystem.service.project.manage;
@@ -40,9 +28,9 @@ import com.intellij.util.Alarm;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -469,7 +457,7 @@ public class ExternalProjectsDataStorage implements SettingsSavingComponent, Per
static class ModuleState {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false, elementTag = "id")
@XCollection(elementName = "id")
public final Set<String> set = ContainerUtil.newConcurrentSet();
public ModuleState() {
@@ -1,22 +1,10 @@
/*
* 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.
* 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.externalSystem.service.project.manage;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -29,31 +17,31 @@ import java.util.List;
@Tag("activation")
public class TaskActivationState {
@Tag("before_run")
@AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
@XCollection(elementName = "task", valueAttributeName = "name")
public List<String> beforeRunTasks = new ArrayList<>();
@Tag("before_sync")
@AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
@XCollection(elementName = "task", valueAttributeName = "name")
public List<String> beforeSyncTasks = new ArrayList<>();
@Tag("after_sync")
@AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
@XCollection(elementName = "task", valueAttributeName = "name")
public List<String> afterSyncTasks = new ArrayList<>();
@Tag("before_compile")
@AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
@XCollection(elementName = "task", valueAttributeName = "name")
public List<String> beforeCompileTasks = new ArrayList<>();
@Tag("after_compile")
@AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
@XCollection(elementName = "task", valueAttributeName = "name")
public List<String> afterCompileTasks = new ArrayList<>();
@Tag("after_rebuild")
@AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
@XCollection(elementName = "task", valueAttributeName = "name")
public List<String> afterRebuildTask = new ArrayList<>();
@Tag("before_rebuild")
@AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
@XCollection(elementName = "task", valueAttributeName = "name")
public List<String> beforeRebuildTask = new ArrayList<>();
public boolean isEmpty() {
@@ -196,6 +196,10 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
public void customizeLogConsole(LogConsole console) {
}
public void loadState(@NotNull Element element) {
readExternal(element);
}
@Override
public void readExternal(@NotNull Element element) throws InvalidDataException {
myLogFiles.clear();
@@ -1,9 +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 com.intellij.facet.frameworks.beans;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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;
/**
* @deprecated this class will be removed from open API in IDEA 11. Use {@link com.intellij.util.download.DownloadableFileService} instead
@@ -13,7 +16,7 @@ public class Artifact {
public static final Artifact[] EMPTY_ARRAY = new Artifact[0];
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public ArtifactItem[] myItems;
@Attribute("version")
@@ -1,36 +1,21 @@
/*
* Copyright 2000-2010 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.facet.frameworks.beans;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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 java.util.List;
@Tag("item")
public class ArtifactItem {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public RequiredClass[] myRequiredClasses;
@Attribute("name")
@@ -1,12 +1,15 @@
/*
* 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.facet.frameworks.beans;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
public class Artifacts {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public Artifact[] myVersions;
public Artifact[] getArtifacts() {
@@ -1,9 +1,10 @@
// 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.
/*
* 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.execution;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
@@ -12,8 +13,6 @@ import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import java.io.File;
/**
* @author dyoma
*/
@@ -31,7 +30,7 @@ public class ExternalizablePath implements JDOMExternalizable {
}
@Override
public void writeExternal(final Element element) throws WriteExternalException {
public void writeExternal(final Element element) {
element.setAttribute(VALUE_ATTRIBUTE, myUrl);
}
@@ -40,7 +39,7 @@ public class ExternalizablePath implements JDOMExternalizable {
}
public static String urlValue(String localPath) {
return StringUtil.isEmptyOrSpaces(localPath) ? "" : VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, localPath.trim().replace(File.separatorChar, '/'));
return StringUtil.isEmptyOrSpaces(localPath) ? "" : VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtilRt.toSystemIndependentName(localPath.trim()));
}
public static String localPathValue(@Nullable String url) {
@@ -1,39 +1,24 @@
/*
* Copyright 2000-2015 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.execution.startup;
import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.XmlSerializerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.Transient;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
/**
* @author Irina.Chernushina on 8/19/2015.
*/
public class ProjectStartupConfigurationBase implements PersistentStateComponent<ProjectStartupConfigurationBase> {
@Tag("configurations") @AbstractCollection(surroundWithTag = false)
@Tag("configurations")
@XCollection
private final List<ConfigurationDescriptor> myList;
protected ProjectStartupConfigurationBase() {
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2011 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.framework.detection.impl.exclude;
@@ -19,6 +7,7 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
import java.util.ArrayList;
import java.util.List;
@@ -38,7 +27,7 @@ public class ExcludesConfigurationState {
}
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<ExcludedFileState> getFiles() {
return myFiles;
}
@@ -1,17 +1,5 @@
/*
* 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.framework.detection.impl.exclude.old;
@@ -19,9 +7,9 @@ package com.intellij.framework.detection.impl.exclude.old;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.containers.SortedList;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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;
import org.jetbrains.annotations.Nullable;
@@ -62,7 +50,7 @@ public class DisabledAutodetectionByTypeElement {
}
@Tag("modules")
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<DisabledAutodetectionInModuleElement> getModuleElements() {
return myModuleElements;
}
@@ -1,24 +1,12 @@
/*
* 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.framework.detection.impl.exclude.old;
import com.intellij.util.containers.SortedList;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,7 +19,7 @@ public class DisabledAutodetectionInfo {
private List<DisabledAutodetectionByTypeElement> myElements = new SortedList<>(DisabledAutodetectionByTypeElement.COMPARATOR);
@Tag("autodetection-disabled")
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<DisabledAutodetectionByTypeElement> getElements() {
return myElements;
}
@@ -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.ide.projectView.impl;
@@ -24,9 +12,9 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.util.ModificationTracker;
import com.intellij.util.containers.SortedList;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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;
import java.util.Arrays;
@@ -109,7 +97,7 @@ public class ProjectViewFileNestingService implements PersistentStateComponent<P
public static class MyState {
@Tag("nesting-rules")
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<NestingRule> myRules = new SortedList<>(Comparator.comparing(o -> o.getParentFileSuffix()));
public MyState() {
@@ -1,4 +1,6 @@
// 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.
/*
* 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.module.impl
import com.intellij.notification.Notification
@@ -11,8 +13,8 @@ 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.AbstractCollection
import com.intellij.util.xmlb.annotations.Tag
import com.intellij.util.xmlb.annotations.XCollection
import com.intellij.xml.util.XmlStringUtil
/**
@@ -153,7 +155,7 @@ class AutomaticModuleUnloader(private val project: Project) : PersistentStateCom
class LoadedModulesListStorage {
@Tag("loaded-modules")
@AbstractCollection(surroundWithTag = false, elementTag = "module", elementValueAttribute = "name")
@XCollection(elementName = "module", valueAttributeName = "name")
var modules: MutableList<String> = ArrayList()
}
@@ -1,21 +1,8 @@
/*
* 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.openapi.actionSystem.ex;
import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.extensions.PluginId;
@@ -26,7 +13,6 @@ import javax.swing.*;
import java.awt.event.InputEvent;
import java.util.Comparator;
public abstract class ActionManagerEx extends ActionManager {
public static ActionManagerEx getInstanceEx() {
return (ActionManagerEx)getInstance();
@@ -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.openapi.options;
@@ -23,10 +11,10 @@ import com.intellij.openapi.extensions.AbstractExtensionPointBean;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.AtomicNotNullLazyValue;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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 org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.picocontainer.PicoContainer;
@@ -84,7 +72,7 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
}
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public ConfigurableEP[] children;
/**
@@ -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.openapi.ui;
@@ -20,9 +8,9 @@ import com.intellij.openapi.components.*;
import com.intellij.openapi.project.Project;
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.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -90,7 +78,7 @@ public class MasterDetailsStateService implements PersistentStateComponent<Maste
private List<ComponentState> myStates = new ArrayList<>();
@Tag("states")
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<ComponentState> getStates() {
return myStates;
}
@@ -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.externalDependencies.impl;
@@ -26,8 +14,8 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.FilteringIterator;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -99,7 +87,7 @@ public class ExternalDependenciesManagerImpl extends ExternalDependenciesManager
public static class ExternalDependenciesState {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<DependencyOnPluginState> myDependencies = new ArrayList<>();
}
}
@@ -1,7 +1,10 @@
/*
* 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.remoteServer.impl.configuration;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
import java.util.ArrayList;
import java.util.List;
@@ -11,6 +14,6 @@ import java.util.List;
*/
public class RemoteServersManagerState {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<RemoteServerState> myServers = new ArrayList<>();
}
@@ -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.remoteServer.impl.runtime.clientLibrary;
@@ -32,9 +20,7 @@ import com.intellij.remoteServer.runtime.clientLibrary.ClientLibraryManager;
import com.intellij.util.EventDispatcher;
import com.intellij.util.download.*;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -192,7 +178,7 @@ public class ClientLibraryManagerImpl extends ClientLibraryManager implements Pe
public static class State {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<DownloadedLibraryState> myLibraries = new ArrayList<>();
}
}
@@ -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.execution.testframework.autotest;
@@ -39,9 +27,9 @@ import com.intellij.openapi.util.Key;
import com.intellij.ui.content.Content;
import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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;
import org.jetbrains.annotations.Nullable;
@@ -245,7 +233,7 @@ public abstract class AbstractAutoTestManager implements PersistentStateComponen
public static class State {
@Tag("enabled-run-configurations")
@AbstractCollection(surroundWithTag = false)
@XCollection
List<AutoTestManager.RunConfigurationDescriptor> myEnabledRunConfigurations = ContainerUtil.newArrayList();
}
@@ -1,23 +1,13 @@
// 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;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import gnu.trove.THashMap;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jdom.Content;
import org.jdom.Element;
import org.jdom.Text;
@@ -28,22 +18,31 @@ import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
abstract class AbstractCollectionBinding extends NotNullDeserializeBinding implements MultiNodeBinding {
private Map<Class<?>, Binding> itemBindings;
private List<Binding> itemBindings;
protected final Class<?> itemType;
@Nullable
protected final AbstractCollection annotation;
private final AbstractCollection annotation;
@Nullable
protected final XCollection newAnnotation;
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
private Serializer serializer;
private boolean isItemTypePrimitive;
public AbstractCollectionBinding(@NotNull Class elementType, @Nullable MutableAccessor accessor) {
super(accessor);
itemType = elementType;
annotation = accessor == null ? null : accessor.getAnnotation(AbstractCollection.class);
newAnnotation = accessor == null ? null : accessor.getAnnotation(XCollection.class);
annotation = newAnnotation == null ? (accessor == null ? null : accessor.getAnnotation(AbstractCollection.class)) : null;
}
protected boolean isSortOrderedSet() {
return annotation == null || annotation.sortOrderedSet();
}
@Override
@@ -55,36 +54,43 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
public void init(@NotNull Type originalType, @NotNull Serializer serializer) {
this.serializer = serializer;
if (annotation == null || annotation.surroundWithTag()) {
if (isSurroundWithTag()) {
return;
}
if (StringUtil.isEmpty(annotation.elementTag()) ||
(annotation.elementTag().equals(Constants.OPTION) && serializer.getBinding(itemType) == null)) {
isItemTypePrimitive = XmlSerializerImpl.isPrimitive(itemType);
//noinspection ConstantConditions
if (isItemTypePrimitive && (newAnnotation != null || StringUtil.isEmpty(getElementName()))) {
throw new XmlSerializationException("If surround with tag is turned off, element tag must be specified for: " + myAccessor);
}
}
private boolean isSurroundWithTag() {
return newAnnotation == null && (annotation == null || annotation.surroundWithTag());
}
@NotNull
private synchronized Map<Class<?>, Binding> getElementBindings() {
private synchronized List<Binding> getElementBindings() {
if (itemBindings == null) {
Binding binding = serializer.getBinding(itemType);
if (annotation == null || annotation.elementTypes().length == 0) {
itemBindings = binding == null ? Collections.<Class<?>, Binding>emptyMap() : Collections.<Class<?>, Binding>singletonMap(itemType, binding);
itemBindings = binding == null ? Collections.<Binding>emptyList() : Collections.singletonList(binding);
}
else {
itemBindings = new THashMap<Class<?>, Binding>();
itemBindings = new SmartList<Binding>();
if (binding != null) {
itemBindings.put(itemType, binding);
itemBindings.add(binding);
}
for (Class aClass : annotation.elementTypes()) {
Binding b = serializer.getBinding(aClass);
if (b != null) {
itemBindings.put(aClass, b);
if (b != null && !itemBindings.contains(b)) {
itemBindings.add(b);
}
}
if (itemBindings.isEmpty()) {
itemBindings = Collections.emptyMap();
itemBindings = Collections.emptyList();
}
}
}
@@ -93,7 +99,7 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
@Nullable
private Binding getElementBinding(@NotNull Element element) {
for (Binding binding : getElementBindings().values()) {
for (Binding binding : getElementBindings()) {
if (binding.isBoundTo(element)) {
return binding;
}
@@ -173,8 +179,8 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
Binding binding = serializer.getBinding(value.getClass());
if (binding == null) {
Element serializedItem = new Element(annotation == null ? Constants.OPTION : annotation.elementTag());
String attributeName = annotation == null ? Constants.VALUE : annotation.elementValueAttribute();
Element serializedItem = new Element(getElementName());
String attributeName = getValueAttributeName();
String serialized = XmlSerializerImpl.convertToString(value);
if (attributeName.isEmpty()) {
if (!serialized.isEmpty()) {
@@ -194,7 +200,7 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
private Object deserializeItem(@NotNull Element node, @Nullable Object context) {
Binding binding = getElementBinding(node);
if (binding == null) {
String attributeName = annotation == null ? Constants.VALUE : annotation.elementValueAttribute();
String attributeName = getValueAttributeName();
String value;
if (attributeName.isEmpty()) {
value = XmlSerializerImpl.getTextValue(node, "");
@@ -209,6 +215,22 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
}
}
@NotNull
private String getElementName() {
if (newAnnotation != null) {
return newAnnotation.elementName();
}
return annotation == null ? Constants.OPTION : annotation.elementTag();
}
@NotNull
private String getValueAttributeName() {
if (newAnnotation != null) {
return newAnnotation.valueAttributeName();
}
return annotation == null ? Constants.VALUE : annotation.elementValueAttribute();
}
@Override
@NotNull
public Object deserialize(@Nullable Object context, @NotNull Element element) {
@@ -253,22 +275,21 @@ abstract class AbstractCollectionBinding extends NotNullDeserializeBinding imple
@Override
public boolean isBoundTo(@NotNull Element element) {
String tagName = getTagName(element);
if (tagName == null) {
if (element.getName().equals(annotation == null ? Constants.OPTION : annotation.elementTag())) {
return true;
}
if (getElementBinding(element) != null) {
return true;
}
if (tagName != null) {
return element.getName().equals(tagName);
}
return element.getName().equals(tagName);
if (isItemTypePrimitive) {
return element.getName().equals(getElementName());
}
else {
return getElementBinding(element) != null;
}
}
@Nullable
private String getTagName(@Nullable Object target) {
return annotation == null || annotation.surroundWithTag() ? getCollectionTagName(target) : null;
return isSurroundWithTag() ? getCollectionTagName(target) : null;
}
protected abstract String getCollectionTagName(@Nullable Object target);
@@ -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;
@@ -22,7 +10,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
class AccessorBindingWrapper extends Binding implements MultiNodeBinding {
private final Binding myBinding;
protected final Binding myBinding;
private final boolean myFlat;
@@ -1,16 +1,6 @@
// 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;
import com.intellij.openapi.util.Couple;
@@ -369,6 +359,7 @@ public class BeanBinding extends NotNullDeserializeBinding {
object.getAnnotation(Text.class) != null ||
object.getAnnotation(CollectionBean.class) != null ||
object.getAnnotation(MapAnnotation.class) != null ||
object.getAnnotation(XCollection.class) != null ||
object.getAnnotation(AbstractCollection.class) != null;
}
@@ -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;
@@ -46,7 +34,7 @@ class CollectionBinding extends AbstractCollectionBinding {
@NotNull
@Override
Collection<Object> getIterable(@NotNull Object o) {
if (annotation != null && !annotation.sortOrderedSet() && o instanceof LinkedHashSet) {
if (isSortOrderedSet() && o instanceof LinkedHashSet) {
return (Collection<Object>)o;
}
return o instanceof Set ? new TreeSet((Set)o) : (Collection<Object>)o;
@@ -1,16 +1,6 @@
// 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;
import com.intellij.openapi.util.JDOMExternalizableStringList;
@@ -185,7 +175,7 @@ public final class XmlSerializerImpl {
}
}
private static boolean isPrimitive(@NotNull Class<?> aClass) {
static boolean isPrimitive(@NotNull Class<?> aClass) {
return aClass.isPrimitive() ||
aClass == String.class ||
aClass == Integer.class ||
@@ -0,0 +1,62 @@
/*
* 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.annotations;
import com.intellij.util.xmlb.Constants;
import org.jetbrains.annotations.ApiStatus;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Experimental.
*
* ```xml
* <option value="$value" />
* ... n item elements
* ```
*
* Where `option` it is item element (use `elementName` to customize element name) and
* `value` it is value attribute (use `valueAttributeName` to customize attribute name).
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
@ApiStatus.Experimental
public @interface XCollection {
/**
* Value of primitive type wrapped into element named `option`. This option allows you to customize element name.
* For example, for `elementName = "module"`:
*
* <module value="$value" />
*/
String elementName() default Constants.OPTION;
/**
* Value of primitive type wrapped into element named `option`. This option allows you to customize name of value attribute.
* For example, for `valueAttributeName = "name"`:
*
* <option name="$value" />
*
* Empty name is allowed — in this case value will be serialized as element text.
* For example, for `valueAttributeName = ""`:
*
* <option>
* $value
* </option>
*/
String valueAttributeName() default Constants.OPTION;
enum Style {
/**
* Old style as AbstractCollection(surroundWithTag = false).
* <p>
* <option value="$value" />
*/
v1
}
Style style() default Style.v1;
}
@@ -1,4 +1,6 @@
// 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.
/*
* 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.vcs;
import com.intellij.ide.todo.TodoPanelSettings;
@@ -68,7 +70,7 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
public boolean SHELVE_DETAILS_PREVIEW_SHOWN = false;
public boolean RELOAD_CONTEXT = true;
@AbstractCollection(surroundWithTag = false, elementTag = "path")
@XCollection(elementName = "path")
@Tag("ignored-roots")
public List<String> IGNORED_UNREGISTERED_ROOTS = ContainerUtil.newArrayList();
@@ -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.impl;
@@ -34,9 +22,9 @@ import com.intellij.util.PathUtil;
import com.intellij.util.SystemProperties;
import com.intellij.util.graph.*;
import com.intellij.util.xmlb.XmlSerializer;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import org.jdom.Document;
import org.jetbrains.annotations.NotNull;
@@ -363,7 +351,7 @@ public class ConversionServiceImpl extends ConversionService {
@Tag("conversion")
public static class CachedConversionResult {
@Tag("applied-converters")
@AbstractCollection(surroundWithTag = false, elementTag = "converter", elementValueAttribute = "id")
@XCollection(elementName = "converter", valueAttributeName = "id")
public Set<String> myAppliedConverters = new HashSet<>();
@Tag("project-files")
@@ -1,12 +1,14 @@
// 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.
/*
* 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.PersistentStateComponent;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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;
@@ -64,7 +66,7 @@ public class XDebuggerWatchesManager implements PersistentStateComponent<XDebugg
@Tag("watches-manager")
public static class WatchesManagerState {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<ConfigurationState> expressions = new ArrayList<>();
}
@@ -74,7 +76,7 @@ public class XDebuggerWatchesManager implements PersistentStateComponent<XDebugg
public String myName;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public WatchState[] myExpressionStates;
public ConfigurationState() {
@@ -1,4 +1,6 @@
// 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.
/*
* 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.Disposable;
@@ -18,6 +20,7 @@ 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.*;
@@ -513,7 +516,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
private String myDefaultGroup;
@Tag("default-breakpoints")
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<BreakpointState> getDefaultBreakpoints() {
return myDefaultBreakpoints;
}
@@ -1,4 +1,6 @@
// 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.
/*
* 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.settings;
import com.intellij.configurationStore.ComponentSerializationUtil;
@@ -9,10 +11,10 @@ import com.intellij.openapi.util.JDOMUtil;
import com.intellij.util.SmartList;
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.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.settings.XDebuggerSettings;
import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import gnu.trove.THashMap;
@@ -118,7 +120,7 @@ public class XDebuggerSettingManagerImpl extends XDebuggerSettingsManager implem
public static class SettingsState {
@Tag("debuggers")
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<SpecificSettingsState> specificStates = new SmartList<>();
private XDebuggerDataViewSettings myDataViewSettings = new XDebuggerDataViewSettings();
private XDebuggerGeneralSettings myGeneralSettings = new XDebuggerGeneralSettings();
@@ -1,24 +1,12 @@
/*
* Copyright 2000-2012 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 org.jetbrains.jps.ant.model.impl.artifacts;
import com.intellij.lang.ant.config.impl.BuildFileProperty;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
import java.util.ArrayList;
import java.util.List;
@@ -37,6 +25,6 @@ public class AntArtifactExtensionProperties {
public boolean myEnabled;
@Tag("build-properties")
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<BuildFileProperty> myUserProperties = new ArrayList<>();
}
@@ -2,7 +2,7 @@ import com.intellij.util.xmlb.annotations.*;
public class ExtBeanWithInnerTags {
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public InnerBean[] children;
}
@@ -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 git4idea.config;
@@ -23,10 +11,10 @@ import com.intellij.openapi.project.Project;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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 git4idea.GitRemoteBranch;
import git4idea.GitUtil;
import git4idea.push.GitPushTagMode;
@@ -84,7 +72,7 @@ public class GitVcsSettings implements PersistentStateComponent<GitVcsSettings.S
public boolean SET_USER_NAME_GLOBALLY = true;
public boolean SWAP_SIDES_IN_COMPARE_BRANCHES = false;
@AbstractCollection(surroundWithTag = false)
@XCollection
@Tag("push-targets")
public List<PushTargetInfo> PUSH_TARGETS = ContainerUtil.newArrayList();
@@ -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 org.jetbrains.plugins.gradle.settings;
@@ -29,7 +17,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.psi.CommonClassNames;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -226,16 +213,16 @@ public class GradleExtensionsSettings implements PersistentStateComponent<Gradle
@Attribute("parent")
public String parent;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<GradleExtension> extensions = new SmartList<>();
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<GradleProp> properties = new SmartList<>();
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<GradleTask> tasks = new SmartList<>();
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public List<GradleConfiguration> configurations = new SmartList<>();
@Transient
@@ -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 org.jetbrains.plugins.groovy.dsl;
@@ -20,8 +8,8 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.XCollection;
import gnu.trove.THashMap;
import gnu.trove.TObjectObjectProcedure;
import org.jetbrains.annotations.NotNull;
@@ -91,7 +79,7 @@ public class DslActivationStatus implements PersistentStateComponent<DslActivati
}
public static class State {
@AbstractCollection(surroundWithTag = false)
@XCollection
public Collection<Entry> entries;
public State(@NotNull Collection<Entry> entries) {
@@ -1,25 +1,13 @@
/*
* 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.
* 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 org.jetbrains.plugins.groovy.extensions;
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.XCollection;
/**
* @author Sergey Evdokimov
@@ -33,7 +21,6 @@ public class GroovyClassDescriptor extends AbstractExtensionPointBean {
public String className;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public GroovyMethodDescriptorTag[] methods;
}
@@ -1,25 +1,13 @@
/*
* 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 org.jetbrains.plugins.groovy.extensions;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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 org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.extensions.impl.StringTypeCondition;
@@ -29,7 +17,6 @@ import java.util.*;
* @author Sergey Evdokimov
*/
public class GroovyMethodDescriptor {
private static final String ATTR_NAMES_DELIMITER = " \t\n\r,;";
@Attribute("name")
@@ -39,7 +26,7 @@ public class GroovyMethodDescriptor {
public Boolean checkParamsType;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public Param[] params;
@Tag("param")
@@ -67,7 +54,7 @@ public class GroovyMethodDescriptor {
public Boolean isNamedArgsShowFirst;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
//public Arguments[] arguments;
public NamedArgument[] myArguments;
@@ -95,7 +82,7 @@ public class GroovyMethodDescriptor {
}
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public ClosureArgument[] myClosureArguments;
@Tag("closureArgument")
@@ -1,27 +1,15 @@
/*
* Copyright 2000-2010 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 org.jetbrains.idea.maven.dom.converters.repositories.beans;
import com.intellij.util.xmlb.annotations.AbstractCollection;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.util.xmlb.annotations.XCollection;
public class RepositoriesBean {
@Tag("repositories")
@AbstractCollection(surroundWithTag = false)
@XCollection
public RepositoryBeanInfo[] myRepositories;
public RepositoryBeanInfo[] getRepositories() {
@@ -1,17 +1,5 @@
/*
* 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.
* 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 org.jetbrains.idea.maven.plugins.api;
@@ -23,10 +11,10 @@ import com.intellij.util.SmartList;
import com.intellij.util.xml.DomElement;
import com.intellij.util.xml.DomUtil;
import com.intellij.util.xml.Required;
import com.intellij.util.xmlb.annotations.AbstractCollection;
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 org.jetbrains.idea.maven.dom.model.MavenDomConfiguration;
import org.jetbrains.idea.maven.dom.model.MavenDomGoal;
import org.jetbrains.idea.maven.dom.model.MavenDomPlugin;
@@ -56,11 +44,11 @@ public class MavenPluginDescriptor extends AbstractExtensionPointBean {
public String mavenId;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public Param[] params;
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
public ModelProperty[] properties;
@Attribute("propertyGenerator")
@@ -137,7 +125,7 @@ public class MavenPluginDescriptor extends AbstractExtensionPointBean {
if (res == null) {
res = new HashMap<>();
for (MavenPluginDescriptor pluginDescriptor : MavenPluginDescriptor.EP_NAME.getExtensions()) {
for (MavenPluginDescriptor pluginDescriptor : EP_NAME.getExtensions()) {
Pair<String, String> pluginId = parsePluginId(pluginDescriptor.mavenId);
Map<String, Map<String, List<MavenPluginDescriptor>>> groupMap = MavenUtil.getOrCreate(res, pluginId.second);// pluginId.second is artifactId
@@ -1,3 +1,6 @@
/*
* 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.tasks.generic;
import com.intellij.openapi.diagnostic.Logger;
@@ -8,9 +11,9 @@ 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.AbstractCollection;
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;
import org.jetbrains.annotations.Nullable;
@@ -85,7 +88,7 @@ public abstract class SelectorBasedResponseHandler extends ResponseHandler {
@Tag("selectors")
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
@XCollection
@NotNull
public List<Selector> getSelectors() {
return new ArrayList<>(mySelectors.values());
@@ -1,3 +1,6 @@
/*
* 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.tasks.mantis;
import com.intellij.tasks.mantis.model.ProjectData;
@@ -62,7 +65,7 @@ public final class MantisProject {
}
//@OptionTag(tag = "filters", nameAttribute = "")
//@AbstractCollection(surroundWithTag = false)
//@XCollection
/**
* Filters here are used only to simplify combo boxes management and are refreshed every time when settings
@@ -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.jetbrains.python.console;
@@ -224,7 +212,7 @@ public class PyConsoleOptions implements PersistentStateComponent<PyConsoleOptio
}
@NotNull
@AbstractCollection(surroundWithTag = false)
@XCollection
public PathMappingSettings getMappings() {
return myMappings;
}
-4
View File
@@ -10,10 +10,6 @@
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>
<configuration name="&lt;template&gt;" type="Applet" default="true" selected="false">
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
</configuration>
<configuration name="&lt;template&gt;" type="JUnit" default="true" selected="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" value="-ea"/>