本文整理匯總了Java中com.intellij.openapi.ui.Messages.NO屬性的典型用法代碼示例。如果您正苦於以下問題:Java Messages.NO屬性的具體用法?Java Messages.NO怎麽用?Java Messages.NO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.intellij.openapi.ui.Messages
的用法示例。
在下文中一共展示了Messages.NO屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: moveDirectoriesLibrariesSafe
private static void moveDirectoriesLibrariesSafe(Project project,
PsiElement targetContainer,
MoveCallback callback,
PsiDirectory[] directories,
String prompt) {
final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directories[0]);
LOG.assertTrue(aPackage != null);
final PsiDirectory[] projectDirectories = aPackage.getDirectories(GlobalSearchScope.projectScope(project));
if (projectDirectories.length > 1) {
int ret = Messages
.showYesNoCancelDialog(project, prompt + " or all directories in project?", RefactoringBundle.message("warning.title"),
RefactoringBundle.message("move.current.directory"),
RefactoringBundle.message("move.directories"),
CommonBundle.getCancelButtonText(), Messages.getWarningIcon());
if (ret == Messages.YES) {
moveAsDirectory(project, targetContainer, callback, directories);
}
else if (ret == Messages.NO) {
moveAsDirectory(project, targetContainer, callback, projectDirectories);
}
}
else if (Messages.showOkCancelDialog(project, prompt + "?", RefactoringBundle.message("warning.title"),
Messages.getWarningIcon()) == Messages.OK) {
moveAsDirectory(project, targetContainer, callback, directories);
}
}
示例2: showYesNoCancelDialog
@Override
public int showYesNoCancelDialog(@NotNull String title,
String message,
@NotNull String defaultButton,
String alternateButton,
String otherButton,
@Nullable Window window,
@Nullable DialogWrapper.DoNotAskOption doNotAskOption) {
if (window == null) {
window = getForemostWindow(null);
}
SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(),
new String [] {defaultButton, otherButton, alternateButton},
doNotAskOption, defaultButton, alternateButton);
String resultString = sheetMessage.getResult();
int result = resultString.equals(defaultButton) ? Messages.YES : resultString.equals(alternateButton) ? Messages.NO : Messages.CANCEL;
if (doNotAskOption != null) {
doNotAskOption.setToBeShown(sheetMessage.toBeShown(), result);
}
return result;
}
示例3: showYesNoDialog
@Override
public int showYesNoDialog(@NotNull String title,
String message,
@NotNull String yesButton,
@NotNull String noButton,
@Nullable Window window,
@Nullable DialogWrapper.DoNotAskOption doNotAskDialogOption) {
if (window == null) {
window = getForemostWindow(null);
}
SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(),
new String [] {yesButton, noButton}, doNotAskDialogOption, yesButton, noButton);
int result = sheetMessage.getResult().equals(yesButton) ? Messages.YES : Messages.NO;
if (doNotAskDialogOption != null && (result == Messages.YES || doNotAskDialogOption.shouldSaveOptionsOnCancel())) {
doNotAskDialogOption.setToBeShown(sheetMessage.toBeShown(), result);
}
return result;
}
示例4: deleteObsoleteModules
private boolean deleteObsoleteModules() {
final List<Module> obsoleteModules = collectObsoleteModules();
if (obsoleteModules.isEmpty()) return false;
setMavenizedModules(obsoleteModules, false);
final int[] result = new int[1];
MavenUtil.invokeAndWait(myProject, myModelsProvider.getModalityStateForQuestionDialogs(), new Runnable() {
public void run() {
result[0] = Messages.showYesNoDialog(myProject,
ProjectBundle.message("maven.import.message.delete.obsolete", formatModules(obsoleteModules)),
ProjectBundle.message("maven.project.import.title"),
Messages.getQuestionIcon());
}
});
if (result[0] == Messages.NO) return false;// NO
for (Module each : obsoleteModules) {
if (!each.isDisposed()) {
myModuleModel.disposeModule(each);
}
}
return true;
}
示例5: doOKAction
@Override
protected void doOKAction() {
File file = getTemplateFile();
if (file.exists()) {
if (Messages.showYesNoDialog(myPanel,
FileUtil.getNameWithoutExtension(file) + " exists already.\n" +
"Do you want to replace it with the new one?", "Template Already Exists",
Messages.getWarningIcon()) == Messages.NO) {
return;
}
file.delete();
}
super.doOKAction();
}
示例6: validate
public boolean validate() throws ConfigurationException {
if (!super.validate()) {
return false;
}
if (CREATE_SOURCE_PANEL.equals(myCurrentMode) && myRbCreateSource.isSelected()) {
final String sourceDirectoryPath = getSourceDirectoryPath();
final String relativePath = myTfSourceDirectoryName.getText().trim();
if (relativePath.length() == 0) {
String text = IdeBundle.message("prompt.relative.path.to.sources.empty", FileUtil.toSystemDependentName(sourceDirectoryPath));
final int answer = Messages.showYesNoCancelDialog(myTfSourceDirectoryName, text, IdeBundle.message("title.mark.source.directory"),
IdeBundle.message("action.mark"), IdeBundle.message("action.do.not.mark"),
CommonBundle.getCancelButtonText(), Messages.getQuestionIcon());
if (answer == Messages.CANCEL) {
return false; // cancel
}
if (answer == Messages.NO) { // don't mark
myRbNoSource.doClick();
}
}
if (sourceDirectoryPath != null) {
final File rootDir = new File(getContentRootPath());
final File srcDir = new File(sourceDirectoryPath);
if (!FileUtil.isAncestor(rootDir, srcDir, false)) {
Messages.showErrorDialog(myTfSourceDirectoryName,
IdeBundle.message("error.source.directory.should.be.under.module.content.root.directory"),
CommonBundle.getErrorTitle());
return false;
}
try {
VfsUtil.createDirectories(srcDir.getPath());
}
catch (IOException e) {
throw new ConfigurationException(e.getMessage());
}
}
}
return true;
}
示例7: getSuperMethod
@Nullable
protected static PyFunction getSuperMethod(@Nullable PyFunction function) {
if (function == null) {
return null;
}
final PyClass containingClass = function.getContainingClass();
if (containingClass == null) {
return function;
}
final PyFunction deepestSuperMethod = PySuperMethodsSearch.findDeepestSuperMethod(function);
if (!deepestSuperMethod.equals(function)) {
final PyClass baseClass = deepestSuperMethod.getContainingClass();
final PyBuiltinCache cache = PyBuiltinCache.getInstance(baseClass);
final String baseClassName = baseClass == null ? "" : baseClass.getName();
if (cache.isBuiltin(baseClass)) {
return function;
}
final String message = PyBundle.message("refactoring.change.signature.find.usages.of.base.class",
function.getName(),
containingClass.getName(),
baseClassName);
final int choice;
if (ApplicationManager.getApplication().isUnitTestMode()) {
choice = Messages.YES;
}
else {
choice = Messages.showYesNoCancelDialog(function.getProject(), message, REFACTORING_NAME, Messages.getQuestionIcon());
}
switch (choice) {
case Messages.YES:
return deepestSuperMethod;
case Messages.NO:
return function;
default:
return null;
}
}
return function;
}
示例8: saveTo
public void saveTo(CvsApplicationLevelConfiguration config) {
final String pathToPasswordFile = CvsApplicationLevelConfiguration.convertToIOFilePath(myPathToPasswordFile.getText());
final File passwordFile = new File(pathToPasswordFile);
if (!passwordFile.exists()) {
final int result = Messages.showYesNoDialog(myPanel, CvsBundle.message("message.password.file.does.not.exist", pathToPasswordFile),
CvsBundle.message("title.password.file.does.not.exist"), Messages.getQuestionIcon());
if (result == Messages.NO) {
throw new InputException(myPathToPasswordFile);
}
try {
passwordFile.createNewFile();
}
catch (IOException e) {
throw new InputException(e.getMessage(), myPathToPasswordFile);
}
}
config.setPathToPasswordFile(pathToPasswordFile);
try {
final int timeout = Integer.parseInt(myTimeout.getText());
if (timeout < 0) {
throwInvalidTimeoutException();
}
config.TIMEOUT = timeout;
}
catch (NumberFormatException ex) {
throwInvalidTimeoutException();
}
}
示例9: copyPropertyToAnotherBundle
private static void copyPropertyToAnotherBundle(Collection<IProperty> properties, final String newName, ResourceBundle resourceBundle) {
final Map<IProperty, PropertiesFile> propertiesFileMapping = new HashMap<IProperty, PropertiesFile>();
for (IProperty property : properties) {
final PropertiesFile containingFile = property.getPropertiesFile();
final PropertiesFile matched = findWithMatchedSuffix(containingFile, resourceBundle);
if (matched != null) {
propertiesFileMapping.put(property, matched);
}
}
final Project project = resourceBundle.getProject();
if (properties.size() != propertiesFileMapping.size() &&
Messages.NO == Messages.showYesNoDialog(project,
"Source and target resource bundles properties files are not matched correctly. Copy properties anyway?",
"Resource Bundles Are not Matched", null)) {
return;
}
WriteCommandAction.runWriteCommandAction(project, new Runnable() {
@Override
public void run() {
for (Map.Entry<IProperty, PropertiesFile> entry : propertiesFileMapping.entrySet()) {
final String value = entry.getKey().getValue();
final PropertiesFile target = entry.getValue();
target.addProperty(newName, value);
}
}
});
}
示例10: createApplicationIfNeeded
public void createApplicationIfNeeded(@NotNull final Module module) {
if (findAppRoot(module) == null && module.getUserData(CREATE_APP_STRUCTURE) == Boolean.TRUE) {
while (ModuleRootManager.getInstance(module).getSdk() == null) {
if (Messages.showYesNoDialog(module.getProject(), "Cannot generate " + getDisplayName() + " project structure because JDK is not specified for module \"" +
module.getName() + "\".\n" +
getDisplayName() + " project will not be created if you don't specify JDK.\nDo you want to specify JDK?",
"Error", Messages.getErrorIcon()) == Messages.NO) {
return;
}
ProjectSettingsService.getInstance(module.getProject()).showModuleConfigurationDialog(module.getName(), ClasspathEditor.NAME);
}
module.putUserData(CREATE_APP_STRUCTURE, null);
final GeneralCommandLine commandLine = getCreationCommandLine(module);
if (commandLine == null) return;
MvcConsole.executeProcess(module, commandLine, new Runnable() {
@Override
public void run() {
VirtualFile root = findAppRoot(module);
if (root == null) return;
PsiDirectory psiDir = PsiManager.getInstance(module.getProject()).findDirectory(root);
IdeView ide = LangDataKeys.IDE_VIEW.getData(DataManager.getInstance().getDataContext());
if (ide != null) ide.selectElement(psiDir);
//also here comes fileCreated(application.properties) which manages roots and run configuration
}
}, true);
}
}
示例11: showDialog
/**
* Shows this dialog.
* <p/>
* The user now has the choices to either:
* <ul>
* <li/>Replace existing method
* <li/>Create a duplicate method
* <li/>Cancel
* </ul>
*
* @param targetMethodName the name of the target method (toString)
* @return the chosen conflict resolution policy (never null)
*/
public static ConflictResolutionPolicy showDialog(String targetMethodName) {
int exit = Messages.showYesNoCancelDialog("Replace existing " + targetMethodName + " method", "Method Already Exists", Messages.getQuestionIcon());
if (exit == Messages.CANCEL) {
return CancelPolicy.getInstance();
}
if (exit == Messages.YES) {
return ReplacePolicy.getInstance();
}
if (exit == Messages.NO) {
return DuplicatePolicy.getInstance();
}
throw new IllegalArgumentException("exit code [" + exit + "] from YesNoCancelDialog not supported");
}
示例12: evaluateFinallyBlocks
static boolean evaluateFinallyBlocks(Project project,
String title,
JavaStackFrame stackFrame,
XDebuggerEvaluator.XEvaluationCallback callback) {
if (!DebuggerSettings.EVALUATE_FINALLY_NEVER.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME)) {
List<PsiStatement> statements = getFinallyStatements(stackFrame.getDescriptor().getSourcePosition());
if (!statements.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (PsiStatement statement : statements) {
sb.append("\n").append(statement.getText());
}
if (DebuggerSettings.EVALUATE_FINALLY_ALWAYS.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME)) {
evaluateAndAct(project, stackFrame, sb, callback);
return true;
}
else {
int res = MessageDialogBuilder
.yesNoCancel(title,
DebuggerBundle.message("warning.finally.block.detected") + sb)
.project(project)
.icon(Messages.getWarningIcon())
.yesText(DebuggerBundle.message("button.execute.finally"))
.noText(DebuggerBundle.message("button.drop.anyway"))
.cancelText(CommonBundle.message("button.cancel"))
.doNotAsk(
new DialogWrapper.DoNotAskOption() {
@Override
public boolean isToBeShown() {
return !DebuggerSettings.EVALUATE_FINALLY_ALWAYS.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME) &&
!DebuggerSettings.EVALUATE_FINALLY_NEVER.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME);
}
@Override
public void setToBeShown(boolean value, int exitCode) {
if (!value) {
DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME =
exitCode == Messages.YES ? DebuggerSettings.EVALUATE_FINALLY_ALWAYS : DebuggerSettings.EVALUATE_FINALLY_NEVER;
}
else {
DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME = DebuggerSettings.EVALUATE_FINALLY_ASK;
}
}
@Override
public boolean canBeHidden() {
return true;
}
@Override
public boolean shouldSaveOptionsOnCancel() {
return false;
}
@NotNull
@Override
public String getDoNotShowMessage() {
return CommonBundle.message("dialog.options.do.not.show");
}
})
.show();
switch (res) {
case Messages.CANCEL:
return true;
case Messages.NO:
break;
case Messages.YES: // evaluate finally
evaluateAndAct(project, stackFrame, sb, callback);
return true;
}
}
}
}
return false;
}
示例13: addMouseShortcut
private void addMouseShortcut(Shortcut shortcut, ShortcutRestrictions restrictions) {
String actionId = myActionsTree.getSelectedActionId();
if (actionId == null) {
return;
}
Keymap keymap = createKeymapCopyIfNeeded();
MouseShortcut mouseShortcut = shortcut instanceof MouseShortcut ? (MouseShortcut)shortcut : null;
Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(this));
MouseShortcutDialog dialog = new MouseShortcutDialog(
this,
mouseShortcut,
keymap,
actionId,
ActionsTreeUtil.createMainGroup(project, keymap, myQuickLists, null, true, null),
restrictions
);
if (!dialog.showAndGet()) {
return;
}
mouseShortcut = dialog.getMouseShortcut();
if (mouseShortcut == null) {
return;
}
String[] actionIds = keymap.getActionIds(mouseShortcut);
if (actionIds.length > 1 || (actionIds.length == 1 && !actionId.equals(actionIds[0]))) {
int result = Messages.showYesNoCancelDialog(
this,
KeyMapBundle.message("conflict.shortcut.dialog.message"),
KeyMapBundle.message("conflict.shortcut.dialog.title"),
KeyMapBundle.message("conflict.shortcut.dialog.remove.button"),
KeyMapBundle.message("conflict.shortcut.dialog.leave.button"),
KeyMapBundle.message("conflict.shortcut.dialog.cancel.button"),
Messages.getWarningIcon());
if (result == Messages.YES) {
for (String id : actionIds) {
keymap.removeShortcut(id, mouseShortcut);
}
}
else if (result != Messages.NO) {
return;
}
}
// if shortcut is already registered to this action, just select it in the list
Shortcut[] shortcuts = keymap.getShortcuts(actionId);
for (Shortcut shortcut1 : shortcuts) {
if (shortcut1.equals(mouseShortcut)) {
return;
}
}
keymap.addShortcut(actionId, mouseShortcut);
if (StringUtil.startsWithChar(actionId, '$')) {
keymap.addShortcut(KeyMapBundle.message("editor.shortcut", actionId.substring(1)), mouseShortcut);
}
repaintLists();
currentKeymapChanged();
}
示例14: exportTextToFile
public static void exportTextToFile(Project project, String fileName, String textToExport) {
String prepend = "";
File file = new File(fileName);
if (file.exists()) {
int result = Messages.showYesNoCancelDialog(
project,
IdeBundle.message("error.text.file.already.exists", fileName),
IdeBundle.message("title.warning"),
IdeBundle.message("action.overwrite"),
IdeBundle.message("action.append"),
CommonBundle.getCancelButtonText(),
Messages.getWarningIcon()
);
if (result != Messages.NO && result != Messages.YES) {
return;
}
if (result == Messages.NO) {
char[] buf = new char[(int)file.length()];
try {
FileReader reader = new FileReader(fileName);
try {
reader.read(buf, 0, (int)file.length());
prepend = new String(buf) + SystemProperties.getLineSeparator();
}
finally {
reader.close();
}
}
catch (IOException ignored) {
}
}
}
try {
FileWriter writer = new FileWriter(fileName);
try {
writer.write(prepend + textToExport);
}
finally {
writer.close();
}
}
catch (IOException e) {
Messages.showMessageDialog(
project,
IdeBundle.message("error.writing.to.file", fileName),
CommonBundle.getErrorTitle(),
Messages.getErrorIcon()
);
}
}
示例15: promptAndKillSession
private boolean promptAndKillSession(
Executor executor, Project project, AndroidSessionInfo info) {
String previousExecutor = info.getExecutorId();
String currentExecutor = executor.getId();
if (ourKillLaunchOption.isToBeShown()) {
String msg;
String noText;
if (previousExecutor.equals(currentExecutor)) {
msg =
String.format(
"Restart App?\nThe app is already running. "
+ "Would you like to kill it and restart the session?");
noText = "Cancel";
} else {
msg =
String.format(
"To switch from %1$s to %2$s, the app has to restart. Continue?",
previousExecutor, currentExecutor);
noText = "Cancel " + currentExecutor;
}
String title = "Launching " + getName();
String yesText = "Restart " + getName();
if (Messages.NO
== Messages.showYesNoDialog(
project,
msg,
title,
yesText,
noText,
AllIcons.General.QuestionDialog,
ourKillLaunchOption)) {
return false;
}
}
LOG.info("Disconnecting existing session of the same launch configuration");
info.getProcessHandler().detachProcess();
return true;
}