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:org.jetbrains.idea.svn.actions.MarkLocallyDeletedTreeConflictResolvedAction.java

License:Apache License

@Override
public void actionPerformed(AnActionEvent e) {
    final MyLocallyDeletedChecker locallyDeletedChecker = new MyLocallyDeletedChecker(e);
    if (!locallyDeletedChecker.isEnabled())
        return;//  w  ww  .j ava 2 s.c om

    final String markText = SvnBundle.message("action.mark.tree.conflict.resolved.confirmation.title");
    final Project project = locallyDeletedChecker.getProject();
    final int result = Messages.showYesNoDialog(project,
            SvnBundle.message("action.mark.tree.conflict.resolved.confirmation.text"), markText,
            Messages.getQuestionIcon());
    if (result == Messages.YES) {
        final Ref<VcsException> exception = new Ref<VcsException>();
        ProgressManager.getInstance()
                .run(new Task.Backgroundable(project, markText, true, BackgroundFromStartOption.getInstance()) {
                    public void run(@NotNull ProgressIndicator indicator) {
                        resolveLocallyDeletedTextConflict(locallyDeletedChecker, exception);
                    }
                });
        if (!exception.isNull()) {
            AbstractVcsHelper.getInstance(project).showError(exception.get(), markText);
        }
    }
}

From source file:org.jetbrains.idea.svn.actions.MarkTreeConflictResolvedAction.java

License:Apache License

public void actionPerformed(AnActionEvent e) {
    final MyChecker checker = new MyChecker(e);
    if (!checker.isEnabled())
        return;//w  w w.  j a v a2  s  .c  om

    final String markText = SvnBundle.message("action.mark.tree.conflict.resolved.confirmation.title");
    final int result = Messages.showYesNoDialog(checker.getProject(),
            SvnBundle.message("action.mark.tree.conflict.resolved.confirmation.text"), markText,
            Messages.getQuestionIcon());
    if (result == Messages.YES) {
        final Ref<VcsException> exception = new Ref<VcsException>();
        ProgressManager.getInstance().run(new Task.Backgroundable(checker.getProject(), markText, true,
                BackgroundFromStartOption.getInstance()) {
            public void run(@NotNull ProgressIndicator indicator) {
                final ConflictedSvnChange change = checker.getChange();
                final FilePath path = change.getTreeConflictMarkHolder();
                SvnVcs vcs = SvnVcs.getInstance(checker.getProject());

                try {
                    vcs.getFactory(path.getIOFile()).createConflictClient().resolve(path.getIOFile(),
                            SVNDepth.EMPTY, false, false, true);
                } catch (VcsException e) {
                    exception.set(e);
                }
                VcsDirtyScopeManager.getInstance(checker.getProject()).filePathsDirty(getDistinctFiles(change),
                        null);
            }
        });
        if (!exception.isNull()) {
            AbstractVcsHelper.getInstance(checker.getProject()).showError(exception.get(), markText);
        }
    }
}

From source file:org.jetbrains.idea.svn.integrate.QuickMergeInteractionImpl.java

License:Apache License

@NotNull
@Override/*ww  w  .jav  a 2  s  .  c  o m*/
public LocalChangesAction selectLocalChangesAction(final boolean mergeAll) {
    if (!mergeAll) {
        final LocalChangesAction[] possibleResults = { LocalChangesAction.shelve, LocalChangesAction.inspect,
                LocalChangesAction.continueMerge, LocalChangesAction.cancel };
        final int result = Messages.showDialog(
                "There are local changes that will intersect with merge changes.\nDo you want to continue?",
                myTitle, new String[] { "Shelve local changes", "Inspect changes", "Continue merge", "Cancel" },
                0, Messages.getQuestionIcon());
        return possibleResults[result];
    } else {
        final LocalChangesAction[] possibleResults = { LocalChangesAction.shelve,
                LocalChangesAction.continueMerge, LocalChangesAction.cancel };
        final int result = Messages.showDialog(
                "There are local changes that can potentially intersect with merge changes.\nDo you want to continue?",
                myTitle, new String[] { "Shelve local changes", "Continue merge", "Cancel" }, 0,
                Messages.getQuestionIcon());
        return possibleResults[result];
    }
}

From source file:org.jetbrains.idea.svn.integrate.QuickMergeInteractionImpl.java

License:Apache License

