本文整理汇总了Java中com.intellij.openapi.ui.Messages.showOkCancelDialog方法的典型用法代码示例。如果您正苦于以下问题:Java Messages.showOkCancelDialog方法的具体用法?Java Messages.showOkCancelDialog怎么用?Java Messages.showOkCancelDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.Messages
的用法示例。
在下文中一共展示了Messages.showOkCancelDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureUsagesWritable
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private boolean ensureUsagesWritable(ReplaceContext replaceContext, Collection<Usage> selectedUsages) {
Set<VirtualFile> readOnlyFiles = null;
for (final Usage usage : selectedUsages) {
final VirtualFile file = ((UsageInFile)usage).getFile();
if (file != null && !file.isWritable()) {
if (readOnlyFiles == null) readOnlyFiles = new HashSet<VirtualFile>();
readOnlyFiles.add(file);
}
}
if (readOnlyFiles != null) {
ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(VfsUtilCore.toVirtualFileArray(readOnlyFiles));
}
if (hasReadOnlyUsages(selectedUsages)) {
int result = Messages.showOkCancelDialog(replaceContext.getUsageView().getComponent(),
FindBundle.message("find.replace.occurrences.in.read.only.files.prompt"),
FindBundle.message("find.replace.occurrences.in.read.only.files.title"),
Messages.getWarningIcon());
if (result != Messages.OK) {
return false;
}
}
return true;
}
示例2: actionPerformed
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
final SimpleNode selectedNode = treeView.getTree().getSelectedNode();
if (selectedNode instanceof BaseDomElementNode) {
if (selectedNode instanceof DomFileElementNode) {
e.getPresentation().setVisible(false);
return;
}
final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
final int ret = Messages.showOkCancelDialog(getPresentationText(selectedNode, "Remove") + "?", "Remove",
Messages.getQuestionIcon());
if (ret == Messages.OK) {
new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) {
@Override
protected void run(@NotNull final Result result) throws Throwable {
domElement.undefine();
}
}.execute();
}
}
}
示例3: contentRemoveQuery
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void contentRemoveQuery(ContentManagerEvent event) {
if (event.getContent() == myContent) {
if (!myIndicator.isCanceled() && shouldAskUser()) {
int result = Messages.showOkCancelDialog(
myProject,
CompilerBundle.message("warning.compiler.running.on.toolwindow.close"),
CompilerBundle.message("compiler.running.dialog.title"),
Messages.getQuestionIcon()
);
if (result != Messages.OK) {
event.consume(); // veto closing
}
myUserAcceptedCancel = true;
}
}
}
示例4: processDragFinish
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
protected void processDragFinish(MouseEvent event, boolean willDragOutStart) {
super.processDragFinish(event, willDragOutStart);
endDrag(willDragOutStart);
final JBTabsPosition position = myTabs.getTabsPosition();
if (!willDragOutStart && myTabs.isAlphabeticalMode() && position != JBTabsPosition.top && position != JBTabsPosition.bottom) {
Point p = new Point(event.getPoint());
p = SwingUtilities.convertPoint(event.getComponent(), p, myTabs);
if (myTabs.getVisibleRect().contains(p) && myPressedOnScreenPoint.distance(new RelativePoint(event).getScreenPoint()) > 15) {
final int answer = Messages.showOkCancelDialog(myTabs,
IdeBundle.message("alphabetical.mode.is.on.warning"),
IdeBundle.message("title.warning"),
Messages.getQuestionIcon());
if (answer == Messages.OK) {
JBEditorTabs.setAlphabeticalMode(false);
myTabs.relayout(true, false);
myTabs.revalidate();
}
}
}
}
示例5: checkAssociate
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
public static boolean checkAssociate(final Project project, String fileName, DiffChainContext context) {
final String pattern = FileUtilRt.getExtension(fileName).toLowerCase();
if (context.contains(pattern)) return false;
int rc = Messages.showOkCancelDialog(project,
VcsBundle.message("diff.unknown.file.type.prompt", fileName),
VcsBundle.message("diff.unknown.file.type.title"),
VcsBundle.message("diff.unknown.file.type.associate"),
CommonBundle.getCancelButtonText(),
Messages.getQuestionIcon());
if (rc == Messages.OK) {
FileType fileType = FileTypeChooser.associateFileType(fileName);
return fileType != null && !fileType.isBinary();
} else {
context.add(pattern);
}
return false;
}
示例6: askUser
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private boolean askUser() {
String actionText = getActionName(myUndoableGroup.getCommandName());
if (actionText.length() > 80) {
actionText = actionText.substring(0, 80) + "... ";
}
return Messages.showOkCancelDialog(myManager.getProject(), actionText + "?", getActionName(),
Messages.getQuestionIcon()) == Messages.OK;
}
示例7: actionPerformed
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
protected void actionPerformed(@NotNull final VcsContext context) {
Collection<FilePath> filePaths = getFilePaths(context);
final List<ChangeList> selectedChangeLists = new ArrayList<ChangeList>();
final ChangeList[] selectionFromContext = context.getSelectedChangeLists();
if (selectionFromContext != null) {
Collections.addAll(selectedChangeLists, selectionFromContext);
}
final List<CommittedChangeList> incomingChanges = CommittedChangesCache.getInstance(context.getProject()).getCachedIncomingChanges();
final List<CommittedChangeList> intersectingChanges = new ArrayList<CommittedChangeList>();
if (incomingChanges != null) {
for(CommittedChangeList changeList: incomingChanges) {
if (!selectedChangeLists.contains(changeList)) {
for(Change change: changeList.getChanges()) {
if (filePaths.contains(ChangesUtil.getFilePath(change))) {
intersectingChanges.add(changeList);
break;
}
}
}
}
}
if (intersectingChanges.size() > 0) {
int rc = Messages.showOkCancelDialog(
context.getProject(), VcsBundle.message("get.committed.changes.intersecting.prompt", intersectingChanges.size(), selectedChangeLists.size()),
VcsBundle.message("get.committed.changes.title"), Messages.getQuestionIcon());
if (rc != Messages.OK) return;
}
super.actionPerformed(context);
}
示例8: createLeft
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private ActionListener createLeft(final TreeConflictDescription description) {
return new ActionListener() {
@Override
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<TreeConflictDescription>(myVcs.getProject(), "Accepting yours for: " + filePath(paths.myMainPath),
BackgroundFromStartOption.getInstance(), Collections.singletonList(description),
true) {
@Override
protected void process(TreeConflictDescription d) throws VcsException {
new SvnTreeConflictResolver(myVcs, paths.myMainPath, paths.myAdditionalPath).resolveSelectMineFull();
}
@Override
public void onSuccess() {
super.onSuccess();
if (executedOk()) {
VcsBalloonProblemNotifier.showOverChangesView(myProject, "Yours accepted for " + filePath(paths.myMainPath), MessageType.INFO);
}
}
});
}
};
}
示例9: tryToSetUpGroovyFacetOnTheFly
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
public static boolean tryToSetUpGroovyFacetOnTheFly(final Module module) {
final Project project = module.getProject();
GroovyConfigUtils utils = GroovyConfigUtils.getInstance();
final Library[] libraries = utils.getAllSDKLibraries(project);
if (libraries.length > 0) {
final Library library = libraries[0];
int result = Messages
.showOkCancelDialog(
GroovyBundle.message("groovy.like.library.found.text", module.getName(), library.getName(), utils.getSDKLibVersion(library)),
GroovyBundle.message("groovy.like.library.found"), JetgroovyIcons.Groovy.Groovy_32x32);
if (result == Messages.OK) {
AccessToken accessToken = WriteAction.start();
try {
ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
LibraryOrderEntry entry = model.addLibraryEntry(libraries[0]);
LibrariesUtil.placeEntryToCorrectPlace(model, entry);
model.commit();
return true;
}
finally {
accessToken.finish();
}
}
}
return false;
}
示例10: actionPerformed
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (Registry.is("ide.hide.excluded.files")) {
String message = files.length == 1 ? FileUtil.toSystemDependentName(files[0].getPath()) : files.length + " selected files";
final int rc = Messages.showOkCancelDialog(e.getData(CommonDataKeys.PROJECT), getPromptText(message), "Mark as Excluded",
Messages.getQuestionIcon());
if (rc != Messages.OK) {
return;
}
}
super.actionPerformed(e);
}
示例11: createRight
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private ActionListener createRight(final TreeConflictDescription description) {
return new ActionListener() {
@Override
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<TreeConflictDescription>(myVcs.getProject(), "Accepting theirs for: " + filePath(paths.myMainPath),
BackgroundFromStartOption.getInstance(), Collections.singletonList(description),
true) {
@Override
protected void process(TreeConflictDescription d) throws VcsException {
new SvnTreeConflictResolver(myVcs, paths.myMainPath, paths.myAdditionalPath).resolveSelectTheirsFull();
}
@Override
public void onSuccess() {
super.onSuccess();
if (executedOk()) {
VcsBalloonProblemNotifier.showOverChangesView(myProject, "Theirs accepted for " + filePath(paths.myMainPath), MessageType.INFO);
}
}
});
}
};
}
示例12: getTargetDirectory
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Nullable
@Override
protected PsiDirectory getTargetDirectory(DataContext dataContext, IdeView view) {
final PsiDirectory[] directories = view.getDirectories();
for (PsiDirectory directory : directories) {
final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
if (aPackage == null) {
continue;
}
if (directory.findFile(PsiPackage.PACKAGE_INFO_FILE) != null) {
Messages.showErrorDialog(CommonDataKeys.PROJECT.getData(dataContext),
IdeBundle.message("error.package.already.contains.package-info", aPackage.getQualifiedName()),
IdeBundle.message("title.cannot.create.file"));
return null;
}
else if (directory.findFile("package.html") != null) {
if (Messages.showOkCancelDialog(CommonDataKeys.PROJECT.getData(dataContext),
IdeBundle.message("error.package.already.contains.package.html", aPackage.getQualifiedName()),
IdeBundle.message("error.package.html.found.title"),
IdeBundle.message("button.create"), CommonBundle.message("button.cancel"),
Messages.getQuestionIcon()) != Messages.OK) {
return null;
}
}
}
return super.getTargetDirectory(dataContext, view);
}
示例13: checkLookAndFeel
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private boolean checkLookAndFeel(final UIManager.LookAndFeelInfo lafInfo, final boolean confirm) {
String message = null;
if (lafInfo.getName().contains("GTK") && SystemInfo.isXWindow && !SystemInfo.isJavaVersionAtLeast("1.6.0_12")) {
message = IdeBundle.message("warning.problem.laf.1");
}
if (message != null) {
if (confirm) {
final String[] options = {IdeBundle.message("confirm.set.look.and.feel"), CommonBundle.getCancelButtonText()};
final int result = Messages.showOkCancelDialog(message, CommonBundle.getWarningTitle(), options[0], options[1], Messages.getWarningIcon());
if (result == Messages.OK) {
myLastWarning = message;
return true;
}
return false;
}
if (!message.equals(myLastWarning)) {
Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, "L&F Manager", message, NotificationType.WARNING,
NotificationListener.URL_OPENING_LISTENER));
myLastWarning = message;
}
}
return true;
}
示例14: validate
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
public boolean validate() throws ConfigurationException {
final Sdk jdk = myProjectJdksConfigurable.getSelectedJdk();
if (jdk == null && !ApplicationManager.getApplication().isUnitTestMode()) {
int result = Messages.showOkCancelDialog(IdeBundle.message("prompt.confirm.project.no.jdk"),
IdeBundle.message("title.no.jdk.specified"), Messages.getWarningIcon());
if (result != Messages.OK) {
return false;
}
}
myProjectJdksConfigurable.apply();
return true;
}
示例15: deleteElement
import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
public void deleteElement(@NotNull DataContext dataContext) {
final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
if (files == null || files.length == 0) return;
Project project = CommonDataKeys.PROJECT.getData(dataContext);
String message = createConfirmationMessage(files);
int returnValue = Messages.showOkCancelDialog(message, UIBundle.message("delete.dialog.title"), ApplicationBundle.message("button.delete"),
CommonBundle.getCancelButtonText(), Messages.getQuestionIcon());
if (returnValue != Messages.OK) return;
Arrays.sort(files, FileComparator.getInstance());
final List<String> problems = ContainerUtil.newLinkedList();
new WriteCommandAction.Simple(project) {
@Override
protected void run() throws Throwable {
for (final VirtualFile file : files) {
try {
file.delete(this);
}
catch (IOException e) {
LOG.info(e);
problems.add(file.getName());
}
}
}
}.execute();
if (!problems.isEmpty()) {
reportDeletionProblem(problems);
}
}