blob: 83460541904012200adfd800f45e0d10c3812e38 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Eugen Neufeld - initial API and implementation
******************************************************************************/
package org.eclipse.emf.ecp.ui.tester;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.emf.ecp.core.ECPProvider;
import org.eclipse.emf.ecp.core.util.ECPUtil;
/**
* Tests, whether repositories can be added. This is the case if there is at least one provider installed, which allows
* to create repositories.
*
* @author Jonas
*
*/
public class CanAddRepositoriesTester extends PropertyTester {
/**
*
* {@inheritDoc}
*
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[],
* java.lang.Object)
*/
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
for (final ECPProvider provider : ECPUtil.getECPProviderRegistry().getProviders()) {
if (provider.hasCreateRepositorySupport()) {
return expectedValue.equals(true);
}
}
return expectedValue.equals(false);
}
}