diff options
Diffstat (limited to 'platform/external-system-api/src/com/intellij/openapi/externalSystem/model')
15 files changed, 985 insertions, 32 deletions
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java index 4efac184c2ee..10fc11acbf5f 100644 --- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java @@ -69,6 +69,18 @@ public class DataNode<T> implements Serializable { } @NotNull + public <T> DataNode<T> createOrReplaceChild(@NotNull Key<T> key, @NotNull T data) { + for (Iterator<DataNode<?>> iterator = myChildren.iterator(); iterator.hasNext(); ) { + DataNode<?> child = iterator.next(); + if (child.getKey().equals(key)) { + iterator.remove(); + break; + } + } + return createChild(key, data); + } + + @NotNull public Key<T> getKey() { return myKey; } diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalFilter.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalFilter.java new file mode 100644 index 000000000000..6bc9cf9aed94 --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalFilter.java @@ -0,0 +1,62 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; + +/** + * @author Vladislav.Soroka + * @since 7/22/2014 + */ +public class DefaultExternalFilter implements ExternalFilter { + private static final long serialVersionUID = 1L; + + @NotNull + private String myFilterType; + @NotNull + private String myPropertiesAsJsonMap; + + public DefaultExternalFilter() { + myPropertiesAsJsonMap = ""; + myFilterType = ""; + } + + + public DefaultExternalFilter(ExternalFilter filter) { + myPropertiesAsJsonMap = filter.getPropertiesAsJsonMap(); + myFilterType = filter.getFilterType(); + } + + @NotNull + @Override + public String getFilterType() { + return myFilterType; + } + + public void setFilterType(@NotNull String filterType) { + myFilterType = filterType; + } + + @Override + @NotNull + public String getPropertiesAsJsonMap() { + return myPropertiesAsJsonMap; + } + + public void setPropertiesAsJsonMap(@NotNull String propertiesAsJsonMap) { + myPropertiesAsJsonMap = propertiesAsJsonMap; + } +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalPlugin.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalPlugin.java new file mode 100644 index 000000000000..8b7991b1d88c --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalPlugin.java @@ -0,0 +1,46 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; + +/** + * @author Vladislav.Soroka + * @since 7/16/2014 + */ +public class DefaultExternalPlugin implements ExternalPlugin { + private static final long serialVersionUID = 1L; + + @NotNull + private String myId; + + public DefaultExternalPlugin() { + } + + public DefaultExternalPlugin(ExternalPlugin plugin) { + myId = plugin.getId(); + } + + @NotNull + @Override + public String getId() { + return myId; + } + + public void setId(@NotNull String id) { + myId = id; + } +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalProject.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalProject.java new file mode 100644 index 000000000000..cecb9ad33c12 --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalProject.java @@ -0,0 +1,243 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public class DefaultExternalProject implements ExternalProject { + + private static final long serialVersionUID = 1L; + + @NotNull + private String myName; + @NotNull + private String myQName; + @Nullable + private String myDescription; + @NotNull + private String myGroup; + @NotNull + private String myVersion; + @NotNull + private Map<String, ExternalProject> myChildProjects; + @NotNull + private File myProjectDir; + @NotNull + private File myBuildDir; + @Nullable + private File myBuildFile; + @NotNull + private Map<String, ExternalTask> myTasks; + @NotNull + private Map<String, ?> myProperties; + @NotNull + private Map<String, ExternalSourceSet> mySourceSets; + @NotNull + private String myExternalSystemId; + @NotNull + private Map<String, ExternalPlugin> myPlugins; + + public DefaultExternalProject() { + myChildProjects = new HashMap<String, ExternalProject>(); + myTasks = new HashMap<String, ExternalTask>(); + myProperties = new HashMap<String, Object>(); + mySourceSets = new HashMap<String, ExternalSourceSet>(); + myPlugins = new HashMap<String, ExternalPlugin>(); + } + + public DefaultExternalProject(@NotNull ExternalProject externalProject) { + this(); + myName = externalProject.getName(); + myQName = externalProject.getQName(); + myVersion = externalProject.getVersion(); + myGroup = externalProject.getGroup(); + myDescription = externalProject.getDescription(); + myProjectDir = externalProject.getProjectDir(); + myBuildDir = externalProject.getBuildDir(); + myBuildFile = externalProject.getBuildFile(); + myExternalSystemId = externalProject.getExternalSystemId(); + + for (Map.Entry<String, ExternalProject> entry : externalProject.getChildProjects().entrySet()) { + myChildProjects.put(entry.getKey(), new DefaultExternalProject(entry.getValue())); + } + + for (Map.Entry<String, ExternalTask> entry : externalProject.getTasks().entrySet()) { + myTasks.put(entry.getKey(), new DefaultExternalTask(entry.getValue())); + } + for (Map.Entry<String, ExternalSourceSet> entry : externalProject.getSourceSets().entrySet()) { + mySourceSets.put(entry.getKey(), new DefaultExternalSourceSet(entry.getValue())); + } + for (Map.Entry<String, ExternalPlugin> entry : externalProject.getPlugins().entrySet()) { + myPlugins.put(entry.getKey(), new DefaultExternalPlugin(entry.getValue())); + } + } + + + @NotNull + @Override + public String getExternalSystemId() { + return myExternalSystemId; + } + + public void setExternalSystemId(@NotNull String externalSystemId) { + myExternalSystemId = externalSystemId; + } + + @NotNull + @Override + public String getName() { + return myName; + } + + public void setName(@NotNull String name) { + myName = name; + } + + @NotNull + @Override + public String getQName() { + return myQName; + } + + public void setQName(@NotNull String QName) { + myQName = QName; + } + + @Nullable + @Override + public String getDescription() { + return myDescription; + } + + public void setDescription(@Nullable String description) { + myDescription = description; + } + + @NotNull + @Override + public String getGroup() { + return myGroup; + } + + public void setGroup(@NotNull String group) { + myGroup = group; + } + + @NotNull + @Override + public String getVersion() { + return myVersion; + } + + public void setVersion(@NotNull String version) { + myVersion = version; + } + + @NotNull + @Override + public Map<String, ExternalProject> getChildProjects() { + return myChildProjects; + } + + public void setChildProjects(@NotNull Map<String, ExternalProject> childProjects) { + myChildProjects = childProjects; + } + + @NotNull + @Override + public File getProjectDir() { + return myProjectDir; + } + + public void setProjectDir(@NotNull File projectDir) { + myProjectDir = projectDir; + } + + @NotNull + @Override + public File getBuildDir() { + return myBuildDir; + } + + public void setBuildDir(@NotNull File buildDir) { + myBuildDir = buildDir; + } + + @Nullable + @Override + public File getBuildFile() { + return myBuildFile; + } + + public void setBuildFile(@Nullable File buildFile) { + myBuildFile = buildFile; + } + + @NotNull + @Override + public Map<String, ExternalTask> getTasks() { + return myTasks; + } + + public void setTasks(@NotNull Map<String, ExternalTask> tasks) { + myTasks = tasks; + } + + @NotNull + @Override + public Map<String, ExternalPlugin> getPlugins() { + return myPlugins; + } + + public void setPlugins(@NotNull Map<String, ExternalPlugin> plugins) { + myPlugins = plugins; + } + + @NotNull + @Override + public Map<String, ?> getProperties() { + return myProperties; + } + + public void setProperties(@NotNull Map<String, ?> properties) { + myProperties = properties; + } + + @Nullable + @Override + public Object getProperty(String name) { + return myProperties.get(name); + } + + @NotNull + @Override + public Map<String, ExternalSourceSet> getSourceSets() { + return mySourceSets; + } + + public void setSourceSets(@NotNull Map<String, ExternalSourceSet> sourceSets) { + mySourceSets = sourceSets; + } +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceDirectorySet.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceDirectorySet.java new file mode 100644 index 000000000000..d6a8d7aa6291 --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceDirectorySet.java @@ -0,0 +1,124 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public class DefaultExternalSourceDirectorySet implements ExternalSourceDirectorySet { + private static final long serialVersionUID = 1L; + + @NotNull + private String myName; + @NotNull + private Set<File> mySrcDirs; + @NotNull + private File myOutputDir; + @NotNull + private Set<String> myExcludes; + @NotNull + private Set<String> myIncludes; + @NotNull + private List<ExternalFilter> myFilters; + + public DefaultExternalSourceDirectorySet() { + mySrcDirs = new HashSet<File>(); + myExcludes = new HashSet<String>(); + myIncludes = new HashSet<String>(); + myFilters = new ArrayList<ExternalFilter>(); + } + + public DefaultExternalSourceDirectorySet(ExternalSourceDirectorySet sourceDirectorySet) { + this(); + myName = sourceDirectorySet.getName(); + mySrcDirs = new HashSet<File>(sourceDirectorySet.getSrcDirs()); + myOutputDir = sourceDirectorySet.getOutputDir(); + myExcludes = new HashSet<String>(sourceDirectorySet.getExcludes()); + myIncludes = new HashSet<String>(sourceDirectorySet.getIncludes()); + for (ExternalFilter filter : sourceDirectorySet.getFilters()) { + myFilters.add(new DefaultExternalFilter(filter)); + } + } + + @NotNull + @Override + public String getName() { + return myName; + } + + public void setName(@NotNull String name) { + myName = name; + } + + @NotNull + @Override + public Set<File> getSrcDirs() { + return mySrcDirs; + } + + public void setSrcDirs(@NotNull Set<File> srcDirs) { + mySrcDirs = srcDirs; + } + + @NotNull + @Override + public File getOutputDir() { + return myOutputDir; + } + + @NotNull + @Override + public Set<String> getIncludes() { + return myIncludes; + } + + public void setIncludes(@NotNull Set<String> includes) { + myIncludes = includes; + } + + @NotNull + @Override + public Set<String> getExcludes() { + return myExcludes; + } + + public void setExcludes(@NotNull Set<String> excludes) { + myExcludes = excludes; + } + + @NotNull + @Override + public List<ExternalFilter> getFilters() { + return myFilters; + } + + public void setFilters(@NotNull List<ExternalFilter> filters) { + myFilters = filters; + } + + public void setOutputDir(@NotNull File outputDir) { + myOutputDir = outputDir; + } +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceSet.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceSet.java new file mode 100644 index 000000000000..19d692dd1985 --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceSet.java @@ -0,0 +1,66 @@ +/* + * 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.model; + +import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType; +import com.intellij.openapi.externalSystem.model.project.IExternalSystemSourceType; +import org.jetbrains.annotations.NotNull; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public class DefaultExternalSourceSet implements ExternalSourceSet { + private static final long serialVersionUID = 1L; + + private String myName; + private Map<IExternalSystemSourceType, ExternalSourceDirectorySet> mySources; + + public DefaultExternalSourceSet() { + mySources = new HashMap<IExternalSystemSourceType, ExternalSourceDirectorySet>(); + } + + public DefaultExternalSourceSet(ExternalSourceSet sourceSet) { + this(); + myName = sourceSet.getName(); + for (Map.Entry<IExternalSystemSourceType, ExternalSourceDirectorySet> entry : sourceSet.getSources().entrySet()) { + mySources.put(ExternalSystemSourceType.from(entry.getKey()), new DefaultExternalSourceDirectorySet(entry.getValue())); + } + } + + @NotNull + @Override + public String getName() { + return myName; + } + + public void setName(String name) { + myName = name; + } + + @NotNull + @Override + public Map<IExternalSystemSourceType, ExternalSourceDirectorySet> getSources() { + return mySources; + } + + public void setSources(Map<IExternalSystemSourceType, ExternalSourceDirectorySet> sources) { + mySources = sources; + } +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalTask.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalTask.java new file mode 100644 index 000000000000..e9392eb52e84 --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalTask.java @@ -0,0 +1,86 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public class DefaultExternalTask implements ExternalTask { + private static final long serialVersionUID = 1L; + + @NotNull + private String myName; + @NotNull + private String myQName; + @Nullable + private String myDescription; + @Nullable + private String myGroup; + + public DefaultExternalTask() { + } + + public DefaultExternalTask(ExternalTask externalTask) { + myName = externalTask.getName(); + myQName = externalTask.getQName(); + myDescription = externalTask.getDescription(); + myGroup = externalTask.getGroup(); + } + + @NotNull + @Override + public String getName() { + return myName; + } + + public void setName(@NotNull String name) { + myName = name; + } + + @NotNull + @Override + public String getQName() { + return myQName; + } + + public void setQName(@NotNull String QName) { + myQName = QName; + } + + @Nullable + @Override + public String getDescription() { + return myDescription; + } + + public void setDescription(@Nullable String description) { + myDescription = description; + } + + @Nullable + @Override + public String getGroup() { + return myGroup; + } + + public void setGroup(@Nullable String group) { + myGroup = group; + } +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalFilter.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalFilter.java new file mode 100644 index 000000000000..98fc003cb645 --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalFilter.java @@ -0,0 +1,34 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.Serializable; +import java.util.Map; +import java.util.Set; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public interface ExternalFilter extends Serializable { + @NotNull + String getFilterType(); + @NotNull + String getPropertiesAsJsonMap(); +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalPlugin.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalPlugin.java new file mode 100644 index 000000000000..edd3db771b3f --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalPlugin.java @@ -0,0 +1,30 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.Serializable; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public interface ExternalPlugin extends Serializable { + @NotNull + String getId(); +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalProject.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalProject.java new file mode 100644 index 000000000000..6df2d413d0fd --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalProject.java @@ -0,0 +1,87 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.File; +import java.io.Serializable; +import java.util.Map; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public interface ExternalProject extends Serializable { + + @NotNull + String getExternalSystemId(); + + @NotNull + String getName(); + + @NotNull + String getQName(); + + @Nullable + String getDescription(); + + @NotNull + String getGroup(); + + @NotNull + String getVersion(); + + @NotNull + Map<String, ExternalProject> getChildProjects(); + + @NotNull + File getProjectDir(); + + @NotNull + File getBuildDir(); + + @Nullable + File getBuildFile(); + + @NotNull + Map<String, ExternalTask> getTasks(); + + //@NotNull + //Map<String, ExternalConfiguration> getConfigurations(); + + //@NotNull + //List<ExternalRepository> getRepositories(); + + //@NotNull + //List<ExternalDependency> getDependencies(); + + @NotNull + Map<String, ExternalPlugin> getPlugins(); + + //@NotNull + //ExternalProjectBuild getBuild(); + + @NotNull + Map<String, ?> getProperties(); + + @Nullable + Object getProperty(String name); + + @NotNull + Map<String, ExternalSourceSet> getSourceSets(); +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceDirectorySet.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceDirectorySet.java new file mode 100644 index 000000000000..70f0bed3d177 --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceDirectorySet.java @@ -0,0 +1,46 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public interface ExternalSourceDirectorySet extends Serializable { + @NotNull + String getName(); + + @NotNull + Set<File> getSrcDirs(); + + @NotNull + File getOutputDir(); + + @NotNull + Set<String> getExcludes(); + @NotNull + Set<String> getIncludes(); + + @NotNull + List<ExternalFilter> getFilters(); +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceSet.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceSet.java new file mode 100644 index 000000000000..b23c07bbafa6 --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceSet.java @@ -0,0 +1,39 @@ +/* + * 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.model; + +import com.intellij.openapi.externalSystem.model.project.IExternalSystemSourceType; +import org.jetbrains.annotations.NotNull; + +import java.io.Serializable; +import java.util.Map; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public interface ExternalSourceSet extends Serializable { + @NotNull + String getName(); + //@NotNull + //ClasspathContainer getCompileClasspath(); + + //@NotNull + //ClasspathContainer getRuntimeClasspath(); + + @NotNull + Map<IExternalSystemSourceType, ExternalSourceDirectorySet> getSources(); +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalTask.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalTask.java new file mode 100644 index 000000000000..b4c61c662acc --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalTask.java @@ -0,0 +1,36 @@ +/* + * 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.model; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.Serializable; + +/** + * @author Vladislav.Soroka + * @since 7/14/2014 + */ +public interface ExternalTask extends Serializable { + @NotNull + String getName(); + @NotNull + String getQName(); + @Nullable + String getDescription(); + @Nullable + String getGroup(); +} diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java index ffe8a52d4a06..0e112b1c2b14 100644 --- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java @@ -1,52 +1,62 @@ package com.intellij.openapi.externalSystem.model.project; -import org.jetbrains.annotations.NotNull; - -import java.io.Serializable; - /** * Enumerates module source types. * * @author Denis Zhdanov * @since 8/10/11 5:21 PM */ -public class ExternalSystemSourceType implements Serializable { - - @NotNull public static final ExternalSystemSourceType SOURCE = new ExternalSystemSourceType("SOURCE"); - @NotNull public static final ExternalSystemSourceType TEST = new ExternalSystemSourceType("TEST"); - @NotNull public static final ExternalSystemSourceType EXCLUDED = new ExternalSystemSourceType("EXCLUDED"); - @NotNull public static final ExternalSystemSourceType SOURCE_GENERATED = new ExternalSystemSourceType("SOURCE_GENERATED"); - @NotNull public static final ExternalSystemSourceType TEST_GENERATED = new ExternalSystemSourceType("TEST_GENERATED"); - @NotNull public static final ExternalSystemSourceType RESOURCE = new ExternalSystemSourceType("RESOURCE"); - @NotNull public static final ExternalSystemSourceType TEST_RESOURCE = new ExternalSystemSourceType("TEST_RESOURCE"); - - private static final long serialVersionUID = 1L; - - @NotNull private final String myId; - - public ExternalSystemSourceType(@NotNull String id) { - myId = id; +public enum ExternalSystemSourceType implements IExternalSystemSourceType { + + SOURCE(false, false, false, false), + TEST(true, false, false, false), + EXCLUDED(false, false, false, true), + SOURCE_GENERATED(true, true, false, false), + TEST_GENERATED(true, true, false, false), + RESOURCE(false, false, true, false), + TEST_RESOURCE(true, false, true, false); + + private final boolean isTest; + private final boolean isGenerated; + private final boolean isResource; + private final boolean isExcluded; + + ExternalSystemSourceType(boolean test, boolean generated, boolean resource, boolean excluded) { + isTest = test; + isGenerated = generated; + isResource = resource; + isExcluded = excluded; } @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ExternalSystemSourceType type = (ExternalSystemSourceType)o; - - if (!myId.equals(type.myId)) return false; + public boolean isTest() { + return isTest; + } - return true; + @Override + public boolean isGenerated() { + return isGenerated; } @Override - public int hashCode() { - return myId.hashCode(); + public boolean isResource() { + return isResource; } @Override - public String toString() { - return myId; + public boolean isExcluded() { + return isExcluded; + } + + public static ExternalSystemSourceType from(IExternalSystemSourceType sourceType) { + for (ExternalSystemSourceType systemSourceType : ExternalSystemSourceType.values()) { + if (systemSourceType.isGenerated == sourceType.isGenerated() && + systemSourceType.isResource == sourceType.isResource() && + systemSourceType.isTest == sourceType.isTest() && + systemSourceType.isExcluded == sourceType.isExcluded()) { + return systemSourceType; + } + } + throw new IllegalArgumentException("Invalid source type: " + sourceType); } } diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/IExternalSystemSourceType.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/IExternalSystemSourceType.java new file mode 100644 index 000000000000..2ad8821b06cd --- /dev/null +++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/IExternalSystemSourceType.java @@ -0,0 +1,32 @@ +/* + * 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.model.project; + +import java.io.Serializable; + +/** + * @author Vladislav.Soroka + * @since 7/17/2014 + */ +public interface IExternalSystemSourceType extends Serializable { + boolean isTest(); + + boolean isGenerated(); + + boolean isResource(); + + boolean isExcluded(); +} |