// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/handler/AddBuilder.java
// public class AddBuilder extends AbstractHandler implements IHandler {
// 
// 	@Override
// 	public Object execute(final ExecutionEvent event) {
// 		final IProject project = getProject(event);
// 
// 		if (project != null) {
// 			try {
// 				// verify already registered builders
// 				if (hasBuilder(project))
// 					// already enabled
// 					return null;
// 
// 				// add builder to project properties
// 				IProjectDescription description = project.getDescription();
// 				final ICommand buildCommand = description.newCommand();
// 				buildCommand.setBuilderName(SolidityBuilder.BUILDER_ID);
// 
// 				final List<ICommand> commands = new ArrayList<ICommand>();
// 				commands.addAll(Arrays.asList(description.getBuildSpec()));
// 				commands.add(buildCommand);
// 
// 				description.setBuildSpec(commands.toArray(new ICommand[commands.size()]));
// 				project.setDescription(description, null);
// 
// 			} catch (final CoreException e) {
// 				Activator.logError("Error adding solc builder", e);
// 			}
// 		}
// 		return null;
// 	}
// 
// 	public static IProject getProject(final ExecutionEvent event) {
// 		final ISelection selection = HandlerUtil.getCurrentSelection(event);
// 		if (selection instanceof IStructuredSelection) {
// 			final Object element = ((IStructuredSelection) selection).getFirstElement();
// 
// 			return (IProject) Platform.getAdapterManager().getAdapter(element, IProject.class);
// 		}
// 		return null;
// 	}
// 
// 	public static final boolean hasBuilder(final IProject project) {
// 		try {
// 			for (final ICommand buildSpec : project.getDescription().getBuildSpec()) {
// 				if (SolidityBuilder.BUILDER_ID.equals(buildSpec.getBuilderName()))
// 					return true;
// 			}
// 		} catch (final CoreException e) {
// 		}
// 		return false;
// 	}
// }


import de.urszeidler.eclipse.solidity.compiler.handler.AddBuilder;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Platform;
/**
 * 
 */
package de.urszeidler.eclipse.solidity.compiler.propertytester;



/**
 * @author urs
 *
 */
public class HasBuilderTester extends PropertyTester {
	private static final String IS_ENABLED = "isEnabled";

	/*
	 * (non-Javadoc)
	 * 
	 * @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) {
		if (IS_ENABLED.equals(property)) {
// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/handler/AddBuilder.java
// public class AddBuilder extends AbstractHandler implements IHandler {
// 
// 	@Override
// 	public Object execute(final ExecutionEvent event) {
// 		final IProject project = getProject(event);
// 
// 		if (project != null) {
// 			try {
// 				// verify already registered builders
// 				if (hasBuilder(project))
// 					// already enabled
// 					return null;
// 
// 				// add builder to project properties
// 				IProjectDescription description = project.getDescription();
// 				final ICommand buildCommand = description.newCommand();
// 				buildCommand.setBuilderName(SolidityBuilder.BUILDER_ID);
// 
// 				final List<ICommand> commands = new ArrayList<ICommand>();
// 				commands.addAll(Arrays.asList(description.getBuildSpec()));
// 				commands.add(buildCommand);
// 
// 				description.setBuildSpec(commands.toArray(new ICommand[commands.size()]));
// 				project.setDescription(description, null);
// 
// 			} catch (final CoreException e) {
// 				Activator.logError("Error adding solc builder", e);
// 			}
// 		}
// 		return null;
// 	}
// 
// 	public static IProject getProject(final ExecutionEvent event) {
// 		final ISelection selection = HandlerUtil.getCurrentSelection(event);
// 		if (selection instanceof IStructuredSelection) {
// 			final Object element = ((IStructuredSelection) selection).getFirstElement();
// 
// 			return (IProject) Platform.getAdapterManager().getAdapter(element, IProject.class);
// 		}
// 		return null;
// 	}
// 
// 	public static final boolean hasBuilder(final IProject project) {
// 		try {
// 			for (final ICommand buildSpec : project.getDescription().getBuildSpec()) {
// 				if (SolidityBuilder.BUILDER_ID.equals(buildSpec.getBuilderName()))
// 					return true;
// 			}
// 		} catch (final CoreException e) {
// 		}
// 		return false;
// 	}
// }


// Path: de.urszeidler.eclipse.solidity.compiler.support/src/de/urszeidler/eclipse/solidity/compiler/propertytester/HasBuilderTester.java
import de.urszeidler.eclipse.solidity.compiler.handler.AddBuilder;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Platform;

/**
 * 
 */
package de.urszeidler.eclipse.solidity.compiler.propertytester;



/**
 * @author urs
 *
 */
public class HasBuilderTester extends PropertyTester {
	private static final String IS_ENABLED = "isEnabled";

	/*
	 * (non-Javadoc)
	 * 
	 * @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) {
		if (IS_ENABLED.equals(property)) {
			final IProject project = (IProject) Platform.getAdapterManager().getAdapter(receiver, IProject.class);