
com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsState Maven / Gradle / Ivy
/*
* 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.
*/
package com.intellij.openapi.externalSystem.service.project.manage;
import com.intellij.openapi.externalSystem.view.ExternalProjectsViewState;
import com.intellij.util.containers.FactoryMap;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.Tag;
import org.jetbrains.annotations.Nullable;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author Vladislav.Soroka
* @since 10/23/2014
*/
public class ExternalProjectsState {
private final Map myExternalSystemsState = new NullSafeMap() {
@Nullable
@Override
protected State create(String key) {
return new State();
}
};
@Property(surroundWithTag = false)
@MapAnnotation(surroundWithTag = false, surroundValueWithTag = false, surroundKeyWithTag = false,
keyAttributeName = "id", entryTagName = "system")
public Map getExternalSystemsState() {
return myExternalSystemsState;
}
@SuppressWarnings("UnusedDeclaration")
public void setExternalSystemsState(Map externalSystemsState) {
}
@Tag("state")
public static class State {
private ExternalProjectsViewState projectsViewState = new ExternalProjectsViewState();
private final Map myExternalSystemsTaskActivation = new FactoryMap() {
@Nullable
@Override
protected TaskActivationState create(String key) {
return new TaskActivationState();
}
@Override
public TaskActivationState put(String key, TaskActivationState value) {
if(value == null) return null;
return super.put(key, value);
}
@Override
protected Map createMap() {
return new LinkedHashMap();
}
};
@Property(surroundWithTag = false)
@MapAnnotation(surroundWithTag = false, surroundValueWithTag = false, surroundKeyWithTag = false,
keyAttributeName = "path", entryTagName = "task", sortBeforeSave = false)
public Map getExternalSystemsTaskActivation() {
return myExternalSystemsTaskActivation;
}
@SuppressWarnings("UnusedDeclaration")
public void setExternalSystemsTaskActivation(Map externalSystemsTaskActivation) {
}
@Property(surroundWithTag = false)
public ExternalProjectsViewState getProjectsViewState() {
return projectsViewState;
}
public void setProjectsViewState(ExternalProjectsViewState projectsViewState) {
this.projectsViewState = projectsViewState;
}
}
public static abstract class NullSafeMap extends FactoryMap {
@Override
public V put(K key, V value) {
if(value == null) return null;
return super.put(key, value);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy