use of com.intellij.openapi.vcs.changes.VcsDirtyScopeManager in project intellij-community by JetBrains.
the class CreateExternalAction method doInBackground.
private static void doInBackground(@NotNull Project project, @NotNull VirtualFile file, String url, boolean checkout, String target) {
SvnVcs vcs = SvnVcs.getInstance(project);
VcsDirtyScopeManager dirtyScopeManager = VcsDirtyScopeManager.getInstance(project);
File ioFile = virtualToIoFile(file);
try {
addToExternalProperty(vcs, ioFile, target, url);
dirtyScopeManager.fileDirty(file);
if (checkout) {
UpdateClient client = vcs.getFactory(ioFile).createUpdateClient();
client.setEventHandler(new SvnProgressCanceller());
client.doUpdate(ioFile, SVNRevision.HEAD, Depth.UNKNOWN, false, false);
file.refresh(true, true, () -> dirtyScopeManager.dirDirtyRecursively(file));
}
} catch (VcsException e) {
AbstractVcsHelper.getInstance(project).showError(e, "Create External");
}
}
use of com.intellij.openapi.vcs.changes.VcsDirtyScopeManager in project intellij-community by JetBrains.
the class SynchronizeCurrentFileAction method postRefresh.
private static void postRefresh(Project project, VirtualFile[] files) {
VcsDirtyScopeManager dirtyScopeManager = VcsDirtyScopeManager.getInstance(project);
for (VirtualFile f : files) {
if (f.isDirectory()) {
dirtyScopeManager.dirDirtyRecursively(f);
} else {
dirtyScopeManager.fileDirty(f);
}
}
StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
if (statusBar != null) {
statusBar.setInfo(IdeBundle.message("action.sync.completed.successfully", getMessage(files)));
}
}
use of com.intellij.openapi.vcs.changes.VcsDirtyScopeManager in project intellij-community by JetBrains.
the class AddFileOrDirectoryAction method onActionPerformed.
@Override
protected void onActionPerformed(final CvsContext context, final CvsTabbedWindow tabbedWindow, final boolean successfully, final CvsHandler handler) {
super.onActionPerformed(context, tabbedWindow, successfully, handler);
final VirtualFile[] filesToAdd = context.getSelectedFiles();
final VcsDirtyScopeManager dirtyScopeManager = VcsDirtyScopeManager.getInstance(context.getProject());
for (VirtualFile file : filesToAdd) {
if (file.isDirectory()) {
dirtyScopeManager.dirDirtyRecursively(file);
} else {
dirtyScopeManager.fileDirty(file);
}
}
}
use of com.intellij.openapi.vcs.changes.VcsDirtyScopeManager in project intellij-community by JetBrains.
the class GitCheckoutProvider method clone.
public static void clone(final Project project, @NotNull final Git git, final Listener listener, final VirtualFile destinationParent, final String sourceRepositoryURL, final String directoryName, final String parentDirectory) {
final AtomicBoolean cloneResult = new AtomicBoolean();
new Task.Backgroundable(project, DvcsBundle.message("cloning.repository", sourceRepositoryURL)) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
cloneResult.set(doClone(project, git, directoryName, parentDirectory, sourceRepositoryURL));
}
@Override
public void onSuccess() {
if (!cloneResult.get()) {
return;
}
DvcsUtil.addMappingIfSubRoot(project, FileUtil.join(parentDirectory, directoryName), GitVcs.NAME);
destinationParent.refresh(true, true, new Runnable() {
public void run() {
if (project.isOpen() && (!project.isDisposed()) && (!project.isDefault())) {
final VcsDirtyScopeManager mgr = VcsDirtyScopeManager.getInstance(project);
mgr.fileDirty(destinationParent);
}
}
});
listener.directoryCheckedOut(new File(parentDirectory, directoryName), GitVcs.getKey());
listener.checkoutCompleted();
}
}.queue();
}
use of com.intellij.openapi.vcs.changes.VcsDirtyScopeManager in project intellij-community by JetBrains.
the class SvnFileSystemListener method refreshFiles.
private void refreshFiles(final Project project) {
final List<VirtualFile> toRefreshFiles = new ArrayList<>();
final List<VirtualFile> toRefreshDirs = new ArrayList<>();
for (VirtualFile file : myFilesToRefresh) {
if (file == null)
continue;
if (file.isDirectory()) {
toRefreshDirs.add(file);
} else {
toRefreshFiles.add(file);
}
}
// if refresh asynchronously, local changes would also be notified that they are dirty asynchronously,
// and commit could be executed while not all changes are visible
filterOutInvalid(myFilesToRefresh);
RefreshQueue.getInstance().refresh(true, true, () -> {
if (project.isDisposed())
return;
filterOutInvalid(toRefreshFiles);
filterOutInvalid(toRefreshDirs);
final VcsDirtyScopeManager vcsDirtyScopeManager = VcsDirtyScopeManager.getInstance(project);
vcsDirtyScopeManager.filesDirty(toRefreshFiles, toRefreshDirs);
}, myFilesToRefresh);
myFilesToRefresh.clear();
}
Aggregations