RunManager: cyclic initialization removed
[fedora-idea.git] / lang-api / src / com / intellij / execution / configurations / ConfigurationFactory.java
blob2c9a8aa6bcd9dc9afee15ec727fb7a80cf9abdf3
1 /*
2 * Copyright 2000-2007 JetBrains s.r.o.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package com.intellij.execution.configurations;
18 import com.intellij.execution.RunManager;
19 import com.intellij.openapi.project.Project;
20 import com.intellij.openapi.util.IconLoader;
21 import org.jetbrains.annotations.NotNull;
23 import javax.swing.*;
25 /**
26 * @author dyoma
28 public abstract class ConfigurationFactory {
29 public static final Icon ADD_ICON = IconLoader.getIcon("/general/add.png");
31 private final ConfigurationType myType;
33 protected ConfigurationFactory(@NotNull final ConfigurationType type) {
34 myType = type;
37 public RunConfiguration createConfiguration(String name, RunConfiguration template) {
38 RunConfiguration newConfiguration = template.clone();
39 newConfiguration.setName(name);
40 return newConfiguration;
43 public abstract RunConfiguration createTemplateConfiguration(Project project);
45 public RunConfiguration createTemplateConfiguration(Project project, RunManager runManager) {
46 return createTemplateConfiguration(project);
49 public String getName() {
50 return myType.getDisplayName();
53 public Icon getAddIcon() {
54 return ADD_ICON;
57 public Icon getIcon(@NotNull final RunConfiguration configuration) {
58 return getIcon();
61 public Icon getIcon() {
62 return myType.getIcon();
65 @NotNull
66 public ConfigurationType getType() {
67 return myType;