selectedFile = fileChooserDialog .open( shell, null, "file", new String[] { "*.txt", "*.csv", "*" }, new String[] { BaseMessages.getString( PKG, "System.FileType.TextFiles" ), BaseMessages.getString( PKG, "System.FileType.CSVFiles" ),
protected List<VFSScheme> getAvailableVFSSchemes() { VfsFileChooserDialog fileChooserDialog = getVfsFileChooserDialog( null, null ); List<CustomVfsUiPanel> customVfsUiPanels = fileChooserDialog.getCustomVfsUiPanels(); List<VFSScheme> vfsSchemes = new ArrayList<>(); customVfsUiPanels.forEach( vfsPanel -> { VFSScheme scheme = new VFSScheme( vfsPanel.getVfsScheme(), vfsPanel.getVfsSchemeDisplayText() ); vfsSchemes.add( scheme ); } ); return vfsSchemes; }
public void activate() { try { getVfsFileChooserDialog().setRootFile( null ); getVfsFileChooserDialog().setInitialFile( null ); getVfsFileChooserDialog().openFileCombo.setText( GoogleDriveFileProvider.SCHEME + "://" ); getVfsFileChooserDialog().vfsBrowser.fileSystemTree.removeAll(); super.activate(); FileObject newRoot = resolveFile( getVfsFileChooserDialog().openFileCombo.getText() ); getVfsFileChooserDialog().vfsBrowser.resetVfsRoot( newRoot ); } catch ( FileSystemException e ) { System.out.println( e ); } }
public VfsFileChooserDialog getVfsFileChooserDialog( FileObject rootFile, FileObject initialFile ) { if ( vfsFileChooserDialog == null ) { vfsFileChooserDialog = new VfsFileChooserDialog( shell, new KettleVfsDelegatingResolver(), rootFile, initialFile ); } vfsFileChooserDialog.setRootFile( rootFile ); vfsFileChooserDialog.setInitialFile( initialFile ); return vfsFileChooserDialog; }
public FileObject browse( String[] fileFilters, String[] fileFilterNames, String fileUri, FileSystemOptions opts, int fileDialogMode, boolean showLocation, boolean showCustomUI ) throws KettleException, FileSystemException { // Get current file FileObject rootFile = null; FileObject initialFile = null; if ( fileUri != null ) { initialFile = KettleVFS.getFileObject( fileUri, variableSpace, opts ); } else { initialFile = KettleVFS.getFileObject( Spoon.getInstance().getLastFileOpened() ); } rootFile = initialFile.getFileSystem().getRoot(); fileChooserDialog.setRootFile( rootFile ); fileChooserDialog.setInitialFile( initialFile ); fileChooserDialog.defaultInitialFile = rootFile; FileObject selectedFile = null; selectedFile = fileChooserDialog.open( shell, this.schemeRestrictions, getDefaultScheme(), showFileScheme(), initialFile.getName().getPath(), fileFilters, fileFilterNames, returnsUserAuthenticatedFileObjects(), fileDialogMode, showLocation, showCustomUI ); return selectedFile; }
fileChooserDialog.open( shell, new String[] { "file" }, "file", true, path, new String[] { "*.*" }, FILETYPES, false, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, false ); } else if ( clusterName.equals( S3_ENVIRONMENT ) ) { selectedFile = fileChooserDialog.open( shell, new String[] { Schemes.S3_SCHEME }, Schemes.S3_SCHEME, true, path, new String[] { "*.*" }, FILETYPES, false, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, true ); if ( namedCluster.isMapr() ) { selectedFile = fileChooserDialog.open( shell, new String[] { Schemes.MAPRFS_SCHEME }, Schemes.MAPRFS_SCHEME, false, path, new String[] { "*.*" }, FILETYPES, true, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, false ); } else { List<CustomVfsUiPanel> customPanels = fileChooserDialog.getCustomVfsUiPanels(); for ( CustomVfsUiPanel panel : customPanels ) { if ( panel instanceof HadoopVfsFileChooserDialog ) { fileChooserDialog.open( shell, new String[] { Schemes.HDFS_SCHEME }, Schemes.HDFS_SCHEME, false, path, new String[] { "*.*" }, FILETYPES, true, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, false ); CustomVfsUiPanel currentPanel = fileChooserDialog.getCurrentPanel(); if ( currentPanel instanceof HadoopVfsFileChooserDialog ) { namedClusterWidget = ( (HadoopVfsFileChooserDialog) currentPanel ).getNamedClusterWidget();
if ( namedCluster.isMapr() ) { selectedFile = fileChooserDialog.open( shell, new String[] { Schemes.MAPRFS_SCHEME }, Schemes.MAPRFS_SCHEME, true, path, fileFilters, fileFilterNames, true, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, false ); } else { List<CustomVfsUiPanel> customPanels = fileChooserDialog.getCustomVfsUiPanels(); String ncName = null; HadoopVfsFileChooserDialog hadoopDialog = null; fileChooserDialog.open( shell, new String[] { Schemes.HDFS_SCHEME }, Schemes.HDFS_SCHEME, true, path, fileFilters, fileFilterNames, true, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, false );
public void connect() { NamedCluster nc = getNamedClusterWidget().getSelectedNamedCluster(); // The Named Cluster may be hdfs, maprfs or wasb. We need to detect it here since the named // cluster was just selected. schemeName = "wasb".equals( nc.getStorageScheme() ) ? "wasb" : "hdfs"; FileObject root = rootFile; try { root = KettleVFS.getFileObject( nc.processURLsubstitution( FileName.ROOT_PATH, Spoon.getInstance().getMetaStore(), getVariableSpace() ) ); } catch ( KettleFileException exc ) { showMessageAndLog( BaseMessages.getString( PKG, "HadoopVfsFileChooserDialog.error" ), BaseMessages.getString( PKG, "HadoopVfsFileChooserDialog.Connection.error" ), exc.getMessage() ); } vfsFileChooserDialog.setRootFile( root ); vfsFileChooserDialog.setSelectedFile( root ); rootFile = root; }
public void run() { VfsFileChooserDialog dialog = spoon.getVfsFileChooserDialog( null, null ); GoogleDriveFileChooserDialog hadoopVfsFileChooserDialog = new GoogleDriveFileChooserDialog( GoogleDriveFileProvider.SCHEME, GoogleDriveFileProvider.DISPLAY_NAME, dialog, SWT.NONE ); dialog.addVFSUIPanel( hadoopVfsFileChooserDialog ); } } );
@Override public NamedCluster getNamedClusterFromVfsFileChooser( Spoon spoon ) { VfsFileChooserDialog dialog = spoon.getVfsFileChooserDialog( null, null ); CustomVfsUiPanel currentPanel = dialog.getCurrentPanel(); if ( currentPanel != null && currentPanel instanceof HadoopVfsFileChooserDialog ) { HadoopVfsFileChooserDialog hadoopVfsFileChooserDialog = (HadoopVfsFileChooserDialog) currentPanel; NamedClusterWidgetImpl ncWidget = hadoopVfsFileChooserDialog.getNamedClusterWidget(); return NamedClusterBridgeImpl.fromOsgiNamedCluster( ncWidget.getSelectedNamedCluster() ); } return null; } }
public FileObject browse( String[] fileFilters, String[] fileFilterNames, String fileUri, FileSystemOptions opts, int fileDialogMode, boolean showLocation, boolean showCustomUI ) throws KettleException, FileSystemException { // Get current file FileObject rootFile = null; FileObject initialFile = null; if ( fileUri != null ) { initialFile = KettleVFS.getFileObject( fileUri, variableSpace, opts ); } else { initialFile = KettleVFS.getFileObject( Spoon.getInstance().getLastFileOpened() ); } rootFile = initialFile.getFileSystem().getRoot(); fileChooserDialog.setRootFile( rootFile ); fileChooserDialog.setInitialFile( initialFile ); fileChooserDialog.defaultInitialFile = rootFile; FileObject selectedFile = null; selectedFile = fileChooserDialog.open( shell, this.schemeRestrictions, getDefaultScheme(), showFileScheme(), initialFile.getName().getPath(), fileFilters, fileFilterNames, returnsUserAuthenticatedFileObjects(), fileDialogMode, showLocation, showCustomUI ); return selectedFile; }
fileChooserDialog.open( shell, new String[] { "file" }, "file", true, path, fileFilters, fileFilterNames, false, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, false ); } else if ( clusterName.equals( S3_ENVIRONMENT ) ) { selectedFile = fileChooserDialog.open( shell, new String[] { Schemes.S3_SCHEME }, Schemes.S3_SCHEME, true, path, fileFilters, fileFilterNames, false, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, true ); if ( namedCluster.isMapr() ) { selectedFile = fileChooserDialog.open( shell, new String[] { Schemes.MAPRFS_SCHEME }, Schemes.MAPRFS_SCHEME, true, path, fileFilters, fileFilterNames, false, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, false ); } else { List<CustomVfsUiPanel> customPanels = fileChooserDialog.getCustomVfsUiPanels(); for ( CustomVfsUiPanel panel : customPanels ) { if ( panel instanceof HadoopVfsFileChooserDialog ) { fileChooserDialog.open( shell, new String[] { Schemes.HDFS_SCHEME }, Schemes.HDFS_SCHEME, false, path, fileFilters, fileFilterNames, true, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE_OR_DIRECTORY, false, false ); CustomVfsUiPanel currentPanel = fileChooserDialog.getCurrentPanel(); if ( currentPanel instanceof HadoopVfsFileChooserDialog ) { namedClusterWidget = ( (HadoopVfsFileChooserDialog) currentPanel ).getNamedClusterWidget();
public void connect() { NamedCluster nc = getNamedClusterWidget().getSelectedNamedCluster(); HadoopVfsConnection hdfsConnection = new HadoopVfsConnection( nc, getVariableSpace() ); hdfsConnection.setCustomParameters( Props.getInstance() ); // The Named Cluster may be hdfs, maprfs or wasb. We need to detect it here since the named // cluster was just selected. //schemeName = "wasb".equals( nc.getStorageScheme() ) ? "wasb" : "hdfs"; String connectionString = Schemes.NAMED_CLUSTER_SCHEME + "://" + nc.getName(); FileSystemOptions fsoptions = new FileSystemOptions(); FileObject root = rootFile; try { root = KettleVFS.getFileObject( connectionString, fsoptions ); } catch ( KettleFileException exc ) { showMessageAndLog( BaseMessages.getString( PKG, "HadoopVfsFileChooserDialog.error" ), BaseMessages.getString( PKG, "HadoopVfsFileChooserDialog.Connection.error" ), exc.getMessage() ); } vfsFileChooserDialog.setRootFile( root ); vfsFileChooserDialog.setSelectedFile( root ); rootFile = root; }
@Override public void run() { VfsFileChooserDialog dialog = spoon.getVfsFileChooserDialog( null, null ); hdfsFileChooserDialog = new HadoopVfsFileChooserDialog( Schemes.HDFS_SCHEME, Schemes.HDFS_SCHEME_DISPLAY_NAME, dialog, null, null, ncService, rtTestActServ, rtTester ); dialog.addVFSUIPanel( hdfsPriority, hdfsFileChooserDialog ); mapRFSFileChooserDialog = new MapRFSFileChooserDialog( Schemes.MAPRFS_SCHEME, Schemes.MAPRFS_SCHEME_DISPLAY_NAME, dialog ); dialog.addVFSUIPanel( maprPriority, mapRFSFileChooserDialog ); ncFileChooserDialog = new NamedClusterVfsFileChooserDialog( Schemes.NAMED_CLUSTER_SCHEME, Schemes.NAMED_CLUSTER_SCHEME_DISPLAY_NAME, dialog, null, null, ncService, rtTestActServ, rtTester ); dialog.addVFSUIPanel( ncPriority, ncFileChooserDialog ); } } );
protected void extractNamedClusterFromVfsFileChooser() { VfsFileChooserDialog dialog = Spoon.getInstance().getVfsFileChooserDialog( null, null ); CustomVfsUiPanel currentPanel = dialog.getCurrentPanel(); if ( currentPanel != null && currentPanel instanceof HadoopVfsFileChooserDialog ) { HadoopVfsFileChooserDialog hadoopVfsFileChooserDialog = (HadoopVfsFileChooserDialog) currentPanel; selectedNamedCluster = hadoopVfsFileChooserDialog.getNamedClusterWidget().getSelectedNamedCluster(); } if ( selectedNamedCluster != null ) { setSelectedNamedCluster( selectedNamedCluster ); } }
selectedFile = fileChooserDialog .open( shell, null, "file", new String[] { "*.txt", "*.csv", "*" }, new String[] { BaseMessages.getString( PKG, "System.FileType.TextFiles" ), BaseMessages.getString( PKG, "System.FileType.CSVFiles" ),
public void activate() { vfsFileChooserDialog.setRootFile( null ); vfsFileChooserDialog.setInitialFile( null ); vfsFileChooserDialog.openFileCombo.setText( "maprfs://" ); vfsFileChooserDialog.vfsBrowser.fileSystemTree.removeAll(); super.activate(); try { FileObject newRoot = resolveFile( vfsFileChooserDialog.openFileCombo.getText() ); vfsFileChooserDialog.vfsBrowser.resetVfsRoot( newRoot ); } catch ( FileSystemException ignored ) { //ignored } }
protected List<VFSScheme> getAvailableVFSSchemes() throws KettleFileException, FileSystemException { VfsFileChooserDialog fileChooserDialog = getVfsFileChooserDialog( null, null ); List<CustomVfsUiPanel> customVfsUiPanels = fileChooserDialog.getCustomVfsUiPanels(); List<VFSScheme> vfsSchemes = new ArrayList<>(); customVfsUiPanels.forEach( vfsPanel -> { VFSScheme scheme = new VFSScheme( vfsPanel.getVfsScheme(), vfsPanel.getVfsSchemeDisplayText() ); vfsSchemes.add( scheme ); } ); return vfsSchemes; }
public void onStart( LifeEventHandler arg0 ) throws LifecycleException { VfsFileChooserDialog dialog = Spoon.getInstance().getVfsFileChooserDialog( null, null ); Spoon.getInstance().getVfsFileChooserDialog( null, null ).addVFSUIPanel( s3Priority, new S3NVfsFileChooserDialog( dialog, null, null ) ); }
private Optional<String> promptForLocalFile() { String curFile = transMeta.environmentSubstitute( wFileName.getText() ); FileObject root; try { root = KettleVFS.getFileObject( curFile != null ? curFile : Const.getUserHomeDirectory() ); VfsFileChooserDialog vfsFileChooser = Spoon.getInstance().getVfsFileChooserDialog( root.getParent(), root ); FileObject file = vfsFileChooser.open( getShell(), null, fileFilters, fileFilterNames, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE ); if ( file == null ) { return Optional.empty(); } String filePath = getRelativePath( file.getName().toString() ); return Optional.ofNullable( filePath ); } catch ( IOException | KettleException e ) { new ErrorDialog( getShell(), BaseMessages.getString( PKG, "VFSFileSelection.ErrorLoadingFile.DialogTitle" ), BaseMessages.getString( PKG, "VFSFileSelection.ErrorLoadingFile.DialogMessage" ), e ); } return Optional.empty(); }