• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VFileCreateEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent的典型用法代码示例。如果您正苦于以下问题:Java VFileCreateEvent类的具体用法?Java VFileCreateEvent怎么用?Java VFileCreateEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VFileCreateEvent类属于com.intellij.openapi.vfs.newvfs.events包,在下文中一共展示了VFileCreateEvent类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testManyPointersUpdatePerformance

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
public void testManyPointersUpdatePerformance() throws IOException {
  LoggingListener listener = new LoggingListener();
  final List<VFileEvent> events = new ArrayList<VFileEvent>();
  final File ioTempDir = createTempDirectory();
  final VirtualFile temp = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ioTempDir);
  for (int i=0; i<100000; i++) {
    myVirtualFilePointerManager.create(VfsUtilCore.pathToUrl("/a/b/c/d/" + i), disposable, listener);
    events.add(new VFileCreateEvent(this, temp, "xxx" + i, false, true));
  }
  PlatformTestUtil.startPerformanceTest("vfp update", 10000, new ThrowableRunnable() {
    @Override
    public void run() throws Throwable {
      for (int i=0; i<100; i++) {
        // simulate VFS refresh events since launching the actual refresh is too slow
        myVirtualFilePointerManager.before(events);
        myVirtualFilePointerManager.after(events);
      }
    }
  }).assertTiming();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:VirtualFilePointerTest.java


示例2: testManyPointersUpdatePerformance

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
public void testManyPointersUpdatePerformance() throws IOException {
  FilePointerPartNode.pushDebug(false, disposable);
  LoggingListener listener = new LoggingListener();
  final List<VFileEvent> events = new ArrayList<VFileEvent>();
  final File ioTempDir = createTempDirectory();
  final VirtualFile temp = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ioTempDir);
  for (int i=0; i<100000; i++) {
    myVirtualFilePointerManager.create(VfsUtilCore.pathToUrl("/a/b/c/d/" + i), disposable, listener);
    events.add(new VFileCreateEvent(this, temp, "xxx" + i, false, true));
  }
  PlatformTestUtil.startPerformanceTest("vfp update", 10000, new ThrowableRunnable() {
    @Override
    public void run() throws Throwable {
      for (int i=0; i<100; i++) {
        // simulate VFS refresh events since launching the actual refresh is too slow
        myVirtualFilePointerManager.before(events);
        myVirtualFilePointerManager.after(events);
      }
    }
  }).assertTiming();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:VirtualFilePointerTest.java


