java - eclipse refactoring API delete folders -


i writing delete refactoring (deleteparticipant) customized eclipse ide.

what try archieve following:

when user deletes file, deleteparticipant registers , deletes several other files. if causes folders become empty, folders deleted deleteparticipant. if causes parent folders become empty, again, deleted participant.

to achieve that, create deleteresourcechange each file , store them in compositechange object returned deleteparticipant.

example:

enter image description here

problem:

the deletion works fine. however, when try undo changes eclipse shows me following error message:

'delete' cannot undone. reason: there not enough information restore 'gen'. 

as far understand problem, due fact undo logic first checks if reverting of each file possible , complains cannot restore gen folder in not existing services folder.

is there way hint eclipse undo nevertheless consistent?

question:

i found out reverting single delete containing multiple files possible, while reverting multiple deletes containing nested files not. thus, solve issue, wrote small method following:

  1. create ideleteresourcechange every deletion , remember new file count in each parent folder.
  2. check if 1 of parents becomes empty: if so, remove single file deletion changes , add 1 change parent folder. also, if desired, enter recursion.

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - TypeError: 'NoneType' object is not subscriptable "channel_id = c.fetchone()[0]" -