How to properly add a source files to shelf or local changes programmatically?

I'm currently trying to add an external file changes to my sources programatically.

I have a set of files that I want to add to the project files. It woold be nice if the file is displayed as a separate local change or shelf. At the momoent I have found only one solution - to generate a patch and add it with the following code:

ApplyPatchAction#showApplyPatch(Project, VirtualFile);

How can I get the patch file on the basis of two VirtualFile or how can I add VirtualFile to the local change(shelf) without patch creation.

1 comment
Comment actions Permalink

First of all, shelved changes are not actually part of the project code. If you need your changes to be part of your source code, then the shelf is completely irrelevant here.

To add unversioned files to a specific changelist, call ChangeListManagerImpl.getInstanceImpl(project).addUnversionedFiles(). To add changes of existing files to a specific changelist, call the moveChangesTo() method on the same object.


Please sign in to leave a comment.