From e8c2e45481cf16d91184dda8abe9480ae7e4c35a Mon Sep 17 00:00:00 2001 From: David Inglis Date: Wed, 12 May 2004 18:25:57 +0000 Subject: [PATCH] added method to initializer to allow some forms for editing the entries in a container ie source attribute of lib --- .../model/PathEntryContainerInitializer.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/PathEntryContainerInitializer.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/PathEntryContainerInitializer.java index 8c70268070d..a5b65bbeec6 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/PathEntryContainerInitializer.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/PathEntryContainerInitializer.java @@ -28,6 +28,48 @@ public abstract class PathEntryContainerInitializer { public abstract void initialize(IPath containerPath, ICProject project) throws CoreException; + /** + * Returns true if this container initializer can be requested to perform updates + * on its own container values. If so, then an update request will be performed using + * PathEntryContainerInitializer#requestPathEntryContainerUpdate/ + *

+ * @param containerPath the path of the container which requires to be updated + * @param project the project for which the container is to be updated + * @return returns true if the container can be updated + */ + public boolean canUpdatePathEntryContainer(IPath containerPath, ICProject project) { + + // By default, path container initializers do not accept updating containers + return false; + } + + /** + * Request a registered container definition to be updated according to a container suggestion. The container suggestion + * only acts as a place-holder to pass along the information to update the matching container definition(s) held by the + * container initializer. In particular, it is not expected to store the container suggestion as is, but rather adjust + * the actual container definition based on suggested changes. + *

+ * IMPORTANT: In reaction to receiving an update request, a container initializer will update the corresponding + * container definition (after reconciling changes) at its earliest convenience, using + * CoreModel#setPathContainer(IPath, ICProject[], IPathEntryContainer[], IProgressMonitor). + * Until it does so, the update will not be reflected in the Java Model. + *

+ * In order to anticipate whether the container initializer allows to update its containers, the predicate + * PathEntryContainerInitializer#canUpdatePathEntryContainer should be used. + *

+ * @param containerPath the path of the container which requires to be updated + * @param project the project for which the container is to be updated + * @param containerSuggestion a suggestion to update the corresponding container definition + * @throws CoreException when CoreModel#setPathEntryContainer would throw any. + * @see CoreModel#setPathEntryContainer(IPath, ICProject[], IPathEntryContainer[], org.eclipse.core.runtime.IProgressMonitor) + * @see PathContainerInitializer#canUpdatePathContainer(IPath, ICProject) + */ + public void requestClasspathContainerUpdate(IPath containerPath, ICProject project, IPathEntryContainer containerSuggestion) throws CoreException { + + // By default, path container initializers do not accept updating containers + } + + public String getDescription(IPath containerPath, ICProject project) { // By default, a container path is the only available description return containerPath.makeRelative().toString();