public void widgetSelected(SelectionEvent e) { IndexFiles indexFiles = new IndexFiles(); String directoryToIndex = textDirectoryToIndex.getText() + "/"; String indexDestination = directoryToIndex + "MyDocumentsIndex"; indexFiles.index(new File(directoryToIndex), true, indexDestination); indexOutcome.setText(indexFiles.getMessage().toString()); window.getFileExplorer().setInput(directoryToIndex); try { PrintWriter pw = new PrintWriter(new FileWriter("directoryToIndex.txt")); pw.println(indexDestination); pw.close(); } catch (IOException e1) { WarningMessageBox messageBox = new WarningMessageBox( window.getShell(), "Trouble settingup the file with index directory file-path."); } }