1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.core.resources; 12 13 import org.eclipse.core.runtime.CoreException; 14 15 /** 16 * Interface for project nature runtime classes. 17 * It can configure a project with the project nature, or de-configure it. 18 * When a project is configured with a project nature, this is 19 * recorded in the list of project natures on the project. 20 * Individual project natures may expose a more specific runtime type, 21 * with additional API for manipulating the project in a 22 * nature-specific way. 23 * <p> 24 * Clients may implement this interface. 25 * </p> 26 * 27 * @see IProject#getNature(String) 28 * @see IProject#hasNature(String) 29 * @see IProjectDescription#getNatureIds() 30 * @see IProjectDescription#hasNature(String) 31 * @see IProjectDescription#setNatureIds(String[]) 32 */ 33 public interface IProjectNature { 34 /** 35 * Configures this nature for its project. This is called by the workspace 36 * when natures are added to the project using <code>IProject.setDescription</code> 37 * and should not be called directly by clients. The nature extension 38 * id is added to the list of natures before this method is called, 39 * and need not be added here. 40 * 41 * Exceptions thrown by this method will be propagated back to the caller 42 * of <code>IProject.setDescription</code>, but the nature will remain in 43 * the project description. 44 * 45 * @exception CoreException if this method fails. 46 */ 47 public void configure() throws CoreException; 48 49 /** 50 * De-configures this nature for its project. This is called by the workspace 51 * when natures are removed from the project using 52 * <code>IProject.setDescription</code> and should not be called directly by 53 * clients. The nature extension id is removed from the list of natures before 54 * this method is called, and need not be removed here. 55 * 56 * Exceptions thrown by this method will be propagated back to the caller 57 * of <code>IProject.setDescription</code>, but the nature will still be 58 * removed from the project description. 59 * * 60 * @exception CoreException if this method fails. 61 */ 62 public void deconfigure() throws CoreException; 63 64 /** 65 * Returns the project to which this project nature applies. 66 * 67 * @return the project handle 68 */ 69 public IProject getProject(); 70 71 /** 72 * Sets the project to which this nature applies. 73 * Used when instantiating this project nature runtime. 74 * This is called by <code>IProject.create()</code> or 75 * <code>IProject.setDescription()</code> 76 * and should not be called directly by clients. 77 * 78 * @param project the project to which this nature applies 79 */ 80 public void setProject(IProject project); 81 } 82