本文整理了Java中org.eclipse.swt.widgets.FileDialog.setOverwrite()
方法的一些代码示例,展示了FileDialog.setOverwrite()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileDialog.setOverwrite()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.FileDialog
类名称:FileDialog
方法名:setOverwrite
[英]Sets the flag that the dialog will use to determine whether to prompt the user for file overwrite if the selected file already exists.
[中]设置对话框将用于确定在所选文件已存在时是否提示用户进行文件覆盖的标志。
代码示例来源:origin: net.sf.okapi.steps/okapi-step-searchandreplace-ui
public void widgetSelected(SelectionEvent e) {
FileDialog fd = new FileDialog(shell, SWT.SAVE);
fd.setText("Export Search and Replace Options");
fd.setOverwrite(true);
String selected = fd.open();
if ( selected != null ) {
Parameters tmpParams = new Parameters();
if ( saveData(tmpParams) ) {
tmpParams.save(selected);
}
}
}
});
代码示例来源:origin: org.eclipse.equinox.p2/ui
/**
* Export the specified list of sites to a bookmarks file that
* can be read later.
*
* @param shell the shell used to parent the export dialog
* @param sites the sites to export
*/
public static void exportSites(Shell shell, MetadataRepositoryElement[] sites) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setText(ProvUIMessages.UpdateManagerCompatibility_ExportSitesTitle);
dialog.setFileName("bookmarks.xml"); //$NON-NLS-1$
dialog.setFilterExtensions(new String[] {"*.xml", "*"}); //$NON-NLS-1$ //$NON-NLS-2$
dialog.setOverwrite(true);
String bookmarksFile = dialog.open();
if (bookmarksFile == null)
return;
writeBookmarkFile(bookmarksFile, sites);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
int decideDestinationWithSuggestedFilename (int /*long*/ download, int /*long*/ filename) {
String name = WebKit.extractBSTR (filename);
FileDialog dialog = new FileDialog (browser.getShell(), SWT.SAVE);
dialog.setText (SWT.getMessage ("SWT_FileDownload")); //$NON-NLS-1$
dialog.setFileName (name);
dialog.setOverwrite (true);
String path = dialog.open ();
IWebDownload iwebdownload = new IWebDownload (download);
iwebdownload.setDeletesFileUponFailure (0);
if (path == null) {
/*
* Bug in WebKit. Failure to set a non-null destination on the IWebDownload results in
* a crash, even when the download is being cancelled.
*/
iwebdownload.setDestination (WebKit.createBSTR (""), 1); //$NON-NLS-1$
iwebdownload.cancel();
iwebdownload.Release();
} else {
File file = new File (path);
if (file.exists ()) file.delete ();
iwebdownload.setDestination (WebKit.createBSTR (path), 1);
openDownloadWindow (iwebdownload, path);
}
return COM.S_OK;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
fileDialog.setFilterNames(new String[] { Util.translateString(
RESOURCE_BUNDLE, "csvFilterName") }); //$NON-NLS-1$
fileDialog.setOverwrite(true);
final String filePath = fileDialog.open();
if (filePath == null) {
代码示例来源:origin: org.xworker/xworker_swt
fileDialog.setFilterIndex(filterIndex);
boolean overwrite = self.getBoolean("overwrite");
fileDialog.setOverwrite(overwrite);
代码示例来源:origin: org.xworker/xworker_swt
dialog.setOverwrite(overwrite);
内容来源于网络,如有侵权,请联系作者删除!