• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
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.android.atest.run;
17 
18 import com.android.atest.Constants;
19 import com.intellij.execution.configurations.ConfigurationFactory;
20 import com.intellij.execution.configurations.ConfigurationType;
21 import com.intellij.openapi.util.IconLoader;
22 import javax.swing.Icon;
23 import org.jetbrains.annotations.NotNull;
24 
25 /**
26  * Atest run configuration type. It is the starting point for implementing run configuration type.
27  */
28 public class AtestConfigurationType implements ConfigurationType {
29 
30     protected static final String ID = "atestRunConfiguration";
31 
32     /**
33      * Returns the display name of the configuration type. This is used to represent the
34      * configuration type in the run configurations tree, and also as the name of the action used to
35      * create the configuration.
36      *
37      * @return Atest display name of the configuration type.
38      */
39     @NotNull
40     @Override
getDisplayName()41     public String getDisplayName() {
42         return Constants.ATEST_NAME;
43     }
44 
45     /**
46      * Gets the description of the configuration type.
47      *
48      * @return the description of Atest configuration type.
49      */
50     @Override
getConfigurationTypeDescription()51     public String getConfigurationTypeDescription() {
52         return Constants.ATEST_NAME;
53     }
54 
55     /**
56      * Gets the 16x16 icon used to represent the configuration type.
57      *
58      * @return the icon.
59      */
60     @Override
getIcon()61     public Icon getIcon() {
62         return IconLoader.getIcon(Constants.ATEST_ICON_PATH);
63     }
64 
65     /**
66      * The ID of the configuration type. Should be camel-cased without dashes, underscores, spaces
67      * and quotation marks. The ID is used to store run configuration settings in a project or
68      * workspace file and must not change between plugin versions.
69      *
70      * @return Atest configuration ID.
71      */
72     @NotNull
73     @Override
getId()74     public String getId() {
75         return ID;
76     }
77 
78     /**
79      * Returns the configuration factories used by this configuration type. Normally each
80      * configuration type provides just a single factory.
81      *
82      * @return the run configuration factories.
83      */
84     @Override
getConfigurationFactories()85     public ConfigurationFactory[] getConfigurationFactories() {
86         return new ConfigurationFactory[] {new AtestConfigurationFactory(this)};
87     }
88 }
89