View | Details | Raw Unified | Return to bug 168077 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/core/ClasspathContainerInitializer.java (-1 / +64 lines)
Lines 19-24 Link Here
19
19
20
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IPath;
21
import org.eclipse.core.runtime.IPath;
22
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.Status;
24
import org.eclipse.jdt.internal.core.JavaModelStatus;
22
25
23
/**
26
/**
24
 * Abstract base implementation of all classpath container initializer.
27
 * Abstract base implementation of all classpath container initializer.
Lines 43-55 Link Here
43
 */
46
 */
44
public abstract class ClasspathContainerInitializer {
47
public abstract class ClasspathContainerInitializer {
45
	
48
	
46
   /**
49
	public static final int ATTRIBUTE_NOT_SUPPORTED= 1;
50
	public static final int ATTRIBUTE_NOT_MODIFIABLE= 2;
51
	public static final int INVALID_VALUE= 3;
52
53
/**
47
     * Creates a new classpath container initializer.
54
     * Creates a new classpath container initializer.
48
     */
55
     */
49
    public ClasspathContainerInitializer() {
56
    public ClasspathContainerInitializer() {
50
    	// a classpath container initializer must have a public 0-argument constructor
57
    	// a classpath container initializer must have a public 0-argument constructor
51
    }
58
    }
52
59
60
	/**
61
	 * Return whether attributes of a given classpath container classpath entry
62
	 * can be modified or not.
63
	 * <p>
64
	 * The returned status is {@link IStatus#isOK()} if the attributes
65
	 * are supported, modifiable and optionally have a valid value.<br>
66
	 * Otherwise (i.e. if {@link IStatus#ERROR} is returned), then the
67
	 * {@link IStatus#getCode()} can have one of the following value:
68
	 * <ul>
69
	 * <li>{@link #ATTRIBUTE_NOT_SUPPORTED}: at least one attribute
70
	 * 	is not supported</li>
71
	 * <li>{@link #ATTRIBUTE_NOT_MODIFIABLE}: all attributes are supported
72
	 * 	but at least one is not modifiable</li>
73
	 * <li>{@link #INVALID_VALUE}: all attributes are supported and modifiable
74
	 * 	but at least one has an invalid value</li>
75
	 * </ul>
76
	 * The status message can contain more information.
77
	 * </p><p>
78
	 * The attributes to be tested are the attributes of the class path entry
79
	 * that are not set to their default value and all extra classpath attributes 
80
	 * returned by the entries {@link IClasspathEntry#getExtraAttributes()}.
81
	 * </p><p>
82
	 * Default values for the built in attributes are:
83
	 * <ul><li>{@link IClasspathEntry#getSourceAttachmentPath()
84
	 *               source attachment path}: <code>null</code></li>
85
	 * <li>{@link IClasspathEntry#getSourceAttachmentRootPath()
86
	 *                source attachment root path}: <code>null</code></li>
87
	 * <li>{@link IClasspathEntry#getAccessRules() access rules}:
88
	 *                 <code>empty array of IAccessRule</code></li>
89
	 * <li>{@link IClasspathEntry#combineAccessRules() 
90
	 *                combineAccessRules}: <code>true</code></li>
91
	 * </ul>
92
	 * If <code>testValue</code> is set, the value is also tested for validity.
93
	 * If not set, all values are accepted.
94
	 * </p>
95
	 *    
96
	 * @param containerPath the path of the container which requires to be
97
	 * updated
98
	 * @param project the project for which the container is to be updated
99
	 * @param entry an entry of the classpath container with all attributes set
100
	 * that need to be tested. Set means a value that is not the attributes
101
	 * default value.
102
	 * @param testValue if set the value is also tested
103
	 * @return returns the resulting status
104
	 * 
105
	 * @since 3.3
106
	 */
107
	public IStatus canUpdateChildAttributes(IPath containerPath,
108
		IJavaProject project, IClasspathEntry entry, boolean testValue) {
109
	
110
		if (canUpdateClasspathContainer(containerPath, project)) {
111
			return Status.OK_STATUS;
112
		}
113
		return new JavaModelStatus(ATTRIBUTE_NOT_MODIFIABLE);
114
	}
115
53
    /**
116
    /**
54
     * Binds a classpath container to a <code>IClasspathContainer</code> for a given project,
117
     * Binds a classpath container to a <code>IClasspathContainer</code> for a given project,
55
     * or silently fails if unable to do so.
118
     * or silently fails if unable to do so.

Return to bug 168077