本文整理汇总了Java中org.eclipse.jface.dialogs.IDialogConstants.OK_LABEL属性的典型用法代码示例。如果您正苦于以下问题:Java IDialogConstants.OK_LABEL属性的具体用法?Java IDialogConstants.OK_LABEL怎么用?Java IDialogConstants.OK_LABEL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jface.dialogs.IDialogConstants
的用法示例。
在下文中一共展示了IDialogConstants.OK_LABEL属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
};
}
示例2: checkValidWorkspace
/**
* Return true if the argument directory is ok to use as a workspace and false otherwise. A version check will be
* performed, and a confirmation box may be displayed on the argument shell if an older version is detected.
*
* @return true if the argument URL is ok to use as a workspace and false otherwise.
*/
private boolean checkValidWorkspace(final Shell shell, final URL url) {
// a null url is not a valid workspace
if (url == null) {
return false;
}
if (WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION == null) {
// no reference bundle installed, no check possible
return true;
}
final Version version = readWorkspaceVersion(url);
// if the version could not be read, then there is not any existing
// workspace data to trample, e.g., perhaps its a new directory that
// is just starting to be used as a workspace
if (version == null) {
return true;
}
final Version ide_version = toMajorMinorVersion(WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION);
final Version workspace_version = toMajorMinorVersion(version);
final int versionCompareResult = workspace_version.compareTo(ide_version);
// equality test is required since any version difference (newer
// or older) may result in data being trampled
if (versionCompareResult == 0) {
return true;
}
// At this point workspace has been detected to be from a version
// other than the current ide version -- find out if the user wants
// to use it anyhow.
int severity;
String title;
String message;
if (versionCompareResult < 0) {
// Workspace < IDE. Update must be possible without issues,
// so only inform user about it.
severity = INFORMATION;
title = IDEApplication_versionTitle_olderWorkspace;
message = NLS.bind(IDEApplication_versionMessage_olderWorkspace, url.getFile());
} else {
// Workspace > IDE. It must have been opened with a newer IDE version.
// Downgrade might be problematic, so warn user about it.
severity = WARNING;
title = IDEApplication_versionTitle_newerWorkspace;
message = NLS.bind(IDEApplication_versionMessage_newerWorkspace, url.getFile());
}
final MessageDialog dialog = new MessageDialog(shell, title, null, message, severity,
new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
return dialog.open() == Window.OK;
}