01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.core;
11:
12: import org.eclipse.core.resources.IFile;
13:
14: /**
15: * Classes that implement this interface are responsible for holding a table of
16: * models associated with the underlying objects. They have several
17: * responsibilities:
18: * <ul>
19: * <li>To hold model objects in one place
20: * <li>To allow requesters to connect to the models or to disconnect from them.
21: * <li>To notify interested parties when models are added and removed.
22: * </ul>
23: * Model providers are responsible for listening to the workspace, updating
24: * models whose underlying resources have been updated, and removing them from
25: * the table when those resources have been deleted.
26: *
27: * @since 2.0
28: */
29: public interface IModelProvider {
30: /**
31: * Registers a listener that will be notified about changes in the managed
32: * models.
33: *
34: * @param listener
35: * the listener that will be registered
36: */
37: void addModelProviderListener(IModelProviderListener listener);
38:
39: /**
40: * Returns the model for the provided file resource.
41: *
42: * @param file
43: * the file resource we need the model for
44: * @return the object that represents a structured representation of the
45: * file content
46: */
47: public IModel getModel(IFile file);
48:
49: /**
50: * Deregisters a listener from notification.
51: *
52: * @param listener
53: * the listener to be deregistered
54: */
55: void removeModelProviderListener(IModelProviderListener listener);
56: }
|