1 /******************************************************************************* 2 * Copyright (c) 2005, 2006 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.mapping; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.core.runtime.IProgressMonitor; 16 17 /** 18 * A model provider descriptor contains information about a model provider 19 * obtained from the plug-in manifest (<code>plugin.xml</code>) file. 20 * <p> 21 * Model provider descriptors are platform-defined objects that exist 22 * independent of whether that model provider's plug-in has been started. 23 * In contrast, a model provider's runtime object (<code>ModelProvider</code>) 24 * generally runs plug-in-defined code. 25 * </p> 26 * <p> 27 * This interface is not intended to be implemented by clients. 28 * </p> 29 * 30 * @see org.eclipse.core.resources.mapping.ModelProvider 31 * @since 3.2 32 */ 33 public interface IModelProviderDescriptor { 34 35 /** 36 * Return the ids of model providers that this model provider extends. 37 * @return the ids of model providers that this model provider extends 38 */ 39 public String[] getExtendedModels(); 40 41 /** 42 * Returns the unique identifier of this model provider. 43 * <p> 44 * The model provider identifier is composed of the model provider's 45 * plug-in id and the simple id of the provider extension. For example, if 46 * plug-in <code>"com.xyz"</code> defines a provider extension with id 47 * <code>"myModelProvider"</code>, the unique model provider identifier will be 48 * <code>"com.xyz.myModelProvider"</code>. 49 * </p> 50 * 51 * @return the unique model provider identifier 52 */ 53 public String getId(); 54 55 /** 56 * Returns a displayable label for this model provider. 57 * Returns the empty string if no label for this provider 58 * is specified in the plug-in manifest file. 59 * <p> Note that any translation specified in the plug-in manifest 60 * file is automatically applied. 61 * </p> 62 * 63 * @return a displayable string label for this model provider, 64 * possibly the empty string 65 */ 66 public String getLabel(); 67 68 /** 69 * From the provides set of resources, return those that match the enablement 70 * rule specified for the model provider descriptor. The resource mappings 71 * for the returned resources can then be obtained by invoking 72 * {@link ModelProvider#getMappings(IResource[], ResourceMappingContext, IProgressMonitor)} 73 * 74 * @param resources the resources 75 * @return the resources that match the descriptor's enablement rule 76 */ 77 public IResource[] getMatchingResources(IResource[] resources) throws CoreException; 78 79 /** 80 * Return the set of traversals that overlap with the resources that 81 * this descriptor matches. 82 * 83 * @param traversals the traversals being tested 84 * @return the subset of these traversals that overlap with the resources 85 * that match this descriptor 86 * @throws CoreException 87 */ 88 public ResourceTraversal[] getMatchingTraversals(ResourceTraversal[] traversals) throws CoreException; 89 90 /** 91 * Return the model provider for this descriptor, instantiating it if it is 92 * the first time the method is called. 93 * 94 * @return the model provider for this descriptor 95 * @exception CoreException if the model provider could not be instantiated for 96 * some reason 97 */ 98 public ModelProvider getModelProvider() throws CoreException; 99 } 100