Example usage for com.intellij.openapi.ui Messages getQuestionIcon

List of usage examples for com.intellij.openapi.ui Messages getQuestionIcon

Introduction

In this page you can find the example usage for com.intellij.openapi.ui Messages getQuestionIcon.

Prototype

@NotNull
    public static Icon getQuestionIcon() 

Source Link

Usage

From source file:com.intellij.ide.RecentProjectsManagerBase.java

License:Apache License

/**
 * @param addClearListItem - used for detecting whether the "Clear List" action should be added
 * to the end of the returned list of actions
 * @return//from w w w  . jav a  2 s  .  c om
 */
public AnAction[] getRecentProjectsActions(boolean addClearListItem) {
    validateRecentProjects();

    final Set<String> openedPaths = ContainerUtil.newHashSet();
    for (Project openProject : ProjectManager.getInstance().getOpenProjects()) {
        ContainerUtil.addIfNotNull(openedPaths, getProjectPath(openProject));
    }

    final LinkedHashSet<String> paths;
    synchronized (myStateLock) {
        paths = ContainerUtil.newLinkedHashSet(myState.recentPaths);
    }
    paths.remove(null);
    paths.removeAll(openedPaths);

    ArrayList<AnAction> actions = new ArrayList<AnAction>();
    Set<String> duplicates = getDuplicateProjectNames(openedPaths, paths);
    for (final String path : paths) {
        final String projectName = getProjectName(path);
        String displayName;
        synchronized (myStateLock) {
            displayName = myState.names.get(path);
        }
        if (StringUtil.isEmptyOrSpaces(displayName)) {
            displayName = duplicates.contains(path) ? path : projectName;
        }

        // It's better don't to remove non-existent projects. Sometimes projects stored
        // on USB-sticks or flash-cards, and it will be nice to have them in the list
        // when USB device or SD-card is mounted
        if (new File(path).exists()) {
            actions.add(new ReopenProjectAction(path, projectName, displayName));
        }
    }

    if (actions.isEmpty()) {
        return AnAction.EMPTY_ARRAY;
    }

    ArrayList<AnAction> list = new ArrayList<AnAction>();
    for (AnAction action : actions) {
        list.add(action);
    }
    if (addClearListItem) {
        AnAction clearListAction = new AnAction(IdeBundle.message("action.clear.list")) {
            public void actionPerformed(AnActionEvent e) {
                final int rc = Messages.showOkCancelDialog(e.getData(CommonDataKeys.PROJECT),
                        "Would you like to clear the list of recent projects?", "Clear Recent Projects List",
                        Messages.getQuestionIcon());

                if (rc == 0) {
                    synchronized (myStateLock) {
                        myState.recentPaths.clear();
                    }
                    WelcomeFrame.clearRecents();
                }
            }
        };

        list.add(AnSeparator.getInstance());
        list.add(clearListAction);
    }

    return list.toArray(new AnAction[list.size()]);
}

From source file:com.intellij.ide.util.DeleteHandler.java

License:Apache License

