Search in sources :

Example 1 with EnableNatureAction

use of org.eclipse.m2e.core.ui.internal.actions.EnableNatureAction in project sling by apache.

the class MavenProjectAdapter method convertToMavenProject.

/**
     * Converts the wrapped project to a Maven project
     * 
     * <p>It waits for for the conversion to succeed, and fails with an unchecked exception
     * if the conversion does not succeed in the allocated time.</p>
     * 
     * @throws CoreException
     * @throws InterruptedException
     */
public void convertToMavenProject() throws CoreException, InterruptedException {
    EnableNatureAction action = new EnableNatureAction();
    action.selectionChanged(null, new StructuredSelection(getProject()));
    action.run(null);
    new Poller().pollUntil(new Callable<Boolean>() {

        @Override
        public Boolean call() throws Exception {
            return getProject().hasNature(IMavenConstants.NATURE_ID);
        }
    }, CoreMatchers.equalTo(true));
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) EnableNatureAction(org.eclipse.m2e.core.ui.internal.actions.EnableNatureAction) Poller(org.apache.sling.ide.test.impl.helpers.Poller) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

Poller (org.apache.sling.ide.test.impl.helpers.Poller)1 CoreException (org.eclipse.core.runtime.CoreException)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 EnableNatureAction (org.eclipse.m2e.core.ui.internal.actions.EnableNatureAction)1