org.eclipse.swt.widgets.FileDialog Java Examples
The following examples show how to use
org.eclipse.swt.widgets.FileDialog.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SasInputDialog.java From hop with Apache License 2.0 | 7 votes |
public void get() { try { // As the user for a file to use as a reference // FileDialog dialog = new FileDialog( shell, SWT.OPEN ); dialog.setFilterExtensions( new String[] { "*.sas7bdat;*.SAS7BDAT", "*.*" } ); dialog.setFilterNames( new String[] { BaseMessages.getString( PKG, "SASInputDialog.FileType.SAS7BAT" ) + ", " + BaseMessages.getString( PKG, "System.FileType.TextFiles" ), BaseMessages.getString( PKG, "System.FileType.CSVFiles" ), BaseMessages.getString( PKG, "System.FileType.TextFiles" ), BaseMessages.getString( PKG, "System.FileType.AllFiles" ) } ); if ( dialog.open() != null ) { String filename = dialog.getFilterPath() + System.getProperty( "file.separator" ) + dialog.getFileName(); SasInputHelper helper = new SasInputHelper( filename ); BaseTransformDialog.getFieldsFromPrevious( helper.getRowMeta(), wFields, 1, new int[] { 1 }, new int[] { 3 }, 4, 5, null ); } } catch ( Exception e ) { new ErrorDialog( shell, "Error", "Error reading information from file", e ); } }
Example #2
Source File: FilterView.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
@Override public void run() { try { FileDialog dlg = TmfFileDialogFactory.create(new Shell(), SWT.SAVE); dlg.setFilterNames(new String[] { Messages.FilterView_FileDialogFilterName + " (*.xml)" }); //$NON-NLS-1$ dlg.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$ String fn = dlg.open(); if (fn != null) { TmfFilterXMLWriter writerXML = new TmfFilterXMLWriter(fRoot); writerXML.saveTree(fn); } } catch (ParserConfigurationException e) { Activator.getDefault().logError("Error parsing filter xml file", e); //$NON-NLS-1$ } }
Example #3
Source File: ExportHTTP4eAction.java From http4e with Apache License 2.0 | 6 votes |
public void run(){ try { FileDialog fileDialog = new FileDialog(view.getSite().getShell(), SWT.SAVE); fileDialog.setFileName("sessions.http4e"); fileDialog.setFilterNames(new String[] { "HTTP4e File *.http4e (HTTP4e all tab sessions)" }); fileDialog.setFilterExtensions(new String[] { "*.http4e" }); fileDialog.setText("Save As HTTP4e replay script"); fileDialog.setFilterPath(getUserHomeDir()); String path = fileDialog.open(); if (path != null) { HdViewPart hdView = (HdViewPart) view; BaseUtils.writeHttp4eSessions(path, hdView.getFolderView().getModel()); updateUserHomeDir(path); } } catch (Exception e) { ExceptionHandler.handle(e); } }
Example #4
Source File: FileChooser.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private static String openFileDialog(Shell shell, String extension, String defaultName, String filterPath, int swtFlag) { FileDialog dialog = new FileDialog(shell, swtFlag); dialog.setText(getDialogText(swtFlag)); String ext = null; if (extension != null) { ext = extension.trim(); if (ext.contains("|")) ext = ext.substring(0, ext.indexOf("|")).trim(); dialog.setFilterExtensions(new String[] { ext }); } dialog.setFileName(defaultName); if (filterPath != null) dialog.setFilterPath(filterPath); if (extension != null) { if (extension.contains("|")) { String label = extension.substring(extension.indexOf("|") + 1); label += " (" + ext + ")"; dialog.setFilterNames(new String[] { label }); } } return dialog.open(); }
Example #5
Source File: ChartComposite.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Opens a file chooser and gives the user an opportunity to save the chart * in PNG format. * * @throws IOException if there is an I/O error. */ public void doSaveAs() throws IOException { FileDialog fileDialog = new FileDialog(this.canvas.getShell(), SWT.SAVE); String[] extensions = {"*.png"}; fileDialog.setFilterExtensions(extensions); String filename = fileDialog.open(); if (filename != null) { if (isEnforceFileExtensions()) { if (!filename.endsWith(".png")) { filename = filename + ".png"; } } //TODO replace getSize by getBounds ? ChartUtilities.saveChartAsPNG(new File(filename), this.chart, this.canvas.getSize().x, this.canvas.getSize().y); } }
Example #6
Source File: XSLTransformationDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 打开文件对话框 * @param txt * 显示路径文本框 * @param style * 对话框样式 * @param title * 对话框标题 * @param extensions * @param filterNames * ; */ private void openFileDialog(Text txt, int style, String title, String[] extensions, String[] filterNames) { FileDialog dialog = new FileDialog(getShell(), style); dialog.setText(title); dialog.setFilterExtensions(extensions); dialog.setFilterNames(filterNames); String fileSep = System.getProperty("file.separator"); if (txt.getText() != null && !txt.getText().trim().equals("")) { dialog.setFilterPath(txt.getText().substring(0, txt.getText().lastIndexOf(fileSep))); dialog.setFileName(txt.getText().substring(txt.getText().lastIndexOf(fileSep) + 1)); } else { dialog.setFilterPath(System.getProperty("user.home")); } String path = dialog.open(); if (path != null) { txt.setText(path); } }
Example #7
Source File: ExportToTextCommandHandler.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { List<TmfEventTableColumn> columns = getColumns(event.getApplicationContext()); ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); ITmfFilter filter = TmfTraceManager.getInstance().getCurrentTraceContext().getFilter(); if (trace != null) { FileDialog fd = TmfFileDialogFactory.create(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.SAVE); fd.setFilterExtensions(new String[] { "*.csv", "*.*", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ fd.setOverwrite(true); final String s = fd.open(); if (s != null) { Job j = new ExportToTextJob(trace, filter, columns, s); j.setUser(true); j.schedule(); } } return null; }
Example #8
Source File: XSLTransformationDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 打开文件对话框 * @param txt * 显示路径文本框 * @param style * 对话框样式 * @param title * 对话框标题 * @param extensions * @param filterNames * ; */ private void openFileDialog(Text txt, int style, String title, String[] extensions, String[] filterNames) { FileDialog dialog = new FileDialog(getShell(), style); dialog.setText(title); dialog.setFilterExtensions(extensions); dialog.setFilterNames(filterNames); String fileSep = System.getProperty("file.separator"); if (txt.getText() != null && !txt.getText().trim().equals("")) { dialog.setFilterPath(txt.getText().substring(0, txt.getText().lastIndexOf(fileSep))); dialog.setFileName(txt.getText().substring(txt.getText().lastIndexOf(fileSep) + 1)); } else { dialog.setFilterPath(System.getProperty("user.home")); } String path = dialog.open(); if (path != null) { txt.setText(path); } }
Example #9
Source File: Activator.java From ermaster-b with Apache License 2.0 | 6 votes |
/** * �ۑ��_�C�A���O��\�����܂� * * @param filePath * �f�t�H���g�̃t�@�C���p�X * @param filterExtensions * �g���q * @return �ۑ��_�C�A���O�őI�����ꂽ�t�@�C���̃p�X */ public static String showSaveDialog(String filePath, String[] filterExtensions) { String dir = null; String fileName = null; if (filePath != null && !"".equals(filePath.trim())) { File file = new File(filePath.trim()); dir = file.getParent(); fileName = file.getName(); } FileDialog fileDialog = new FileDialog(PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(), SWT.SAVE); fileDialog.setFilterPath(dir); fileDialog.setFileName(fileName); fileDialog.setFilterExtensions(filterExtensions); return fileDialog.open(); }
Example #10
Source File: ChartComposite.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Opens a file chooser and gives the user an opportunity to save the chart * in PNG format. * * @throws IOException if there is an I/O error. */ public void doSaveAs() throws IOException { FileDialog fileDialog = new FileDialog(this.canvas.getShell(), SWT.SAVE); String[] extensions = { "*.png" }; fileDialog.setFilterExtensions(extensions); String filename = fileDialog.open(); if (filename != null) { if (isEnforceFileExtensions()) { if (!filename.endsWith(".png")) { filename = filename + ".png"; } } //TODO replace getSize by getBounds ? ChartUtilities.saveChartAsPNG(new File(filename), this.chart, this.canvas.getSize().x, this.canvas.getSize().y); } }
Example #11
Source File: PmTrans.java From pmTrans with GNU Lesser General Public License v3.0 | 6 votes |
protected void importText() { if (!textEditor.isDisposed()) { FileDialog fd = new FileDialog(shell, SWT.OPEN); fd.setText("Open"); String[] filterExt = { "*.txt;*.TXT" }; String[] filterNames = { "TXT files" }; fd.setFilterExtensions(filterExt); fd.setFilterNames(filterNames); String lastPath = Config.getInstance().getString(Config.LAST_OPEN_TEXT_PATH); if (lastPath != null && !lastPath.isEmpty()) fd.setFileName(lastPath); String selected = fd.open(); if (selected != null) { importTextFile(new File(selected)); Config.getInstance().putValue(Config.LAST_OPEN_TEXT_PATH, selected); try { Config.getInstance().save(); } catch (IOException e) { // The user do not NEED to know about this... } } } }
Example #12
Source File: ChartComposite.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Opens a file chooser and gives the user an opportunity to save the chart * in PNG format. * * @throws IOException if there is an I/O error. */ public void doSaveAs() throws IOException { FileDialog fileDialog = new FileDialog(this.canvas.getShell(), SWT.SAVE); String[] extensions = {"*.png"}; fileDialog.setFilterExtensions(extensions); String filename = fileDialog.open(); if (filename != null) { if (isEnforceFileExtensions()) { if (!filename.endsWith(".png")) { filename = filename + ".png"; } } //TODO replace getSize by getBounds ? ChartUtilities.saveChartAsPNG(new File(filename), this.chart, this.canvas.getSize().x, this.canvas.getSize().y); } }
Example #13
Source File: ParamsAttachManager.java From http4e with Apache License 2.0 | 6 votes |
public void widgetSelected( SelectionEvent event){ FileDialog fd = new FileDialog(st.getShell(), SWT.OPEN); fd.setText("Add File Parameter"); fd.setFilterExtensions(CoreConstants.FILE_FILTER_EXT); String file = fd.open(); if (file != null) { if (manager.isMultipart()) { st.setText(st.getText() + CoreConstants.FILE_PREFIX + file); } else { try { st.setText(readFileAsString(file)); } catch (IOException e) { // ignore } } // model.fireExecute(new ModelEvent(ModelEvent.BODY_FOCUS_LOST, // model)); // // force body to refresh itself // model.fireExecute(new ModelEvent(ModelEvent.PARAMS_FOCUS_LOST, // model)); } }
Example #14
Source File: ClassPathBlock.java From birt with Eclipse Public License 1.0 | 6 votes |
public static IPath configureExternalJAREntry( Shell shell, IPath initialEntry ) { if ( initialEntry == null ) { throw new IllegalArgumentException( ); } String lastUsedPath = initialEntry.removeLastSegments( 1 ).toOSString( ); FileDialog dialog = new FileDialog( shell, SWT.SINGLE ); dialog.setText( Messages.getString( "ClassPathBlock_FileDialog.edit.text" ) ); //$NON-NLS-1$ dialog.setFilterExtensions( JAR_ZIP_FILTER_EXTENSIONS ); dialog.setFilterPath( lastUsedPath ); dialog.setFileName( initialEntry.lastSegment( ) ); String res = dialog.open( ); if ( res == null ) { return null; } //lastUsedPath = dialog.getFilterPath( ); return Path.fromOSString( res ).makeAbsolute( ); }
Example #15
Source File: HiveTab.java From neoscada with Eclipse Public License 1.0 | 6 votes |
protected void chooseFile () { final FileDialog dlg = new FileDialog ( getShell (), SWT.OPEN | SWT.MULTI ); dlg.setFilterExtensions ( new String[] { "*.xml", "*.*" } ); dlg.setFilterNames ( new String[] { "Eclipse NeoSCADA Exporter Files", "All files" } ); final String result = dlg.open (); if ( result != null ) { final File base = new File ( dlg.getFilterPath () ); for ( final String name : dlg.getFileNames () ) { this.fileText.setText ( new File ( base, name ).getAbsolutePath () ); } makeDirty (); } }
Example #16
Source File: UserLibraryPreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void changeControlPressed(DialogField field) { String label= isSave() ? PreferencesMessages.UserLibraryPreferencePage_LoadSaveDialog_filedialog_save_title : PreferencesMessages.UserLibraryPreferencePage_LoadSaveDialog_filedialog_load_title; FileDialog dialog= new FileDialog(getShell(), isSave() ? SWT.SAVE : SWT.OPEN); dialog.setText(label); dialog.setFilterExtensions(new String[] {"*.userlibraries", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ String lastPath= fLocationField.getText(); if (lastPath.length() == 0 || !new File(lastPath).exists()) { lastPath= fSettings.get(PREF_LASTPATH); } if (lastPath != null) { dialog.setFileName(lastPath); } String fileName= dialog.open(); if (fileName != null) { fSettings.put(PREF_LASTPATH, fileName); fLocationField.setText(fileName); } }
Example #17
Source File: XMLAnalysesManagerPreferencePage.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Import new analysis. */ private void importAnalysis() { FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.OPEN | SWT.MULTI); dialog.setText(Messages.ManageXMLAnalysisDialog_SelectFilesImport); dialog.setFilterNames(new String[] { Messages.ManageXMLAnalysisDialog_ImportXmlFile + " (" + XML_FILTER_EXTENSION + ")" }); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION }); dialog.open(); String directoryPath = dialog.getFilterPath(); if (!directoryPath.isEmpty()) { File directory = new File(directoryPath); String[] files = dialog.getFileNames(); Collection<String> filesToProcess = Lists.newArrayList(); for (String fileName : files) { File file = new File(directory, fileName); if (loadXmlFile(file, true)) { filesToProcess.add(file.getName()); } } if (!filesToProcess.isEmpty()) { fillAnalysesTable(); Collection<TmfCommonProjectElement> elements = deleteSupplementaryFiles(filesToProcess); XmlAnalysisModuleSource.notifyModuleChange(); refreshProject(elements); } } }
Example #18
Source File: JdbcDriverManagerDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * actions after add button is click in jarPage */ private void addJars( ) { jarChanged=true; FileDialog dlg = new FileDialog( getShell( ), SWT.MULTI ); dlg.setFilterExtensions( new String[]{ "*.jar", "*.zip" //$NON-NLS-1$, $NON-NLS-2$ } ); if ( dlg.open( ) != null ) { String jarNames[] = dlg.getFileNames( ); String folder = dlg.getFilterPath( ) + File.separator; for( int i = 0; i < jarNames.length; i++ ) { addSingleJar( folder + jarNames[i], jarNames[i] ); } refreshJarViewer( ); updateJarButtons( ); } }
Example #19
Source File: ChartComposite.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Opens a file chooser and gives the user an opportunity to save the chart * in PNG format. * * @throws IOException if there is an I/O error. */ public void doSaveAs() throws IOException { FileDialog fileDialog = new FileDialog(this.canvas.getShell(), SWT.SAVE); String[] extensions = {"*.png"}; fileDialog.setFilterExtensions(extensions); String filename = fileDialog.open(); if (filename != null) { if (isEnforceFileExtensions()) { if (!filename.endsWith(".png")) { filename = filename + ".png"; } } //TODO replace getSize by getBounds ? ChartUtilities.saveChartAsPNG(new File(filename), this.chart, this.canvas.getSize().x, this.canvas.getSize().y); } }
Example #20
Source File: BuildPathDialogAccess.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Shows the UI to configure an external JAR or ZIP archive. * The dialog returns the configured or <code>null</code> if the dialog has * been canceled. The dialog does not apply any changes. * * @param shell The parent shell for the dialog. * @param initialEntry The path of the initial archive entry. * @return Returns the configured external JAR path or <code>null</code> if the dialog has * been canceled by the user. */ public static IPath configureExternalJAREntry(Shell shell, IPath initialEntry) { if (initialEntry == null) { throw new IllegalArgumentException(); } String lastUsedPath= initialEntry.removeLastSegments(1).toOSString(); FileDialog dialog= new FileDialog(shell, SWT.SINGLE); dialog.setText(NewWizardMessages.BuildPathDialogAccess_ExtJARArchiveDialog_edit_title); dialog.setFilterExtensions(ArchiveFileFilter.JAR_ZIP_FILTER_EXTENSIONS); dialog.setFilterPath(lastUsedPath); dialog.setFileName(initialEntry.lastSegment()); String res= dialog.open(); if (res == null) { return null; } JavaPlugin.getDefault().getDialogSettings().put(IUIConstants.DIALOGSTORE_LASTEXTJAR, dialog.getFilterPath()); return Path.fromOSString(res).makeAbsolute(); }
Example #21
Source File: TMX2TXTConverterDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 选择TXT文件 ; */ private void selecteTXTFile() { FileDialog fd = new FileDialog(getShell(), SWT.OPEN); String[] extensions = { "*.txt", "*.*" }; fd.setFilterExtensions(extensions); String[] names = { Messages.getString("dialog.TMX2TXTConverterDialog.TXTNames1"), Messages.getString("dialog.TMX2TXTConverterDialog.TXTNames2") }; fd.setFilterNames(names); String file = fd.open(); if (file != null) { txtTxt.setText(file); } }
Example #22
Source File: OpenTmxFileHandler.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private File tmxfileBrowser() { FileDialog dlg = new FileDialog(window.getShell(), SWT.SINGLE); String[] supExtentions = new String[] { "*.tmx" }; dlg.setFilterExtensions(supExtentions); String absolutePath = dlg.open(); if (absolutePath == null) return null; return new File(absolutePath); }
Example #23
Source File: MainWindow.java From arx with Apache License 2.0 | 5 votes |
/** * Shows a file open dialog. * * @param shell * @param filter * @return */ public String showOpenFileDialog(final Shell shell, String filter) { final FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] { filter }); dialog.setFilterIndex(0); String file = dialog.open(); if (file == null) { return null; } else if (!new File(file).exists()) { showInfoDialog(shell, Resources.getMessage("MainWindow.5"), Resources.getMessage("MainWindow.14")); //$NON-NLS-1$ //$NON-NLS-2$ return null; } else { return file; } }
Example #24
Source File: DotGraphView.java From gef with Eclipse Public License 2.0 | 5 votes |
@Override public void run() { FileDialog dialog = new FileDialog(getViewSite().getShell(), SWT.OPEN); dialog.setFileName(lastSelection); String[] filterSuffixPattern = new String[EXTENSIONS.length + 1]; String[] filterReadableName = new String[EXTENSIONS.length + 1]; filterSuffixPattern[0] = "*.*"; //$NON-NLS-1$ filterReadableName[0] = String.format("Embedded DOT Graph (%s)", //$NON-NLS-1$ filterSuffixPattern[0]); for (int i = 1; i <= EXTENSIONS.length; i++) { String suffix = EXTENSIONS[i - 1]; filterSuffixPattern[i] = "*." + suffix; //$NON-NLS-1$ filterReadableName[i] = String.format(Locale.ENGLISH, "%S file (%s)", suffix, //$NON-NLS-1$ filterSuffixPattern[i]); } dialog.setFilterExtensions(filterSuffixPattern); dialog.setFilterNames(filterReadableName); String selection = dialog.open(); if (selection != null) { lastSelection = selection; updateGraph(new File(selection)); } }
Example #25
Source File: FileChooser.java From mappwidget with Apache License 2.0 | 5 votes |
public String openFile() { FileDialog dlg = new FileDialog(button.getShell(), SWT.OPEN); dlg.setFileName(text.getText()); dlg.setFilterExtensions(new String[] { "*.gif; *.jpg; *.png; *.ico; *.bmp" }); dlg.setText(OPEN); String path = dlg.open(); return path; }
Example #26
Source File: MultiFileFieldEditor.java From ermasterr with Apache License 2.0 | 5 votes |
private File[] getFile(final File startingDirectory) { int style = SWT.OPEN; if (multiple) { style |= SWT.MULTI; } final FileDialog dialog = new FileDialog(getShell(), style); if (startingDirectory != null) { dialog.setFileName(startingDirectory.getPath()); } if (extensions != null) { dialog.setFilterExtensions(extensions); } dialog.open(); final String[] fileNames = dialog.getFileNames(); if (fileNames.length > 0) { final File[] files = new File[fileNames.length]; for (int i = 0; i < fileNames.length; i++) { files[i] = new File(dialog.getFilterPath(), fileNames[i]); } return files; } return null; }
Example #27
Source File: PluginConfigManageDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 选择文件 * @param title * @param extensions * @param names * @return ; */ private String browseFile(String title, String[] extensions, String[] names) { FileDialog fd = new FileDialog(getShell(), SWT.OPEN); fd.setText(title); if (extensions != null) { fd.setFilterExtensions(extensions); } if (names != null) { fd.setFilterNames(names); } return fd.open(); }
Example #28
Source File: ExportPayloadDropperPage.java From JReFrameworker with MIT License | 5 votes |
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(3, false)); Label dropperJarLabel = new Label(container, SWT.NONE); dropperJarLabel.setText("Payload Dropper Jar: "); dropperJarText = new Text(container, SWT.BORDER); dropperJarText.setEditable(false); dropperJarText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); final FileDialog fileChooser = new FileDialog(container.getShell(), SWT.SAVE); fileChooser.setFilterExtensions(new String[] { "*.jar" }); fileChooser.setFileName("dropper.jar"); Button browseButton = new Button(container, SWT.NONE); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String path = fileChooser.open(); if (path != null){ jarPath = path; setPageComplete(true); } dropperJarText.setText(jarPath); } }); browseButton.setText("Browse..."); setPageComplete(false); }
Example #29
Source File: TableEditor.java From cppcheclipse with Apache License 2.0 | 5 votes |
protected File openExternalFile(String title) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell(); FileDialog fileDialog = new FileDialog(shell); fileDialog.setText(title); String file = fileDialog.open(); if (file != null) { return new File(file); } return null; }
Example #30
Source File: ImportProjectWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * The browse button has been selected. Select the location. */ protected void handleLocationArchiveButtonPressed() { FileDialog dialog = new FileDialog(archivePathField.getShell(), SWT.SHEET); dialog.setFilterExtensions(FILE_IMPORT_MASK); dialog .setText(DataTransferMessages.WizardProjectsImportPage_SelectArchiveDialogTitle); String fileName = archivePathField.getText().trim(); if (fileName.length() == 0) { fileName = previouslyBrowsedArchive; } if (fileName.length() == 0) { dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace() .getRoot().getLocation().toOSString()); } else { File path = new File(fileName).getParentFile(); if (path != null && path.exists()) { dialog.setFilterPath(path.toString()); } } String selectedArchive = dialog.open(); if (selectedArchive != null) { previouslyBrowsedArchive = selectedArchive; archivePathField.setText(previouslyBrowsedArchive); updateProjectsList(selectedArchive); } }