PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Java | 62 lines | 21 code | 11 blank | 30 comment | 2 complexity | ce7c94789906909cdf6c3802cab180b2 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.Window;
  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. //}}}
  34. ///}}}
  35. // TODO: remove this?
  36. public class FirstWindowMatcher implements ComponentMatcher{
  37. private boolean found = false;
  38. private String title;
  39. public FirstWindowMatcher(String title){
  40. this.title = title;
  41. }
  42. public boolean matches(Component comp){
  43. if(found)return false;
  44. if(comp instanceof Window){
  45. //System.err.println("got this window : "+((JDialog)comp).getTitle());
  46. found = true;
  47. }
  48. //System.out.println("discarded:"+comp);
  49. return found;
  50. }
  51. }