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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/DefaultWorkingCopyOwner.java (-4 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 28-36 Link Here
28
		// only one instance can be created
28
		// only one instance can be created
29
	}
29
	}
30
30
31
	/**
32
	 * @deprecated Marked deprecated as it is using deprecated code
33
	 */
34
	public IBuffer createBuffer(ICompilationUnit workingCopy) {
31
	public IBuffer createBuffer(ICompilationUnit workingCopy) {
35
		if (this.primaryBufferProvider != null) return this.primaryBufferProvider.createBuffer(workingCopy);
32
		if (this.primaryBufferProvider != null) return this.primaryBufferProvider.createBuffer(workingCopy);
36
		return super.createBuffer(workingCopy);
33
		return super.createBuffer(workingCopy);
(-)model/org/eclipse/jdt/internal/core/CompilationUnit.java (-2 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 68-73 Link Here
68
		operation.runOperation(monitor);
68
		operation.runOperation(monitor);
69
	}
69
	}
70
}
70
}
71
/*
72
 * @see ICompilationUnit#becomeWorkingCopy(IProgressMonitor)
73
 */
74
public void becomeWorkingCopy(IProgressMonitor monitor) throws JavaModelException {
75
	IProblemRequestor requestor = this.owner == null ? null : this.owner.getProblemRequestor(this);
76
	becomeWorkingCopy(requestor, monitor);
77
}
71
protected boolean buildStructure(OpenableElementInfo info, final IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException {
78
protected boolean buildStructure(OpenableElementInfo info, final IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException {
72
79
73
	// check if this compilation unit can be opened
80
	// check if this compilation unit can be opened
Lines 1122-1128 Link Here
1122
	throws JavaModelException {
1129
	throws JavaModelException {
1123
	return reconcile(astLevel, forceProblemDetection, false, workingCopyOwner, monitor);
1130
	return reconcile(astLevel, forceProblemDetection, false, workingCopyOwner, monitor);
1124
}
1131
}
1125
		
1132
1126
/**
1133
/**
1127
 * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor)
1134
 * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, IProgressMonitor)
1128
 * @since 3.0
1135
 * @since 3.0
(-)model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java (-21 / +43 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 61-67 Link Here
61
		this.enableStatementsRecovery = enableStatementsRecovery;
61
		this.enableStatementsRecovery = enableStatementsRecovery;
62
		this.workingCopyOwner = workingCopyOwner;
62
		this.workingCopyOwner = workingCopyOwner;
63
	}
63
	}
64
	
64
65
	/**
65
	/**
66
	 * @exception JavaModelException if setting the source
66
	 * @exception JavaModelException if setting the source
67
	 * 	of the original compilation unit fails
67
	 * 	of the original compilation unit fails
Lines 76-81 Link Here
76
		CompilationUnit workingCopy = getWorkingCopy();
76
		CompilationUnit workingCopy = getWorkingCopy();
77
		boolean wasConsistent = workingCopy.isConsistent();
77
		boolean wasConsistent = workingCopy.isConsistent();
78
		IProblemRequestor problemRequestor = workingCopy.getPerWorkingCopyInfo();
78
		IProblemRequestor problemRequestor = workingCopy.getPerWorkingCopyInfo();
79
		if (problemRequestor != null) {
80
			problemRequestor =  ((JavaModelManager.PerWorkingCopyInfo)problemRequestor).problemRequestor;
81
		}
82
		IProblemRequestor ownerProblemRequestor = this.workingCopyOwner.getProblemRequestor(workingCopy);
79
		this.resolveBindings |= problemRequestor != null && problemRequestor.isActive();
83
		this.resolveBindings |= problemRequestor != null && problemRequestor.isActive();
80
		
84
		
81
		// create the delta builder (this remembers the current content of the cu)
85
		// create the delta builder (this remembers the current content of the cu)
Lines 93-114 Link Here
93
	
97
	
94
		// report problems
98
		// report problems
95
		if (this.problems != null && (this.forceProblemDetection || !wasConsistent)) {
99
		if (this.problems != null && (this.forceProblemDetection || !wasConsistent)) {
96
			try {
100
			if (problemRequestor != null) {
97
				problemRequestor.beginReporting();
101
				reportProblems(workingCopy, problemRequestor);
98
				for (Iterator iteraror = this.problems.values().iterator(); iteraror.hasNext();) {
102
			}
99
					CategorizedProblem[] categorizedProblems = (CategorizedProblem[]) iteraror.next();
103
			if (ownerProblemRequestor != null && ownerProblemRequestor != problemRequestor) {
100
					if (categorizedProblems == null) continue;
104
				reportProblems(workingCopy, ownerProblemRequestor);
101
					for (int i = 0, length = categorizedProblems.length; i < length; i++) {
102
						CategorizedProblem problem = categorizedProblems[i];
103
						if (JavaModelManager.VERBOSE){
104
							System.out.println("PROBLEM FOUND while reconciling : " + problem.getMessage());//$NON-NLS-1$
105
						}
106
						if (this.progressMonitor != null && this.progressMonitor.isCanceled()) break;
107
						problemRequestor.acceptProblem(problem);
108
					}
109
				}
110
			} finally {
111
				problemRequestor.endReporting();
112
			}
105
			}
113
		}
106
		}
114
		
107
		
Lines 122-139 Link Here
122
			if (this.progressMonitor != null) this.progressMonitor.done();
115
			if (this.progressMonitor != null) this.progressMonitor.done();
123
		}
116
		}
124
	}
117
	}
118
119
	/**
120
	 * Report working copy problems to a given requestor.
121
	 * 
122
	 * @param workingCopy
123
	 * @param problemRequestor
124
	 */
125
	private void reportProblems(CompilationUnit workingCopy, IProblemRequestor problemRequestor) {
126
		try {
127
			problemRequestor.beginReporting();
128
			for (Iterator iteraror = this.problems.values().iterator(); iteraror.hasNext();) {
129
				CategorizedProblem[] categorizedProblems = (CategorizedProblem[]) iteraror.next();
130
				if (categorizedProblems == null) continue;
131
				for (int i = 0, length = categorizedProblems.length; i < length; i++) {
132
					CategorizedProblem problem = categorizedProblems[i];
133
					if (JavaModelManager.VERBOSE){
134
						System.out.println("PROBLEM FOUND while reconciling : " + problem.getMessage());//$NON-NLS-1$
135
					}
136
					if (this.progressMonitor != null && this.progressMonitor.isCanceled()) break;
137
					problemRequestor.acceptProblem(problem);
138
				}
139
			}
140
		} finally {
141
			problemRequestor.endReporting();
142
		}
143
	}
144
125
	/**
145
	/**
126
	 * Returns the working copy this operation is working on.
146
	 * Returns the working copy this operation is working on.
127
	 */
147
	 */
128
	protected CompilationUnit getWorkingCopy() {
148
	protected CompilationUnit getWorkingCopy() {
129
		return (CompilationUnit)getElementToProcess();
149
		return (CompilationUnit)getElementToProcess();
130
	}
150
	}
131
	/**
151
132
	 * @see JavaModelOperation#isReadOnly
152
	/* (non-Javadoc)
153
	 * @see org.eclipse.jdt.internal.core.JavaModelOperation#isReadOnly()
133
	 */
154
	 */
134
	public boolean isReadOnly() {
155
	public boolean isReadOnly() {
135
		return true;
156
		return true;
136
	}
157
	}
158
137
	/*
159
	/*
138
	 * Makes the given working copy consistent, computes the delta and computes an AST if needed.
160
	 * Makes the given working copy consistent, computes the delta and computes an AST if needed.
139
	 * Returns the AST.
161
	 * Returns the AST.
Lines 232-237 Link Here
232
			});
254
			});
233
		}
255
		}
234
	}
256
	}
257
235
	protected IJavaModelStatus verify() {
258
	protected IJavaModelStatus verify() {
236
		IJavaModelStatus status = super.verify();
259
		IJavaModelStatus status = super.verify();
237
		if (!status.isOK()) {
260
		if (!status.isOK()) {
Lines 244-248 Link Here
244
		return status;
267
		return status;
245
	}
268
	}
246
269
247
248
}
270
}
(-)model/org/eclipse/jdt/core/WorkingCopyOwner.java (-6 / +75 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 19-25 Link Here
19
import org.eclipse.jdt.internal.core.PackageFragment;
19
import org.eclipse.jdt.internal.core.PackageFragment;
20
20
21
/**
21
/**
22
 * The owner of an <code>ICompilationUnit</code> handle in working copy mode. 
22
 * The owner of an {@link ICompilationUnit} handle in working copy mode. 
23
 * An owner is used to identify a working copy and to create its buffer.
23
 * An owner is used to identify a working copy and to create its buffer.
24
 * <p>
24
 * <p>
25
 * Clients should subclass this class to instantiate a working copy owner that is specific to their need and that
25
 * Clients should subclass this class to instantiate a working copy owner that is specific to their need and that
Lines 71-76 Link Here
71
71
72
		return BufferManager.getDefaultBufferManager().createBuffer(workingCopy);
72
		return BufferManager.getDefaultBufferManager().createBuffer(workingCopy);
73
	}
73
	}
74
75
	/**
76
	 * Returns the problem requestor used by a working copy of this working copy owner.
77
	 * <p>
78
	 * By default, no problem requestor is configured. Clients can override this 
79
	 * method to provide a requestor.
80
	 * </p>
81
	 * 
82
	 * @param workingCopy The problem requestor used for the given working copy.
83
	 * If <code>null</code>, then return the problem requestor used for all working 
84
	 * copies of the working copy owner.
85
	 * @return the problem requestor to be used by working copies of this working 
86
	 * copy owner or <code>null</code> if no problem requestor is configured.
87
	 * 
88
	 * @since 3.3
89
	 */
90
	public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) {
91
		return null;
92
	}
74
	
93
	
75
	/**
94
	/**
76
	 * Returns a new working copy with the given name using this working copy owner to 
95
	 * Returns a new working copy with the given name using this working copy owner to 
Lines 81-91 Link Here
81
	 * However this Java project has the given classpath that is used when resolving names
100
	 * However this Java project has the given classpath that is used when resolving names
82
	 * in this working copy.
101
	 * in this working copy.
83
	 * </p><p>
102
	 * </p><p>
84
	 * A DOM AST created using this working copy will have bindings resolved using the given
103
	 * If a DOM AST is created using this working copy, then given classpath will be used
85
	 * classpath, and problem are reported to the given problem requestor.
104
	 *  if bindings need to be resolved and problems will be reported to the given problem requestor
105
	 * if it is not <code>null</code>.
86
	 * <p></p>
106
	 * <p></p>
87
	 * <code>JavaCore#getOptions()</code> is used to create the DOM AST as it is not
107
	 * Options used to create the DOM AST are got from {@link JavaCore#getOptions()}
88
	 * possible to set the options on the non-existing Java project.
108
	 * as it is not possible to set the options on a non-existing Java project.
89
	 * </p><p>
109
	 * </p><p>
90
	 * When the working copy instance is created, an {@link IJavaElementDelta#ADDED added delta} is 
110
	 * When the working copy instance is created, an {@link IJavaElementDelta#ADDED added delta} is 
91
	 * reported on this working copy.
111
	 * reported on this working copy.
Lines 111-116 Link Here
111
	 * @return a new working copy
131
	 * @return a new working copy
112
	 * @see ICompilationUnit#becomeWorkingCopy(IProblemRequestor, IProgressMonitor)
132
	 * @see ICompilationUnit#becomeWorkingCopy(IProblemRequestor, IProgressMonitor)
113
	 * @since 3.2
133
	 * @since 3.2
134
	 * 
135
	 * @deprecated Use {@link #newWorkingCopy(String, IClasspathEntry[], IProgressMonitor)} instead.
114
	 */
136
	 */
115
	public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException {
137
	public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException {
116
		ExternalJavaProject project = new ExternalJavaProject(classpath);
138
		ExternalJavaProject project = new ExternalJavaProject(classpath);
Lines 119-123 Link Here
119
		result.becomeWorkingCopy(problemRequestor, monitor);
141
		result.becomeWorkingCopy(problemRequestor, monitor);
120
		return result;
142
		return result;
121
	}
143
	}
144
	
145
	/**
146
	 * Returns a new working copy with the given name using this working copy owner to 
147
	 * create its buffer. 
148
	 * <p>
149
	 * This working copy always belongs to the default package in a package
150
	 * fragment root that corresponds to its Java project, and this Java project never exists.
151
	 * However this Java project has the given classpath that is used when resolving names
152
	 * in this working copy.
153
	 * </p><p>
154
	 * If a DOM AST is created using this working copy, then given classpath will be used
155
	 *  if bindings need to be resolved and problems will be reported to the current working copy
156
	 * owner problem requestor if it is not <code>null</code>.
157
	 * <p></p>
158
	 * Options used to create the DOM AST are got from {@link JavaCore#getOptions()}
159
	 * as it is not possible to set the options on a non-existing Java project.
160
	 * </p><p>
161
	 * When the working copy instance is created, an {@link IJavaElementDelta#ADDED added delta} is 
162
	 * reported on this working copy.
163
	 * </p><p>
164
	 * Once done with the working copy, users of this method must discard it using 
165
	 * {@link ICompilationUnit#discardWorkingCopy()}.
166
	 * </p><p>
167
	 * Note that when such working copy is committed, only its buffer is saved (see 
168
	 * {@link IBuffer#save(IProgressMonitor, boolean)}) but no resource is created.
169
	 * </p><p>
170
	 * This method is not intended to be overriden by clients.
171
	 * </p>
172
	 * 
173
	 * @param name the name of the working copy (e.g. "X.java")
174
	 * @param classpath the classpath used to resolve names in this working copy
175
	 * @param monitor a progress monitor used to report progress while opening the working copy
176
	 * 	or <code>null</code> if no progress should be reported 
177
	 * @throws JavaModelException if the contents of this working copy can
178
	 *   not be determined. 
179
	 * @return a new working copy
180
	 * @see ICompilationUnit#becomeWorkingCopy(IProgressMonitor)
181
	 * 
182
	 * @since 3.3
183
	 */
184
	public final ICompilationUnit newWorkingCopy(String name, IClasspathEntry[] classpath, IProgressMonitor monitor) throws JavaModelException {
185
		ExternalJavaProject project = new ExternalJavaProject(classpath);
186
		IPackageFragment parent = project.getPackageFragmentRoot(Path.EMPTY).getPackageFragment(IPackageFragment.DEFAULT_PACKAGE_NAME);
187
		CompilationUnit result = new CompilationUnit((PackageFragment) parent, name, this);
188
		result.becomeWorkingCopy(getProblemRequestor(result), monitor);
189
		return result;
190
	}
122
191
123
}
192
}
(-)model/org/eclipse/jdt/core/ICompilationUnit.java (-2 / +32 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 70-75 Link Here
70
 */
70
 */
71
void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
71
void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
72
/**
72
/**
73
 * Changes this compilation unit handle into a working copy. A new {@link IBuffer} is
74
 * created using this compilation unit handle's owner. Uses the primary owner is none was
75
 * specified when this compilation unit handle was created.
76
 * <p>
77
 * When switching to working copy mode, problems are reported to the {@link IProblemRequestor
78
 * problem requestor} of the {@link WorkingCopyOwner working copy owner}.
79
 * </p>
80
 * <p>
81
 * Once in working copy mode, changes to this compilation unit or its children are done in memory.
82
 * Only the new buffer is affected. Using {@link #commitWorkingCopy(boolean, IProgressMonitor)}
83
 * will bring the underlying resource in sync with this compilation unit.
84
 * </p>
85
 * <p>
86
 * If this compilation unit was already in working copy mode, an internal counter is incremented and no
87
 * other action is taken on this compilation unit. To bring this compilation unit back into the original mode 
88
 * (where it reflects the underlying resource), {@link #discardWorkingCopy} must be call as many 
89
 * times as {@link #becomeWorkingCopy(IProblemRequestor, IProgressMonitor)}.
90
 * </p>
91
 * 
92
 * @param monitor a progress monitor used to report progress while opening this compilation unit
93
 * 	or <code>null</code> if no progress should be reported 
94
 * @throws JavaModelException if this compilation unit could not become a working copy.
95
 * @see #discardWorkingCopy()
96
 * @since 3.3
97
 */
98
void becomeWorkingCopy(IProgressMonitor monitor) throws JavaModelException;
99
/**
73
 * Commits the contents of this working copy to its underlying resource.
100
 * Commits the contents of this working copy to its underlying resource.
74
 *
101
 *
75
 * <p>It is possible that the contents of the original resource have changed
102
 * <p>It is possible that the contents of the original resource have changed
Lines 223-232 Link Here
223
 * This has no effect if this compilation unit was not in working copy mode.
250
 * This has no effect if this compilation unit was not in working copy mode.
224
 * </p>
251
 * </p>
225
 * <p>
252
 * <p>
226
 * If {@link #becomeWorkingCopy} was called several times on this
253
 * If <code>becomeWorkingCopy(...)</code> methods was called several times on this
227
 * compilation unit, {@link #discardWorkingCopy} must be called as 
254
 * compilation unit, {@link #discardWorkingCopy} must be called as 
228
 * many times before it switches back to the original mode.
255
 * many times before it switches back to the original mode.
229
 * </p>
256
 * </p>
257
 * <p>{@link #discardWorkingCopy()} also has to be called on each compilation unit returned by
258
 * {@link #getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)}.
259
 * </p>
230
 * 
260
 * 
231
 * @throws JavaModelException if this working copy could not return in its original mode.
261
 * @throws JavaModelException if this working copy could not return in its original mode.
232
 * @see #becomeWorkingCopy(IProblemRequestor, IProgressMonitor)
262
 * @see #becomeWorkingCopy(IProblemRequestor, IProgressMonitor)
(-)model/org/eclipse/jdt/core/IJavaElementDelta.java (-75 / +76 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 19-63 Link Here
19
 * changed, and any children that have changed.
19
 * changed, and any children that have changed.
20
 * <p>
20
 * <p>
21
 * Deltas have a different status depending on the kind of change they represent.  
21
 * Deltas have a different status depending on the kind of change they represent.  
22
 * The list below summarizes each status (as returned by <code>getKind</code>)
22
 * The list below summarizes each status (as returned by {@link #getKind})
23
 * and its meaning (see individual constants for a more detailled description):
23
 * and its meaning (see individual constants for a more detailled description):
24
 * <ul>
24
 * <ul>
25
 * <li><code>ADDED</code> - The element described by the delta has been added.</li>
25
 * <li>{@link #ADDED} - The element described by the delta has been added.</li>
26
 * <li><code>REMOVED</code> - The element described by the delta has been removed.</li>
26
 * <li>{@link #REMOVED} - The element described by the delta has been removed.</li>
27
 * <li><code>CHANGED</code> - The element described by the delta has been changed in some way.  
27
 * <li>{@link #CHANGED} - The element described by the delta has been changed in some way.  
28
 * Specification of the type of change is provided by <code>getFlags</code> which returns the following values:
28
 * Specification of the type of change is provided by {@link #getFlags} which returns the following values:
29
 * <ul>
29
 * <ul>
30
 * <li><code>F_ADDED_TO_CLASSPATH</code> - A classpath entry corresponding to the element
30
 * <li>{@link #F_ADDED_TO_CLASSPATH} - A classpath entry corresponding to the element
31
 * has been added to the project's classpath. This flag is only valid if the element is an 
31
 * has been added to the project's classpath. This flag is only valid if the element is an 
32
 * <code>IPackageFragmentRoot</code>.</li>
32
 * {@link IPackageFragmentRoot}.</li>
33
 * <li><code>F_ARCHIVE_CONTENT_CHANGED</code> - The contents of an archive
33
 * <li>{@link #F_ARCHIVE_CONTENT_CHANGED} - The contents of an archive
34
 * has changed in some way. This flag is only valid if the element is an <code>IPackageFragmentRoot</code>
34
 * has changed in some way. This flag is only valid if the element is an {@link IPackageFragmentRoot}
35
 * which is an archive.</li>
35
 * which is an archive.</li>
36
 * <li><code>F_CHILDREN</code> - A child of the element has changed in some way.  This flag
36
 * <li>{@link #F_CHILDREN} - A child of the element has changed in some way.  This flag
37
 * is only valid if the element is an <code>IParent</code>.</li>
37
 * is only valid if the element is an {@link IParent}.</li>
38
 * <li><code>F_CLASSPATH_REORDER</code> - A classpath entry corresponding to the element
38
 * <li>{@link #F_CLASSPATH_REORDER} - A classpath entry corresponding to the element
39
 * has changed position in the project's classpath. This flag is only valid if the element is an 
39
 * has changed position in the project's classpath. This flag is only valid if the element is an 
40
 * <code>IPackageFragmentRoot</code>.</li>
40
 * {@link IPackageFragmentRoot}.</li>
41
 * <li><code>F_CLOSED</code> - The underlying <code>IProject</code>
41
 * <li>{@link #F_CLOSED} - The underlying {@link org.eclipse.core.resources.IProject}
42
 * has been closed. This flag is only valid if the element is an <code>IJavaProject</code>.</li>
42
 * has been closed. This flag is only valid if the element is an {@link IJavaProject}.</li>
43
 * <li><code>F_CONTENT</code> - The contents of the element have been altered.  This flag
43
 * <li>{@link #F_CONTENT} - The contents of the element have been altered.  This flag
44
 * is only valid for elements which correspond to files.</li>
44
 * is only valid for elements which correspond to files.</li>
45
 *<li><code>F_FINE_GRAINED</code> - The delta is a fine-grained delta, that is, an analysis down
45
 *<li>{@link #F_FINE_GRAINED} - The delta is a fine-grained delta, that is, an analysis down
46
 * to the members level was done to determine if there were structural changes to members of the element.</li>
46
 * to the members level was done to determine if there were structural changes to members of the element.</li>
47
 * <li><code>F_MODIFIERS</code> - The modifiers on the element have changed in some way. 
47
 * <li>{@link #F_MODIFIERS} - The modifiers on the element have changed in some way. 
48
 * This flag is only valid if the element is an <code>IMember</code>.</li>
48
 * This flag is only valid if the element is an {@link IMember}.</li>
49
 * <li><code>F_OPENED</code> - The underlying <code>IProject</code>
49
 * <li>{@link #F_OPENED} - The underlying {@link org.eclipse.core.resources.IProject}
50
 * has been opened. This flag is only valid if the element is an <code>IJavaProject</code>.</li>
50
 * has been opened. This flag is only valid if the element is an {@link IJavaProject}.</li>
51
 * <li><code>F_REMOVED_FROM_CLASSPATH</code> - A classpath entry corresponding to the element 
51
 * <li>{@link #F_REMOVED_FROM_CLASSPATH} - A classpath entry corresponding to the element 
52
 * has been removed from the project's classpath. This flag is only valid if the element is an 
52
 * has been removed from the project's classpath. This flag is only valid if the element is an 
53
 * <code>IPackageFragmentRoot</code>.</li>
53
 * {@link IPackageFragmentRoot}.</li>
54
 * <li><code>F_SOURCEATTACHED</code> - The source attachment path or the source attachment root path
54
 * <li>{@link #F_SOURCEATTACHED} - The source attachment path or the source attachment root path
55
 * of a classpath entry corresponding to the element was added. This flag is only valid if the element is an 
55
 * of a classpath entry corresponding to the element was added. This flag is only valid if the element is an 
56
 * <code>IPackageFragmentRoot</code>.</li>
56
 * {@link IPackageFragmentRoot}.</li>
57
 * <li><code>F_SOURCEDETACHED</code> - The source attachment path or the source attachment root path
57
 * <li>{@link #F_SOURCEDETACHED} - The source attachment path or the source attachment root path
58
 * of a classpath entry corresponding to the element was removed. This flag is only valid if the element is an 
58
 * of a classpath entry corresponding to the element was removed. This flag is only valid if the element is an 
59
 * <code>IPackageFragmentRoot</code>.</li>
59
 * {@link IPackageFragmentRoot}.</li>
60
 * <li><code>F_SUPER_TYPES</code> - One of the supertypes of an <code>IType</code> has changed</li>.
60
 * <li>{@link #F_SUPER_TYPES} - One of the supertypes of an {@link IType} has changed</li>.
61
 * </ul>
61
 * </ul>
62
 * </li>
62
 * </li>
63
 * </ul>
63
 * </ul>
Lines 65-75 Link Here
65
 * <p>
65
 * <p>
66
 * Move operations are indicated by other change flags, layered on top
66
 * Move operations are indicated by other change flags, layered on top
67
 * of the change flags described above. If element A is moved to become B,
67
 * of the change flags described above. If element A is moved to become B,
68
 * the delta for the  change in A will have status <code>REMOVED</code>,
68
 * the delta for the  change in A will have status {@link #REMOVED},
69
 * with change flag <code>F_MOVED_TO</code>. In this case,
69
 * with change flag {@link #F_MOVED_TO}. In this case,
70
 * <code>getMovedToElement</code> on delta A will return the handle for B.
70
 * {@link #getMovedToElement} on delta A will return the handle for B.
71
 * The  delta for B will have status <code>ADDED</code>, with change flag
71
 * The  delta for B will have status {@link #ADDED}, with change flag
72
 * <code>F_MOVED_FROM</code>, and <code>getMovedFromElement</code> on delta
72
 * {@link #F_MOVED_FROM}, and {@link #getMovedFromElement} on delta
73
 * B will return the handle for A. (Note, the handle to A in this case represents
73
 * B will return the handle for A. (Note, the handle to A in this case represents
74
 * an element that no longer exists).
74
 * an element that no longer exists).
75
 * </p>
75
 * </p>
Lines 78-102 Link Here
78
 * do not imply anything about the parent or children of the element.
78
 * do not imply anything about the parent or children of the element.
79
 * </p>
79
 * </p>
80
 * <p>
80
 * <p>
81
 * The <code>F_ADDED_TO_CLASSPATH</code>, <code>F_REMOVED_FROM_CLASSPATH</code> and
81
 * The {@link #F_ADDED_TO_CLASSPATH}, {@link #F_REMOVED_FROM_CLASSPATH} and
82
 * <code>F_CLASSPATH_REORDER</code> flags are triggered by changes to a project's classpath. They do not mean that
82
 * {@link #F_CLASSPATH_REORDER} flags are triggered by changes to a project's classpath. They do not mean that
83
 * the underlying resource was added, removed or changed. For example, if a project P already contains a folder src, then 
83
 * the underlying resource was added, removed or changed. For example, if a project P already contains a folder src, then 
84
 * adding a classpath entry with the 'P/src' path to the project's classpath will result in an <code>IJavaElementDelta</code> 
84
 * adding a classpath entry with the 'P/src' path to the project's classpath will result in an {@link IJavaElementDelta} 
85
 * with the <code>F_ADDED_TO_CLASSPATH</code> flag for the <code>IPackageFragmentRoot</code> P/src.
85
 * with the {@link #F_ADDED_TO_CLASSPATH} flag for the {@link IPackageFragmentRoot} P/src.
86
 * On the contrary, if a resource is physically added, removed or changed and this resource corresponds to a classpath
86
 * On the contrary, if a resource is physically added, removed or changed and this resource corresponds to a classpath
87
 * entry of the project, then an <code>IJavaElementDelta</code> with the <code>ADDED</code>, 
87
 * entry of the project, then an {@link IJavaElementDelta} with the {@link #ADDED}, 
88
 * <code>REMOVED</code>, or <code>CHANGED</code> kind will be fired.
88
 * {@link #REMOVED}, or {@link #CHANGED} kind will be fired.
89
 * </p>
89
 * </p>
90
 * <p>
90
 * <p>
91
 * Note that when a source attachment path or a source attachment root path is changed, then the flags of the delta contain
91
 * Note that when a source attachment path or a source attachment root path is changed, then the flags of the delta contain
92
 * both <code>F_SOURCEATTACHED</code> and <code>F_SOURCEDETTACHED</code>.
92
 * both {@link #F_SOURCEATTACHED} and {@link #F_SOURCEDETACHED}.
93
 * </p>
93
 * </p>
94
 * <p>
94
 * <p>
95
 * No assumptions should be made on whether the java element delta tree is rooted at the <code>IJavaModel</code>
95
 * No assumptions should be made on whether the java element delta tree is rooted at the {@link IJavaModel}
96
 * level or not.
96
 * level or not.
97
 * </p>
97
 * </p>
98
 * <p>
98
 * <p>
99
 * <code>IJavaElementDelta</code> object are not valid outside the dynamic scope
99
 * {@link IJavaElementDelta} object are not valid outside the dynamic scope
100
 * of the notification.
100
 * of the notification.
101
 * </p>
101
 * </p>
102
 * <p>
102
 * <p>
Lines 133-181 Link Here
133
133
134
	/**
134
	/**
135
	 * Change flag indicating that the modifiers of the element have changed.
135
	 * Change flag indicating that the modifiers of the element have changed.
136
	 * This flag is only valid if the element is an <code>IMember</code>. 
136
	 * This flag is only valid if the element is an {@link IMember}. 
137
	 */
137
	 */
138
	public int F_MODIFIERS = 0x000002;
138
	public int F_MODIFIERS = 0x000002;
139
139
140
	/**
140
	/**
141
	 * Change flag indicating that there are changes to the children of the element.
141
	 * Change flag indicating that there are changes to the children of the element.
142
	 * This flag is only valid if the element is an <code>IParent</code>. 
142
	 * This flag is only valid if the element is an {@link IParent}. 
143
	 */
143
	 */
144
	public int F_CHILDREN = 0x000008;
144
	public int F_CHILDREN = 0x000008;
145
145
146
	/**
146
	/**
147
	 * Change flag indicating that the element was moved from another location.
147
	 * Change flag indicating that the element was moved from another location.
148
	 * The location of the old element can be retrieved using <code>getMovedFromElement</code>.
148
	 * The location of the old element can be retrieved using {@link #getMovedFromElement}.
149
	 */
149
	 */
150
	public int F_MOVED_FROM = 0x000010;
150
	public int F_MOVED_FROM = 0x000010;
151
151
152
	/**
152
	/**
153
	 * Change flag indicating that the element was moved to another location.
153
	 * Change flag indicating that the element was moved to another location.
154
	 * The location of the new element can be retrieved using <code>getMovedToElement</code>.
154
	 * The location of the new element can be retrieved using {@link #getMovedToElement}.
155
	 */
155
	 */
156
	public int F_MOVED_TO = 0x000020;
156
	public int F_MOVED_TO = 0x000020;
157
157
158
	/**
158
	/**
159
	 * Change flag indicating that a classpath entry corresponding to the element has been added to the project's classpath. 
159
	 * Change flag indicating that a classpath entry corresponding to the element has been added to the project's classpath. 
160
	 * This flag is only valid if the element is an <code>IPackageFragmentRoot</code>.
160
	 * This flag is only valid if the element is an {@link IPackageFragmentRoot}.
161
	 */
161
	 */
162
	public int F_ADDED_TO_CLASSPATH = 0x000040;
162
	public int F_ADDED_TO_CLASSPATH = 0x000040;
163
163
164
	/**
164
	/**
165
	 * Change flag indicating that a classpath entry corresponding to the element has been removed from the project's 
165
	 * Change flag indicating that a classpath entry corresponding to the element has been removed from the project's 
166
	 * classpath. This flag is only valid if the element is an <code>IPackageFragmentRoot</code>.
166
	 * classpath. This flag is only valid if the element is an {@link IPackageFragmentRoot}.
167
	 */
167
	 */
168
	public int F_REMOVED_FROM_CLASSPATH = 0x000080;
168
	public int F_REMOVED_FROM_CLASSPATH = 0x000080;
169
169
170
	/**
170
	/**
171
	 * Change flag indicating that a classpath entry corresponding to the element has changed position in the project's 
171
	 * Change flag indicating that a classpath entry corresponding to the element has changed position in the project's 
172
	 * classpath. This flag is only valid if the element is an <code>IPackageFragmentRoot</code>.
172
	 * classpath. This flag is only valid if the element is an {@link IPackageFragmentRoot}.
173
	 * @deprecated Use {@link #F_REORDER} instead.
173
	 * @deprecated Use {@link #F_REORDER} instead.
174
	 */
174
	 */
175
	public int F_CLASSPATH_REORDER = 0x000100;
175
	public int F_CLASSPATH_REORDER = 0x000100;
176
	/**
176
	/**
177
	 * Change flag indicating that the element has changed position relatively to its siblings. 
177
	 * Change flag indicating that the element has changed position relatively to its siblings. 
178
	 * If the element is an <code>IPackageFragmentRoot</code>,  a classpath entry corresponding 
178
	 * If the element is an {@link IPackageFragmentRoot},  a classpath entry corresponding 
179
	 * to the element has changed position in the project's classpath.
179
	 * to the element has changed position in the project's classpath.
180
	 * 
180
	 * 
181
	 * @since 2.1
181
	 * @since 2.1
Lines 183-201 Link Here
183
	public int F_REORDER = 0x000100;
183
	public int F_REORDER = 0x000100;
184
184
185
	/**
185
	/**
186
	 * Change flag indicating that the underlying <code>IProject</code> has been
186
	 * Change flag indicating that the underlying {@link org.eclipse.core.resources.IProject} has been
187
	 * opened. This flag is only valid if the element is an <code>IJavaProject</code>. 
187
	 * opened. This flag is only valid if the element is an {@link IJavaProject}. 
188
	 */
188
	 */
189
	public int F_OPENED = 0x000200;
189
	public int F_OPENED = 0x000200;
190
190
191
	/**
191
	/**
192
	 * Change flag indicating that the underlying <code>IProject</code> has been
192
	 * Change flag indicating that the underlying {@link org.eclipse.core.resources.IProject} has been
193
	 * closed. This flag is only valid if the element is an <code>IJavaProject</code>. 
193
	 * closed. This flag is only valid if the element is an {@link IJavaProject}. 
194
	 */
194
	 */
195
	public int F_CLOSED = 0x000400;
195
	public int F_CLOSED = 0x000400;
196
196
197
	/**
197
	/**
198
	 * Change flag indicating that one of the supertypes of an <code>IType</code>
198
	 * Change flag indicating that one of the supertypes of an {@link IType}
199
	 * has changed.
199
	 * has changed.
200
	 */
200
	 */
201
	public int F_SUPER_TYPES = 0x000800;
201
	public int F_SUPER_TYPES = 0x000800;
Lines 203-216 Link Here
203
	/**
203
	/**
204
	 * Change flag indicating that the source attachment path or the source attachment root path of a classpath entry 
204
	 * Change flag indicating that the source attachment path or the source attachment root path of a classpath entry 
205
	 * corresponding to the element was added. This flag is only valid if the element is an 
205
	 * corresponding to the element was added. This flag is only valid if the element is an 
206
	 * <code>IPackageFragmentRoot</code>.
206
	 * {@link IPackageFragmentRoot}.
207
	 */
207
	 */
208
	public int F_SOURCEATTACHED = 0x001000;	
208
	public int F_SOURCEATTACHED = 0x001000;	
209
209
210
	/**
210
	/**
211
	 * Change flag indicating that the source attachment path or the source attachment root path of a classpath entry 
211
	 * Change flag indicating that the source attachment path or the source attachment root path of a classpath entry 
212
	 * corresponding to the element was removed. This flag is only valid if the element is an 
212
	 * corresponding to the element was removed. This flag is only valid if the element is an 
213
	 * <code>IPackageFragmentRoot</code>.
213
	 * {@link IPackageFragmentRoot}.
214
	 */
214
	 */
215
	public int F_SOURCEDETACHED = 0x002000;	
215
	public int F_SOURCEDETACHED = 0x002000;	
216
	
216
	
Lines 220-228 Link Here
220
	 * members.
220
	 * members.
221
	 * <p>
221
	 * <p>
222
	 * Clients can use this flag to find out if a compilation unit 
222
	 * Clients can use this flag to find out if a compilation unit 
223
     * that have a <code>F_CONTENT</code> change should assume that there are 
223
     * that have a {@link #F_CONTENT} change should assume that there are 
224
     * no finer grained changes (<code>F_FINE_GRAINED</code> is set) or if 
224
     * no finer grained changes ({@link #F_FINE_GRAINED} is set) or if 
225
     * finer grained changes were not considered (<code>F_FINE_GRAINED</code> 
225
     * finer grained changes were not considered ({@link #F_FINE_GRAINED} 
226
     * is not set). 
226
     * is not set). 
227
     * 
227
     * 
228
     * @since 2.0
228
     * @since 2.0
Lines 231-237 Link Here
231
231
232
	/**
232
	/**
233
	 * Change flag indicating that the element's archive content on the classpath has changed.
233
	 * Change flag indicating that the element's archive content on the classpath has changed.
234
	 * This flag is only valid if the element is an <code>IPackageFragmentRoot</code>
234
	 * This flag is only valid if the element is an {@link IPackageFragmentRoot}
235
	 * which is an archive.
235
	 * which is an archive.
236
	 * 
236
	 * 
237
	 * @see IPackageFragmentRoot#isArchive()
237
	 * @see IPackageFragmentRoot#isArchive()
Lines 242-248 Link Here
242
	/**
242
	/**
243
	 * Change flag indicating that a compilation unit has become a primary working copy, or that a 
243
	 * Change flag indicating that a compilation unit has become a primary working copy, or that a 
244
	 * primary working copy has reverted to a compilation unit.
244
	 * primary working copy has reverted to a compilation unit.
245
	 * This flag is only valid if the element is an <code>ICompilationUnit</code>.
245
	 * This flag is only valid if the element is an {@link ICompilationUnit}.
246
	 * 
246
	 * 
247
	 * @since 3.0
247
	 * @since 3.0
248
	 */
248
	 */
Lines 250-256 Link Here
250
250
251
	/**
251
	/**
252
	 * Change flag indicating that the raw classpath (or the output folder) of a project has changed. 
252
	 * Change flag indicating that the raw classpath (or the output folder) of a project has changed. 
253
	 * This flag is only valid if the element is an <code>IJavaProject</code>.
253
	 * This flag is only valid if the element is an {@link IJavaProject}.
254
	 *
254
	 *
255
	 * @since 3.0
255
	 * @since 3.0
256
	 */
256
	 */
Lines 258-264 Link Here
258
258
259
	/**
259
	/**
260
	 * Change flag indicating that the resource of a primary compilation unit has changed.
260
	 * Change flag indicating that the resource of a primary compilation unit has changed.
261
	 * This flag is only valid if the element is a primary <code>ICompilationUnit</code>.
261
	 * This flag is only valid if the element is a primary {@link ICompilationUnit}.
262
	 * 
262
	 * 
263
	 * @since 3.0
263
	 * @since 3.0
264
	 */
264
	 */
Lines 267-273 Link Here
267
	/**
267
	/**
268
	 * Change flag indicating that a reconcile operation has affected the compilation unit AST created in a 
268
	 * Change flag indicating that a reconcile operation has affected the compilation unit AST created in a 
269
	 * previous reconcile operation. Use {@link #getCompilationUnitAST()} to retrieve the AST (if any is available).
269
	 * previous reconcile operation. Use {@link #getCompilationUnitAST()} to retrieve the AST (if any is available).
270
	 * This flag is only valid if the element is an <code>ICompilationUnit</code> in working copy mode.
270
	 * This flag is only valid if the element is an {@link ICompilationUnit} in working copy mode.
271
	 * 
271
	 * 
272
	 * @since 3.2
272
	 * @since 3.2
273
	 */
273
	 */
Lines 275-281 Link Here
275
	
275
	
276
	/**
276
	/**
277
	 * Change flag indicating that the categories of the element have changed.
277
	 * Change flag indicating that the categories of the element have changed.
278
	 * This flag is only valid if the element is an <code>IMember</code>. 
278
	 * This flag is only valid if the element is an {@link IMember}. 
279
	 * 
279
	 * 
280
	 * @since 3.2
280
	 * @since 3.2
281
	 */
281
	 */
Lines 298-306 Link Here
298
	 * This returns a non-null value if and only if:
298
	 * This returns a non-null value if and only if:
299
	 * <ul>
299
	 * <ul>
300
	 * <li>the last reconcile operation on this working copy requested an AST</li>
300
	 * <li>the last reconcile operation on this working copy requested an AST</li>
301
	 * <li>this delta's element is an <code>ICompilationUnit</code> in working copy mode</li>
301
	 * <li>this delta's element is an {@link ICompilationUnit} in working copy mode</li>
302
	 * <li>the delta comes from a <code>POST_RECONCILE</code> event
302
	 * <li>the delta comes from a {@link ElementChangedEvent#POST_RECONCILE} event
303
	 * </ul>
303
	 * </ul>
304
	 * 
304
	 * @return the AST created during the last reconcile operation
305
	 * @return the AST created during the last reconcile operation
305
	 * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, org.eclipse.core.runtime.IProgressMonitor)
306
	 * @see ICompilationUnit#reconcile(int, boolean, WorkingCopyOwner, org.eclipse.core.runtime.IProgressMonitor)
306
	 * @see #F_AST_AFFECTED
307
	 * @see #F_AST_AFFECTED
Lines 334-341 Link Here
334
	public int getFlags();
335
	public int getFlags();
335
336
336
	/**
337
	/**
337
	 * Returns the kind of this delta - one of <code>ADDED</code>, <code>REMOVED</code>,
338
	 * Returns the kind of this delta - one of {@link #ADDED}, {@link #REMOVED},
338
	 * or <code>CHANGED</code>.
339
	 * or {@link #CHANGED}.
339
	 * 
340
	 * 
340
	 * @return the kind of this delta
341
	 * @return the kind of this delta
341
	 */
342
	 */
Lines 344-364 Link Here
344
	/**
345
	/**
345
	 * Returns an element describing this element before it was moved
346
	 * Returns an element describing this element before it was moved
346
	 * to its current location, or <code>null</code> if the
347
	 * to its current location, or <code>null</code> if the
347
	 * <code>F_MOVED_FROM</code> change flag is not set. 
348
	 * {@link #F_MOVED_FROM} change flag is not set. 
348
	 * 
349
	 * 
349
	 * @return an element describing this element before it was moved
350
	 * @return an element describing this element before it was moved
350
	 * to its current location, or <code>null</code> if the
351
	 * to its current location, or <code>null</code> if the
351
	 * <code>F_MOVED_FROM</code> change flag is not set
352
	 * {@link #F_MOVED_FROM} change flag is not set
352
	 */
353
	 */
353
	public IJavaElement getMovedFromElement();
354
	public IJavaElement getMovedFromElement();
354
355
355
	/**
356
	/**
356
	 * Returns an element describing this element in its new location,
357
	 * Returns an element describing this element in its new location,
357
	 * or <code>null</code> if the <code>F_MOVED_TO</code> change
358
	 * or <code>null</code> if the {@link #F_MOVED_TO} change
358
	 * flag is not set.
359
	 * flag is not set.
359
	 * 
360
	 * 
360
	 * @return an element describing this element in its new location,
361
	 * @return an element describing this element in its new location,
361
	 * or <code>null</code> if the <code>F_MOVED_TO</code> change
362
	 * or <code>null</code> if the {@link #F_MOVED_TO} change
362
	 * flag is not set
363
	 * flag is not set
363
	 */
364
	 */
364
	public IJavaElement getMovedToElement();
365
	public IJavaElement getMovedToElement();
(-)src/org/eclipse/jdt/core/tests/model/WorkingCopyOwnerTests.java (-4 / +3 lines)
Lines 41-54 Link Here
41
	public static Test suite() {
41
	public static Test suite() {
42
		return buildModelTestSuite(WorkingCopyOwnerTests.class);
42
		return buildModelTestSuite(WorkingCopyOwnerTests.class);
43
	}
43
	}
44
44
	// Use this static initializer to specify subset for tests
45
	// Use this static initializer to specify subset for tests
45
	// All specified tests which do not belong to the class are skipped...
46
	// All specified tests which do not belong to the class are skipped...
46
	static {
47
	static {
47
		// Names of tests to run: can be "testBugXXXX" or "BugXXXX")
48
//		TESTS_NAMES = new String[] { "testNewWorkingCopy03" };
48
//		TESTS_NAMES = new String[] { "testNewWorkingCopy03" };
49
		// Numbers of tests to run: "test<number>" will be run for each number of this array
50
//		TESTS_NUMBERS = new int[] { 2, 12 };
49
//		TESTS_NUMBERS = new int[] { 2, 12 };
51
		// Range numbers of tests to run: all tests between "test<first>" and "test<last>" will be run for { first, last }
52
//		TESTS_RANGE = new int[] { 16, -1 };
50
//		TESTS_RANGE = new int[] { 16, -1 };
53
	}
51
	}
54
52
Lines 1031-1037 Link Here
1031
				return buffer;
1029
				return buffer;
1032
			}
1030
			}
1033
		};
1031
		};
1034
		this.workingCopy = owner.newWorkingCopy("X.java", null/*no classpath*/, null/*no problem requestor*/, null/*no progress monitor*/);
1032
//		this.workingCopy = owner.newWorkingCopy("X.java", null/*no classpath*/, null/*no problem requestor*/, null/*no progress monitor*/);
1033
		this.workingCopy = owner.newWorkingCopy("X.java", null/*no classpath*/, null/*no progress monitor*/);
1035
		this.workingCopy.commitWorkingCopy(true, null);
1034
		this.workingCopy.commitWorkingCopy(true, null);
1036
		assertFalse("Should not have unsaved changes", this.workingCopy.hasUnsavedChanges());
1035
		assertFalse("Should not have unsaved changes", this.workingCopy.hasUnsavedChanges());
1037
	}
1036
	}
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java (-3 / +9 lines)
Lines 1538-1544 Link Here
1538
	}	