public static void deletePsiElement(final PsiElement[] elementsToDelete, final Project project,
        boolean needConfirmation) {
    if (elementsToDelete == null || elementsToDelete.length == 0)
        return;/*w w w  . j  a  v a  2 s  . com*/

    final PsiElement[] elements = PsiTreeUtil.filterAncestors(elementsToDelete);

    boolean safeDeleteApplicable = true;
    for (int i = 0; i < elements.length && safeDeleteApplicable; i++) {
        PsiElement element = elements[i];
        safeDeleteApplicable = SafeDeleteProcessor.validElement(element);
    }

    final boolean dumb = DumbService.getInstance(project).isDumb();
    if (safeDeleteApplicable && !dumb) {
        final Ref<Boolean> exit = Ref.create(false);
        final SafeDeleteDialog dialog = new SafeDeleteDialog(project, elements,
                new SafeDeleteDialog.Callback() {
                    @Override
                    public void run(final SafeDeleteDialog dialog) {
                        if (!CommonRefactoringUtil.checkReadOnlyStatusRecursively(project,
                                Arrays.asList(elements), true))
                            return;
                        SafeDeleteProcessor.createInstance(project, new Runnable() {
                            @Override
                            public void run() {
                                exit.set(true);
                                dialog.close(DialogWrapper.OK_EXIT_CODE);
                            }
                        }, elements, dialog.isSearchInComments(), dialog.isSearchForTextOccurences(), true)
                                .run();
                    }
                }) {
            @Override
            protected boolean isDelete() {
                return true;
            }
        };
        if (needConfirmation) {
            dialog.show();
            if (!dialog.isOK() || exit.get())
                return;
        }
    } else {
        @SuppressWarnings({ "UnresolvedPropertyKey" })
        String warningMessage = DeleteUtil.generateWarningMessage(IdeBundle.message("prompt.delete.elements"),
                elements);

        boolean anyDirectories = false;
        String directoryName = null;
        for (PsiElement psiElement : elementsToDelete) {
            if (psiElement instanceof PsiDirectory && !PsiUtilBase.isSymLink((PsiDirectory) psiElement)) {
                anyDirectories = true;
                directoryName = ((PsiDirectory) psiElement).getName();
                break;
            }
        }
        if (anyDirectories) {
            if (elements.length == 1) {
                warningMessage += IdeBundle.message("warning.delete.all.files.and.subdirectories",
                        directoryName);
            } else {
                warningMessage += IdeBundle
                        .message("warning.delete.all.files.and.subdirectories.in.the.selected.directory");
            }
        }

        if (safeDeleteApplicable && dumb) {
            warningMessage += "\n\nWarning:\n  Safe delete is not available while "
                    + ApplicationNamesInfo.getInstance().getFullProductName()
                    + " updates indices,\n  no usages will be checked.";
        }

        if (needConfirmation) {
            int result = Messages.showOkCancelDialog(project, warningMessage, IdeBundle.message("title.delete"),
                    ApplicationBundle.message("button.delete"), CommonBundle.getCancelButtonText(),
                    Messages.getQuestionIcon());
            if (result != Messages.OK)
                return;
        }
    }

    CommandProcessor.getInstance().executeCommand(project, new Runnable() {
        @Override
        public void run() {
            if (!CommonRefactoringUtil.checkReadOnlyStatusRecursively(project, Arrays.asList(elements),
                    false)) {
                return;
            }

            // deleted from project view or something like that.
            if (CommonDataKeys.EDITOR.getData(DataManager.getInstance().getDataContext()) == null) {
                CommandProcessor.getInstance().markCurrentCommandAsGlobal(project);
            }

            for (final PsiElement elementToDelete : elements) {
                if (!elementToDelete.isValid())
                    continue; //was already deleted
                if (elementToDelete instanceof PsiDirectory) {
                    VirtualFile virtualFile = ((PsiDirectory) elementToDelete).getVirtualFile();
                    if (virtualFile.isInLocalFileSystem() && !virtualFile.is(VFileProperty.SYMLINK)) {
                        ArrayList<VirtualFile> readOnlyFiles = new ArrayList<VirtualFile>();
                        CommonRefactoringUtil.collectReadOnlyFiles(virtualFile, readOnlyFiles);

                        if (!readOnlyFiles.isEmpty()) {
                            String message = IdeBundle.message("prompt.directory.contains.read.only.files",
                                    virtualFile.getPresentableUrl());
                            int _result = Messages.showYesNoDialog(project, message,
                                    IdeBundle.message("title.delete"), Messages.getQuestionIcon());
                            if (_result != Messages.YES)
                                continue;

                            boolean success = true;
                            for (VirtualFile file : readOnlyFiles) {
                                success = clearReadOnlyFlag(file, project);
                                if (!success)
                                    break;
                            }
                            if (!success)
                                continue;
                        }
                    }
                } else if (!elementToDelete.isWritable() && !(elementToDelete instanceof PsiFileSystemItem
                        && PsiUtilBase.isSymLink((PsiFileSystemItem) elementToDelete))) {
                    final PsiFile file = elementToDelete.getContainingFile();
                    if (file != null) {
                        final VirtualFile virtualFile = file.getVirtualFile();
                        if (virtualFile.isInLocalFileSystem()) {
                            int _result = MessagesEx.fileIsReadOnly(project, virtualFile)
                                    .setTitle(IdeBundle.message("title.delete"))
                                    .appendMessage(IdeBundle.message("prompt.delete.it.anyway")).askYesNo();
                            if (_result != Messages.YES)
                                continue;

                            boolean success = clearReadOnlyFlag(virtualFile, project);
                            if (!success)
                                continue;
                        }
                    }
                }

                try {
                    elementToDelete.checkDelete();
                } catch (IncorrectOperationException ex) {
                    Messages.showMessageDialog(project, ex.getMessage(), CommonBundle.getErrorTitle(),
                            Messages.getErrorIcon());
                    continue;
                }

                ApplicationManager.getApplication().runWriteAction(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            elementToDelete.delete();
                        } catch (final IncorrectOperationException ex) {
                            ApplicationManager.getApplication().invokeLater(new Runnable() {
                                @Override
                                public void run() {
                                    Messages.showMessageDialog(project, ex.getMessage(),
                                            CommonBundle.getErrorTitle(), Messages.getErrorIcon());
                                }
                            });
                        }
                    }
                });
            }
        }
    }, RefactoringBundle.message("safe.delete.command",
            RefactoringUIUtil.calculatePsiElementDescriptionList(elements)), null);
}

