413
414
415 TestSuite ts = ip.getTestSuite();
416 if (ts == null) {
417 return null;
418 }
419
420 ExecTool et = new ExecTool(this, ts);
421 // it's better to rely on config.restore(m) although...
422 // may in be in the next life...
423 et.update(ip.getWorkDirectory());
424 et.update(ip);
425 et.restore(m);
426 return et;
427 */
428 } catch (Exception e) {
429 throw new Fault(i18n, "mgr.restoreFaultWD", e.getMessage());
430 }
431 }
432
433 private static InterviewParameters getInterview(Map m) throws Interview.Fault {
434 String tsp = (String) (m.get("testSuite"));
435 String wdp = (String) (m.get("workDir"));
436 String cfp = (String) (m.get("config"));
437 if (isEmpty(tsp) && isEmpty(wdp) && isEmpty(cfp))
438 return null;
439
440 return InterviewParameters.open(tsp, wdp, cfp);
441 }
442 private static boolean isEmpty(String s) {
443 return (s == null || s.length() == 0);
444 }
445
446 //-------------------------------------------------------------------------
447
448 /**
449 * Create an ExecTool instance using the given test suite.
450 * @param ts the test suite to seed the new tool with
451 * @return tool instance now associated with the given test suite
452 * @throws Interview.Fault if there is a problem initializing
453 * the test suite interview parameters
454 * @throws TestSuite.Fault if there is a problem while accessing the test
455 * suite object
456 * @deprecated
511 * @param wd the work directory to open
512 * @return tool instance now associated with the given work directory
513 * @throws Interview.Fault if there is a problem initializing
514 * the test suite interview parameters
515 * @throws TestSuite.Fault if there is a problem while accessing the test
516 * suite object
517 * @deprecated
518 */
519 @Deprecated
520 public ExecTool showWorkDirectory(WorkDirectory wd)
521 throws InterviewParameters.Fault, TestSuite.Fault
522 {
523 return addNewExecTool(wd.getTestSuite(), wd, null, "tmgr.errorOpenWorkDir");
524 }
525
526 void addToFileHistory(WorkDirectory wd) {
527 getDesktop().addToFileHistory(wd.getRoot(), workDirOpener);
528 }
529
530 void showError(String key) {
531 showError(key, (Object[]) null);
532 }
533
534 void showError(String key, Object arg) {
535 showError(key, new Object[] { arg });
536 }
537
538 void showError(String key, Object[] args) {
539 getUIF().showError(key, args);
540 }
541
542 int showCloseQuestion() {
543 return getUIF().showYesNoDialog("tse.closeCurrent");
544 }
545
546
547 UIFactory getUIF() {
548 if (uif == null)
549 uif = new UIFactory(getClass(), getDesktop().getDialogParent(), getDesktop().getHelpBroker());
550 return uif;
551 }
|
413
414
415 TestSuite ts = ip.getTestSuite();
416 if (ts == null) {
417 return null;
418 }
419
420 ExecTool et = new ExecTool(this, ts);
421 // it's better to rely on config.restore(m) although...
422 // may in be in the next life...
423 et.update(ip.getWorkDirectory());
424 et.update(ip);
425 et.restore(m);
426 return et;
427 */
428 } catch (Exception e) {
429 throw new Fault(i18n, "mgr.restoreFaultWD", e.getMessage());
430 }
431 }
432
433 private static InterviewParameters getInterview(Map<String, String> m) throws Interview.Fault {
434 String tsp = (m.get("testSuite"));
435 String wdp = (m.get("workDir"));
436 String cfp = (m.get("config"));
437 if (isEmpty(tsp) && isEmpty(wdp) && isEmpty(cfp))
438 return null;
439
440 return InterviewParameters.open(tsp, wdp, cfp);
441 }
442 private static boolean isEmpty(String s) {
443 return (s == null || s.length() == 0);
444 }
445
446 //-------------------------------------------------------------------------
447
448 /**
449 * Create an ExecTool instance using the given test suite.
450 * @param ts the test suite to seed the new tool with
451 * @return tool instance now associated with the given test suite
452 * @throws Interview.Fault if there is a problem initializing
453 * the test suite interview parameters
454 * @throws TestSuite.Fault if there is a problem while accessing the test
455 * suite object
456 * @deprecated
511 * @param wd the work directory to open
512 * @return tool instance now associated with the given work directory
513 * @throws Interview.Fault if there is a problem initializing
514 * the test suite interview parameters
515 * @throws TestSuite.Fault if there is a problem while accessing the test
516 * suite object
517 * @deprecated
518 */
519 @Deprecated
520 public ExecTool showWorkDirectory(WorkDirectory wd)
521 throws InterviewParameters.Fault, TestSuite.Fault
522 {
523 return addNewExecTool(wd.getTestSuite(), wd, null, "tmgr.errorOpenWorkDir");
524 }
525
526 void addToFileHistory(WorkDirectory wd) {
527 getDesktop().addToFileHistory(wd.getRoot(), workDirOpener);
528 }
529
530 void showError(String key) {
531 showError(key, null);
532 }
533
534 void showError(String key, Object arg) {
535 showError(key, new Object[] { arg });
536 }
537
538 void showError(String key, Object[] args) {
539 getUIF().showError(key, args);
540 }
541
542 int showCloseQuestion() {
543 return getUIF().showYesNoDialog("tse.closeCurrent");
544 }
545
546
547 UIFactory getUIF() {
548 if (uif == null)
549 uif = new UIFactory(getClass(), getDesktop().getDialogParent(), getDesktop().getHelpBroker());
550 return uif;
551 }
|