本文整理汇总了Java中org.eclipse.swt.SWT.NO属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.NO属性的具体用法?Java SWT.NO怎么用?Java SWT.NO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.NO属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runWithObject
@Override
public void runWithObject(Object object) throws Exception {
String typeName = getObjectTypeName(object);
if (typeName == null) {
return;
}
String name = getObjectName(object);
if (name == null) {
return;
}
MessageBox messageBox = new MessageBox(getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setMessage("Are you sure you want to delete the " + typeName + " '" + name + "'?");
messageBox.setText("Confirm Delete");
int response = messageBox.open();
if (response == SWT.YES) {
try {
delete(object);
}
catch (Exception e) {
throw new Exception("Failed to delete the " + typeName + " '" + name + "'.", e);
}
}
}
示例2: closeTranscription
/**
* @return true if the transcription was closed, false if the operation was
* cancelled
*/
protected boolean closeTranscription() {
if (!textEditor.isDisposed()) {
if (textEditor.isChanged()) {
MessageBox diag = new MessageBox(shell,
SWT.APPLICATION_MODAL | SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL);
diag.setMessage("You have unsaved changes, would you like to save them?");
int opt = diag.open();
if (opt == SWT.YES)
saveTranscription();
if (opt == SWT.CANCEL)
return false;
}
textEditor.clear();
transcriptionFile = null;
}
return true;
}
示例3: confirmationFromUser
private boolean confirmationFromUser() {
/*MessageDialog messageDialog = new MessageDialog(Display.getCurrent().getActiveShell(),Messages.CONFIRM_FOR_GRAPH_PROPS_RUN_JOB_TITLE, null,
Messages.CONFIRM_FOR_GRAPH_PROPS_RUN_JOB, MessageDialog.QUESTION, new String[] { "Yes",
"No" }, 0);*/
MessageBox dialog = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
dialog.setText(Messages.CONFIRM_FOR_GRAPH_PROPS_RUN_JOB_TITLE);
dialog.setMessage(Messages.CONFIRM_FOR_GRAPH_PROPS_RUN_JOB);
int response = dialog.open();
if(response == 0){
return true;
} else {
return false;
}
}
示例4: showMessageForGeneratingUniqueJobId
/**
* Create a Message Box displays a currentJob UniqueId and a message to
* generate new Unique Id.
* @param container
* @param jobFile
* @param isSubjob
* @return {@link Integer}
*/
private int showMessageForGeneratingUniqueJobId(Container container, IFile jobFile, boolean isSubJob) {
int buttonId = SWT.NO;
if(StringUtils.isBlank(container.getUniqueJobId())){
return SWT.YES;
}
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setText("Question");
String previousUniqueJobId = container.getUniqueJobId();
if (isSubJob) {
messageBox.setMessage(Messages.bind(Messages.GENERATE_NEW_UNIQUE_JOB_ID_FOR_SUB_JOB, jobFile.getName(),
previousUniqueJobId));
} else {
messageBox.setMessage(
Messages.bind(Messages.GENERATE_NEW_UNIQUE_JOB_ID_FOR_JOB, jobFile.getName(), previousUniqueJobId));
}
buttonId = messageBox.open();
return buttonId;
}
示例5: cancelPressed
@Override
protected void cancelPressed() {
if (isAnyUpdatePerformed) {
int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO |SWT.ICON_INFORMATION;
MessageBox messageBox = new MessageBox(new Shell(), style);
messageBox.setText(INFORMATION);
messageBox.setMessage(Messages.MessageBeforeClosingWindow);
if (messageBox.open() == SWT.YES) {
closeDialog = super.close();
}
} else {
closeDialog = super.close();
}
}
示例6: run
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TraceTreeObject traceObject = (TraceTreeObject)explorerView.getFirstSelectedTreeObject();
MessageBox messageBox = new MessageBox(shell,SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
String message = java.text.MessageFormat.format("Do you really want to delete the trace \"{0}\"?", new Object[] {traceObject.getName()});
messageBox.setMessage(message);
if (messageBox.open() == SWT.YES) {
File file = (File) traceObject.getObject();
if (file.exists()) {
if (file.delete()) {
TreeParent treeParent = traceObject.getParent();
treeParent.removeChild(traceObject);
explorerView.refreshTreeObject(treeParent);
}
else {
throw new Exception("Unable to delete file \""+ file.getAbsolutePath() + "\"");
}
}
}
}
}
catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to delete the trace file!");
}
finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
示例7: showYesNoDialog
/**
* Display a dialog box with the question icon and a yes/no button selection.
*/
public static int showYesNoDialog(Shell shell, String title, String message) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setText(title);
messageBox.setMessage(message);
return messageBox.open();
}
示例8: getExitConfirmation
/**
* @return true, if the user choosed OK in the exit dialog
*
* @author Rene Leonhardt
*/
private static boolean getExitConfirmation(boolean for_restart) {
MessageBoxShell mb = new MessageBoxShell(SWT.ICON_WARNING | SWT.YES
| SWT.NO, for_restart ? "MainWindow.dialog.restartconfirmation"
: "MainWindow.dialog.exitconfirmation", (String[]) null);
mb.open(null);
return mb.waitUntilClosed() == SWT.YES;
}
示例9: notConfirmedByUser
private boolean notConfirmedByUser() {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.YES
| SWT.NO);
messageBox.setMessage(Messages.CONFIRM_TO_CREATE_SUBJOB_MESSAGE);
messageBox.setText(Messages.CONFIRM_TO_CREATE_SUBJOB_WINDOW_TITLE);
int response = messageBox.open();
if (response == SWT.YES) {
return false;
} else
return true;
}
示例10: hasOutputMappingInTableChanged
private Boolean hasOutputMappingInTableChanged() {
boolean returnValue = false;
populateCurrentItemsOfTable();
if (currentItems.length == 0 && previousItems.length == 0) {
super.close();
} else {
if (!Arrays.equals(currentItems, previousItems)) {
int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO | SWT.ICON_INFORMATION;
MessageBox messageBox = new MessageBox(new Shell(), style);
messageBox.setText(INFORMATION);
messageBox.setMessage(Messages.MessageBeforeClosingWindow);
if (messageBox.open() == SWT.YES) {
joinOutputList.clear();
LookupMapProperty[] lookupMapPropertyObjects = new LookupMapProperty[previousItems.length];
for (int i = 0; i < previousItems.length; i++) {
if(!previousItems[i].isDisposed())
{
lookupMapPropertyObjects[i] = (LookupMapProperty) previousItems[i].getData();
joinOutputList.add(lookupMapPropertyObjects[i]);
}
}
getJoinPropertyGrid();
returnValue = super.close();
}
} else {
returnValue = super.close();
}
}
return returnValue;
}
示例11: isFileExistsOnLocalFileSystem
/**
* Check if file exist on local file system.
* @param jobFilePath
* @param textBox
* @return
*/
private boolean isFileExistsOnLocalFileSystem(IPath jobFilePath, Text textBox) {
jobFilePath=jobFilePath.removeFileExtension().addFileExtension(Constants.XML_EXTENSION_FOR_IPATH);
try {
if (ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath).exists()){
return true;
}
else if (jobFilePath.toFile().exists()){
return true;
}
} catch (Exception exception) {
logger.error("Error occured while cheking file on local file system", exception);
}
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING | SWT.YES
| SWT.NO);
messageBox.setMessage(jobFilePath.lastSegment()+Messages.FILE_DOES_NOT_EXISTS);
messageBox.setText(jobFilePath.toString() +Messages.NOT_EXISTS);
int response = messageBox.open();
if (response == SWT.YES) {
jobFilePath=jobFilePath.removeFileExtension().addFileExtension(Constants.JOB_EXTENSION_FOR_IPATH);
textBox.setText(jobFilePath.toString().substring(1));
}
else{
textBox.setText("");
}
return false;
}
示例12: cancelPressed
@Override
protected void cancelPressed() {
if (isAnyUpdatePerformed) {
int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO |SWT.ICON_INFORMATION;
MessageBox messageBox = new MessageBox(getShell(), style);
messageBox.setText(INFORMATION); //$NON-NLS-1$
messageBox.setMessage(Messages.MessageBeforeClosingWindow);
if (messageBox.open() == SWT.YES) {
closeDialog = super.close();
}
} else {
closeDialog = super.close();
}
}
示例13: hasOutputMappingInTableChanged
private Boolean hasOutputMappingInTableChanged() {
boolean returnValue = false;
populateCurrentItemsOfTable();
if (currentItems.length == 0 && previousItems.length == 0) {
super.close();
} else {
if (!Arrays.equals(currentItems, previousItems)) {
int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO | SWT.ICON_INFORMATION;
MessageBox messageBox = new MessageBox(new Shell(), style);
messageBox.setText(INFORMATION);
messageBox.setMessage(Messages.MessageBeforeClosingWindow);
if (messageBox.open() == SWT.YES) {
joinOutputList.clear();
LookupMapProperty[] lookupMapPropertyObjects = new LookupMapProperty[previousItems.length];
for (int i = 0; i < previousItems.length; i++) {
if(!previousItems[i].isDisposed())
{
lookupMapPropertyObjects[i] = (LookupMapProperty) previousItems[i].getData();
joinOutputList.add(lookupMapPropertyObjects[i]);
}
}
getLookupPropertyGrid();
returnValue = super.close();
}
} else {
returnValue = super.close();
}
}
return returnValue;
}
示例14: save
/**
* Saves a project.
*
* @return <code>false</code> if the save process has been canceled by user.
*/
public boolean save(boolean bDialog) {
boolean ret = true;
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = display.getActiveShell();
if (shell != null) {
shell.setCursor(waitCursor);
try {
if (hasChanged()) {
Project project = getObject();
String projectName = project.getName();
int response = SWT.YES;
if (bDialog) {
MessageBox messageBox = new MessageBox(shell,SWT.YES | SWT.NO | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
messageBox.setMessage("The project \"" + projectName + "\" has not been saved. Do you want to save your work now?");
response = messageBox.open();
}
if (response == SWT.YES) {
ConvertigoPlugin.logInfo("Saving the project '" + projectName + "'");
Engine.theApp.databaseObjectsManager.exportProject(project);
hasBeenModified(false);
ConvertigoPlugin.logInfo("Project '" + projectName + "' saved!");
getIProject().refreshLocal(IResource.DEPTH_ONE, null);
}
}
} catch (Exception e) {
ConvertigoPlugin.logException(e, "Unable to save the project!");
ConvertigoPlugin.logInfo("Project NOT saved!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
return ret;
}
示例15: swtButtonStylesToText
private static Object[] swtButtonStylesToText(int style) {
List<String> buttons = new ArrayList<>(2);
List<Integer> buttonVal = new ArrayList<>(2);
int buttonCount = 0;
if ((style & SWT.OK) > 0) {
buttons.add(MessageText.getString("Button.ok"));
buttonVal.add(Integer.valueOf(SWT.OK));
buttonCount++;
}
if ((style & SWT.YES) > 0) {
buttons.add(MessageText.getString("Button.yes"));
buttonVal.add(Integer.valueOf(SWT.YES));
buttonCount++;
}
if ((style & SWT.NO) > 0) {
buttons.add(MessageText.getString("Button.no"));
buttonVal.add(Integer.valueOf(SWT.NO));
buttonCount++;
}
if ((style & SWT.CANCEL) > 0) {
buttons.add(MessageText.getString("Button.cancel"));
buttonVal.add(Integer.valueOf(SWT.CANCEL));
buttonCount++;
}
if ((style & SWT.ABORT) > 0) {
buttons.add(MessageText.getString("Button.abort"));
buttonVal.add(Integer.valueOf(SWT.ABORT));
buttonCount++;
}
if ((style & SWT.RETRY) > 0) {
buttons.add(MessageText.getString("Button.retry"));
buttonVal.add(Integer.valueOf(SWT.RETRY));
buttonCount++;
}
if ((style & SWT.IGNORE) > 0) {
buttons.add(MessageText.getString("Button.ignore"));
buttonVal.add(Integer.valueOf(SWT.IGNORE));
buttonCount++;
}
return new Object[] {
buttons.toArray(new String[buttonCount]),
buttonVal.toArray(new Integer[buttonCount])
};
}