From source file:com.intellij.ide.util.PackageChooserDialog.java

License:Apache License

private void createNewPackage() {
    final PsiJavaPackage selectedPackage = getTreeSelection();
    if (selectedPackage == null)
        return;/*from   w  ww . j  a v  a2  s.  c o m*/

    final String newPackageName = Messages.showInputDialog(myProject,
            IdeBundle.message("prompt.enter.a.new.package.name"), IdeBundle.message("title.new.package"),
            Messages.getQuestionIcon(), "", new InputValidator() {
                public boolean checkInput(final String inputString) {
                    return inputString != null && inputString.length() > 0;
                }

                public boolean canClose(final String inputString) {
                    return checkInput(inputString);
                }
            });
    if (newPackageName == null)
        return;

    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
        public void run() {
            final Runnable action = new Runnable() {
                public void run() {

                    try {
                        String newQualifiedName = selectedPackage.getQualifiedName();
                        if (!Comparing.strEqual(newQualifiedName, ""))
                            newQualifiedName += ".";
                        newQualifiedName += newPackageName;
                        final PsiDirectory dir = PackageUtil.findOrCreateDirectoryForPackage(myProject,
                                newQualifiedName, null, false);
                        if (dir == null)
                            return;
                        final PsiJavaPackage newPackage = JavaDirectoryService.getInstance().getPackage(dir);

                        DefaultMutableTreeNode node = (DefaultMutableTreeNode) myTree.getSelectionPath()
                                .getLastPathComponent();
                        final DefaultMutableTreeNode newChild = new DefaultMutableTreeNode();
                        newChild.setUserObject(newPackage);
                        node.add(newChild);

                        final DefaultTreeModel model = (DefaultTreeModel) myTree.getModel();
                        model.nodeStructureChanged(node);

                        final TreePath selectionPath = myTree.getSelectionPath();
                        TreePath path;
                        if (selectionPath == null) {
                            path = new TreePath(newChild.getPath());
                        } else {
                            path = selectionPath.pathByAddingChild(newChild);
                        }
                        myTree.setSelectionPath(path);
                        myTree.scrollPathToVisible(path);
                        myTree.expandPath(path);

                    } catch (IncorrectOperationException e) {
                        Messages.showMessageDialog(getContentPane(), StringUtil.getMessage(e),
                                CommonBundle.getErrorTitle(), Messages.getErrorIcon());
                        if (LOG.isDebugEnabled()) {
                            LOG.debug(e);
                        }
                    }
                }
            };
            ApplicationManager.getApplication().runReadAction(action);
        }
    }, IdeBundle.message("command.create.new.package"), null);
}

From source file:com.intellij.ide.util.PackageUtil.java

License:Apache License

/**
 * @deprecated//from w w w  . j a v a  2s.com
 */
