Bug 14368 Create getter and setter insert code into read-only file
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
status.add(new Status(Status.INFO, JavaUI.ID_PLUGIN, Status.ERROR, message, null));					
				} catch (CoreException e) {
					JavaPlugin.log(e);
					String message= ActionMessages.getFormattedString("OrganizeImportsAction.multi.error.unexpected", e.getMessage()); 
					status.add(new Status(Status.ERROR, JavaUI.ID_PLUGIN, Status.ERROR, message, null));					
				} catch (OperationCanceledException e) {
					throw new InterruptedException();
				}
			}
		} finally {
			monitor.done();
		}
	}
				
	private void runOnSingle(ICompilationUnit cu, boolean doResolve) {
		try {
			String[] prefOrder= ImportOrganizePreferencePage.getImportOrderPreference();
			int threshold= ImportOrganizePreferencePage.getImportNumberThreshold();
			boolean ignoreLowerCaseNames= ImportOrganizePreferencePage.doIgnoreLowerCaseNames();
			
			if (!cu.isWorkingCopy()) {
				IEditorPart editor= EditorUtility.openInEditor(cu);
				if (editor instanceof JavaEditor) {
					fEditor= (JavaEditor) editor;
				}
				
				ICompilationUnit workingCopy= EditorUtility.getWorkingCopy(cu);
				if (workingCopy != null) {
					cu= workingCopy;
				}