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 com
.intellij
.openapi
.roots
.ui
.configuration
;
18 import com
.intellij
.ide
.projectView
.impl
.ModuleGroup
;
19 import com
.intellij
.ide
.projectView
.impl
.nodes
.NamedLibraryElement
;
20 import com
.intellij
.ide
.util
.projectWizard
.JdkChooserPanel
;
21 import com
.intellij
.openapi
.module
.Module
;
22 import com
.intellij
.openapi
.options
.ShowSettingsUtil
;
23 import com
.intellij
.openapi
.project
.Project
;
24 import com
.intellij
.openapi
.roots
.JdkOrderEntry
;
25 import com
.intellij
.openapi
.roots
.LibraryOrderEntry
;
26 import com
.intellij
.openapi
.roots
.OrderEntry
;
27 import com
.intellij
.openapi
.roots
.ui
.configuration
.projectRoot
.ModuleStructureConfigurable
;
28 import com
.intellij
.openapi
.projectRoots
.Sdk
;
29 import org
.jetbrains
.annotations
.Nullable
;
34 public class IdeaProjectSettingsService
extends ProjectSettingsService
{
35 private final Project myProject
;
37 public IdeaProjectSettingsService(final Project project
) {
41 public void openModuleSettings(final Module module
) {
42 ModulesConfigurator
.showDialog(myProject
, module
.getName(), null, false);
45 public void openModuleLibrarySettings(final Module module
) {
46 ModulesConfigurator
.showDialog(myProject
, module
.getName(), ClasspathEditor
.NAME
, false);
49 public void openContentEntriesSettings(final Module module
) {
50 ModulesConfigurator
.showDialog(myProject
, module
.getName(), ContentEntriesEditor
.NAME
, false);
53 public void openProjectLibrarySettings(final NamedLibraryElement element
) {
54 final ProjectStructureConfigurable config
= ProjectStructureConfigurable
.getInstance(myProject
);
55 ShowSettingsUtil
.getInstance().editConfigurable(myProject
, config
, new Runnable() {
57 final OrderEntry orderEntry
= element
.getOrderEntry();
58 if (orderEntry
instanceof JdkOrderEntry
) {
59 config
.select(((JdkOrderEntry
)orderEntry
).getJdk(), true);
61 config
.select((LibraryOrderEntry
)orderEntry
, true);
67 public boolean processModulesMoved(final Module
[] modules
, @Nullable final ModuleGroup targetGroup
) {
68 final ModuleStructureConfigurable rootConfigurable
= ModuleStructureConfigurable
.getInstance(myProject
);
69 if (rootConfigurable
.updateProjectTree(modules
, targetGroup
)) { //inside project root editor
70 if (targetGroup
!= null) {
71 rootConfigurable
.selectNodeInTree(targetGroup
.toString());
74 rootConfigurable
.selectNodeInTree(modules
[0].getName());
82 public void showModuleConfigurationDialog(String moduleToSelect
, String tabNameToSelect
, boolean showModuleWizard
) {
83 ModulesConfigurator
.showDialog(myProject
, moduleToSelect
, tabNameToSelect
, showModuleWizard
);
87 public Sdk
chooseAndSetSdk() {
88 return JdkChooserPanel
.chooseAndSetJDK(myProject
);