@Nullable
public static PsiDirectory findOrCreateDirectoryForPackage(Project project, String packageName,
        PsiDirectory baseDir, boolean askUserToCreate, boolean filterSourceDirsForTestBaseDir)
        throws IncorrectOperationException {

    PsiDirectory psiDirectory = null;

    if (!"".equals(packageName)) {
        PsiJavaPackage rootPackage = findLongestExistingPackage(project, packageName);
        if (rootPackage != null) {
            int beginIndex = rootPackage.getQualifiedName().length() + 1;
            packageName = beginIndex < packageName.length() ? packageName.substring(beginIndex) : "";
            String postfixToShow = packageName.replace('.', File.separatorChar);
            if (packageName.length() > 0) {
                postfixToShow = File.separatorChar + postfixToShow;
            }
            PsiDirectory[] directories = rootPackage.getDirectories();
            if (filterSourceDirsForTestBaseDir) {
                directories = filterSourceDirectories(baseDir, project, directories);
            }
            psiDirectory = DirectoryChooserUtil.selectDirectory(project, directories, baseDir, postfixToShow);
            if (psiDirectory == null) {
                return null;
            }
        }
    }

    if (psiDirectory == null) {
        PsiDirectory[] sourceDirectories = getSourceRootDirectories(project);
        psiDirectory = DirectoryChooserUtil.selectDirectory(project, sourceDirectories, baseDir,
                File.separatorChar + packageName.replace('.', File.separatorChar));
        if (psiDirectory == null) {
            return null;
        }
    }

    String restOfName = packageName;
    boolean askedToCreate = false;
    while (restOfName.length() > 0) {
        final String name = getLeftPart(restOfName);
        PsiDirectory foundExistingDirectory = psiDirectory.findSubdirectory(name);
        if (foundExistingDirectory == null) {
            if (!askedToCreate && askUserToCreate) {
                int toCreate = Messages.showYesNoDialog(project,
                        IdeBundle.message("prompt.create.non.existing.package", packageName),
                        IdeBundle.message("title.package.not.found"), Messages.getQuestionIcon());
                if (toCreate != 0) {
                    return null;
                }
                askedToCreate = true;
            }
            psiDirectory = createSubdirectory(psiDirectory, name, project);
        } else {
            psiDirectory = foundExistingDirectory;
        }
        restOfName = cutLeftPart(restOfName);
    }
    return psiDirectory;
}

From source file:com.intellij.ide.util.PackageUtil.java

License:Apache License

@Nullable
public static PsiDirectory findOrCreateDirectoryForPackage(@NotNull Module module, String packageName,
        PsiDirectory baseDir, boolean askUserToCreate, boolean filterSourceDirsForBaseTestDirectory)
        throws IncorrectOperationException {
    final Project project = module.getProject();
    PsiDirectory psiDirectory = null;//from w w w  .j ava 2  s. com
    if (!packageName.isEmpty()) {
        PsiJavaPackage rootPackage = findLongestExistingPackage(module, packageName);
        if (rootPackage != null) {
            int beginIndex = rootPackage.getQualifiedName().length() + 1;
            packageName = beginIndex < packageName.length() ? packageName.substring(beginIndex) : "";
            String postfixToShow = packageName.replace('.', File.separatorChar);
            if (packageName.length() > 0) {
                postfixToShow = File.separatorChar + postfixToShow;
            }
            PsiDirectory[] moduleDirectories = getPackageDirectoriesInModule(rootPackage, module);
            if (filterSourceDirsForBaseTestDirectory) {
                moduleDirectories = filterSourceDirectories(baseDir, project, moduleDirectories);
            }
            psiDirectory = DirectoryChooserUtil.selectDirectory(project, moduleDirectories, baseDir,
                    postfixToShow);
            if (psiDirectory == null) {
                return null;
            }
        }
    }

    if (psiDirectory == null) {
        if (!checkSourceRootsConfigured(module, askUserToCreate)) {
            return null;
        }
        final VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
        List<PsiDirectory> directoryList = new ArrayList<PsiDirectory>();
        for (VirtualFile sourceRoot : sourceRoots) {
            final PsiDirectory directory = PsiManager.getInstance(project).findDirectory(sourceRoot);
            if (directory != null) {
                directoryList.add(directory);
            }
        }
        PsiDirectory[] sourceDirectories = directoryList.toArray(new PsiDirectory[directoryList.size()]);
        psiDirectory = DirectoryChooserUtil.selectDirectory(project, sourceDirectories, baseDir,
                File.separatorChar + packageName.replace('.', File.separatorChar));
        if (psiDirectory == null) {
            return null;
        }
    }

    String restOfName = packageName;
    boolean askedToCreate = false;
    while (restOfName.length() > 0) {
        final String name = getLeftPart(restOfName);
        PsiDirectory foundExistingDirectory = psiDirectory.findSubdirectory(name);
        if (foundExistingDirectory == null) {
            if (!askedToCreate && askUserToCreate) {
                if (!ApplicationManager.getApplication().isUnitTestMode()) {
                    int toCreate = Messages.showYesNoDialog(project,
                            IdeBundle.message("prompt.create.non.existing.package", packageName),
                            IdeBundle.message("title.package.not.found"), Messages.getQuestionIcon());
                    if (toCreate != 0) {
                        return null;
                    }
                }
                askedToCreate = true;
            }

            final PsiDirectory psiDirectory1 = psiDirectory;
            try {
                psiDirectory = ActionRunner
                        .runInsideWriteAction(new ActionRunner.InterruptibleRunnableWithResult<PsiDirectory>() {
                            public PsiDirectory run() throws Exception {
                                return psiDirectory1.createSubdirectory(name);
                            }
                        });
            } catch (IncorrectOperationException e) {
                throw e;
            } catch (IOException e) {
                throw new IncorrectOperationException(e.toString(), e);
            } catch (Exception e) {
                LOG.error(e);
            }
        } else {
            psiDirectory = foundExistingDirectory;
        }
        restOfName = cutLeftPart(restOfName);
    }
    return psiDirectory;
}

