2 * Copyright 2000-2009 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 org
.jetbrains
.idea
.maven
.utils
;
18 import com
.intellij
.openapi
.options
.Configurable
;
19 import com
.intellij
.openapi
.options
.SearchableConfigurable
;
20 import com
.intellij
.openapi
.options
.ConfigurationException
;
21 import com
.intellij
.openapi
.project
.Project
;
22 import com
.intellij
.openapi
.util
.IconLoader
;
23 import org
.jetbrains
.annotations
.Nls
;
24 import org
.jetbrains
.idea
.maven
.indices
.MavenIndicesConfigurable
;
25 import org
.jetbrains
.idea
.maven
.project
.*;
26 import org
.jetbrains
.idea
.maven
.execution
.MavenRunnerConfigurable
;
27 import org
.jetbrains
.idea
.maven
.execution
.MavenRunnerSettings
;
28 import org
.jetbrains
.idea
.maven
.execution
.MavenRunner
;
29 import org
.jetbrains
.idea
.maven
.project
.MavenProjectsManager
;
32 import java
.util
.ArrayList
;
33 import java
.util
.List
;
35 public class MavenSettings
implements SearchableConfigurable
.Parent
{
36 private final Project myProject
;
37 private final Configurable myConfigurable
;
38 private final List
<Configurable
> myChildren
;
40 public MavenSettings(Project project
) {
43 myConfigurable
= new MavenGeneralConfigurable() {
44 protected MavenGeneralSettings
getState() {
45 return MavenProjectsManager
.getInstance(myProject
).getGeneralSettings();
49 myChildren
= new ArrayList
<Configurable
>();
50 myChildren
.add(new MavenImportingConfigurable(MavenProjectsManager
.getInstance(myProject
).getImportingSettings()));
51 myChildren
.add(new MavenIgnoredFilesConfigurable(MavenProjectsManager
.getInstance(myProject
)));
53 myChildren
.add(new MavenRunnerConfigurable(myProject
, false) {
54 protected MavenRunnerSettings
getState() {
55 return MavenRunner
.getInstance(myProject
).getState();
59 if (!myProject
.isDefault()) {
60 myChildren
.add(new MavenIndicesConfigurable(myProject
));
64 public boolean hasOwnContent() {
68 public boolean isVisible() {
72 public Runnable
enableSearch(String option
) {
76 public JComponent
createComponent() {
77 return myConfigurable
.createComponent();
80 public boolean isModified() {
81 return myConfigurable
.isModified();
84 public void apply() throws ConfigurationException
{
85 myConfigurable
.apply();
89 myConfigurable
.reset();
92 public void disposeUIResources() {
93 myConfigurable
.disposeUIResources();
96 public Configurable
[] getConfigurables() {
97 return myChildren
.toArray(new Configurable
[myChildren
.size()]);
100 public String
getId() {
101 return MavenSettings
.class.getSimpleName();
105 public String
getDisplayName() {
109 public Icon
getIcon() {
110 return IconLoader
.getIcon("/general/configurableEditor.png");
113 public String
getHelpTopic() {
114 return myConfigurable
.getHelpTopic();