[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Problem Report: Refactoring ignores read-only status

Adam Kiezun <Adam_Kiezun@xxxxxxx> wrote:
> Jon Skeet wrote:
> > 
> > In a bit of experimentation, I've found that I can reformat and refactor
> > code which I can't actually edit (due to it being read-only). Is this
> > deliberate?
> 
> no, it is not.
> can you provide a more detailed scenario? which refactoring did you use.

Okay, one detailed way to reproduce it (and show a couple of other 
problems):

o Create a new class (using the wizard or by hand)

o Add a field into the class

o Save the class and close Eclipse

o In the file system, mark the file as read-only

o Restart Eclipse

o Open the class up in an editor

o Check that you can't type in the editor (ie it's really read-only)

o In the Outline, select field and try to Refactor -> Rename (this 
  fails, correctly)

o Still in the Outline, select field and Generate Getters and Setters
  (this succeeds, incorrectly)

o Save the file - this correctly fails to save, giving the correct
  reason

o In the editor, with nothing selected, choose "Format"
  (Interestingly, this reformats the code that was generated with the
   Getters and Setters - any reason not to reformat that on inclusion?)

o In the Package view, select the class and choose "Refresh from Local"
  - this doesn't seem to actually go to the filesystem, which correctly
  hasn't been changed.

o Select the code in the setter, and choose "Extract Method"
  Give a method name and finish the refactoring - it will fail, with
  choices of Undo or Abort. Choosing Undo *doesn't* actually Undo
  all the executed changes, as far as I can see.

If you'd like me to investigate what other refactorings succeed where 
they shouldn't, let me know.

-- 
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too