Search in sources :

Example 1 with EditFileProvider

use of com.intellij.openapi.vcs.EditFileProvider in project intellij-community by JetBrains.

the class VcsHandleType method processFiles.

public void processFiles(final Collection<VirtualFile> files, @Nullable final String changelist) {
    try {
        EditFileProvider provider = myVcs.getEditFileProvider();
        assert provider != null;
        provider.editFiles(VfsUtil.toVirtualFileArray(files));
    } catch (VcsException e) {
        Messages.showErrorDialog(VcsBundle.message("message.text.cannot.edit.file", e.getLocalizedMessage()), VcsBundle.message("message.title.edit.files"));
    }
    ApplicationManager.getApplication().runWriteAction(new Runnable() {

        public void run() {
            for (final VirtualFile file : files) {
                file.refresh(false, false);
            }
        }
    });
    if (changelist != null) {
        myChangeListManager.invokeAfterUpdate(new Runnable() {

            @Override
            public void run() {
                LocalChangeList list = myChangeListManager.findChangeList(changelist);
                if (list != null) {
                    List<Change> changes = ContainerUtil.mapNotNull(files, myChangeFunction);
                    myChangeListManager.moveChangesTo(list, changes.toArray(new Change[changes.size()]));
                }
            }
        }, InvokeAfterUpdateMode.SILENT, "", ModalityState.NON_MODAL);
    }
}
Also used : EditFileProvider(com.intellij.openapi.vcs.EditFileProvider) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsException(com.intellij.openapi.vcs.VcsException) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) List(java.util.List)

Aggregations

EditFileProvider (com.intellij.openapi.vcs.EditFileProvider)1 VcsException (com.intellij.openapi.vcs.VcsException)1 LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 List (java.util.List)1