Bug 5343

Summary: Smart Save behaviour of a CU is problematic (1.0 fix candidate)
Product: [Eclipse Project] JDT Reporter: Erich Gamma <erich_gamma>
Component: UIAssignee: Erich Gamma <erich_gamma>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: John_Wiegand
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Erich Gamma CLA 2001-10-29 17:13:55 EST
This is a fix candidate for 1.0

Changing the name of the top-level type of a CU followed by save prompts the 
user whether they want to rename the compilation unit as well.

The current implementation is problematic since the prompt is done inside the 
delta processing. As a consequence, when changing a type programmatically a 
dialog can show up as a side effect.

We have removed this behaviour in the 2.0 stream since the same effect can be 
achieved with the rename type refactoring.

Proposal is to remove this behaviour in the 1.0 stream as well (1.0 already has 
the rename type refactoring).
Comment 1 Erich Gamma CLA 2001-11-12 08:33:10 EST
This would be the fix

The fix is even simpler:

In CompilationUnitEditor's default constructor:
	/**
	 * Default constructor.
	 */
	public CompilationUnitEditor() {
		super();
		setDocumentProvider(JavaPlugin.getDefault
().getCompilationUnitDocumentProvider());
		setEditorContextMenuId("#CompilationUnitEditorContext"); //$NON-
NLS-1$
		setRulerContextMenuId("#CompilationUnitRulerContext"); //$NON-
NLS-1$
		setOutlinerContextMenuId("#CompilationUnitOutlinerContext"); //
$NON-NLS-1$
		fSavePolicy= new CUSavePolicy();
	}

set the fSavePolicy to null.

Comment 2 Erich Gamma CLA 2001-11-27 04:56:17 EST
fixed in 1.0 stream
Comment 3 Randy Giffen CLA 2001-12-04 12:02:17 EST
One case to consider (for 2.0 not the 1.0 rollup) is 
1) Edit a .java file to change the class name, save (you get problems)
2) Select the class in its outline and rename back to the old name
You are not able to do this since it detects that the file exists, but since it 
is the file you are changing, this case should not fail.
Comment 4 Erich Gamma CLA 2002-03-25 05:15:09 EST
fixed in rollup1