|
Lines 1-5
Link Here
|
| 1 |
/********************************************************************** |
1 |
/********************************************************************** |
| 2 |
* Copyright (c) 2005, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 54-61
Link Here
|
| 54 |
/** |
54 |
/** |
| 55 |
* Abstract wizard page which can be extended by any wizard page which wants to provide controls for selecting file location |
55 |
* Abstract wizard page which can be extended by any wizard page which wants to provide controls for selecting file location |
| 56 |
* and specifying file name. It provides the directory structure in a tree and allows filename to be entered. It keeps track of the |
56 |
* and specifying file name. It provides the directory structure in a tree and allows filename to be entered. It keeps track of the |
| 57 |
* last selected file for any extender and restores that selection the next time the extender is instantiated |
57 |
* last selected file for any extender and restores that selection the next time the extender is instantiated. |
| 58 |
* @author Ernest Jessee |
58 |
* <p/> |
|
|
59 |
* |
| 60 |
* |
| 61 |
* @author Paul E. Slauenwhite |
| 62 |
* @author Ernest Jessee |
| 63 |
* @version March 13, 2008 |
| 64 |
* @since February 1, 2005 |
| 59 |
*/ |
65 |
*/ |
| 60 |
public abstract class FileLocationSelectionWizardpage extends WizardPage implements ITestGenWizardPage |
66 |
public abstract class FileLocationSelectionWizardpage extends WizardPage implements ITestGenWizardPage |
| 61 |
{ |
67 |
{ |
|
Lines 68-74
Link Here
|
| 68 |
private Text selectedFileName; |
74 |
private Text selectedFileName; |
| 69 |
|
75 |
|
| 70 |
private boolean saveLastSelected = false; |
76 |
private boolean saveLastSelected = false; |
| 71 |
|
77 |
|
|
|
78 |
private IStructuredSelection selection = null; |
| 79 |
|
| 72 |
public abstract String getFileExtension(); |
80 |
public abstract String getFileExtension(); |
| 73 |
|
81 |
|
| 74 |
public abstract String getFileNameLabel(); |
82 |
public abstract String getFileNameLabel(); |
|
Lines 188-199
Link Here
|
| 188 |
|
196 |
|
| 189 |
public FileLocationSelectionWizardpage(boolean saveLastSelected) |
197 |
public FileLocationSelectionWizardpage(boolean saveLastSelected) |
| 190 |
{ |
198 |
{ |
|
|
199 |
this(saveLastSelected, null); |
| 200 |
} |
| 201 |
|
| 202 |
public FileLocationSelectionWizardpage(boolean saveLastSelected, IStructuredSelection selection){ |
| 203 |
|
| 191 |
super(FileLocationSelectionWizardpage.class.getName()); |
204 |
super(FileLocationSelectionWizardpage.class.getName()); |
|
|
205 |
|
| 192 |
this.saveLastSelected = saveLastSelected; |
206 |
this.saveLastSelected = saveLastSelected; |
|
|
207 |
this.selection = selection; |
| 193 |
} |
208 |
} |
| 194 |
|
209 |
|
| 195 |
|
|
|
| 196 |
|
| 197 |
public void saveSettings() |
210 |
public void saveSettings() |
| 198 |
{ |
211 |
{ |
| 199 |
if (saveLastSelected) |
212 |
if (saveLastSelected) |
|
Lines 295-314
Link Here
|
| 295 |
|
308 |
|
| 296 |
TestgenUIUtility.layoutControlInGrid(fileNameLabel,1,GridData.HORIZONTAL_ALIGN_END); |
309 |
TestgenUIUtility.layoutControlInGrid(fileNameLabel,1,GridData.HORIZONTAL_ALIGN_END); |
| 297 |
TestgenUIUtility.layoutControlInGrid(selectedFileName,1,GridData.HORIZONTAL_ALIGN_FILL|GridData.GRAB_HORIZONTAL); |
310 |
TestgenUIUtility.layoutControlInGrid(selectedFileName,1,GridData.HORIZONTAL_ALIGN_FILL|GridData.GRAB_HORIZONTAL); |
|
|
311 |
|
| 298 |
autoSelectProject(); |
312 |
autoSelectProject(); |
| 299 |
|
313 |
|
| 300 |
setPageComplete(true); |
314 |
//Set focus on the file name text field if a directory has been selected and no file name has been selected: |
| 301 |
|
315 |
if((selectedContainer != null) && (selectedFileName.getText().trim().length() == 0)){ |
| 302 |
|
316 |
selectedFileName.setFocus(); |
|
|
317 |
} |
| 303 |
|
318 |
|
| 304 |
|
319 |
setPageComplete(true); |
| 305 |
} |
320 |
} |
| 306 |
catch (TestGenUIException e) |
321 |
catch (TestGenUIException e) |
| 307 |
{ |
322 |
{ |
| 308 |
e.printStackTrace(); |
323 |
UiPlugin.logError(e); |
| 309 |
} |
324 |
} |
| 310 |
|
|
|
| 311 |
|
| 312 |
} |
325 |
} |
| 313 |
|
326 |
|
| 314 |
private String getPreviouslySelectedObject(ArrayList objectList) |
327 |
private String getPreviouslySelectedObject(ArrayList objectList) |
|
Lines 421-445
Link Here
|
| 421 |
{ |
434 |
{ |
| 422 |
if (selectedContainer == null ) |
435 |
if (selectedContainer == null ) |
| 423 |
{ |
436 |
{ |
| 424 |
IProject[] projects = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getProjects(); |
437 |
|
| 425 |
IProject project = null; |
438 |
if(selection != null){ |
| 426 |
if (projects.length > 0) |
439 |
((StructuredViewer)(tree)).setSelection(selection); |
| 427 |
{ |
440 |
} |
| 428 |
int i = 0; |
441 |
else{ |
| 429 |
project = projects[0]; |
442 |
|
| 430 |
while (!project.isOpen()) |
443 |
IProject[] projects = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getProjects(); |
|
|
444 |
IProject project = null; |
| 445 |
if (projects.length > 0) |
| 431 |
{ |
446 |
{ |
| 432 |
if (++i < projects.length) |
447 |
int i = 0; |
| 433 |
project = projects[i]; |
448 |
project = projects[0]; |
| 434 |
else |
449 |
while (!project.isOpen()) |
| 435 |
{ |
450 |
{ |
| 436 |
project = projects[0]; |
451 |
if (++i < projects.length) |
| 437 |
break; |
452 |
project = projects[i]; |
| 438 |
} |
453 |
else |
| 439 |
} |
454 |
{ |
| 440 |
((StructuredViewer)tree).setSelection(new StructuredSelection(project)); |
455 |
project = projects[0]; |
|
|
456 |
break; |
| 457 |
} |
| 458 |
} |
| 459 |
((StructuredViewer)tree).setSelection(new StructuredSelection(project)); |
| 460 |
} |
| 441 |
} |
461 |
} |
| 442 |
|
|
|
| 443 |
} |
462 |
} |
| 444 |
} |
463 |
} |
| 445 |
|
464 |
|