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


Java VirtualFileEvent.getFile方法代码示例

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


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

示例1: fileDeleted

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
@Override
public void fileDeleted(@NotNull VirtualFileEvent event) {
  if (myProject.isDisposed() || !myProject.isOpen()) {
    return;
  }
  VirtualFile removedFile = event.getFile();
  final TaskFile taskFile = CCProjectService.getInstance(myProject).getTaskFile(removedFile);
  if (taskFile != null) {
    deleteAnswerFile(removedFile, taskFile);
    return;
  }
  Course course = CCProjectService.getInstance(myProject).getCourse();
  if (course == null) {
    return;
  }
  if (removedFile.getName().contains(EduNames.TASK)) {
    deleteTask(course, removedFile, myProject);
  }
  if (removedFile.getName().contains(EduNames.LESSON)) {
    deleteLesson(course, removedFile);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CCFileDeletedListener.java

示例2: executeMake

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
private void executeMake(final VirtualFileEvent event) {
        if(
            (pluginConfiguration == null || pluginConfiguration.isIncrementalBuilds())
// If no Configuration Selected which can happen when the project is not AEM / Sling based then do nothing
            && serverConnectionManager.isConfigurationSelected()
        ) {
            // Check if the file is a Java Class and if os build it
            VirtualFile file = event.getFile();
            if("java".equalsIgnoreCase(file.getExtension())) {
                //AS TODO: In order to use the Code Snell Detector this needs to be invoked in a Read Only Thread but part of the Dispatcher Thread
                ApplicationManager.getApplication().invokeLater(
                    new Runnable() {
                        @Override
                        public void run() {
                            executeMakeInUIThread(event);
                        }
                    }
                );
            }
        }
    }
 
开发者ID:headwirecom,项目名称:aem-ide-tooling-4-intellij,代码行数:22,代码来源:ContentResourceChangeListener.java

示例3: beforeContentChange

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
void beforeContentChange(@Nonnull VirtualFileEvent event) {
  if (event.isFromSave()) return;

  VirtualFile file = event.getFile();
  if (!file.isValid() || hasConflict(file)) return;

  Document document = FileDocumentManager.getInstance().getCachedDocument(file);
  if (document == null || !FileDocumentManager.getInstance().isDocumentUnsaved(document)) return;

  long documentStamp = document.getModificationStamp();
  long oldFileStamp = event.getOldModificationStamp();
  if (documentStamp != oldFileStamp) {
    LOG.info("reload " + file.getName() + " from disk?");
    LOG.info("  documentStamp:" + documentStamp);
    LOG.info("  oldFileStamp:" + oldFileStamp);
    if (myConflicts.isEmpty()) {
      ApplicationManager.getApplication().invokeLater(this::processConflicts);
    }
    myConflicts.add(file);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:MemoryDiskConflictResolver.java

示例4: fileCreated

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
@Override
public void fileCreated(@NotNull VirtualFileEvent event) {
  if (myProject.isDisposed()) return;
  final VirtualFile createdFile = event.getFile();
  final VirtualFile taskDir = StudyUtils.getTaskDir(createdFile);
  final Course course = StudyTaskManager.getInstance(myProject).getCourse();
  if (course == null || !EduNames.STUDY.equals(course.getCourseMode())) {
    return;
  }
  if (taskDir != null && taskDir.getName().contains(EduNames.TASK)) {
    int taskIndex = EduUtils.getIndex(taskDir.getName(), EduNames.TASK);
    final VirtualFile lessonDir = taskDir.getParent();
    if (lessonDir != null && lessonDir.getName().contains(EduNames.LESSON)) {
      int lessonIndex = EduUtils.getIndex(lessonDir.getName(), EduNames.LESSON);
      List<Lesson> lessons = course.getLessons();
      if (StudyUtils.indexIsValid(lessonIndex, lessons)) {
        final Lesson lesson = lessons.get(lessonIndex);
        final List<Task> tasks = lesson.getTaskList();
        if (StudyUtils.indexIsValid(taskIndex, tasks)) {
          final Task task = tasks.get(taskIndex);
          final TaskFile taskFile = new TaskFile();
          taskFile.initTaskFile(task, false);
          taskFile.setUserCreated(true);
          final String name = FileUtil.getRelativePath(taskDir.getPath(), createdFile.getPath(), '/');
          taskFile.name = name;
          //TODO: put to other steps as well
          task.getTaskFiles().put(name, taskFile);
        }
      }
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:33,代码来源:StudyProjectComponent.java

示例5: fileDeleted

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
@Override
public void fileDeleted(@NotNull VirtualFileEvent event) {
  VirtualFile removedFile = event.getFile();
  String path = removedFile.getPath();
  if (path.contains(CCUtils.GENERATED_FILES_FOLDER)) {
    return;
  }

  if (myProject == null) {
    return;
  }
  if (myProject.getBasePath() !=null && !FileUtil.isAncestor(myProject.getBasePath(), removedFile.getPath(), true)) {
    return;
  }
  Course course = StudyTaskManager.getInstance(myProject).getCourse();
  if (course == null) {
    return;
  }
  final TaskFile taskFile = StudyUtils.getTaskFile(myProject, removedFile);
  if (taskFile != null) {
    deleteTaskFile(removedFile, taskFile);
    return;
  }
  if (removedFile.getName().contains(EduNames.TASK)) {
    deleteTask(course, removedFile);
  }
  if (removedFile.getName().contains(EduNames.LESSON)) {
    deleteLesson(course, removedFile, myProject);
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:31,代码来源:CCVirtualFileListener.java

示例6: contentsChanged

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
@Override
public void contentsChanged(@NotNull VirtualFileEvent event){
  if (event.isFromSave()){ // commit
    assertThread();
    VirtualFile file = event.getFile();
    LOG.assertTrue(file.isValid());
    if(myFile.equals(file)){
      updateModifiedProperty();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:TextEditorComponent.java

示例7: fileCreated

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
@Override
public void fileCreated(@NotNull VirtualFileEvent event) {
  if (myProject.isDisposed()) return;
  final VirtualFile createdFile = event.getFile();
  final VirtualFile taskDir = createdFile.getParent();
  final Course course = StudyTaskManager.getInstance(myProject).getCourse();
  if (taskDir != null && taskDir.getName().contains(EduNames.TASK)) {
    int taskIndex = EduUtils.getIndex(taskDir.getName(), EduNames.TASK);
    final VirtualFile lessonDir = taskDir.getParent();
    if (lessonDir != null && lessonDir.getName().contains(EduNames.LESSON)) {
      int lessonIndex = EduUtils.getIndex(lessonDir.getName(), EduNames.LESSON);
      if (course != null) {
        List<Lesson> lessons = course.getLessons();
        if (StudyUtils.indexIsValid(lessonIndex, lessons)) {
          final Lesson lesson = lessons.get(lessonIndex);
          final List<Task> tasks = lesson.getTaskList();
          if (StudyUtils.indexIsValid(taskIndex, tasks)) {
            final Task task = tasks.get(taskIndex);
            final TaskFile taskFile = new TaskFile();
            taskFile.initTaskFile(task, false);
            taskFile.setUserCreated(true);
            final String name = createdFile.getName();
            taskFile.name = name;
            task.getTaskFiles().put(name, taskFile);
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:StudyProjectComponent.java

示例8: UserDeviceManager

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
public UserDeviceManager() {
  myListener = new VirtualFileAdapter() {
    @Override
    public void contentsChanged(@NotNull VirtualFileEvent event) {
      final VirtualFile file = event.getFile();
      if (myUserDevicesFile != null && SdkConstants.FN_DEVICES_XML.equals(file.getName()) &&
          FileUtil.pathsEqual(FileUtil.toSystemIndependentName(myUserDevicesFile.getPath()),
                              file.getPath())) {
        userDevicesChanged();
      }
    }
  };
  LocalFileSystem.getInstance().addVirtualFileListener(myListener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:UserDeviceManager.java

示例9: fileCreated

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
public void fileCreated(@NotNull VirtualFileEvent event) {
  if (! event.isFromRefresh()) {
    return;
  }
  final VirtualFile file = event.getFile();

  if (SvnUtil.SVN_ADMIN_DIR_NAME.equals(file.getName())) {
    if (event.getParent() != null) {
      VirtualFile parent = event.getParent();
      fireFileStatusesChanged(parent);
      refreshAnnotationsUnder(parent);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:SvnEntriesFileListener.java

示例10: fileDeleted

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
public void fileDeleted(@NotNull VirtualFileEvent event) {
  if (!event.isFromRefresh()) {
    return;
  }
  final VirtualFile file = event.getFile();
  if (SvnUtil.SVN_ADMIN_DIR_NAME.equals(file.getName())) {
    if (event.getParent() != null) {
      VirtualFile parent = event.getParent();
      fireFileStatusesChanged(parent);
      refreshAnnotationsUnder(parent);
    }
    return;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:SvnEntriesFileListener.java

示例11: contentsChanged

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
@Override
public void contentsChanged(@NotNull VirtualFileEvent event) {
    final VirtualFile file = event.getFile();
    if(GRAPHQL_CONFIG_JSON.equals(file.getName())) {
        if(myProject.isDisposed()) {
            // the project has been disposed, so this instance isn't needed anymore
            VirtualFileManager.getInstance().removeVirtualFileListener(this);
            return;
        }
        if(file.equals(getGraphQLConfigFile())) {
            final JSGraphQLConfiguration configuration = getConfiguration(file);
            if(configuration != null && configuration.endpoints != null) {
                synchronized (endpointsLock) {
                    if(endpoints == null) {
                        endpoints = configuration.endpoints;
                    } else {
                        for(int i = 0; i < configuration.endpoints.size(); i++) {
                            if(i < endpoints.size()) {
                                // update existing instances since they may already be selected in open editors
                                endpoints.get(i).withPropertiesFrom(configuration.endpoints.get(i));
                            } else {
                                endpoints.add(configuration.endpoints.get(i));
                            }
                        }
                        if(configuration.endpoints.size() < endpoints.size()) {
                            // one or more endpoints deleted
                            endpoints.removeIf(ep -> !configuration.endpoints.contains(ep));
                        }
                    }
                }

                // signal the change
                myProject.getMessageBus().syncPublisher(JSGraphQLConfigurationListener.TOPIC).onEndpointsChanged(endpoints);

            }
            myProject.putUserData(GRAPHQL_CONFIG_ENDPOINT_ENTRY_FILE_URL, null);
        }
    }
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:40,代码来源:JSGraphQLConfigurationProvider.java

示例12: contentsChanged

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
@Override
public void contentsChanged(VirtualFileEvent event){
  if (event.isFromSave()){ // commit
    assertThread();
    VirtualFile file = event.getFile();
    LOG.assertTrue(file.isValid());
    if(myFile.equals(file)){
      updateModifiedProperty();
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:TextEditorComponent.java

示例13: onFileContentChanged

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
private void onFileContentChanged(final VirtualFileEvent event) {
  VirtualFile file = event.getFile();

  if (event.getRequestor() == null && isFileUnder(file, myVFSBaseDir) && !myInsideSave) {
    File ioFile = new File(file.getPath());
    E scheme = findSchemeFor(ioFile.getName());
    ArrayList<E> read = new ArrayList<E>();
    T oldCurrentScheme = null;
    if (scheme != null) {
      oldCurrentScheme = getCurrentScheme();
      @SuppressWarnings("unchecked") T t = (T)scheme;
      removeScheme(t);
      myProcessor.onSchemeDeleted(scheme);
    }

    readSchemeFromFile(read, file, true);
    if (!read.isEmpty()) {
      E readScheme = read.get(0);
      myProcessor.initScheme(readScheme);

      myProcessor.onSchemeAdded(readScheme);

      T newCurrentScheme = getCurrentScheme();

      if (oldCurrentScheme != null && newCurrentScheme == null) {
        setCurrentSchemeName(readScheme.getName());
        newCurrentScheme = getCurrentScheme();
      }

      if (oldCurrentScheme != newCurrentScheme) {
        myProcessor.onCurrentSchemeChanged(oldCurrentScheme);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:SchemesManagerImpl.java

示例14: fileCreated

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
public void fileCreated(VirtualFileEvent event) {
  if (! event.isFromRefresh()) {
    return;
  }
  final VirtualFile file = event.getFile();

  if (SvnUtil.SVN_ADMIN_DIR_NAME.equals(file.getName())) {
    if (event.getParent() != null) {
      VirtualFile parent = event.getParent();
      fireFileStatusesChanged(parent);
      refreshAnnotationsUnder(parent);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:SvnEntriesFileListener.java

示例15: fileDeleted

import com.intellij.openapi.vfs.VirtualFileEvent; //导入方法依赖的package包/类
public void fileDeleted(VirtualFileEvent event) {
  if (!event.isFromRefresh()) {
    return;
  }
  final VirtualFile file = event.getFile();
  if (SvnUtil.SVN_ADMIN_DIR_NAME.equals(file.getName())) {
    if (event.getParent() != null) {
      VirtualFile parent = event.getParent();
      fireFileStatusesChanged(parent);
      refreshAnnotationsUnder(parent);
    }
    return;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:SvnEntriesFileListener.java


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