PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms 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
 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
23package org.gjt.sp.jedit.testframework;
24
25
26//{{{ Imports
27
28import java.awt.Window;
29import java.awt.Component;
30
31
32//{{{	junit
33import org.junit.*;
34import static org.junit.Assert.*;
35//}}}
36
37//{{{	FEST...
38import org.fest.swing.fixture.*;
39import org.fest.swing.core.*;
40//}}}
41
42///}}}
43
44// TODO: remove this?
45public class FirstWindowMatcher implements ComponentMatcher{
46	private boolean found = false;
47	private String title;
48
49	public FirstWindowMatcher(String title){
50		this.title = title;
51	}
52
53	public boolean matches(Component comp){
54		if(found)return false;
55		if(comp instanceof Window){
56			//System.err.println("got this window : "+((JDialog)comp).getTitle());
57			found = true;
58		}
59		//System.out.println("discarded:"+comp);
60		return found;
61	}
62}