|
Lines 71-78
Link Here
|
| 71 |
// SWT FileDialog API fields |
71 |
// SWT FileDialog API fields |
| 72 |
String[] filterNames = new String[ 0 ]; |
72 |
String[] filterNames = new String[ 0 ]; |
| 73 |
String[] filterExtensions = new String[ 0 ]; |
73 |
String[] filterExtensions = new String[ 0 ]; |
|
|
74 |
String[] filePaths = new String[ 0 ]; |
| 74 |
String[] fileNames = new String[ 0 ]; |
75 |
String[] fileNames = new String[ 0 ]; |
| 75 |
String filterPath = ""; |
76 |
String filterPath = ""; |
|
|
77 |
String filePath; |
| 76 |
String fileName; |
78 |
String fileName; |
| 77 |
int filterIndex; |
79 |
int filterIndex; |
| 78 |
boolean overwrite = false; |
80 |
boolean overwrite = false; |
|
Lines 164-170
Link Here
|
| 164 |
} |
166 |
} |
| 165 |
|
167 |
|
| 166 |
/** |
168 |
/** |
| 167 |
* Returns the path of the first file that was selected in the dialog relative |
169 |
* Returns the name of the first file that was selected in the dialog relative |
| 168 |
* to the filter path, or an empty string if no such file has been selected. |
170 |
* to the filter path, or an empty string if no such file has been selected. |
| 169 |
* |
171 |
* |
| 170 |
* @return the relative path of the file |
172 |
* @return the relative path of the file |
|
Lines 174-181
Link Here
|
| 174 |
} |
176 |
} |
| 175 |
|
177 |
|
| 176 |
/** |
178 |
/** |
| 177 |
* Returns a (possibly empty) array with the paths of all files that were |
179 |
* Returns the path of the first file that was selected in the dialog relative |
| 178 |
* selected in the dialog relative to the filter path. |
180 |
* to the filter path, or an empty string if no such file has been selected. |
|
|
181 |
* |
| 182 |
* @return the relative path of the file |
| 183 |
*/ |
| 184 |
public String getFilePath() { |
| 185 |
return filePath; |
| 186 |
} |
| 187 |
/** |
| 188 |
* Returns a (possibly empty) array with the names of all files that were |
| 189 |
* selected in the dialog. |
| 179 |
* |
190 |
* |
| 180 |
* @return the relative paths of the files |
191 |
* @return the relative paths of the files |
| 181 |
*/ |
192 |
*/ |
|
Lines 184-189
Link Here
|
| 184 |
} |
195 |
} |
| 185 |
|
196 |
|
| 186 |
/** |
197 |
/** |
|
|
198 |
* Returns a (possibly empty) array with the paths of all files that were |
| 199 |
* selected in the dialog relative to the filter path. |
| 200 |
* |
| 201 |
* @return the relative paths of the files |
| 202 |
*/ |
| 203 |
public String[] getFilePaths() { |
| 204 |
return filePaths; |
| 205 |
} |
| 206 |
|
| 207 |
/** |
| 187 |
* Returns the file extensions which the dialog will use to filter the files |
208 |
* Returns the file extensions which the dialog will use to filter the files |
| 188 |
* it shows. |
209 |
* it shows. |
| 189 |
* |
210 |
* |
|
Lines 252-257
Link Here
|
| 252 |
} |
273 |
} |
| 253 |
|
274 |
|
| 254 |
/** |
275 |
/** |
|
|
276 |
* Set the initial filepath which the dialog will select by default when |
| 277 |
* opened to the argument, which may be null. The name will be prefixed with |
| 278 |
* the filter path when one is supplied. |
| 279 |
* |
| 280 |
* @param string the file name |
| 281 |
*/ |
| 282 |
public void setFilePath( String string ) { |
| 283 |
filePath = string; |
| 284 |
} |
| 285 |
|
| 286 |
/** |
| 255 |
* Set the file extensions which the dialog will use to filter the files it |
287 |
* Set the file extensions which the dialog will use to filter the files it |
| 256 |
* shows to the argument, which may be null. |
288 |
* shows to the argument, which may be null. |
| 257 |
* <p> |
289 |
* <p> |
|
Lines 356-362
Link Here
|
| 356 |
createControls(); |
388 |
createControls(); |
| 357 |
layoutAndCenterShell(); |
389 |
layoutAndCenterShell(); |
| 358 |
openShell(); |
390 |
openShell(); |
| 359 |
return fileName; |
391 |
return filePath; |
| 360 |
} |
392 |
} |
| 361 |
|
393 |
|
| 362 |
private void initializeDefaults() { |
394 |
private void initializeDefaults() { |
|
Lines 665-678
Link Here
|
| 665 |
if( uploadLocked ) { |
697 |
if( uploadLocked ) { |
| 666 |
if( progressCollector.isFinished() ) { |
698 |
if( progressCollector.isFinished() ) { |
| 667 |
okButton.setText( okText ); |
699 |
okButton.setText( okText ); |
|
|
700 |
filePaths = new String[ uploadPanels.size() ]; |
| 668 |
fileNames = new String[ uploadPanels.size() ]; |
701 |
fileNames = new String[ uploadPanels.size() ]; |
|
|
702 |
filePath = null; |
| 669 |
fileName = null; |
703 |
fileName = null; |
| 670 |
for( int i = 0; i < uploadPanels.size(); i++ ) { |
704 |
for( int i = 0; i < uploadPanels.size(); i++ ) { |
| 671 |
UploadPanel uploadPanel = ( UploadPanel )uploadPanels.get( i ); |
705 |
UploadPanel uploadPanel = ( UploadPanel )uploadPanels.get( i ); |
| 672 |
File uploadedFile = uploadPanel.getUploadedFile(); |
706 |
File uploadedFile = uploadPanel.getUploadedFile(); |
| 673 |
// TODO [rst] Understand if file can be null |
707 |
// TODO [rst] Understand if file can be null |
| 674 |
if( uploadedFile != null ) { |
708 |
if( uploadedFile != null ) { |
| 675 |
fileNames[ i ] = uploadedFile.getAbsolutePath(); |
709 |
filePaths[ i ] = uploadedFile.getAbsolutePath(); |
|
|
710 |
fileNames[ i ] = uploadedFile.getName(); |
| 711 |
} |
| 712 |
if( filePath == null || filePath.length() == 0 ) { |
| 713 |
filePath = filePaths[ 0 ]; |
| 676 |
} |
714 |
} |
| 677 |
if( fileName == null || fileName.length() == 0 ) { |
715 |
if( fileName == null || fileName.length() == 0 ) { |
| 678 |
fileName = fileNames[ 0 ]; |
716 |
fileName = fileNames[ 0 ]; |