本文整理汇总了Java中org.pentaho.vfs.ui.VfsFileChooserDialog.open方法的典型用法代码示例。如果您正苦于以下问题:Java VfsFileChooserDialog.open方法的具体用法?Java VfsFileChooserDialog.open怎么用?Java VfsFileChooserDialog.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.vfs.ui.VfsFileChooserDialog
的用法示例。
在下文中一共展示了VfsFileChooserDialog.open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openFileVFSFile
import org.pentaho.vfs.ui.VfsFileChooserDialog; //导入方法依赖的package包/类
public void openFileVFSFile() {
FileObject initialFile = null;
FileObject rootFile = null;
try {
initialFile = KettleVFS.getFileObject(getLastFileOpened());
rootFile = initialFile.getFileSystem().getRoot();
} catch (IOException e) {
e.printStackTrace();
String message = e.getMessage();
if (e.getCause() != null) {
message = e.getCause().getMessage();
}
MessageBox messageDialog = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
messageDialog.setText(Messages.getString("Spoon.Error"));
messageDialog.setMessage(message);
messageDialog.open();
// bring up a dialog to prompt for userid/password and try again
// lastVfsUsername = "";
// lastVfsPassword = "";
// if (lastFileOpened != null && lastFileOpened.indexOf("@") == -1)
// {
// lastFileOpened = lastFileOpened.substring(0,
// lastFileOpened.indexOf("//")+2) + lastVfsUsername + ":" +
// lastVfsPassword + "@" +
// lastFileOpened.substring(lastFileOpened.indexOf("//")+2);
// }
// openFileVFSFile();
return;
}
VfsFileChooserDialog vfsFileChooser = new VfsFileChooserDialog(rootFile, initialFile);
FileObject selectedFile = vfsFileChooser.open(shell, null, Const.STRING_TRANS_AND_JOB_FILTER_EXT, Const.getTransformationAndJobFilterNames(), VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE);
if (selectedFile != null) {
setLastFileOpened(selectedFile.getName().getFriendlyURI());
openFile(selectedFile.getName().getFriendlyURI(), false);
}
}
示例2: selectFile
import org.pentaho.vfs.ui.VfsFileChooserDialog; //导入方法依赖的package包/类
protected Optional<String> selectFile( TextVar fileWidget, String[] fileFilters ) {
String curFile = transMeta.environmentSubstitute( fileWidget.getText() );
FileObject root = null;
try {
root = KettleVFS.getFileObject( curFile != null ? curFile : Const.getUserHomeDirectory() );
VfsFileChooserDialog vfsFileChooser = Spoon.getInstance().getVfsFileChooserDialog( root.getParent(), root );
FileObject file =
vfsFileChooser.open(
shell, null, fileFilters, Const.getTransformationFilterNames(),
VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE );
if ( file == null ) {
return Optional.empty();
}
String filePath = getRelativePath( file.getName().toString() );
fileWidget.setText( filePath );
return Optional.ofNullable( filePath );
} catch ( IOException | KettleException e ) {
new ErrorDialog( shell,
BaseMessages.getString( PKG, "TransExecutorDialog.ErrorLoadingTransformation.DialogTitle" ),
BaseMessages.getString( PKG, "TransExecutorDialog.ErrorLoadingTransformation.DialogMessage" ), e );
}
return Optional.empty();
}