FileDocCategorySizeDatePackage
FixProjectAction.javaAPI DocAndroid 1.5 API4596Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.adt.project

FixProjectAction

public class FixProjectAction extends Object implements org.eclipse.ui.IObjectActionDelegate
Action to fix the project properties:
  • Make sure the framework archive is present with the link to the java doc

Fields Summary
private org.eclipse.jface.viewers.ISelection
mSelection
Constructors Summary
Methods Summary
private voidfixProject(org.eclipse.core.resources.IProject project)

        new Job("Fix Project Properties") {

            @Override
            protected IStatus run(IProgressMonitor monitor) {
                try {
                    if (monitor != null) {
                        monitor.beginTask("Fix Project Properties", 6);
                    }

                    ProjectHelper.fixProject(project);
                    if (monitor != null) {
                        monitor.worked(1);
                    }
                    
                    // fix the nature order to have the proper project icon
                    ProjectHelper.fixProjectNatureOrder(project);
                    if (monitor != null) {
                        monitor.worked(1);
                    }

                    // now we fix the builders
                    AndroidNature.configureResourceManagerBuilder(project);
                    if (monitor != null) {
                        monitor.worked(1);
                    }

                    AndroidNature.configurePreBuilder(project);
                    if (monitor != null) {
                        monitor.worked(1);
                    }

                    AndroidNature.configureApkBuilder(project);
                    if (monitor != null) {
                        monitor.worked(1);
                    }
                    
                    return Status.OK_STATUS;
                } catch (JavaModelException e) {
                    return e.getJavaModelStatus();
                } catch (CoreException e) {
                    return e.getStatus();
                } finally {
                    if (monitor != null) {
                        monitor.done();
                    }
                }
            }
        }.schedule();
    
public voidinit(org.eclipse.ui.IWorkbenchWindow window)

see
IWorkbenchWindowActionDelegate#init

        // pass
    
public voidrun(org.eclipse.jface.action.IAction action)

        if (mSelection instanceof IStructuredSelection) {

            for (Iterator<?> it = ((IStructuredSelection) mSelection).iterator();
                    it.hasNext();) {
                Object element = it.next();
                IProject project = null;
                if (element instanceof IProject) {
                    project = (IProject) element;
                } else if (element instanceof IAdaptable) {
                    project = (IProject) ((IAdaptable) element)
                            .getAdapter(IProject.class);
                }
                if (project != null) {
                    fixProject(project);
                }
            }
        }
    
public voidselectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection)

        this.mSelection = selection;
    
public voidsetActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart)

see
IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)