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
.codeInsight
.daemon
.impl
.quickfix
;
18 import com
.intellij
.codeInsight
.intention
.IntentionAction
;
19 import com
.intellij
.openapi
.actionSystem
.ActionManager
;
20 import com
.intellij
.openapi
.actionSystem
.AnAction
;
21 import com
.intellij
.openapi
.actionSystem
.IdeActions
;
22 import com
.intellij
.openapi
.editor
.Editor
;
23 import com
.intellij
.openapi
.module
.Module
;
24 import com
.intellij
.openapi
.module
.ModuleUtil
;
25 import com
.intellij
.openapi
.project
.Project
;
26 import com
.intellij
.openapi
.roots
.ui
.configuration
.ProjectSettingsService
;
27 import com
.intellij
.psi
.PsiElement
;
28 import com
.intellij
.psi
.PsiFile
;
29 import com
.intellij
.util
.IncorrectOperationException
;
30 import org
.jetbrains
.annotations
.NotNull
;
32 public class ShowModulePropertiesFix
implements IntentionAction
{
33 private final String myModuleName
;
35 public ShowModulePropertiesFix(String moduleName
) {
36 myModuleName
= moduleName
;
39 public ShowModulePropertiesFix(PsiElement context
) {
40 Module module
= ModuleUtil
.findModuleForPsiElement(context
);
41 myModuleName
= module
!= null ? module
.getName() : null;
45 public String
getText() {
46 AnAction action
= ActionManager
.getInstance().getAction(IdeActions
.MODULE_SETTINGS
);
47 return action
.getTemplatePresentation().getText();
51 public String
getFamilyName() {
55 public boolean isAvailable(@NotNull final Project project
, final Editor editor
, final PsiFile file
) {
56 return myModuleName
!= null;
59 public void invoke(@NotNull final Project project
, final Editor editor
, final PsiFile file
) throws IncorrectOperationException
{
60 ProjectSettingsService
.getInstance(project
).showModuleConfigurationDialog(myModuleName
, null, false);
63 public boolean startInWriteAction() {