001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.pde.core.plugin;
011:
012: import java.net.URL;
013:
014: import org.eclipse.osgi.service.resolver.BundleDescription;
015: import org.eclipse.pde.core.IModelChangeProvider;
016: import org.eclipse.pde.core.build.IBuildModel;
017:
018: /**
019: * This type of model is created by parsing the manifest file.
020: * It serves as a base interface for both plug-in and
021: * fragment models by holding data common to both.
022: * If the file is a workspace resource, it will be
023: * available as the underlying resource of the model.
024: * The model may be read-only or editable.
025: * It will also make a reference to the build.properties
026: * model when created. The reference will be of the
027: * same type as the model itself: if the model is
028: * editable, it will attempt to obtain an exclusive
029: * editable copy of build.properties model.
030: * <p>
031: * The plug-in model can be disabled. Disabling the
032: * model will not change its data. Users of the
033: * model will have to decide if the disabled state
034: * if of any importance to them or not.
035: * <p>
036: * The model is capable of notifying listeners
037: * about changes. An attempt to change a read-only
038: * model will result in a CoreException.
039: */
040: public interface IPluginModelBase extends ISharedExtensionsModel,
041: IModelChangeProvider {
042: /**
043: * Creates and return a top-level plugin model object
044: *
045: * @return a top-level model object representing a plug-in or a fragment.
046: */
047: IPluginBase createPluginBase();
048:
049: /**
050: * Returns an associated build.properties model
051: * that works in conjunction with this model.
052: *
053: * @return the matching plugin.jars model
054: */
055: IBuildModel getBuildModel();
056:
057: /**
058: * Returns a top-level model object. Equivalent to
059: * calling <pre>getPluginBase(true)</pre>.
060: *
061: * @return a top-level model object representing a plug-in or a fragment.
062: */
063: IPluginBase getPluginBase();
064:
065: /**
066: * Returns a top-level model object.
067: *
068: * @param createIfMissing if true, root model object will
069: * be created if not defined.
070: *
071: * @return a top-level model object
072: */
073: IPluginBase getPluginBase(boolean createIfMissing);
074:
075: /**
076: * Returns </samp>true</samp> if this model is currently enabled.
077: *
078: *@return true if the model is enabled
079: */
080: boolean isEnabled();
081:
082: /**
083: * Tests if this model is for the plug-in fragment.
084: *
085: * @return <code>true</code> if the model is for the fragment,
086: * <code>false</code> otherwise.
087: */
088: boolean isFragmentModel();
089:
090: /**
091: * Sets the enable state of the model.
092: *
093: * @param enabled the new enable state
094: */
095: void setEnabled(boolean enabled);
096:
097: /**
098: * Returns the factory that can be used to
099: * create new objects for this model
100: * @return the plug-in model factory
101: */
102: IPluginModelFactory getPluginFactory();
103:
104: /**
105: * Returns the location where property file containing
106: * translations of names in this model can be found.
107: *
108: * @return the location of the property file with translations
109: */
110: URL getNLLookupLocation();
111:
112: /**
113: * Returns the bundle description of the plug-in
114: * in case the plug-in uses the new OSGi bundle layout.
115: *
116: * @return bundle description if this is an OSGi plug-in,
117: * or <code>null</code> if the plug-in is in a classic
118: * format.
119: *
120: * @since 3.0
121: */
122: BundleDescription getBundleDescription();
123:
124: /**
125: * Associates the bundle description of the plug-in
126: * with this model in case the plug-in uses the new
127: * OSGi bundle layout.
128: *
129: * @param description bundle description to associate
130: * with this model
131: *
132: * @since 3.0
133: */
134: void setBundleDescription(BundleDescription description);
135: }
|