org.eclipse.swt.widgets.FileDialog.setFileName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.eclipse.swt.widgets.FileDialog.setFileName()方法的一些代码示例,展示了FileDialog.setFileName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileDialog.setFileName()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.FileDialog
类名称:FileDialog
方法名:setFileName

FileDialog.setFileName介绍

[英]Set the initial filename which the dialog will select by default when opened to the argument, which may be null. The name will be prefixed with the filter path when one is supplied.
[中]设置打开该参数时对话框默认选择的初始文件名,该文件名可能为空。提供过滤器路径时,名称将以过滤器路径作为前缀。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*.shp;*.SHP", "*" } );
  if ( wShape.getText() != null ) {
   dialog.setFileName( wShape.getText() );
  }
  dialog.setFilterNames( new String[] { "Shape files", "All files" } );
  if ( dialog.open() != null ) {
   String str = dialog.getFilterPath() + System.getProperty( "file.separator" ) + dialog.getFileName();
   wShape.setText( str );
   if ( str.toUpperCase().endsWith( ".SHP" ) && ( wDbf.getText() == null || wDbf.getText().length() == 0 ) ) {
    String strdbf = str.substring( 0, str.length() - 4 );
    wDbf.setText( strdbf + ".dbf" );
   }
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*.dbf;*.DBF", "*" } );
  if ( wDbf.getText() != null ) {
   dialog.setFileName( wDbf.getText() );
  }
  dialog.setFilterNames( new String[] { "DBF files", "All files" } );
  if ( dialog.open() != null ) {
   String str = dialog.getFilterPath() + System.getProperty( "file.separator" ) + dialog.getFileName();
   wDbf.setText( str );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  if ( wTrustStorePath.getText() != null ) {
   String fpath = transMeta.environmentSubstitute( wTrustStorePath.getText() );
   dialog.setFileName( fpath );
  }
  if ( dialog.open() != null ) {
   String str = dialog.getFilterPath() + System.getProperty( "file.separator" ) + dialog.getFileName();
   wTrustStorePath.setText( str );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*png;*PNG", "*jpeg;*jpg;*JPEG;*JPG", "*gif;*GIF", "*" } );
  if ( wImageFilename.getText() != null ) {
   dialog.setFileName( transMeta.environmentSubstitute( wImageFilename.getText() ) );
  }
  dialog.setFilterNames( IMAGES_FILE_TYPES );
  if ( dialog.open() != null ) {
   wImageFilename.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
   Random randomgen = new Random();
   wContentID.setText( Long.toString( Math.abs( randomgen.nextLong() ), 32 ) );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*png;*PNG", "*jpeg;*jpg;*JPEG;*JPG", "*gif;*GIF", "*" } );
  if ( wImageFilename.getText() != null ) {
   dialog.setFileName( jobMeta.environmentSubstitute( wImageFilename.getText() ) );
  }
  dialog.setFilterNames( IMAGES_FILE_TYPES );
  if ( dialog.open() != null ) {
   wImageFilename.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
   Random randomgen = new Random();
   wContentID.setText( Long.toString( Math.abs( randomgen.nextLong() ), 32 ) );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wPsqlPath.getText() != null ) {
   dialog.setFileName( wPsqlPath.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wPsqlPath.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wDataFile.getText() != null ) {
   dialog.setFileName( wDataFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wDataFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wDataFile.getText() != null ) {
   dialog.setFileName( wDataFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wDataFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wLogFile.getText() != null ) {
   dialog.setFileName( wLogFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wLogFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wBadFile.getText() != null ) {
   dialog.setFileName( wBadFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wBadFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wDiscardFile.getText() != null ) {
   dialog.setFileName( wDiscardFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wDiscardFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wGploadPath.getText() != null ) {
   dialog.setFileName( wGploadPath.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wGploadPath.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wControlFile.getText() != null ) {
   dialog.setFileName( wControlFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wControlFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wLogFile.getText() != null ) {
   dialog.setFileName( wLogFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wLogFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.SAVE );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wLogFile.getText() != null ) {
   dialog.setFileName( wLogFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wLogFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*.sh;*.bat;*.BAT", "*;*.*" } );
  dialog.setFilterNames( FILEFORMATS );
  if ( wFilename.getText() != null ) {
   dialog.setFileName( wFilename.getText() );
  }
  if ( dialog.open() != null ) {
   wFilename.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
   wName.setText( dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wSqlldr.getText() != null ) {
   dialog.setFileName( wSqlldr.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wSqlldr.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wControlFile.getText() != null ) {
   dialog.setFileName( wControlFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wControlFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.SAVE );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wControlFile.getText() != null ) {
   dialog.setFileName( wControlFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wControlFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  FileDialog dialog = new FileDialog( shell, SWT.OPEN );
  dialog.setFilterExtensions( new String[] { "*" } );
  if ( wLogFile.getText() != null ) {
   dialog.setFileName( wLogFile.getText() );
  }
  dialog.setFilterNames( ALL_FILETYPES );
  if ( dialog.open() != null ) {
   wLogFile.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName() );
  }
 }
} );

相关文章