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 org.eclipse.core.runtime.CoreException;
013: import org.eclipse.core.runtime.IAdaptable;
014: import org.eclipse.pde.core.IWritable;
015:
016: /**
017: * A base interface for all the objects in the plug-in model.
018: */
019: public interface IPluginObject extends IWritable, IAdaptable {
020: /**
021: * A property name that will be used to notify
022: * that the "name" field has changed.
023: */
024: String P_NAME = "name"; //$NON-NLS-1$
025:
026: /**
027: * Returns the model that owns this object.
028: * @return the model instance
029: */
030: ISharedPluginModel getModel();
031:
032: /**
033: * Returns the model that owns this object.
034: * @return the model instance
035: */
036: IPluginModelBase getPluginModel();
037:
038: /**
039: * Returns the name of this model object
040: *@return the object name
041: */
042: String getName();
043:
044: /**
045: * Returns true if this object is currently part of a model.
046: * It is useful to ignore modification events of objects
047: * that have not yet being added to the model or if they
048: * have been removed.
049: */
050: boolean isInTheModel();
051:
052: /**
053: * Set the value indicating whether the object is currently part of a model.
054: * It is useful to ignore modification events of objects
055: * that have not yet being added to the model or if they
056: * have been removed.
057: */
058: void setInTheModel(boolean inModel);
059:
060: /**
061: * Returns the translated name of this model object using
062: * the result of 'getName()' call as a resource key.
063: * @return the translated name or the original name if not found
064: */
065: String getTranslatedName();
066:
067: /**
068: * Returns the parent of this model object.
069: *
070: * @return the object's parent
071: */
072: IPluginObject getParent();
073:
074: /**
075: * Returns the top-level model object.
076: *
077: * @return the top-level model object
078: */
079: IPluginBase getPluginBase();
080:
081: /**
082: * Returns a string by locating the provided
083: * key in the resource bundle associated with
084: * the model.
085: *
086: * @param key the name to use for resource bundle lookup
087: * @return value in the resource bundle for
088: * the provided key, or the key itself if
089: * not found.
090: */
091: String getResourceString(String key);
092:
093: /**
094: * Chances the name of this model object.
095: * This method may throw a CoreException
096: * if the model is not editable.
097: *
098: * @param name the new object name
099: */
100: void setName(String name) throws CoreException;
101:
102: /**
103: * Returns <samp>true</samp> if this object has all
104: * the required attributes set, <samp>false</samp> otherwise.
105: * @return <samp>true</samp> if all the required attributes are set.
106: */
107: boolean isValid();
108: }
|