本文整理汇总了Java中org.eclipse.swt.SWT.APPLICATION_MODAL属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.APPLICATION_MODAL属性的具体用法?Java SWT.APPLICATION_MODAL怎么用?Java SWT.APPLICATION_MODAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.APPLICATION_MODAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateFile
protected void updateFile ()
{
final FileDialog dlg = new FileDialog ( getShell (), SWT.APPLICATION_MODAL | SWT.SAVE );
dlg.setFilterExtensions ( new String[] { Messages.FileSelectionPage_FilterExtension } );
dlg.setFilterNames ( new String[] { Messages.FileSelectionPage_FilterName } );
dlg.setOverwrite ( true );
dlg.setText ( Messages.FileSelectionPage_FileDialog_Text );
final String fileName = dlg.open ();
if ( fileName == null )
{
setFile ( null );
update ();
}
else
{
setFile ( new File ( fileName ) );
update ();
}
}
示例2: 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();
}
}
示例3: reset
public void reset() {
JavelinConnector javelinConnector = (JavelinConnector) connector;
Javelin javelin = javelinConnector.javelin;
int emulatorID = (int) javelinConnector.emulatorID;
switch (emulatorID) {
case Session.EmulIDSNA:
case Session.EmulIDAS400:
MessageBox messageBox = new MessageBox(getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION
| SWT.APPLICATION_MODAL);
String message = "This will send a KEY_RESET to the emulator.";
messageBox.setMessage(message);
int ret = messageBox.open();
if (ret == SWT.OK) {
javelin.doAction("KEY_RESET");
Engine.logEmulators
.info("KEY_RESET has been sent to the emulator, because of an user request.");
}
break;
default:
ConvertigoPlugin
.warningMessageBox("The Reset function is only available for IBM emulators (3270 and AS/400).");
break;
}
}
示例4: main
@SuppressWarnings("unused")
public static void main(String[] args) {
// Create choices
utils.initializeLogger();
logger.info("Initialized logger.");
display = new Display();
shell = new Shell(display);
ChoiceItem[] items = new ChoiceItem[] {
new ChoiceItem("Exit and save my project",
"Save your work in progress and exit the program"),
new ChoiceItem("Exit and don't save",
"Exit the program without saving your project"),
new ChoiceItem("Don't exit", "Return to the program"), };
ChoicesDialog dialog = new ChoicesDialog(shell, SWT.APPLICATION_MODAL);
dialog.setTitle("Exit");
dialog.setMessage("Do you really want to exit?");
dialog.setImage(Display.getCurrent().getSystemImage(SWT.ICON_QUESTION));
dialog.setChoices(items);
dialog.setDefaultChoice(items[2]);
dialog.setShowArrows(false);
int choice = dialog.open();
logger.info("Choice: " + choice);
if (choice == -1) {
// Choice selected, will be one of {0,1,2}
} else {
}
}
示例5: 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;
}
示例6: 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(Shell shell, URL url) {
// a null url is not a valid workspace
if (url == null) {
return false;
}
String 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 int ide_version = Integer.parseInt(WORKSPACE_VERSION_VALUE);
int workspace_version = Integer.parseInt(version);
// equality test is required since any version difference (newer
// or older) may result in data being trampled
if (workspace_version == ide_version) {
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.
String title = IDEWorkbenchMessages.IDEApplication_versionTitle_newerWorkspace;
String message = NLS.bind(IDEWorkbenchMessages.IDEApplication_versionMessage_newerWorkspace, url.getFile());
MessageBox mbox = new MessageBox(shell, SWT.OK | SWT.CANCEL
| SWT.ICON_WARNING | SWT.APPLICATION_MODAL);
mbox.setText(title);
mbox.setMessage(message);
return mbox.open() == SWT.OK;
}
示例7: Preferences
public Preferences(Shell parent) {
super(parent);
int style = SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL
| getDefaultOrientation();
style &= ~SWT.CLOSE;
setShellStyle(style);
}
示例8: checkStyle
private void checkStyle(int style) {
if ((style & ~(SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL
| SWT.MODELESS)) != 0) {
throw new SWTException("Unsupported style");
}
if (Integer.bitCount(style) > 1) {
throw new SWTException(
"Unsupports only one of APPLICATION_MODAL, PRIMARY_MODAL, SYSTEM_MODAL or SWT.MODELESS");
}
}
示例9: 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();
}
}
示例10: cancelPressed
@Override
protected void cancelPressed() {
if (isAnyUpdatePerformed) {
int style = SWT.APPLICATION_MODAL | SWT.OK | SWT.CANCEL |SWT.ICON_INFORMATION;
MessageBox messageBox = new MessageBox(getShell(), style);
messageBox.setText(Messages.INFORMATION); //$NON-NLS-1$
messageBox.setMessage(Messages.MessageBeforeClosingWindow);
if (messageBox.open() == SWT.OK) {
closeDialog = super.close();
}
} else {
closeDialog = super.close();
}
}
示例11: 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();
}
}
示例12: print
public void print ()
{
if ( Printer.getPrinterList ().length == 0 )
{
MessageDialog.openInformation ( this.shell, "No printer", "No installed printer could be found" );
return;
}
final PrintDialog dlg = new PrintDialog ( this.shell, SWT.APPLICATION_MODAL );
final PrinterData initialPd = Printer.getDefaultPrinterData ();
initialPd.orientation = PrinterData.LANDSCAPE;
dlg.setPrinterData ( initialPd );
final PrinterData pd = dlg.open ();
if ( pd != null )
{
final Printer printer = new Printer ( pd );
final ResourceManager rm = new DeviceResourceManager ( printer );
try
{
printer.startJob ( "Chart" );
printer.startPage ();
final GC gc = new GC ( printer );
try
{
final SWTGraphics g = new SWTGraphics ( gc, rm );
try
{
this.viewer.getChartRenderer ().paint ( g );
}
finally
{
g.dispose ();
}
}
finally
{
gc.dispose ();
}
printer.endPage ();
printer.endJob ();
}
finally
{
rm.dispose ();
printer.dispose ();
}
}
}
示例13: getShellStyle
@Override
protected int getShellStyle() {
return SWT.TITLE | SWT.BORDER | SWT.RESIZE | SWT.APPLICATION_MODAL;
}
示例14: getShellStyle
@Override
protected int getShellStyle() {
return SWT.RESIZE | SWT.TITLE | SWT.APPLICATION_MODAL;
}
示例15: findDatabaseObject
protected void findDatabaseObject() {
enumDatabaseObjects = Collections.enumeration(vDatabaseObjects);
while (true) {
while (enumDatabaseObjects.hasMoreElements()) {
DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) enumDatabaseObjects.nextElement();
DatabaseObject databaseObject = databaseObjectTreeObject.getObject();
boolean bContinue = false;
switch(objectType) {
case 0: // *
bContinue = true;
break;
case 1: // Screen class
bContinue = databaseObject.getDatabaseType().equals("ScreenClass");
break;
case 2: // Criteria
bContinue = databaseObject.getDatabaseType().equals("Criteria");
break;
case 3: // Extraction rule
bContinue = databaseObject.getDatabaseType().equals("ExtractionRule");
break;
case 4: // Sheet
bContinue = databaseObject.getDatabaseType().equals("Sheet");
break;
case 5: // Transaction
bContinue = databaseObject.getDatabaseType().equals("Transaction");
break;
case 6: // Statement
bContinue = databaseObject.getDatabaseType().equals("Statement");
break;
case 7: // Sequence
bContinue = databaseObject.getDatabaseType().equals("Sequence");
break;
case 8: // Step
bContinue = databaseObject.getDatabaseType().equals("Step");
break;
}
if (bContinue) {
String text = databaseObjectTreeObject.toString();
if (!bMatchCase) {
objectTextSubstring = objectTextSubstring.toLowerCase();
text = text.toLowerCase();
}
if (text.indexOf(objectTextSubstring) != -1) { // Object found !!!
ConvertigoPlugin.getDefault().getProjectExplorerView().objectSelected(new CompositeEvent(databaseObject));
vDatabaseObjects.remove(databaseObjectTreeObject);
return;
}
}
}
MessageBox messageBox = new MessageBox(getShell(),SWT.YES | SWT.NO | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
String message = "The end of the document has been reached. Do you want to retry the search from the beginning of the document?";
messageBox.setMessage(message);
int ret = messageBox.open();
if (ret == SWT.YES) {
getDatabaseObjects(null);
}
else {
return;
}
}
}