12fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet/* 22fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Copyright (C) 2010 The Android Open Source Project 32fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 42fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 52fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * you may not use this file except in compliance with the License. 62fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * You may obtain a copy of the License at 72fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 82fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * http://www.eclipse.org/org/documents/epl-v10.php 92fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 102fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Unless required by applicable law or agreed to in writing, software 112fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * distributed under the License is distributed on an "AS IS" BASIS, 122fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 132fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * See the License for the specific language governing permissions and 142fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * limitations under the License. 152fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet */ 162fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet 172fddcee1455c71f406f83776d408387369c9578aXavier Ducrohetpackage com.android.ide.eclipse.adt.internal.project; 182fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet 192fddcee1455c71f406f83776d408387369c9578aXavier Ducrohetimport org.eclipse.core.resources.IProject; 202fddcee1455c71f406f83776d408387369c9578aXavier Ducrohetimport org.eclipse.core.resources.IProjectNature; 212fddcee1455c71f406f83776d408387369c9578aXavier Ducrohetimport org.eclipse.core.runtime.CoreException; 222fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet 232fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet/** 242fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Project nature for the Android Export Projects. 252fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet */ 262fddcee1455c71f406f83776d408387369c9578aXavier Ducrohetpublic class AndroidExportNature implements IProjectNature { 272fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet 282fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet /** the project this nature object is associated with */ 292fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet private IProject mProject; 302fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet 312fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet /** 322fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Configures this nature for its project. This is called by the workspace 332fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * when natures are added to the project using 342fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * <code>IProject.setDescription</code> and should not be called directly 352fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * by clients. The nature extension id is added to the list of natures 362fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * before this method is called, and need not be added here. 372fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 382fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Exceptions thrown by this method will be propagated back to the caller of 392fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * <code>IProject.setDescription</code>, but the nature will remain in 402fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * the project description. 412fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 422fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * @see org.eclipse.core.resources.IProjectNature#configure() 432fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * @throws CoreException if configuration fails. 442fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet */ 45ab36f4e7488358dea4ab6b54ee2b7bef3da0232bTor Norbye @Override 462fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet public void configure() throws CoreException { 472fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet // nothing to do. 482fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet } 492fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet 502fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet /** 512fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * De-configures this nature for its project. This is called by the 522fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * workspace when natures are removed from the project using 532fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * <code>IProject.setDescription</code> and should not be called directly 542fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * by clients. The nature extension id is removed from the list of natures 552fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * before this method is called, and need not be removed here. 562fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 572fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Exceptions thrown by this method will be propagated back to the caller of 582fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * <code>IProject.setDescription</code>, but the nature will still be 592fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * removed from the project description. 602fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 612fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * The Android nature removes the custom pre builder and APK builder. 622fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 632fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * @see org.eclipse.core.resources.IProjectNature#deconfigure() 642fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * @throws CoreException if configuration fails. 652fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet */ 66ab36f4e7488358dea4ab6b54ee2b7bef3da0232bTor Norbye @Override 672fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet public void deconfigure() throws CoreException { 682fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet // nothing to do 692fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet } 702fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet 712fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet /** 722fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Returns the project to which this project nature applies. 732fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 742fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * @return the project handle 752fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * @see org.eclipse.core.resources.IProjectNature#getProject() 762fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet */ 77ab36f4e7488358dea4ab6b54ee2b7bef3da0232bTor Norbye @Override 782fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet public IProject getProject() { 792fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet return mProject; 802fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet } 812fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet 822fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet /** 832fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * Sets the project to which this nature applies. Used when instantiating 842fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * this project nature runtime. This is called by 852fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * <code>IProject.create()</code> or 862fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * <code>IProject.setDescription()</code> and should not be called 872fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * directly by clients. 882fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * 892fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * @param project the project to which this nature applies 902fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject) 912fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet */ 92ab36f4e7488358dea4ab6b54ee2b7bef3da0232bTor Norbye @Override 932fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet public void setProject(IProject project) { 942fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet mProject = project; 952fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet } 962fddcee1455c71f406f83776d408387369c9578aXavier Ducrohet} 97