private boolean prompt(final String question) {
    return Messages.showOkCancelDialog(myProject, question, myTitle, Messages.getQuestionIcon()) == Messages.OK;
}

From source file:org.jetbrains.idea.svn.SvnAuthenticationManager.java

License:Apache License

/**
 * Shows a yes/no question whether user wants to store his password in plain text and returns his answer.
 * @param title   title of the questioning dialog.
 * @param message questioning message to be displayed.
 * @return true if user agrees to store his password in plaintext, false if he doesn't.
 *//*ww  w.  j  av a 2  s.co  m*/
@CalledInAwt
private boolean askToStoreUnencrypted(String title, String message) {
    final int answer = Messages.showYesNoDialog(myProject, message, title, Messages.getQuestionIcon());
    return answer == Messages.YES;
}

From source file:org.jetbrains.idea.svn.treeConflict.MergeFromTheirsResolver.java

License:Apache License

public void execute() {
    int ok = Messages.showOkCancelDialog(myVcs.getProject(),
            (myChange.isMoved()/*w w w  .  j a  v  a  2 s .c o m*/
                    ? SvnBundle.message("confirmation.resolve.tree.conflict.merge.moved", myOldPresentation,
                            myNewPresentation)
                    : SvnBundle.message("confirmation.resolve.tree.conflict.merge.renamed", myOldPresentation,
                            myNewPresentation)),
            TreeConflictRefreshablePanel.TITLE, Messages.getQuestionIcon());
    if (Messages.OK != ok)
        return;

    FileDocumentManager.getInstance().saveAllDocuments();
    //final String name = "Merge changes from theirs for: " + myOldPresentation;

    final Continuation fragmented = Continuation.createFragmented(myVcs.getProject(), false);
    fragmented.addExceptionHandler(VcsException.class, new Consumer<VcsException>() {
        @Override
        public void consume(VcsException e) {
            myWarnings.add(e);
            if (e.isWarning()) {
                return;
            }
            AbstractVcsHelper.getInstance(myVcs.getProject()).showErrors(myWarnings,
                    TreeConflictRefreshablePanel.TITLE);
        }
    });

    final List<TaskDescriptor> tasks = new SmartList<TaskDescriptor>();
    if (SVNNodeKind.DIR.equals(myDescription.getNodeKind())) {
        tasks.add(new PreloadChangesContentsForDir());
    } else {
        tasks.add(new PreloadChangesContentsForFile());
    }
    tasks.add(new ConvertTextPaths());
    tasks.add(new PatchCreator());
    tasks.add(new SelectPatchesInApplyPatchDialog());
    tasks.add(new SelectBinaryFiles());

    fragmented.run(tasks);
}

From source file:org.jetbrains.idea.svn.treeConflict.TreeConflictRefreshablePanel.java

License:Apache License

private ActionListener createRight(final SVNTreeConflictDescription description) {
    return new ActionListener() {
        @Override//from  w  w  w . ja  va 2s  .  c  o m
        public void actionPerformed(ActionEvent e) {
            int ok = Messages.showOkCancelDialog(myVcs.getProject(),
                    "Accept theirs for " + filePath(myPath) + "?", TITLE, Messages.getQuestionIcon());
            if (Messages.OK != ok)
                return;
            FileDocumentManager.getInstance().saveAllDocuments();
            final Paths paths = getPaths(description);
            ProgressManager.getInstance().run(new VcsBackgroundTask<SVNTreeConflictDescription>(
                    myVcs.getProject(), "Accepting theirs for: " + filePath(paths.myMainPath),
                    BackgroundFromStartOption.getInstance(), Collections.singletonList(description), true) {
                @Override
                protected void process(SVNTreeConflictDescription d) throws VcsException {
                    new SvnTreeConflictResolver(myVcs, paths.myMainPath, myCommittedRevision,
                            paths.myAdditionalPath).resolveSelectTheirsFull(d);
                }

                @Override
                public void onSuccess() {
                    super.onSuccess();
                    if (executedOk()) {
                        VcsBalloonProblemNotifier.showOverChangesView(myProject,
                                "Theirs accepted for " + filePath(paths.myMainPath), MessageType.INFO);
                    }
                }
            });
        }
    };
}

From source file:org.jetbrains.idea.svn.treeConflict.TreeConflictRefreshablePanel.java

License:Apache License

