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:
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:
- create ideleteresourcechange every deletion , remember new file count in each parent folder.
- 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
Post a Comment