PageRenderTime 1508ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/Fest/src/org/gjt/sp/jedit/testframework/FirstDialogMatcher.java

#
Java | 63 lines | 22 code | 12 blank | 29 comment | 3 complexity | a169919e4783110d57053edd98458978 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /*
  2. * $Revision: 12869 $
  3. * $Date: 2008-06-21 10:02:28 -0600 (Sat, 21 Jun 2008) $
  4. * $Author: kerik-sf $
  5. *
  6. * Copyright (C) 2008 Eric Le Lay
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. package org.gjt.sp.jedit.testframework;
  23. //{{{ Imports
  24. import java.awt.Dialog;
  25. import java.awt.Component;
  26. //{{{ junit
  27. import org.junit.*;
  28. import static org.junit.Assert.*;
  29. //}}}
  30. //{{{ FEST...
  31. import org.fest.swing.fixture.*;
  32. import org.fest.swing.core.*;
  33. import org.fest.swing.finder.WindowFinder;
  34. //}}}
  35. ///}}}
  36. public class FirstDialogMatcher implements ComponentMatcher{
  37. private boolean found = false;
  38. private String title;
  39. public FirstDialogMatcher(String title){
  40. this.title = title;
  41. }
  42. public boolean matches(Component comp){
  43. if(found)return false;
  44. if(comp instanceof Dialog && comp.isVisible()){
  45. //System.err.println("got this window : "+((JDialog)comp).getTitle());
  46. found = title.equals(((Dialog)comp).getTitle());
  47. }
  48. //System.out.println("discarded:"+comp);
  49. return found;
  50. }
  51. }