private ActionListener createLeft(final SVNTreeConflictDescription description) {
    return new ActionListener() {
        @Override// w  w w  .j  a v a2s .  c om
        public void actionPerformed(ActionEvent e) {
            int ok = Messages.showOkCancelDialog(myVcs.getProject(),
                    "Accept yours for " + filePath(myPath) + "?", TITLE, Messages.getQuestionIcon());
            if (Messages.OK != ok)
                return;
            FileDocumentManager.getInstance().saveAllDocuments();
            final Paths paths = getPaths(description);
            ProgressManager.getInstance().run(new VcsBackgroundTask<SVNTreeConflictDescription>(
                    myVcs.getProject(), "Accepting yours for: " + filePath(paths.myMainPath),
                    BackgroundFromStartOption.getInstance(), Collections.singletonList(description), true) {
                @Override
                protected void process(SVNTreeConflictDescription d) throws VcsException {
                    new SvnTreeConflictResolver(myVcs, paths.myMainPath, myCommittedRevision,
                            paths.myAdditionalPath).resolveSelectMineFull(d);
                }

                @Override
                public void onSuccess() {
                    super.onSuccess();
                    if (executedOk()) {
                        VcsBalloonProblemNotifier.showOverChangesView(myProject,
                                "Yours accepted for " + filePath(paths.myMainPath), MessageType.INFO);
                    }
                }
            });
        }
    };
}

From source file:org.jetbrains.jet.plugin.actions.JavaToKotlinAction.java

License:Apache License

@Override
public void actionPerformed(final AnActionEvent e) {
    VirtualFile[] virtualFiles = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
    assert virtualFiles != null;
    final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
    assert project != null;
    final Converter converter = new Converter(project);
    int result = Messages.showYesNoCancelDialog(project, "Would you like to backup Java files?", "Backup",
            Messages.getQuestionIcon());
    final boolean finalRemoveIt = needToRemoveFiles(result);
    final List<PsiFile> allJavaFiles = getAllJavaFiles(virtualFiles, project);

    converter.clearClassIdentifiers();/*from  ww  w. j  a v  a 2  s.  co  m*/
    for (PsiFile f : allJavaFiles) {
        if (f.getFileType() instanceof JavaFileType) {
            setClassIdentifiers(converter, f);
        }
    }

    final List<PsiFile> allJavaFilesNear = getAllJavaFiles(virtualFiles, project);
    CommandProcessor.getInstance().executeCommand(project, new Runnable() {
        @Override
        public void run() {
            final List<VirtualFile> newFiles = convertFiles(converter, allJavaFilesNear);
            if (finalRemoveIt) {
                deleteFiles(allJavaFilesNear);
            } else {
                renameFiles(allJavaFiles);
            }
            reformatFiles(newFiles, project);
            for (VirtualFile vf : newFiles) {
                FileEditorManager.getInstance(project).openFile(vf, true);
            }
        }
    }, "Convert files from Java to Kotlin", "group_id");
}

From source file:org.jetbrains.jet.plugin.refactoring.move.moveTopLevelDeclarations.ui.MoveKotlinTopLevelDeclarationsDialog.java

License:Apache License

@Nullable
private KotlinMoveTarget selectMoveTarget() {
    String message = verifyBeforeRun();
    if (message != null) {
        setErrorText(message);//from w  w w  . ja  va  2  s  .  c o m
        return null;
    }

    setErrorText(null);

    if (isMoveToPackage()) {
        String packageName = getTargetPackage().trim();

        RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, packageName);
        PackageWrapper targetPackage = new PackageWrapper(PsiManager.getInstance(myProject), packageName);
        if (!targetPackage.exists()) {
            int ret = Messages.showYesNoDialog(myProject,
                    RefactoringBundle.message("package.does.not.exist", packageName),
                    RefactoringBundle.message("move.title"), Messages.getQuestionIcon());
            if (ret != Messages.YES)
                return null;
        }

        MoveDestination moveDestination = ((DestinationFolderComboBox) destinationFolderCB)
                .selectDirectory(targetPackage, false);
        return moveDestination != null ? new MoveDestinationKotlinMoveTarget(moveDestination) : null;
    }

    JetFile jetFile = (JetFile) RefactoringPackage.toPsiFile(new File(getTargetFilePath()), myProject);
    assert jetFile != null : "Non-Kotlin files must be filtered out before starting the refactoring";

    return new JetFileKotlinMoveTarget(jetFile);
}