示例3: onFileCreate

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
@Override
public void onFileCreate(VFileCreateEvent event, Facet facet) {
  String newFile = event.getPath();
  Module module = facet.getModule();
  ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
  VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(newFile);
  ContentEntry contentEntry = getContentRootFor(virtualFile, rootModel);
  if (contentEntry != null) {
    contentEntry.addSourceFolder(virtualFile.getUrl(), false);
    rootModel.commit();
  } else {
    ErrorDialog.showErrorDialog(
        module.getProject(),
        "Can't find Content Root",
        "Can't find Content Root for %s",
        virtualFile);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:19,代码来源:HandlePackageCreation.java


示例4: onFileCreate

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
@Override
public void onFileCreate(VFileCreateEvent event, Facet facet) {
  Project project = facet.getModule().getProject();

  FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
  VirtualFile[] selectedFiles = fileEditorManager.getSelectedFiles();
  if (selectedFiles.length != 1) {
    log(
        "Oh, dear. We have a new file in a Project View resource directory, but we have %d selected files",
        selectedFiles.length);
    ErrorDialog.showErrorDialog(
        project,
        "Error moving new file",
        "We have a new file in a Project View resource directory, but we have %d selected files and so don't know which BUCK file to examine",
        selectedFiles.length);
    return; // we are expecting a SINGLE file, here
  }
  VirtualFile selection = selectedFiles[0];

  Editor editor = fileEditorManager.getSelectedTextEditor();

  moveResourceFile(event.getPath(), project, selection, editor);
}
 
开发者ID:facebook,项目名称:buck,代码行数:24,代码来源:MoveResourceFiles.java


示例5: _after

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的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


示例6: createAndFindChildWithEventFire

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
@Nullable
private VirtualFileSystemEntry createAndFindChildWithEventFire(@NotNull String name, @NotNull NewVirtualFileSystem delegate) {
  final VirtualFile fake = new FakeVirtualFile(this, name);
  final FileAttributes attributes = delegate.getAttributes(fake);
  if (attributes == null) return null;
  final String realName = delegate.getCanonicallyCasedName(fake);
  final VFileCreateEvent event = new VFileCreateEvent(null, this, realName, attributes.isDirectory(), true);
  RefreshQueue.getInstance().processSingleEvent(event);
  return findChild(realName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:VirtualDirectoryImpl.java


示例7: after

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的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


示例8: createAndFindChildWithEventFire

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
@Nullable
private VirtualFileSystemEntry createAndFindChildWithEventFire(@Nonnull String name, @Nonnull NewVirtualFileSystem delegate) {
  final VirtualFile fake = new FakeVirtualFile(this, name);
  final FileAttributes attributes = delegate.getAttributes(fake);
  if (attributes == null) return null;
  final String realName = delegate.getCanonicallyCasedName(fake);
  final VFileCreateEvent event = new VFileCreateEvent(null, this, realName, attributes.isDirectory(), true);
  RefreshQueue.getInstance().processSingleEvent(event);
  return findChild(realName);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:VirtualDirectoryImpl.java


示例9: checkSubscription

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
private static void checkSubscription() {
  if (ourSubscribed.getAndSet(true)) return;

  Application app = ApplicationManager.getApplication();
  app.getMessageBus().connect(app).subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
    @Override
    public void after(@NotNull List<? extends VFileEvent> events) {
      InvalidationState state = null;

      synchronized (ourLock) {
        for (VFileEvent event : events) {
          if (!(event.getFileSystem() instanceof LocalFileSystem)) continue;

          if (event instanceof VFileCreateEvent) continue; // created file should not invalidate + getFile is costly

          if (event instanceof VFilePropertyChangeEvent &&
              !VirtualFile.PROP_NAME.equals(((VFilePropertyChangeEvent)event).getPropertyName())) {
            continue;
          }

          String path = event.getPath();
          if (event instanceof VFilePropertyChangeEvent) {
            path = ((VFilePropertyChangeEvent)event).getOldPath();
          }
          else if (event instanceof VFileMoveEvent) {
            path = ((VFileMoveEvent)event).getOldPath();
          }

          VirtualFile file = event.getFile();
          if (file == null || !file.isDirectory()) {
            state = InvalidationState.invalidate(state, path);
          }
          else {
            Collection<String> affectedPaths = ourDominatorsMap.get(path);
            if (affectedPaths != null) {
              affectedPaths = ContainerUtil.newArrayList(affectedPaths);  // defensive copying; original may be updated on invalidation
              for (String affectedPath : affectedPaths) {
                state = InvalidationState.invalidate(state, affectedPath);
              }
            }
          }
        }
      }

      if (state != null) state.scheduleRefresh();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:VfsImplUtil.java


示例10: processAfterVfsChanges

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
public void processAfterVfsChanges(@NotNull List<? extends VFileEvent> events) {
  boolean pushedSomething = false;
  List<Runnable> delayedTasks = ContainerUtil.newArrayList();
  for (VFileEvent event : events) {
    final VirtualFile file = event.getFile();
    if (file == null) continue;

    final FilePropertyPusher[] pushers = file.isDirectory() ? myPushers : myFilePushers;
    if (pushers.length == 0) continue;

    if (event instanceof VFileCreateEvent) {
      if (!event.isFromRefresh() || !file.isDirectory()) {
        // push synchronously to avoid entering dumb mode in the middle of a meaningful write action
        // avoid dumb mode for just one file
        doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
        pushedSomething = true;
      }
      else if (!ProjectCoreUtil.isProjectOrWorkspaceFile(file)) {
        ContainerUtil.addIfNotNull(delayedTasks, createRecursivePushTask(file, pushers));
      }
    } else if (event instanceof VFileMoveEvent) {
      for (FilePropertyPusher pusher : pushers) {
        file.putUserData(pusher.getFileDataKey(), null);
      }
      // push synchronously to avoid entering dumb mode in the middle of a meaningful write action
      doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
      pushedSomething = true;
    }
  }
  if (!delayedTasks.isEmpty()) {
    queueTasks(delayedTasks);
  }
  if (pushedSomething) {
    Application application = ApplicationManager.getApplication();
    Runnable runnable = new Runnable() {
      @Override
      public void run() {
        scheduleDumbModeReindexingIfNeeded();
      }
    };
    if (application.isUnitTestMode()) {
      runnable.run();
    } else {
      application.invokeLater(runnable);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:PushedFilePropertiesUpdaterImpl.java


示例11: checkSubscription

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
private static void checkSubscription() {
  if (ourSubscribed.getAndSet(true)) return;

  Application app = ApplicationManager.getApplication();
  app.getMessageBus().connect(app).subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
    @Override
    public void after(@Nonnull List<? extends VFileEvent> events) {
      InvalidationState state = null;

      synchronized (ourLock) {
        for (VFileEvent event : events) {
          if (!(event.getFileSystem() instanceof LocalFileSystem)) continue;

          if (event instanceof VFileCreateEvent) continue; // created file should not invalidate + getFile is costly

          if (event instanceof VFilePropertyChangeEvent && !VirtualFile.PROP_NAME.equals(((VFilePropertyChangeEvent)event).getPropertyName())) {
            continue;
          }

          String path = event.getPath();
          if (event instanceof VFilePropertyChangeEvent) {
            path = ((VFilePropertyChangeEvent)event).getOldPath();
          }
          else if (event instanceof VFileMoveEvent) {
            path = ((VFileMoveEvent)event).getOldPath();
          }

          VirtualFile file = event.getFile();
          if (file == null || !file.isDirectory()) {
            state = InvalidationState.invalidate(state, path);
          }
          else {
            Collection<String> affectedPaths = ourDominatorsMap.get(path);
            if (affectedPaths != null) {
              affectedPaths = ContainerUtil.newArrayList(affectedPaths);  // defensive copying; original may be updated on invalidation
              for (String affectedPath : affectedPaths) {
                state = InvalidationState.invalidate(state, affectedPath);
              }
            }
          }
        }
      }

      if (state != null) state.scheduleRefresh();
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:48,代码来源:VfsImplUtil.java


示例12: processAfterVfsChanges

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
public void processAfterVfsChanges(@Nonnull List<? extends VFileEvent> events) {
  boolean pushedSomething = false;
  List<Runnable> delayedTasks = ContainerUtil.newArrayList();
  for (VFileEvent event : events) {
    final VirtualFile file = event.getFile();
    if (file == null) continue;

    final FilePropertyPusher[] pushers = file.isDirectory() ? myPushers : myFilePushers;
    if (pushers.length == 0) continue;

    if (event instanceof VFileCreateEvent) {
      if (!event.isFromRefresh() || !file.isDirectory()) {
        // push synchronously to avoid entering dumb mode in the middle of a meaningful write action
        // avoid dumb mode for just one file
        doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
        pushedSomething = true;
      }
      else if (!ProjectCoreUtil.isProjectOrWorkspaceFile(file)) {
        ContainerUtil.addIfNotNull(delayedTasks, createRecursivePushTask(file, pushers));
      }
    } else if (event instanceof VFileMoveEvent) {
      for (FilePropertyPusher pusher : pushers) {
        file.putUserData(pusher.getFileDataKey(), null);
      }
      // push synchronously to avoid entering dumb mode in the middle of a meaningful write action
      doPushRecursively(file, pushers, ProjectRootManager.getInstance(myProject).getFileIndex());
      pushedSomething = true;
    }
  }
  if (!delayedTasks.isEmpty()) {
    queueTasks(delayedTasks);
  }
  if (pushedSomething) {
    GuiUtils.invokeLaterIfNeeded(new Runnable() {
      @Override
      public void run() {
        PushedFilePropertiesUpdaterImpl.this.scheduleDumbModeReindexingIfNeeded();
      }
    }, ModalityState.defaultModalityState());
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:42,代码来源:PushedFilePropertiesUpdaterImpl.java


示例13: onFileCreate

import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent; //导入依赖的package包/类
void onFileCreate(VFileCreateEvent event, Facet facet); 
开发者ID:facebook,项目名称:buck,代码行数:2,代码来源:FileCreateHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpClient类代码示例发布时间:2022-05-22
下一篇:
Java FakeProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap