本文整理汇总了Java中org.eclipse.swt.SWT.SYSTEM_MODAL属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.SYSTEM_MODAL属性的具体用法?Java SWT.SYSTEM_MODAL怎么用?Java SWT.SYSTEM_MODAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.SYSTEM_MODAL属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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");
}
}
示例2: askForRetargetedFilename
private static String askForRetargetedFilename(DiskManagerFileInfo fileInfo) {
// parg - removed SAVE option as this prevents the selection of existing read-only media when re-targetting | SWT.SAVE);
// tux - without SWT.SAVE on OSX, user can't choose a new file. RO seems to work on OSX with SWT.SAVE
int flag = Constants.isOSX ? SWT.SAVE : SWT.NONE;
FileDialog fDialog = new FileDialog(Utils.findAnyShell(), SWT.SYSTEM_MODAL | flag );
File existing_file = fileInfo.getFile(true);
fDialog.setFilterPath(existing_file.getParent());
fDialog.setFileName(existing_file.getName());
fDialog.setText(MessageText.getString("FilesView.rename.choose.path"));
return fDialog.open();
}
示例3: fixupStyle
static private int fixupStyle(int style) {
if ((style & (SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL | SWT.PRIMARY_MODAL)) != 0
&& Utils.anyShellHaveStyle(SWT.ON_TOP | SWT.TITLE)) {
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null && uiFunctions.getMainShell() != null) {
style |= SWT.ON_TOP;
}
}
return style;
}
示例4: open
public void open(final Shell parent, Display... parentDisplay) {
if (TipDayEx.index == -1) {
TipDayEx.index = new Random().nextInt(this.tips.size());
}
this.shell = new Shell(parent,
SWT.SYSTEM_MODAL | SWT.TITLE | SWT.BORDER | SWT.CLOSE | SWT.RESIZE);
this.shell.setText("Tip of the day");
this.shell.setLayout(new GridLayout(2, false));
this.shell.addListener(SWT.Traverse, new Listener() {
@Override
public void handleEvent(final Event event) {
switch (event.detail) {
case SWT.TRAVERSE_ESCAPE:
TipDayEx.this.shell.dispose();
event.detail = SWT.TRAVERSE_NONE;
event.doit = false;
break;
}
}
});
buildLeftColumn();
buildTip();
buildButtons();
this.shell.setDefaultButton(this.buttonClose);
this.shell.pack();
this.shell.open();
if (parentDisplay != null) {
display = parentDisplay[0];
} else {
display = this.shell.getDisplay();
}
Monitor primary = display.getPrimaryMonitor();
Rectangle bounds = primary.getBounds();
Rectangle rect = shell.getBounds();
int x = bounds.x + (bounds.width - rect.width) / 2;
int y = bounds.y + (bounds.height - rect.height) / 2;
shell.setLocation(x, y);
while (!this.shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
示例5: changeDirSelectedTorrents
protected static void changeDirSelectedTorrents(DownloadManager[] dms,
Shell shell) {
if (dms.length <= 0)
return;
String sDefPath = COConfigurationManager.getStringParameter("Default save path");
if (sDefPath.length() > 0) {
File f = new File(sDefPath);
if (!f.exists()) {
FileUtil.mkdirs(f);
}
}
DirectoryDialog dDialog = new DirectoryDialog(shell, SWT.SYSTEM_MODAL);
dDialog.setFilterPath(sDefPath);
dDialog.setMessage(MessageText.getString("MainWindow.dialog.choose.savepath"));
String sSavePath = dDialog.open();
if (sSavePath != null) {
File fSavePath = new File(sSavePath);
for (int i = 0; i < dms.length; i++) {
DownloadManager dm = dms[i];
String displayName = dm.getDisplayName();
int state = dm.getState();
if (state != DownloadManager.STATE_ERROR) {
if (!dm.filesExist(true)) {
state = DownloadManager.STATE_ERROR;
}
}
if (state == DownloadManager.STATE_ERROR) {
File oldSaveLocation = dm.getSaveLocation();
dm.setTorrentSaveDir(sSavePath);
boolean found = dm.filesExist(true);
if (!found && dm.getTorrent() != null
&& !dm.getTorrent().isSimpleTorrent()) {
String parentPath = fSavePath.getParent();
if (parentPath != null) {
dm.setTorrentSaveDir(parentPath);
found = dm.filesExist(true);
if (!found) {
dm.setTorrentSaveDir(parentPath, fSavePath.getName());
found = dm.filesExist(true);
if (!found) {
dm.setTorrentSaveDir(sSavePath, dm.getDisplayName());
found = dm.filesExist(true);
if (!found) {
dm.setTorrentSaveDir(sSavePath);
}
}
}
}
}
if (found) {
dm.stopIt(DownloadManager.STATE_STOPPED, false, false);
ManagerUtils.queue(dm, shell);
}
}
}
}
}
示例6: setSavePath
private void
setSavePath()
{
if ( torrentOptions.isSimpleTorrent()){
changeFileDestination( torrentOptions.getFiles(), false );
}else{
DirectoryDialog dDialog = new DirectoryDialog(shell,SWT.SYSTEM_MODAL);
File filterPath = new File( torrentOptions.getDataDir());
if ( !filterPath.exists()){
filterPath = filterPath.getParentFile();
}
dDialog.setFilterPath( filterPath.getAbsolutePath());
dDialog.setMessage(MessageText.getString("MainWindow.dialog.choose.savepath")
+ " (" + torrentOptions.getTorrentName() + ")");
String sNewDir = dDialog.open();
if (sNewDir == null){
return;
}
File newDir = new File(sNewDir).getAbsoluteFile();
if ( !newDir.isDirectory()){
if ( newDir.exists()){
Debug.out( "new dir isn't a dir!" );
return;
}else if ( !newDir.mkdirs()){
Debug.out( "Failed to create '" + newDir + "'" );
return;
}
}
File new_parent = newDir.getParentFile();
if ( new_parent == null ){
Debug.out( "Invalid save path, parent folder is null" );
return;
}
torrentOptions.setExplicitDataDir( new_parent.getAbsolutePath(), newDir.getName());
if ( COConfigurationManager.getBooleanParameter( "open.torrent.window.rename.on.tlf.change" )){
torrentOptions.setManualRename( newDir.getName());
}else{
torrentOptions.setManualRename( null );
}
updateDataDirCombo();
cmbDataDirChanged();
/* old window used to reset this - not sure why, if the user's
* made some per-file changes already then we should keep them
for ( TorrentOpenFileOptions tfi: torrentOptions.getFiles()){
tfi.setFullDestName( null );
}
*/
}
}