// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/ProjectConfigurationException.java
// public class ProjectConfigurationException extends AndroidMavenException {
// 
//     private static final long serialVersionUID = -4510508504367403748L;
// 
//     public ProjectConfigurationException(String message) {
//         super(message);
//     }
// 
//     public ProjectConfigurationException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ProjectConfigurationException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }


import java.io.IOException;
import me.gladwell.eclipse.m2e.android.configuration.ProjectConfigurationException;
import org.eclipse.andmore.AndmoreAndroidConstants;
import org.eclipse.andmore.internal.project.ProjectHelper;
import org.eclipse.andmore.internal.sdk.ProjectState;
import org.eclipse.andmore.internal.sdk.Sdk;
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.m2e.jdt.IClasspathDescriptor;
import com.android.io.StreamException;
import com.android.sdklib.internal.project.ProjectPropertiesWorkingCopy;
/*******************************************************************************
 * Copyright (c) 2015 Ricardo Gladwell
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package me.gladwell.eclipse.m2e.android.project;





public class AndmoreToolkitAdaptor extends ToolkitAdaptor {

    AndmoreToolkitAdaptor() {
        super(AndmoreAndroidConstants.NATURE_DEFAULT,
                AndmoreAndroidConstants.WS_ASSETS,
                "org.eclipse.andmore.ApkBuilder",
                AndmoreAndroidConstants.CONTAINER_PRIVATE_LIBRARIES);
    }

    @Override
    public void setAndroidProperty(IProject project, IDEAndroidProject library, String property, String value) {
        try {
            ProjectState state = Sdk.getProjectState(project);
            ProjectPropertiesWorkingCopy workingCopy = state.getProperties().makeWorkingCopy();
            workingCopy.setProperty(property, value);
            workingCopy.save();
            state.reloadProperties();
            if (library != null) {
                state.needs(Sdk.getProjectState(library.getProject()));
            }
        } catch (IOException e) {
// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/configuration/ProjectConfigurationException.java
// public class ProjectConfigurationException extends AndroidMavenException {
// 
//     private static final long serialVersionUID = -4510508504367403748L;
// 
//     public ProjectConfigurationException(String message) {
//         super(message);
//     }
// 
//     public ProjectConfigurationException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ProjectConfigurationException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }


// Path: me.gladwell.eclipse.m2e.android/src/main/java/me/gladwell/eclipse/m2e/android/project/AndmoreToolkitAdaptor.java
import java.io.IOException;
import me.gladwell.eclipse.m2e.android.configuration.ProjectConfigurationException;
import org.eclipse.andmore.AndmoreAndroidConstants;
import org.eclipse.andmore.internal.project.ProjectHelper;
import org.eclipse.andmore.internal.sdk.ProjectState;
import org.eclipse.andmore.internal.sdk.Sdk;
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.m2e.jdt.IClasspathDescriptor;
import com.android.io.StreamException;
import com.android.sdklib.internal.project.ProjectPropertiesWorkingCopy;

/*******************************************************************************
 * Copyright (c) 2015 Ricardo Gladwell
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package me.gladwell.eclipse.m2e.android.project;





public class AndmoreToolkitAdaptor extends ToolkitAdaptor {

    AndmoreToolkitAdaptor() {
        super(AndmoreAndroidConstants.NATURE_DEFAULT,
                AndmoreAndroidConstants.WS_ASSETS,
                "org.eclipse.andmore.ApkBuilder",
                AndmoreAndroidConstants.CONTAINER_PRIVATE_LIBRARIES);
    }

    @Override
    public void setAndroidProperty(IProject project, IDEAndroidProject library, String property, String value) {
        try {
            ProjectState state = Sdk.getProjectState(project);
            ProjectPropertiesWorkingCopy workingCopy = state.getProperties().makeWorkingCopy();
            workingCopy.setProperty(property, value);
            workingCopy.save();
            state.reloadProperties();
            if (library != null) {
                state.needs(Sdk.getProjectState(library.getProject()));
            }
        } catch (IOException e) {
            throw new ProjectConfigurationException(e);