Home | History | Annotate | Download | only in project
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ide.eclipse.adt.internal.project;
     18 
     19 import org.eclipse.core.resources.IProject;
     20 import org.eclipse.core.resources.IProjectNature;
     21 import org.eclipse.core.runtime.CoreException;
     22 
     23 /**
     24  * Project nature for the Android Export Projects.
     25  */
     26 public class AndroidExportNature implements IProjectNature {
     27 
     28     /** the project this nature object is associated with */
     29     private IProject mProject;
     30 
     31     /**
     32      * Configures this nature for its project. This is called by the workspace
     33      * when natures are added to the project using
     34      * <code>IProject.setDescription</code> and should not be called directly
     35      * by clients. The nature extension id is added to the list of natures
     36      * before this method is called, and need not be added here.
     37      *
     38      * Exceptions thrown by this method will be propagated back to the caller of
     39      * <code>IProject.setDescription</code>, but the nature will remain in
     40      * the project description.
     41      *
     42      * @see org.eclipse.core.resources.IProjectNature#configure()
     43      * @throws CoreException if configuration fails.
     44      */
     45     @Override
     46     public void configure() throws CoreException {
     47         // nothing to do.
     48     }
     49 
     50     /**
     51      * De-configures this nature for its project. This is called by the
     52      * workspace when natures are removed from the project using
     53      * <code>IProject.setDescription</code> and should not be called directly
     54      * by clients. The nature extension id is removed from the list of natures
     55      * before this method is called, and need not be removed here.
     56      *
     57      * Exceptions thrown by this method will be propagated back to the caller of
     58      * <code>IProject.setDescription</code>, but the nature will still be
     59      * removed from the project description.
     60      *
     61      * The Android nature removes the custom pre builder and APK builder.
     62      *
     63      * @see org.eclipse.core.resources.IProjectNature#deconfigure()
     64      * @throws CoreException if configuration fails.
     65      */
     66     @Override
     67     public void deconfigure() throws CoreException {
     68         // nothing to do
     69     }
     70 
     71     /**
     72      * Returns the project to which this project nature applies.
     73      *
     74      * @return the project handle
     75      * @see org.eclipse.core.resources.IProjectNature#getProject()
     76      */
     77     @Override
     78     public IProject getProject() {
     79         return mProject;
     80     }
     81 
     82     /**
     83      * Sets the project to which this nature applies. Used when instantiating
     84      * this project nature runtime. This is called by
     85      * <code>IProject.create()</code> or
     86      * <code>IProject.setDescription()</code> and should not be called
     87      * directly by clients.
     88      *
     89      * @param project the project to which this nature applies
     90      * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
     91      */
     92     @Override
     93     public void setProject(IProject project) {
     94         mProject = project;
     95     }
     96 }
     97