本文整理匯總了Java中com.intellij.openapi.ui.DialogWrapper.DoNotAskOption方法的典型用法代碼示例。如果您正苦於以下問題:Java DialogWrapper.DoNotAskOption方法的具體用法?Java DialogWrapper.DoNotAskOption怎麽用?Java DialogWrapper.DoNotAskOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.ui.DialogWrapper
的用法示例。
在下文中一共展示了DialogWrapper.DoNotAskOption方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showYesNoCancelDialog
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
@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;
}
示例2: showYesNoDialog
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
@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;
}
示例3: createDoNotAskOption
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
private static DialogWrapper.DoNotAskOption createDoNotAskOption(@NotNull final Project project,
@NotNull final StudyTwitterPluginConfigurator configurator) {
return new DialogWrapper.DoNotAskOption() {
@Override
public boolean isToBeShown() {
return true;
}
@Override
public void setToBeShown(boolean toBeShown, int exitCode) {
if (exitCode == DialogWrapper.CANCEL_EXIT_CODE || exitCode == DialogWrapper.OK_EXIT_CODE) {
configurator.setAskToTweet(project, toBeShown);
}
}
@Override
public boolean canBeHidden() {
return true;
}
@Override
public boolean shouldSaveOptionsOnCancel() {
return true;
}
@NotNull
@Override
public String getDoNotShowMessage() {
return "Never ask me to tweet";
}
};
}
示例4: showYesNoCancelDialog
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
@Messages.YesNoCancelResult
public abstract int showYesNoCancelDialog(@NotNull String title,
String message,
@NotNull String defaultButton,
String alternateButton,
String otherButton,
@Nullable Window window,
@Nullable DialogWrapper.DoNotAskOption doNotAskOption);
示例5: showMessageDialog
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
@Override
public int showMessageDialog(@NotNull String title,
String message,
@NotNull String[] buttons,
boolean errorStyle,
@Nullable Window window,
int defaultOptionIndex,
int focusedOptionIndex,
@Nullable DialogWrapper.DoNotAskOption doNotAskDialogOption) {
if (window == null) {
window = getForemostWindow(null);
}
Icon icon = errorStyle ? UIUtil.getErrorIcon() : UIUtil.getInformationIcon();
final String defaultOptionTitle = defaultOptionIndex != -1 ? buttons[defaultOptionIndex] : null;
final String focusedButtonTitle = focusedOptionIndex != -1 ? buttons[focusedOptionIndex] : null;
final SheetMessage sheetMessage = new SheetMessage(window, title, message, icon, buttons, doNotAskDialogOption, defaultOptionTitle, focusedButtonTitle);
String result = sheetMessage.getResult();
for (int i = 0; i < buttons.length; i++) {
if (result.equals(buttons[i])) {
if (doNotAskDialogOption != null) {
doNotAskDialogOption.setToBeShown(sheetMessage.toBeShown(), i);
}
return i;
}
}
return -1;
}
示例6: showDialog
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
public static Boolean showDialog(Project project, String message, String title, File file) {
final Boolean[] ref = new Boolean[1];
final DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() {
@Override
public boolean isToBeShown() {
return true;
}
@Override
public void setToBeShown(boolean value, int exitCode) {
if (!value) {
if (exitCode == 0) {
// yes
ref[0] = true;
}
else {
ref[0] = false;
}
}
}
@Override
public boolean canBeHidden() {
return true;
}
@Override
public boolean shouldSaveOptionsOnCancel() {
return true;
}
@NotNull
@Override
public String getDoNotShowMessage() {
return CommonBundle.message("dialog.options.do.not.ask");
}
};
showDialog(project, message, title, file, option);
return ref[0];
}
示例7: userApprovesStopForSameTypeConfigurations
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
private static boolean userApprovesStopForSameTypeConfigurations(Project project, String configName, int instancesCount) {
RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project);
final RunManagerConfig config = runManager.getConfig();
if (!config.isRestartRequiresConfirmation()) return true;
DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() {
@Override
public boolean isToBeShown() {
return config.isRestartRequiresConfirmation();
}
@Override
public void setToBeShown(boolean value, int exitCode) {
config.setRestartRequiresConfirmation(value);
}
@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");
}
};
return Messages.showOkCancelDialog(
project,
ExecutionBundle.message("rerun.singleton.confirmation.message", configName, instancesCount),
ExecutionBundle.message("process.is.running.dialog.title", configName),
ExecutionBundle.message("rerun.confirmation.button.text"),
CommonBundle.message("button.cancel"),
Messages.getQuestionIcon(), option) == Messages.OK;
}
示例8: showYesNoDialog
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
@Messages.YesNoResult
public static boolean showYesNoDialog(@Nullable Project project,
@NotNull String title,
@NotNull String message,
@NotNull DialogWrapper.DoNotAskOption doNotAskOption) {
return Messages.YES == Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon(), doNotAskOption);
}
示例9: showMessage
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
public static int showMessage(@NotNull final String description,
@NotNull final String title,
@NotNull final String[] options,
final int defaultButtonIndex,
final int focusedButtonIndex,
@Nullable final Icon icon,
@Nullable final DialogWrapper.DoNotAskOption dontAskOption) {
return dialogManager().showMessageDialog(description, title, options, defaultButtonIndex, focusedButtonIndex, icon, dontAskOption);
}
示例10: showMessageDialog
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
protected int showMessageDialog(@NotNull String description,
@NotNull String title,
@NotNull String[] options,
int defaultButtonIndex,
int focusedButtonIndex,
@Nullable Icon icon,
@Nullable DialogWrapper.DoNotAskOption dontAskOption) {
return Messages.showDialog(description, title, options, defaultButtonIndex, focusedButtonIndex, icon, dontAskOption);
}
示例11: warn
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
/** Warns the user that sources may not resolve. Returns false if sync should be aborted. */
public static boolean warn(Project project) {
if (warningSuppressed()) {
return true;
}
String buildSystem = Blaze.buildSystemName(project);
String message =
String.format(
"Syncing without a %s build will result in unresolved symbols "
+ "in your source files.<p>This can be useful for quickly adding directories to "
+ "your project, but if you're seeing sources marked as '(unsynced)', run a normal "
+ "%<s sync to fix it.",
buildSystem);
String title = String.format("Syncing without a %s build", buildSystem);
DialogWrapper.DoNotAskOption dontAskAgain =
new DialogWrapper.DoNotAskOption.Adapter() {
@Override
public void rememberChoice(boolean isSelected, int exitCode) {
if (isSelected) {
suppressWarning();
}
}
@Override
public String getDoNotShowMessage() {
return "Don't warn again";
}
};
int result =
Messages.showOkCancelDialog(
project,
XmlStringUtil.wrapInHtml(message),
title,
"Run Sync",
"Cancel",
Messages.getWarningIcon(),
dontAskAgain);
return result == Messages.OK;
}
示例12: showYesNoDialog
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
/**
* @return {@link Messages#YES} if user pressed "Yes" or {@link Messages#NO} if user pressed "No" button.
*/
@Messages.YesNoResult
public abstract int showYesNoDialog(@NotNull String title, String message, @NotNull String yesButton, @NotNull String noButton, @Nullable Window window,
@Nullable DialogWrapper.DoNotAskOption doNotAskDialogOption);
示例13: confirmExitIfNeeded
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
private static boolean confirmExitIfNeeded(boolean exitConfirmed) {
final boolean hasUnsafeBgTasks = ProgressManager.getInstance().hasUnsafeProgressIndicator();
if (exitConfirmed && !hasUnsafeBgTasks) {
return true;
}
DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() {
@Override
public boolean isToBeShown() {
return GeneralSettings.getInstance().isConfirmExit() && ProjectManager.getInstance().getOpenProjects().length > 0;
}
@Override
public void setToBeShown(boolean value, int exitCode) {
GeneralSettings.getInstance().setConfirmExit(value);
}
@Override
public boolean canBeHidden() {
return !hasUnsafeBgTasks;
}
@Override
public boolean shouldSaveOptionsOnCancel() {
return false;
}
@NotNull
@Override
public String getDoNotShowMessage() {
return "Do not ask me again";
}
};
if (hasUnsafeBgTasks || option.isToBeShown()) {
String message = ApplicationBundle
.message(hasUnsafeBgTasks ? "exit.confirm.prompt.tasks" : "exit.confirm.prompt",
ApplicationNamesInfo.getInstance().getFullProductName());
if (MessageDialogBuilder.yesNo(ApplicationBundle.message("exit.confirm.title"), message).yesText(ApplicationBundle.message("command.exit")).noText(CommonBundle.message("button.cancel"))
.doNotAsk(option).show() != Messages.YES) {
return false;
}
}
return true;
}
示例14: SheetController
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
SheetController(final SheetMessage sheetMessage,
final String title,
final String message,
final Icon icon,
final String[] buttonTitles,
final String defaultButtonTitle,
final DialogWrapper.DoNotAskOption doNotAskOption,
final String focusedButtonTitle) {
if (icon != null) {
myIcon = icon;
}
myDoNotAskOption = doNotAskOption;
myDoNotAskResult = (doNotAskOption != null) && !doNotAskOption.isToBeShown();
mySheetMessage = sheetMessage;
buttons = new JButton[buttonTitles.length];
myResult = null;
int defaultButtonIndex = -1;
int focusedButtonIndex = -1;
for (int i = 0; i < buttons.length; i++) {
String buttonTitle = buttonTitles[i];
buttons[i] = new JButton();
buttons[i].setOpaque(false);
handleMnemonics(i, buttonTitle);
if (buttonTitle.equals(defaultButtonTitle)) {
defaultButtonIndex = i;
}
if (buttonTitle.equals(focusedButtonTitle) && !focusedButtonTitle.equals("Cancel")) {
focusedButtonIndex = i;
}
}
defaultButtonIndex = (focusedButtonIndex == defaultButtonIndex) || defaultButtonTitle == null ? 0 : defaultButtonIndex;
if (focusedButtonIndex != -1 && defaultButtonIndex != focusedButtonIndex) {
myFocusedComponent = buttons[focusedButtonIndex];
} else if (doNotAskOption != null) {
myFocusedComponent = doNotAskCheckBox;
} else if (buttons.length > 1) {
myFocusedComponent = buttons[buttons.length - 1];
}
myDefaultButton = (defaultButtonIndex == -1) ? buttons[0] : buttons[defaultButtonIndex];
if (myResult == null) {
myResult = Messages.CANCEL_BUTTON;
}
mySheetPanel = createSheetPanel(title, message, buttons);
initShadowImage();
}
示例15: userApprovesStopForIncompatibleConfigurations
import com.intellij.openapi.ui.DialogWrapper; //導入方法依賴的package包/類
private static boolean userApprovesStopForIncompatibleConfigurations(Project project,
String configName,
List<RunContentDescriptor> runningIncompatibleDescriptors) {
RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project);
final RunManagerConfig config = runManager.getConfig();
if (!config.isStopIncompatibleRequiresConfirmation()) return true;
DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() {
@Override
public boolean isToBeShown() {
return config.isStopIncompatibleRequiresConfirmation();
}
@Override
public void setToBeShown(boolean value, int exitCode) {
config.setStopIncompatibleRequiresConfirmation(value);
}
@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");
}
};
final StringBuilder names = new StringBuilder();
for (final RunContentDescriptor descriptor : runningIncompatibleDescriptors) {
String name = descriptor.getDisplayName();
if (names.length() > 0) {
names.append(", ");
}
names.append(StringUtil.isEmpty(name) ? ExecutionBundle.message("run.configuration.no.name")
: String.format("'%s'", name));
}
//noinspection DialogTitleCapitalization
return Messages.showOkCancelDialog(
project,
ExecutionBundle.message("stop.incompatible.confirmation.message",
configName, names.toString(), runningIncompatibleDescriptors.size()),
ExecutionBundle.message("incompatible.configuration.is.running.dialog.title", runningIncompatibleDescriptors.size()),
ExecutionBundle.message("stop.incompatible.confirmation.button.text"),
CommonBundle.message("button.cancel"),
Messages.getQuestionIcon(), option) == Messages.OK;
}