1538
	}	
1539
	public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException {
1539
	public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException {
1540
		return getWorkingCopy(path, source, false);
1540
		return getWorkingCopy(path, source, false);
1541
	}	
1541
	}
1542
	public ICompilationUnit getWorkingCopy(String path, String source, boolean computeProblems) throws JavaModelException {
1542
	public ICompilationUnit getWorkingCopy(String path, String source, boolean computeProblems) throws JavaModelException {
1543
		if (this.wcOwner == null) this.wcOwner = new WorkingCopyOwner() {};
1543
		if (this.wcOwner == null) this.wcOwner = new WorkingCopyOwner() {};
1544
		return getWorkingCopy(path, source, this.wcOwner, computeProblems);
1544
		return getWorkingCopy(path, source, this.wcOwner, computeProblems);
Lines 1632-1646 Link Here
1632
	protected ICompilationUnit newExternalWorkingCopy(String name, final String contents) throws JavaModelException {
1632
	protected ICompilationUnit newExternalWorkingCopy(String name, final String contents) throws JavaModelException {
1633
		return newExternalWorkingCopy(name, null/*no classpath*/, null/*no problem requestor*/, contents);
1633
		return newExternalWorkingCopy(name, null/*no classpath*/, null/*no problem requestor*/, contents);
1634
	}
1634
	}
1635
	protected ICompilationUnit newExternalWorkingCopy(String name, IClasspathEntry[] classpath, IProblemRequestor problemRequestor, final String contents) throws JavaModelException {
1635
	protected ICompilationUnit newExternalWorkingCopy(String name, IClasspathEntry[] classpath, final IProblemRequestor problemRequestor, final String contents) throws JavaModelException {
1636
		WorkingCopyOwner owner = new WorkingCopyOwner() {
1636
		WorkingCopyOwner owner = new WorkingCopyOwner() {
1637
			public IBuffer createBuffer(ICompilationUnit wc) {
1637
			public IBuffer createBuffer(ICompilationUnit wc) {
1638
				IBuffer buffer = super.createBuffer(wc);
1638
				IBuffer buffer = super.createBuffer(wc);
1639
				buffer.setContents(contents);
1639
				buffer.setContents(contents);
1640
				return buffer;
1640
				return buffer;
1641
			}
1641
			}
1642
1643
			public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) {
1644
				return problemRequestor;
1645
			}
1646
			
1642
		};
1647
		};
1643
		return owner.newWorkingCopy(name, classpath, problemRequestor, null/*no progress monitor*/);
1648
//		return owner.newWorkingCopy(name, classpath, problemRequestor, null/*no progress monitor*/);
1649
		return owner.newWorkingCopy(name, classpath, null/*no progress monitor*/);
1644
	}
1650
	}
1645
1651
1646
	public byte[] read(java.io.File file) throws java.io.IOException {
1652
	public byte[] read(java.io.File file) throws java.io.IOException {

Return to bug 175243