本文整理汇总了Java中com.intellij.openapi.vfs.VfsUtil.markDirtyAndRefresh方法的典型用法代码示例。如果您正苦于以下问题:Java VfsUtil.markDirtyAndRefresh方法的具体用法?Java VfsUtil.markDirtyAndRefresh怎么用?Java VfsUtil.markDirtyAndRefresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vfs.VfsUtil
的用法示例。
在下文中一共展示了VfsUtil.markDirtyAndRefresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findFiles
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@NotNull
public static List<VirtualFile> findFiles(@NotNull List<String> filePaths, @Nullable String currentDirectory) throws Exception {
List<VirtualFile> files = new ArrayList<VirtualFile>();
for (String path : filePaths) {
VirtualFile virtualFile = findFile(path, currentDirectory);
if (virtualFile == null) throw new Exception("Can't find file " + path);
files.add(virtualFile);
}
VfsUtil.markDirtyAndRefresh(false, false, false, VfsUtilCore.toVirtualFileArray(files));
for (int i = 0; i < filePaths.size(); i++) {
if (!files.get(i).isValid()) throw new Exception("Can't find file " + filePaths.get(i));
}
return files;
}
示例2: createTemporalFile
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@NotNull
public static VirtualFile createTemporalFile(@Nullable Project project,
@NotNull String prefix,
@NotNull String suffix,
@NotNull byte[] content) throws IOException {
File tempFile = FileUtil.createTempFile(PathUtil.suggestFileName(prefix + "_", true, false),
PathUtil.suggestFileName("_" + suffix, true, false), true);
if (content.length != 0) {
FileUtil.writeToFile(tempFile, content);
}
VirtualFile file = VfsUtil.findFileByIoFile(tempFile, true);
if (file == null) {
throw new IOException("Can't create temp file for revision content");
}
VfsUtil.markDirtyAndRefresh(true, true, true, file);
return file;
}
示例3: loadRoot
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
/**
* Returns true if the root was loaded with conflict.
* False is returned in all other cases: in the case of success and in case of some other error.
*/
private boolean loadRoot(final VirtualFile root) {
LOG.info("loadRoot " + root);
myProgressIndicator.setText(GitHandlerUtil.formatOperationName("Unstashing changes to", root));
GitRepository repository = myRepositoryManager.getRepositoryForRoot(root);
if (repository == null) {
LOG.error("Repository is null for root " + root);
return false;
}
GitSimpleEventDetector conflictDetector = new GitSimpleEventDetector(GitSimpleEventDetector.Event.MERGE_CONFLICT_ON_UNSTASH);
GitCommandResult result = myGit.stashPop(repository, conflictDetector);
VfsUtil.markDirtyAndRefresh(false, true, false, root);
if (result.success()) {
return false;
}
else if (conflictDetector.hasHappened()) {
return true;
}
else {
LOG.info("unstash failed " + result.getErrorOutputAsJoinedString());
GitUIUtil.notifyImportantError(myProject, "Couldn't unstash", "<br/>" + result.getErrorOutputAsHtmlString());
return false;
}
}
示例4: refreshFiles
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@NotNull
public static Collection<VirtualFile> refreshFiles(@NotNull Collection<File> files) {
Collection<VirtualFile> filesToRefresh = ContainerUtil.newHashSet();
for (File file : files) {
VirtualFile vf = findFirstValidVirtualParent(file);
if (vf != null) {
filesToRefresh.add(vf);
}
}
VfsUtil.markDirtyAndRefresh(false, false, false, ArrayUtil.toObjectArray(filesToRefresh, VirtualFile.class));
return filesToRefresh;
}
示例5: refreshDeletedOrReplaced
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private static void refreshDeletedOrReplaced(@NotNull Collection<File> deletedOrReplaced) {
Collection<VirtualFile> filesToRefresh = ContainerUtil.newHashSet();
for (File file : deletedOrReplaced) {
File parent = file.getParentFile();
VirtualFile vf = findFirstValidVirtualParent(parent);
if (vf != null) {
filesToRefresh.add(vf);
}
}
VfsUtil.markDirtyAndRefresh(false, true, false, ArrayUtil.toObjectArray(filesToRefresh, VirtualFile.class));
}
示例6: showMergeDialog
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@Override
@NotNull
public List<VirtualFile> showMergeDialog(@NotNull List<VirtualFile> files,
@NotNull MergeProvider provider,
@NotNull MergeDialogCustomizer mergeDialogCustomizer) {
if (files.isEmpty()) return Collections.emptyList();
VfsUtil.markDirtyAndRefresh(false, false, false, ArrayUtil.toObjectArray(files, VirtualFile.class));
final MultipleFileMergeDialog fileMergeDialog = new MultipleFileMergeDialog(myProject, files, provider, mergeDialogCustomizer);
fileMergeDialog.show();
return fileMergeDialog.getProcessedFiles();
}
示例7: getScripts
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@NotNull
private static List<VirtualFile> getScripts() {
VirtualFile root = getScriptsRootDirectory();
if (root == null) return ContainerUtil.emptyList();
VfsUtil.markDirtyAndRefresh(false, true, true, root);
List<VirtualFile> scripts = VfsUtil.collectChildrenRecursively(root);
scripts = ContainerUtil.filter(scripts, ExtensionsRootType.regularFileFilter());
ContainerUtil.sort(scripts, new FileNameComparator());
return scripts;
}
示例8: execute
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public void execute() {
saveAllDocuments();
AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
Map<GitRepository, GitCommandResult> results = ContainerUtil.newHashMap();
try {
for (Map.Entry<GitRepository, VcsFullCommitDetails> entry : myCommits.entrySet()) {
GitRepository repository = entry.getKey();
VirtualFile root = repository.getRoot();
String target = entry.getValue().getId().asString();
GitLocalChangesWouldBeOverwrittenDetector detector = new GitLocalChangesWouldBeOverwrittenDetector(root, RESET);
GitCommandResult result = myGit.reset(repository, myMode, target, detector);
if (!result.success() && detector.wasMessageDetected()) {
GitCommandResult smartResult = proposeSmartReset(detector, repository, target);
if (smartResult != null) {
result = smartResult;
}
}
results.put(repository, result);
repository.update();
VfsUtil.markDirtyAndRefresh(true, true, false, root);
VcsDirtyScopeManager.getInstance(myProject).dirDirtyRecursively(root);
}
}
finally {
DvcsUtil.workingTreeChangeFinished(myProject, token);
}
notifyResult(results);
}
示例9: fetch
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
/**
* Invokes 'git fetch'.
* @return true if fetch was successful, false in the case of error.
*/
public GitFetchResult fetch(@NotNull GitRepository repository) {
// TODO need to have a fair compound result here
GitFetchResult fetchResult = GitFetchResult.success();
if (myFetchAll) {
fetchResult = fetchAll(repository, fetchResult);
}
else {
return fetchCurrentRemote(repository);
}
VfsUtil.markDirtyAndRefresh(false, true, false, repository.getGitDir());
return fetchResult;
}
示例10: handleResult
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private void handleResult(GitCommandResult result,
Project project,
GitSimpleEventDetector mergeConflictDetector,
GitLocalChangesWouldBeOverwrittenDetector localChangesDetector,
GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector,
GitRepository repository,
GitRevisionNumber currentRev,
Set<VirtualFile> affectedRoots,
Label beforeLabel) {
GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
VirtualFile root = repository.getRoot();
if (result.success() || mergeConflictDetector.hasHappened()) {
VfsUtil.markDirtyAndRefresh(false, true, false, root);
List<VcsException> exceptions = new ArrayList<VcsException>();
GitMergeUtil.showUpdates(this, project, exceptions, root, currentRev, beforeLabel, getActionName(), ActionInfo.UPDATE);
repositoryManager.updateRepository(root);
runFinalTasks(project, GitVcs.getInstance(project), affectedRoots, getActionName(), exceptions);
}
else if (localChangesDetector.wasMessageDetected()) {
LocalChangesWouldBeOverwrittenHelper.showErrorNotification(project, repository.getRoot(), getActionName(),
localChangesDetector.getRelativeFilePaths());
}
else if (untrackedFilesDetector.wasMessageDetected()) {
GitUntrackedFilesHelper.notifyUntrackedFilesOverwrittenBy(project, root, untrackedFilesDetector.getRelativeFilePaths(),
getActionName(), null);
}
else {
GitUIUtil.notifyError(project, "Git " + getActionName() + " Failed", result.getErrorOutputAsJoinedString(), true, null);
repositoryManager.updateRepository(root);
}
}
示例11: refreshAndConfigureVcsMappings
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public static void refreshAndConfigureVcsMappings(final Project project, final VirtualFile root, final String path) {
VfsUtil.markDirtyAndRefresh(false, true, false, root);
ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
manager.setDirectoryMappings(VcsUtil.addMapping(manager.getDirectoryMappings(), path, GitVcs.NAME));
manager.updateActiveVcss();
VcsDirtyScopeManager.getInstance(project).dirDirtyRecursively(root);
}
示例12: refreshExecRoot
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private static void refreshExecRoot(BlazeProjectData blazeProjectData) {
// recursive refresh of the blaze execution root. This is required because our blaze aspect
// can't yet tell us exactly which genfiles are required to resolve the project.
VirtualFile execRoot =
VirtualFileSystemProvider.getInstance()
.getSystem()
.refreshAndFindFileByIoFile(blazeProjectData.blazeInfo.getExecutionRoot());
if (execRoot != null) {
VfsUtil.markDirtyAndRefresh(false, true, true, execRoot);
}
}
示例13: execute
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@Nullable
public HgCommandResult execute() {
List<String> arguments = new LinkedList<String>();
if (clean) {
arguments.add("--clean");
}
if (!StringUtil.isEmptyOrSpaces(revision)) {
arguments.add("--rev");
arguments.add(revision);
}
final HgPromptCommandExecutor executor = new HgPromptCommandExecutor(project);
executor.setShowOutput(true);
HgCommandResult result;
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
result =
executor.executeInCurrentThread(repo, "update", arguments);
if (!clean && hasUncommittedChangesConflict(result)) {
final String message = "<html>Your uncommitted changes couldn't be merged into the requested changeset.<br>" +
"Would you like to perform force update and discard them?";
if (showDiscardChangesConfirmation(project, message) == Messages.OK) {
arguments.add("-C");
result = executor.executeInCurrentThread(repo, "update", arguments);
}
}
}
finally {
DvcsUtil.workingTreeChangeFinished(project, token);
}
VfsUtil.markDirtyAndRefresh(true, true, false, repo);
return result;
}
示例14: refreshManifests
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public void refreshManifests(Collection<File> manifestFiles) {
List<VirtualFile> manifestVirtualFiles =
manifestFiles
.stream()
.map(file -> VfsUtil.findFileByIoFile(file, false))
.filter(Objects::nonNull)
.collect(Collectors.toList());
VfsUtil.markDirtyAndRefresh(
false, false, false, ArrayUtil.toObjectArray(manifestVirtualFiles, VirtualFile.class));
ApplicationManager.getApplication()
.invokeAndWait(
() -> PsiDocumentManager.getInstance(project).commitAllDocuments(),
ModalityState.any());
}
示例15: hardRefresh
import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@Override
public void hardRefresh(@NotNull VirtualFile root) {
VfsUtil.markDirtyAndRefresh(true, true, false, root);
}