From source file:com.intellij.ide.util.projectWizard.NamePathComponent.java

License:Apache License

public boolean validateNameAndPath(WizardContext context) throws ConfigurationException {
    final String name = getNameValue();
    if (name.length() == 0) {
        final ApplicationInfo info = ApplicationManager.getApplication().getComponent(ApplicationInfo.class);
        throw new ConfigurationException(IdeBundle.message("prompt.new.project.file.name",
                info.getVersionName(), context.getPresentationName()));
    }/*  w  w  w.  j  av a 2s  . c o m*/

    final String projectFileDirectory = getPath();
    if (projectFileDirectory.length() == 0) {
        throw new ConfigurationException(
                IdeBundle.message("prompt.enter.project.file.location", context.getPresentationName()));
    }

    final boolean shouldPromptCreation = isPathChangedByUser();
    if (!ProjectWizardUtil.createDirectoryIfNotExists(
            IdeBundle.message("directory.project.file.directory", context.getPresentationName()),
            projectFileDirectory, shouldPromptCreation)) {
        return false;
    }

    final File file = new File(projectFileDirectory);
    if (file.exists() && !file.canWrite()) {
        throw new ConfigurationException(
                String.format("Directory '%s' is not writable!\nPlease choose another project location.",
                        projectFileDirectory));
    }

    boolean shouldContinue = true;
    final File projectDir = new File(getPath(), Project.DIRECTORY_STORE_FOLDER);
    if (projectDir.exists()) {
        int answer = Messages.showYesNoDialog(
                IdeBundle.message("prompt.overwrite.project.folder", projectDir.getAbsolutePath(),
                        context.getPresentationName()),
                IdeBundle.message("title.file.already.exists"), Messages.getQuestionIcon());
        shouldContinue = (answer == Messages.YES);
    }

    return shouldContinue;
}

From source file:com.intellij.ide.util.projectWizard.ProjectNameStep.java

License:Apache License

public boolean validate() throws ConfigurationException {
    String name = myNamePathComponent.getNameValue();
    if (name.length() == 0) {
        final ApplicationInfo info = ApplicationManager.getApplication().getComponent(ApplicationInfo.class);
        throw new ConfigurationException(IdeBundle.message("prompt.new.project.file.name",
                info.getVersionName(), myWizardContext.getPresentationName()));
    }//from  w  w w  .  j  a va  2s  .  co m

    final String projectFileDirectory = getProjectFileDirectory();
    if (projectFileDirectory.length() == 0) {
        throw new ConfigurationException(
                IdeBundle.message("prompt.enter.project.file.location", myWizardContext.getPresentationName()));
    }

    final boolean shouldPromptCreation = myNamePathComponent.isPathChangedByUser();
    if (!ProjectWizardUtil.createDirectoryIfNotExists(
            IdeBundle.message("directory.project.file.directory", myWizardContext.getPresentationName()),
            projectFileDirectory, shouldPromptCreation)) {
        return false;
    }

    boolean shouldContinue = true;

    final String path = getProjectFileDirectory() + "/" + Project.DIRECTORY_STORE_FOLDER;
    final File projectFile = new File(path);
    if (projectFile.exists()) {
        final String title = myWizardContext.isCreatingNewProject() ? IdeBundle.message("title.new.project")
                : IdeBundle.message("title.add.module");
        final String message = IdeBundle.message("prompt.overwrite.project.folder",
                Project.DIRECTORY_STORE_FOLDER, projectFile.getParentFile().getAbsolutePath());
        int answer = Messages.showYesNoDialog(message, title, Messages.getQuestionIcon());
        shouldContinue = answer == Messages.OK;
    }

    return shouldContinue;
}

From source file:com.intellij.ide.util.projectWizard.ProjectWizardUtil.java

License:Apache License

