<commit_before>package org.jboss.reddeer.eclipse.condition;

import org.jboss.reddeer.eclipse.exception.EclipseLayerException;
import org.jboss.reddeer.eclipse.wst.server.ui.view.ServersView;
import org.jboss.reddeer.swt.condition.WaitCondition;

/**
 * Returns true, if there is server with specified name
 * 
 * @author <NAME>
 *
 */
public class ServerExists implements WaitCondition {

	private String name;
	
	/**
	 * Construct the condition with a given name.
	 * 
	 * @param name Name
	 */
	public ServerExists(String name) {
		this.name = name;
	}

	@Override
	public boolean test() {
		try{
			new ServersView().getServer(this.name);
			return true;
		} catch (EclipseLayerException ele){
			return false;
		}		
	}
	
	@Override<commit_msg>ServerExists condition is not calling open() on ServersView.<commit_after>package org.jboss.reddeer.eclipse.condition;

import org.jboss.reddeer.eclipse.exception.EclipseLayerException;
import org.jboss.reddeer.eclipse.wst.server.ui.view.ServersView;
import org.jboss.reddeer.swt.condition.WaitCondition;

/**
 * Returns true, if there is server with specified name
 * 
 * @author <NAME>
 *
 */
public class ServerExists implements WaitCondition {

	private String name;
	
	/**
	 * Construct the condition with a given name.
	 * 
	 * @param name Name
	 */
	public ServerExists(String name) {
		this.name = name;
	}

	@Override
	public boolean test() {
		try{
			ServersView serversView = new ServersView();
			serversView.open();
			serversView.getServer(this.name);
			return true;
		} catch (EclipseLayerException ele){
			return false;
		}		
	}
	
	@Override
{'fraction_non_alphanumeric': 0.10758706467661691, 'fraction_numerical': 0.0, 'mean_word_length': 3.8610271903323263, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5221965', 'n_tokens_mistral': 560, 'n_tokens_neox': 503, 'n_words': 124}