java - filename is displayed in tableviewer but when selected particular column the file location should be retrieved for processing the file in eclipse e4? -


Using FileDialog I'm selected set of files and the checkbox table viewer To display. . And I want to take action to check those files in which I checkboxtableviewer

  public void setTableInput (File [] selectedFiles) {(int i = 0; i & LT; SelectedFiles.length; i ++) {TableViewer.add (Selected files [i] .getName ()); } TableViewer.addCheckStateListener (New ICheckStateListener () {@Override [public void checkStateChanged (CheckStateChangedEvent event) {Object] filesSelected = tableViewer.getCheckedElements () for; (object filename: filesSelected) {println ( "values" + (string) File name);}}}); }  

For the code written on here, I just file can get the names, 'What can you tell me how to proceed if I file by choosing File Location Want to get the location in the checkbox?

Thanks in advance

If you need to use the content and label providers You can set the file table as input.

  [public void setTableInput (File] selectedFiles) {tableViewer.setContentProvider (ArrayContentProvider.getInstance ()); TableViewer.setLabelProvider (new FileLabelProvider ()); TableViewer.setInput (selectedFiles); TableViewer.addCheckStateListener (new ICheckStateListener) {@Override Public Zero checkStateChanged (CheckStateChangedEvent event) {Object [] filesSelected = tableViewer.getCheckedElements (); (FileObj for Object: FilesSelected) {file file = (file) fileObj; System.out Println ("value" + file.getPath ());}}}); } Private static class FileLabelProvider LabelProvider extended {@ Override public string mill text} {file file = (file) element; Return file.getName (); }}  

Comments