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

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

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

FileDialog.setFilterNames介绍

[英]Sets the names that describe the filter extensions which the dialog will use to filter the files it shows to the argument, which may be null.

Each name is a user-friendly short description shown for its corresponding filter. The names array must be the same length as the extensions array.
[中]设置描述筛选器扩展名的名称,对话框将使用这些名称来筛选显示给参数的文件,参数可能为null。
每个名称都是为其相应的筛选器显示的用户友好的简短描述。names数组的长度必须与extensions数组的长度相同。

代码示例

代码示例来源: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 );
  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[] { "*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[] { "*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[] { "*" } );
  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[] { "*" } );
  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 ( 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 ( 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 ( 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[] { "*.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() );
  }
 }
} );

相关文章