2099e404e7483b5a4218c5a21bc664c9007a9e2f
[idea/community.git] / platform / external-system-impl / src / com / intellij / openapi / externalSystem / service / project / manage / TaskActivationState.java
1 /*
2  * Copyright 2000-2014 JetBrains s.r.o.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.intellij.openapi.externalSystem.service.project.manage;
17
18 import com.intellij.util.xmlb.annotations.AbstractCollection;
19 import com.intellij.util.xmlb.annotations.Tag;
20 import org.jetbrains.annotations.NotNull;
21
22 import java.util.Set;
23 import java.util.TreeSet;
24
25 /**
26 * @author Vladislav.Soroka
27 * @since 10/30/2014
28 */
29 @Tag("activation")
30 public class TaskActivationState {
31   @Tag("after_sync")
32   @AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
33   public Set<String> afterSyncTasks = new TreeSet<String>();
34
35   @Tag("before_compile")
36   @AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
37   public Set<String> beforeCompileTasks = new TreeSet<String>();
38
39   @Tag("after_compile")
40   @AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
41   public Set<String> afterCompileTasks = new TreeSet<String>();
42
43   @Tag("after_rebuild")
44   @AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
45   public Set<String> afterRebuildTask = new TreeSet<String>();
46
47   @Tag("before_rebuild")
48   @AbstractCollection(surroundWithTag = false, elementTag = "task", elementValueAttribute = "name")
49   public Set<String> beforeRebuildTask = new TreeSet<String>();
50
51   @NotNull
52   public Set<String> getTasks(@NotNull ExternalSystemTaskActivator.Phase phase) {
53     switch (phase) {
54       case AFTER_COMPILE:
55         return afterCompileTasks;
56       case AFTER_SYNC:
57         return afterSyncTasks;
58       case BEFORE_COMPILE:
59         return beforeCompileTasks;
60       case AFTER_REBUILD:
61         return afterRebuildTask;
62       case BEFORE_REBUILD:
63         return beforeRebuildTask;
64       default:
65         throw new RuntimeException();
66     }
67   }
68 }