当前位置: 首页>>代码示例>>Java>>正文


Java VFileEvent.getFile方法代码示例

本文整理汇总了Java中com.intellij.openapi.vfs.newvfs.events.VFileEvent.getFile方法的典型用法代码示例。如果您正苦于以下问题:Java VFileEvent.getFile方法的具体用法?Java VFileEvent.getFile怎么用?Java VFileEvent.getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vfs.newvfs.events.VFileEvent的用法示例。


在下文中一共展示了VFileEvent.getFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _before

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
private void _before( final List<? extends VFileEvent> events )
{
  if( _project.isDisposed() )
  {
    return;
  }

  for( VFileEvent event : events )
  {
    final VirtualFile file = event.getFile();
    if( file != null )
    {
      if( isMoveOrRename( event ) )
      {
        processRenameBefore( event );
      }
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:20,代码来源:FileModificationManager.java

示例2: after

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
public void after(List<? extends VFileEvent> events) {
    String sources = Utils.getPropertyValue("sources", true);
    List<String> sourcesList = Utils.getSourcesList(sources);
    for (VFileEvent e : events) {
        VirtualFile virtualFile = e.getFile();
        if (virtualFile != null && sourcesList.contains(virtualFile.getName()) && SOURCE_FOLDER_DEFAULT.equals(virtualFile.getParent().getName())) {
            Project[] projects = ProjectManager.getInstance().getOpenProjects();
            Project project = null;
            if (projects.length == 1) {
                project = projects[0];
            }
            System.out.println("Changed file " + virtualFile.getCanonicalPath());
            Crowdin crowdin = new Crowdin();
            String branch = Utils.getCurrentBranch(project);
            crowdin.uploadFile(virtualFile, branch);
        }
    }
}
 
开发者ID:crowdin,项目名称:android-studio-plugin,代码行数:19,代码来源:FileChangeListener.java

示例3: after

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
  CaptureService service = CaptureService.getInstance(myProject);
  VirtualFile captures = service.getCapturesDirectory();
  if (captures == null) {
    if (!service.getCaptures().isEmpty()) {
      queueUpdate();
    }
    return;
  }
  for (VFileEvent event : events) {
    if (event.getFile() != null && VfsUtilCore.isAncestor(captures, event.getFile(), false)) {
      queueUpdate();
      return;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CapturesToolWindow.java

示例4: before

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
/**
 * Handler method that is called before IntelliJ executes the file change, stores a lookup of IntelliJ modules for
 * deleted files because the module can't be determined after the delete is executed
 * @param vFileEvents   List of file events, provided by IntelliJ
 */
public void before(@NotNull List<? extends VFileEvent> vFileEvents) {

	// sometimes file events occur before the plugin was initialized, so lets make sure we have a plugin, a project and a configuration
	if (plugin == null || plugin.getProject() == null || config == null || !config.isOpenCmsPluginEnabled()) {
		return;
	}

	// save all modules for deleted files in a lookup map, because IntelliJ can't find the module after the
	// deletion of directories (ModuleUtil.findModuleForFile returns null in that case)
	for (VFileEvent event : vFileEvents) {
		if (event instanceof VFileDeleteEvent) {
			VirtualFile ideaVFile = event.getFile();
			if (ideaVFile == null) {
				continue;
			}
			Module ideaModule = ModuleUtil.findModuleForFile(ideaVFile, plugin.getProject());
			if (ideaModule == null) {
				continue;
			}
			deletedFileModuleLookup.put(ideaVFile, ideaModule);
		}
	}
}
 
开发者ID:mediaworx,项目名称:opencms-intellijplugin,代码行数:29,代码来源:OpenCmsModuleFileChangeListener.java

示例5: handleFileDeleteEvent

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
/**
 * Internal handler for file delete events, fills a list of files to be deleted that is handled later in
 * {@link OpenCmsModuleFileChangeHandler#handleChanges()}
 * @param event IntelliJ's file change event
 * @throws CmsConnectionException if the connection to OpenCms fails
 */
private void handleFileDeleteEvent(VFileEvent event) throws CmsConnectionException {
	VirtualFile ideaVFile = event.getFile();
	if (ideaVFile != null) {
		String moduleBasePath = PluginTools.getModuleContentRoot(deletedFileModuleLookup.get(ideaVFile));
		OpenCmsModule ocmsModule = openCmsModules.getModuleForBasePath(moduleBasePath);

		// check if the file belongs to an OpenCms module
		if (ocmsModule  != null && ocmsModule.isPathModuleResource(ideaVFile.getPath())) {
			LOG.info("The following module resource was deleted: " + ideaVFile.getPath());
			String vfsPath = ocmsModule.getVfsPathForRealPath(ideaVFile.getPath());
			try {
				if (getVfsAdapter().exists(vfsPath)) {
					changeHandler.addFileToBeDeleted(ocmsModule, vfsPath, ideaVFile.isDirectory());
				}
			}
			catch (CmisPermissionDeniedException e) {
				throw new CmsConnectionException("A local file has been deleted, but it can't be checked if the file exists in the VFS (permission denied).\nPlease check manually: " + vfsPath);
			}
		}
	}
}
 
开发者ID:mediaworx,项目名称:opencms-intellijplugin,代码行数:28,代码来源:OpenCmsModuleFileChangeListener.java

示例6: handleFileRenameEvent

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
/**
 * Internal handler for file rename events fills a list of files to be renamed that is handled later in
 * {@link OpenCmsModuleFileChangeHandler#handleChanges()}
 * @param event IntelliJ's file change event
 * @throws CmsConnectionException if the connection to OpenCms fails
 */
private void handleFileRenameEvent(VFileEvent event) throws CmsConnectionException {
	VirtualFile ideaVFile = event.getFile();
	if (ideaVFile != null) {
		String renameFilePath = ideaVFile.getPath();
		OpenCmsModule ocmsModule = openCmsModules.getModuleForPath(renameFilePath);
		if (ocmsModule != null) {
			LOG.debug("The following file was renamed: " + ideaVFile.getPath());
			String oldName = (String)((VFilePropertyChangeEvent)event).getOldValue();
			String newName = (String)((VFilePropertyChangeEvent)event).getNewValue();
			String newVfsPath = ocmsModule.getVfsPathForRealPath(renameFilePath);
			String oldVfsPath = newVfsPath.replaceFirst(newName, oldName);

			if (!oldVfsPath.equals(newVfsPath) && ocmsModule.isPathModuleResource(ocmsModule.getLocalVfsRoot() + oldVfsPath) && getVfsAdapter().exists(oldVfsPath)) {
				changeHandler.addFileToBeRenamed(ocmsModule, ideaVFile, oldVfsPath, newVfsPath, newName);
			}
		}
	}
}
 
开发者ID:mediaworx,项目名称:opencms-intellijplugin,代码行数:25,代码来源:OpenCmsModuleFileChangeListener.java

示例7: _after

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
private void _after( final List<? extends VFileEvent> events )
{
  if( _project.isDisposed() )
  {
    return;
  }

  for( VFileEvent event : events )
  {
    final VirtualFile file = event.getFile();
    if( file != null )
    {
      if( event instanceof VFileCreateEvent )
      {
        fireCreatedEvent( file );
      }
      else if( event instanceof VFileDeleteEvent )
      {
        fireDeletedEvent( file );
      }
      else if( event instanceof VFileCopyEvent )
      {
        processFileCopyEvent( (VFileCopyEvent)event );
      }
      else if( isMoveOrRename( event ) )
      {
        processRenameAfter( event );
      }
      else // modified
      {
        ApplicationManager.getApplication().runReadAction( () -> fireModifiedEvent( file ) );
      }
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:36,代码来源:FileModificationManager.java

示例8: processRenameBefore

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
private void processRenameBefore( VFileEvent event )
{
  VirtualFile originalFile = event.getFile();
  if( originalFile instanceof LightVirtualFile )
  {
    return;
  }

  // Handle the Deletion *before* it is renamed
  fireDeletedEvent( originalFile );
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:12,代码来源:FileModificationManager.java

示例9: processRenameAfter

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
private void processRenameAfter( VFileEvent event )
{
  VirtualFile renamedFile = event.getFile();
  if( renamedFile instanceof LightVirtualFile )
  {
    return;
  }

  // Handle the Creation *after* it is renamed
  fireCreatedEvent( renamedFile );
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:12,代码来源:FileModificationManager.java

示例10: before

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
@Override
public void before(@NotNull List<? extends VFileEvent> vFileEvents) {
    for (VFileEvent fe : vFileEvents) {
        if(fe.getFile()!=null){
            System.out.println("before(getCanonicalPath)->" + fe.getFile().getCanonicalPath());
            System.out.println("before(getName)->" + fe.getFile().getName());
            System.out.println("before(getLength)->" + fe.getFile().getLength());
        }

    }
}
 
开发者ID:sergenes,项目名称:AllProjects,代码行数:12,代码来源:AllProjectsAppComponent.java

示例11: resetOnEvents

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
boolean resetOnEvents(@NotNull List<? extends VFileEvent> events) {
  for (VFileEvent event : events) {
    VirtualFile file = event.getFile();
    if (file == null || file.isDirectory()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RootIndex.java

示例12: after

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
  final VirtualFile[] roots = mySdk.getRootProvider().getFiles(OrderRootType.CLASSES);
  for (VFileEvent event : events) {
    final VirtualFile file = event.getFile();
    if (file != null) {
      for (VirtualFile root : roots) {
        if (VfsUtilCore.isAncestor(root, file, false)) {
          clearCaches();
          return;
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PyPackageManagerImpl.java

示例13: getFilesToProcess

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
@NotNull
private static Set<VirtualFile> getFilesToProcess(@NotNull List<? extends VFileEvent> events) {
  final Set<VirtualFile> result = new HashSet<VirtualFile>();

  for (VFileEvent event : events) {
    final VirtualFile file = event.getFile();

    if (file != null && shouldScheduleUpdate(file)) {
      result.add(file);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AndroidResourceFilesListener.java

示例14: after

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
  for (VFileEvent event : events) {
    VirtualFile file = event.getFile();
    VirtualFile root = getRootForIndexFile(file);
    if (root != null) {
      myDirtyScopeManager.dirDirtyRecursively(root);
    }
    root = getRootForChangeBranch(file);
    if (root != null) {
      myProject.getMessageBus().syncPublisher(HgVcs.REMOTE_TOPIC).update(myProject, root);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:HgRepositoryWatcher.java

示例15: after

import com.intellij.openapi.vfs.newvfs.events.VFileEvent; //导入方法依赖的package包/类
@Override
public void after(List<? extends VFileEvent> events) {
  if (!enabled) {
    return;
  }
  for (VFileEvent event : events) {
    VirtualFile modifiedFile = null;
    // Skip delete events.
    if (event instanceof VFileContentChangeEvent || event instanceof VFileCreateEvent) {
      modifiedFile = event.getFile();
    } else if (event instanceof VFileCopyEvent) {
      VFileCopyEvent copyEvent = (VFileCopyEvent) event;
      modifiedFile = copyEvent.getNewParent();
    } else if (event instanceof VFileMoveEvent) {
      VFileMoveEvent moveEvent = (VFileMoveEvent) event;
      modifiedFile = moveEvent.getNewParent();
    } else if (event instanceof VFilePropertyChangeEvent) {
      VFilePropertyChangeEvent propEvent = (VFilePropertyChangeEvent) event;
      // Check for file renames (sometimes we get property change events without the name
      // actually changing though)
      if (propEvent.getPropertyName().equals(VirtualFile.PROP_NAME)
          && !propEvent.getOldValue().equals(propEvent.getNewValue())) {
        modifiedFile = propEvent.getFile();
      }
    }
    if (SymbolTableProvider.isSourceFile(modifiedFile)) {
      queueChange(modifiedFile);
    }
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:31,代码来源:BulkSymbolTableBuildingChangeListener.java


注:本文中的com.intellij.openapi.vfs.newvfs.events.VFileEvent.getFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。