本文整理匯總了Java中org.eclipse.jface.dialogs.MessageDialog.QUESTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java MessageDialog.QUESTION屬性的具體用法?Java MessageDialog.QUESTION怎麽用?Java MessageDialog.QUESTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jface.dialogs.MessageDialog
的用法示例。
在下文中一共展示了MessageDialog.QUESTION屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processChanges
/**
* This method has been copied and adapted from org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock.
*/
@Override
protected boolean processChanges(IWorkbenchPreferenceContainer container) {
boolean needsBuild = !getPreferenceChanges().isEmpty() | projectSpecificChanged;
boolean doBuild = false;
if (needsBuild) {
int count = getRebuildCount();
if (count > rebuildCount) {
needsBuild = false;
rebuildCount = count;
}
}
if (needsBuild) {
String[] strings = getFullBuildDialogStrings(project == null);
if (strings != null) {
MessageDialog dialog = new MessageDialog(this.getShell(), strings[0], null, strings[1],
MessageDialog.QUESTION,
new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
IDialogConstants.CANCEL_LABEL },
2);
int res = dialog.open();
if (res == 0) {
doBuild = true;
} else if (res != 1) {
return false;
}
}
}
if (container != null) {
if (doBuild) {
incrementRebuildCount();
container.registerUpdateJob(getBuildJob(getProject()));
}
} else {
if (doBuild) {
getBuildJob(getProject()).schedule();
}
}
return true;
}
示例2: confirmOverwrite
private boolean confirmOverwrite(String msg) {
if (shell == null) return false;
final MessageDialog dialog =
new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0);
shell.getDisplay().syncExec(
new Runnable() {
public void run() {
dialog.open();
}
});
if (hasMultiple) {
switch (dialog.getReturnCode()) {
case 0:
return true;
case 1:
confirmation = YES_TO_ALL;
return true;
case 2:
return false;
case 3:
confirmation = NO_TO_ALL;
default:
return false;
}
} else {
switch (dialog.getReturnCode()) {
case 0:
return true;
case 1:
return false;
case 2:
default:
return false;
}
}
}
示例3: dialogBuild
private boolean dialogBuild(MobileBuilderBuildMode buildMode) {
MessageDialog dialog = new MessageDialog(
null, "Build '" + buildMode.label() + "'",
null, "This action will build your application for '" + buildMode.label() + "':\n" + buildMode.description(),
MessageDialog.QUESTION,
new String[] {"Build", "Cancel"}, 0
);
int result = dialog.open();
if (result == 0) {
this.buildMode = buildMode;
launchBuilder(false, false);
return true;
}
return false;
}
示例4: displayYesNoQuestion
public static int displayYesNoQuestion(String title, String text) {
if (isAutomatedMode ()) return getIntegerAutomatedModeDefaultValue();
MessageDialog dialog = new MessageDialog(null, title, null, text, MessageDialog.QUESTION,
new String[] { MessageUtil.getString("yes"), MessageUtil.getString("no") }, 0);
int result = dialog.open();
return result;
}
示例5: createRememberDecisonDialog
public static MessageDialogWithToggle createRememberDecisonDialog(String title, String text, String toggletext,
Runnable okRunnable) {
final String[] buttons = new String[] { IDialogConstants.CLOSE_LABEL, IDialogConstants.OK_LABEL, };
return new MessageDialogWithToggle(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title,
null, text, MessageDialog.QUESTION, buttons, 0, toggletext, false) {
protected void buttonPressed(int buttonId) {
if (okRunnable != null && IDialogConstants.OK_ID == buttonId) {
okRunnable.run();
return;
}
super.buttonPressed(buttonId);
}
};
}
示例6: queryOverwrite
/**
* The default implementation of this <code>IOverwriteQuery</code> method asks the user whether the existing
* resource at the given path should be overwritten.
*
* @param pathString
* the path of the archive
* @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>, or
* <code>"CANCEL"</code>
*/
@Override
public String queryOverwrite(String pathString) {
IPath path = Path.fromOSString(pathString);
String messageString;
// Break the message up if there is a file name and a directory
// and there are at least 2 segments.
if (path.getFileExtension() == null || path.segmentCount() < 2) {
messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
} else {
messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
path.lastSegment(),
path.removeLastSegments(1).toOSString());
}
final MessageDialog dialog = new MessageDialog(getContainer()
.getShell(), IDEWorkbenchMessages.Question,
null, messageString, MessageDialog.QUESTION, new String[] {
IDialogConstants.YES_LABEL,
IDialogConstants.YES_TO_ALL_LABEL,
IDialogConstants.NO_LABEL,
IDialogConstants.NO_TO_ALL_LABEL,
IDialogConstants.CANCEL_LABEL }, 0) {
@Override
protected int getShellStyle() {
return super.getShellStyle() | SWT.SHEET;
}
};
String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
// run in syncExec because callback is from an operation,
// which is probably not running in the UI thread.
getControl().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
dialog.open();
}
});
return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}