public static boolean createDirectoryIfNotExists(final String promptPrefix, String directoryPath,
        boolean promptUser) {
    File dir = new File(directoryPath);
    if (!dir.exists()) {
        if (promptUser) {
            final int answer = Messages.showOkCancelDialog(
                    IdeBundle.message("promot.projectwizard.directory.does.not.exist", promptPrefix,
                            dir.getPath(), ApplicationNamesInfo.getInstance().getFullProductName()),
                    IdeBundle.message("title.directory.does.not.exist"), Messages.getQuestionIcon());
            if (answer != 0) {
                return false;
            }/*from  ww  w . ja  v a 2  s  . co m*/
        }
        try {
            VfsUtil.createDirectories(dir.getPath());
        } catch (IOException e) {
            Messages.showErrorDialog(IdeBundle.message("error.failed.to.create.directory", dir.getPath()),
                    CommonBundle.getErrorTitle());
            return false;
        }
    }
    return true;
}

From source file:com.intellij.ide.util.scopeChooser.EditScopesDialog.java

License:Apache License

@Override
protected void doOKAction() {
    final Object selectedObject = ((ScopeChooserConfigurable) getConfigurable()).getSelectedObject();
    if (selectedObject instanceof NamedScope) {
        mySelectedScope = (NamedScope) selectedObject;
    }/*from   ww  w  .j  av a2  s  . c  o m*/
    super.doOKAction();
    if (myCheckShared && mySelectedScope != null) {
        final Project project = getProject();
        final DependencyValidationManager manager = DependencyValidationManager.getInstance(project);
        NamedScope scope = manager.getScope(mySelectedScope.getName());
        if (scope == null) {
            if (Messages.showYesNoDialog(IdeBundle.message("scope.unable.to.save.scope.message"),
                    IdeBundle.message("scope.unable.to.save.scope.title"),
                    Messages.getErrorIcon()) == DialogWrapper.OK_EXIT_CODE) {
                final String newName = Messages.showInputDialog(project,
                        IdeBundle.message("add.scope.name.label"),
                        IdeBundle.message("scopes.save.dialog.title.shared"), Messages.getQuestionIcon(),
                        mySelectedScope.getName(), new InputValidator() {
                            @Override
                            public boolean checkInput(String inputString) {
                                return inputString != null && inputString.length() > 0
                                        && manager.getScope(inputString) == null;
                            }

                            @Override
                            public boolean canClose(String inputString) {
                                return checkInput(inputString);
                            }
                        });
                if (newName != null) {
                    final PackageSet packageSet = mySelectedScope.getValue();
                    scope = new NamedScope(newName, packageSet != null ? packageSet.createCopy() : null);
                    mySelectedScope = scope;
                    manager.addScope(mySelectedScope);
                }
            }
        }
    }
}

From source file:com.intellij.ide.util.SuperMethodWarningDialog.java

License:Apache License

public JComponent createNorthPanel() {
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
    Icon icon = Messages.getWarningIcon();
    if (icon != null) {
        JLabel iconLabel = new JLabel(Messages.getQuestionIcon());
        panel.add(iconLabel, BorderLayout.WEST);
    }//from   www.  j  a  v a 2 s. co m
    JPanel labelsPanel = new JPanel(new GridLayout(0, 1, 0, 0));
    labelsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10));
    String classType = myIsParentInterface ? IdeBundle.message("element.of.interface")
            : IdeBundle.message("element.of.class");
    String methodString = IdeBundle.message("element.method");
    labelsPanel.add(new JLabel(IdeBundle.message("label.method", myName)));
    if (myClassNames.length == 1) {
        final String className = myClassNames[0];
        labelsPanel.add(new JLabel(myIsContainedInInterface || !myIsSuperAbstract
                ? IdeBundle.message("label.overrides.method.of_class_or_interface.name", methodString,
                        classType, className)
                : IdeBundle.message("label.implements.method.of_class_or_interface.name", methodString,
                        classType, className)));
    } else {
        labelsPanel.add(new JLabel(IdeBundle.message("label.implements.method.of_interfaces")));
        for (final String className : myClassNames) {
            labelsPanel.add(new JLabel("    " + className));
        }
    }
    labelsPanel.add(new JLabel(IdeBundle.message("prompt.do.you.want.to.action_verb.the.method.from_class",
            myActionString, myClassNames.length > 1 ? 2 : 1)));
    panel.add(labelsPanel, BorderLayout.CENTER);
    return panel;
}