• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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      */
configure()45     public void configure() throws CoreException {
46         // nothing to do.
47     }
48 
49     /**
50      * De-configures this nature for its project. This is called by the
51      * workspace when natures are removed from the project using
52      * <code>IProject.setDescription</code> and should not be called directly
53      * by clients. The nature extension id is removed from the list of natures
54      * before this method is called, and need not be removed here.
55      *
56      * Exceptions thrown by this method will be propagated back to the caller of
57      * <code>IProject.setDescription</code>, but the nature will still be
58      * removed from the project description.
59      *
60      * The Android nature removes the custom pre builder and APK builder.
61      *
62      * @see org.eclipse.core.resources.IProjectNature#deconfigure()
63      * @throws CoreException if configuration fails.
64      */
deconfigure()65     public void deconfigure() throws CoreException {
66         // nothing to do
67     }
68 
69     /**
70      * Returns the project to which this project nature applies.
71      *
72      * @return the project handle
73      * @see org.eclipse.core.resources.IProjectNature#getProject()
74      */
getProject()75     public IProject getProject() {
76         return mProject;
77     }
78 
79     /**
80      * Sets the project to which this nature applies. Used when instantiating
81      * this project nature runtime. This is called by
82      * <code>IProject.create()</code> or
83      * <code>IProject.setDescription()</code> and should not be called
84      * directly by clients.
85      *
86      * @param project the project to which this nature applies
87      * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
88      */
setProject(IProject project)89     public void setProject(IProject project) {
90         mProject = project;
91     }
92 }
93