use of com.intellij.openapi.vcs.changes.VcsDirtyScopeManager in project intellij-community by JetBrains.
the class PropertiesComponent method updateFileStatus.
private void updateFileStatus(boolean recursive) {
if (myFile != null && myVcs != null) {
String url = "file://" + myFile.getPath().replace(File.separatorChar, '/');
VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
if (file != null) {
VcsDirtyScopeManager dirtyScopeManager = VcsDirtyScopeManager.getInstance(myVcs.getProject());
if (recursive && file.isDirectory()) {
dirtyScopeManager.dirDirtyRecursively(file);
} else {
dirtyScopeManager.fileDirty(file);
}
}
}
}
use of com.intellij.openapi.vcs.changes.VcsDirtyScopeManager in project google-cloud-intellij by GoogleCloudPlatform.
the class GcpCheckoutProvider method clone.
private static void clone(@NotNull final Project project, @NotNull final Git git, @Nullable final Listener listener, @NotNull final VirtualFile destinationParent, @NotNull final String sourceRepositoryUrl, @NotNull final String directoryName, @NotNull final String parentDirectory, @Nullable final String gcpUserName) {
final AtomicBoolean cloneResult = new AtomicBoolean();
new Task.Backgroundable(project, GctBundle.message("clonefromgcp.repository", sourceRepositoryUrl)) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
GcpHttpAuthDataProvider.Context context = GcpHttpAuthDataProvider.createContext(gcpUserName);
try {
cloneResult.set(doClone(project, indicator, git, directoryName, parentDirectory, sourceRepositoryUrl));
} finally {
context.close();
}
}
@Override
public void onSuccess() {
if (!cloneResult.get()) {
return;
}
destinationParent.refresh(true, true, new Runnable() {
@Override
public void run() {
if (project.isOpen() && (!project.isDisposed()) && (!project.isDefault())) {
final VcsDirtyScopeManager mgr = VcsDirtyScopeManager.getInstance(project);
mgr.fileDirty(destinationParent);
}
}
});
ProjectManagerListener configWriter = new ProjectManagerListener() {
@Override
public void projectOpened(Project project) {
PropertiesComponent.getInstance(project).setValue(GcpHttpAuthDataProvider.GCP_USER, gcpUserName == null ? "" : gcpUserName);
}
@Override
public boolean canCloseProject(Project project) {
return true;
}
@Override
public void projectClosed(Project project) {
// no-op
}
@Override
public void projectClosing(Project project) {
// no-op
}
};
ProjectManager.getInstance().addProjectManagerListener(configWriter);
try {
if (listener != null) {
listener.directoryCheckedOut(new File(parentDirectory, directoryName), GitVcs.getKey());
listener.checkoutCompleted();
}
} finally {
ProjectManager.getInstance().removeProjectManagerListener(configWriter);
}
}
}.queue();
}
Aggregations