• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java InvalidVirtualFileAccessException类的典型用法和代码示例

java 2次浏览

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

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

示例1: ATSFile

点赞 3

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
public ATSFile(@NotNull FileViewProvider viewProvider) {
    super(viewProvider, ATSLanguage.INSTANCE);

    String extension = "";
    int i = this.getName().lastIndexOf('.');
    if (i > 0) {
        extension = this.getName().substring(i + 1);
    }
    if (extension.equals("dats")) {
        myFileTypeInstance = ATSFileTypeDynamic.INSTANCE;
    } else if (extension.equals("sats")) {
        myFileTypeInstance = ATSFileTypeStatic.INSTANCE;
    } else if (extension.equals("hats")) {
        myFileTypeInstance = ATSFileTypeInclude.INSTANCE;
    } else {
        // This is probably not exactly what we need:
        throw new InvalidVirtualFileAccessException(this.getName());
    }
}
 

开发者ID:bbarker,
项目名称:IntelliJATS,
代码行数:20,
代码来源:ATSFile.java

示例2: getNontrivialFileIndexedStates

点赞 2

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
@NotNull
public static List<ID<?,?>> getNontrivialFileIndexedStates(int fileId) {
  if (fileId != INVALID_FILE_ID) {
    Lock readLock = getStripedLock(fileId).readLock();
    readLock.lock();
    try {
      Timestamps stamp = createOrGetTimeStamp(fileId);
      if (stamp != null && stamp.myIndexStamps != null && !stamp.myIndexStamps.isEmpty()) {
        final SmartList<ID<?, ?>> retained = new SmartList<ID<?, ?>>();
        stamp.myIndexStamps.forEach(new TObjectProcedure<ID<?, ?>>() {
          @Override
          public boolean execute(ID<?, ?> object) {
            retained.add(object);
            return true;
          }
        });
        return retained;
      }
    }
    catch (InvalidVirtualFileAccessException ignored /*ok to ignore it here*/) {
    }
    finally {
      readLock.unlock();
    }
  }
  return Collections.emptyList();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:28,
代码来源:IndexingStamp.java

示例3: update

点赞 2

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
public static void update(final VirtualFile file, final ID<?, ?> indexName, final long indexCreationStamp) {
  synchronized (getStripedLock(file)) {
    try {
      Timestamps stamp = createOrGetTimeStamp(file);
      if (stamp != null) stamp.set(indexName, indexCreationStamp);
    }
    catch (InvalidVirtualFileAccessException ignored /*ok to ignore it here*/) {
    }
  }
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:11,
代码来源:IndexingStamp.java

示例4: getNontrivialFileIndexedStates

点赞 2

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
@Nonnull
public static List<ID<?,?>> getNontrivialFileIndexedStates(int fileId) {
  if (fileId != INVALID_FILE_ID) {
    Lock readLock = getStripedLock(fileId).readLock();
    readLock.lock();
    try {
      Timestamps stamp = createOrGetTimeStamp(fileId);
      if (stamp != null && stamp.myIndexStamps != null && !stamp.myIndexStamps.isEmpty()) {
        final SmartList<ID<?, ?>> retained = new SmartList<ID<?, ?>>();
        stamp.myIndexStamps.forEach(new TObjectProcedure<ID<?, ?>>() {
          @Override
          public boolean execute(ID<?, ?> object) {
            retained.add(object);
            return true;
          }
        });
        return retained;
      }
    }
    catch (InvalidVirtualFileAccessException ignored /*ok to ignore it here*/) {
    }
    finally {
      readLock.unlock();
    }
  }
  return Collections.emptyList();
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:28,
代码来源:IndexingStamp.java

示例5: doLoadContent

点赞 2

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
@SuppressWarnings("InstanceofCatchParameter")
private boolean doLoadContent(@NotNull FileContent content, @NotNull final ProgressIndicator indicator) throws InterruptedException {
  final long contentLength = content.getLength();

  boolean counterUpdated = false;
  try {
    synchronized (myProceedWithLoadingLock) {
      while (myLoadedBytesInQueue > MAX_SIZE_OF_BYTES_IN_QUEUE) {
        indicator.checkCanceled();
        myProceedWithLoadingLock.wait(300);
      }
      myLoadedBytesInQueue += contentLength;
      counterUpdated = true;
    }

    content.getBytes(); // Reads the content bytes and caches them.

    return true;
  }
  catch (Throwable e) {
    if (counterUpdated) {
      synchronized (myProceedWithLoadingLock) {
        myLoadedBytesInQueue -= contentLength;   // revert size counter
      }
    }

    if (e instanceof ProcessCanceledException) {
      throw (ProcessCanceledException)e;
    }
    else if (e instanceof InterruptedException) {
      throw (InterruptedException)e;
    }
    else if (e instanceof IOException || e instanceof InvalidVirtualFileAccessException) {
      LOG.info(e);
    }
    else if (ApplicationManager.getApplication().isUnitTestMode()) {
      //noinspection CallToPrintStackTrace
      e.printStackTrace();
    }
    else {
      LOG.error(e);
    }

    return false;
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:47,
代码来源:FileContentQueue.java

示例6: reportDeadFileAccess

点赞 2

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
private static InvalidVirtualFileAccessException reportDeadFileAccess(VirtualFileSystemEntry file) {
  return new InvalidVirtualFileAccessException("Accessing dead virtual file: " + file.getUrl());
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:4,
代码来源:VfsData.java

示例7: doLoadContent

点赞 2

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
@SuppressWarnings("InstanceofCatchParameter")
private boolean doLoadContent(final FileContent content, @NotNull final ProgressIndicator indicator) throws InterruptedException {
  final long contentLength = content.getLength();

  boolean counterUpdated = false;
  try {
    synchronized (myProceedWithLoadingLock) {
      while (myLoadedBytesInQueue > MAX_SIZE_OF_BYTES_IN_QUEUE) {
        indicator.checkCanceled();
        myProceedWithLoadingLock.wait(300);
      }
      myLoadedBytesInQueue += contentLength;
      counterUpdated = true;
    }

    content.getBytes(); // Reads the content bytes and caches them.

    return true;
  }
  catch (Throwable e) {
    if (counterUpdated) {
      synchronized (myProceedWithLoadingLock) {
        myLoadedBytesInQueue -= contentLength;   // revert size counter
      }
    }

    if (e instanceof ProcessCanceledException) {
      throw (ProcessCanceledException)e;
    }
    else if (e instanceof InterruptedException) {
      throw (InterruptedException)e;
    }
    else if (e instanceof IOException || e instanceof InvalidVirtualFileAccessException) {
      LOG.info(e);
    }
    else if (ApplicationManager.getApplication().isUnitTestMode()) {
      //noinspection CallToPrintStackTrace
      e.printStackTrace();
    }
    else {
      LOG.error(e);
    }

    return false;
  }
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:47,
代码来源:FileContentQueue.java

示例8: doLoadContent

点赞 2

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
@SuppressWarnings("InstanceofCatchParameter")
private boolean doLoadContent(@Nonnull FileContent content, @Nonnull final ProgressIndicator indicator) throws InterruptedException {
  final long contentLength = content.getLength();

  boolean counterUpdated = false;
  try {
    synchronized (myProceedWithLoadingLock) {
      while (myLoadedBytesInQueue > MAX_SIZE_OF_BYTES_IN_QUEUE) {
        indicator.checkCanceled();
        myProceedWithLoadingLock.wait(300);
      }
      myLoadedBytesInQueue += contentLength;
      counterUpdated = true;
    }

    content.getBytes(); // Reads the content bytes and caches them.

    return true;
  }
  catch (Throwable e) {
    if (counterUpdated) {
      synchronized (myProceedWithLoadingLock) {
        myLoadedBytesInQueue -= contentLength;   // revert size counter
      }
    }

    if (e instanceof ProcessCanceledException) {
      throw (ProcessCanceledException)e;
    }
    else if (e instanceof InterruptedException) {
      throw (InterruptedException)e;
    }
    else if (e instanceof IOException || e instanceof InvalidVirtualFileAccessException) {
      LOG.info(e);
    }
    else if (ApplicationManager.getApplication().isUnitTestMode()) {
      //noinspection CallToPrintStackTrace
      e.printStackTrace();
    }
    else {
      LOG.error(e);
    }

    return false;
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:47,
代码来源:FileContentQueue.java

示例9: doFindChild

点赞 2

import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; //导入依赖的package包/类
@Nullable // null if there can't be a child with this name, NULL_VIRTUAL_FILE if cached as absent, the file if found
private VirtualFileSystemEntry doFindChild(@Nonnull String name,
                                           boolean ensureCanonicalName,
                                           @Nonnull NewVirtualFileSystem delegate,
                                           boolean ignoreCase) {
  if (name.isEmpty()) {
    return null;
  }
  if (!isValid()) {
    throw new InvalidVirtualFileAccessException(this);
  }

  VirtualFileSystemEntry found = doFindChildInArray(name, ignoreCase);
  if (found != null) return found;

  if (allChildrenLoaded()) {
    return NULL_VIRTUAL_FILE;
  }

  if (ensureCanonicalName) {
    name = UriUtil.trimTrailingSlashes(UriUtil.trimLeadingSlashes(FileUtilRt.toSystemIndependentName(name)));
    if (name.indexOf('/') != -1) return null; // name must not contain slashes in the middle
    VirtualFile fake = new FakeVirtualFile(this, name);
    name = delegate.getCanonicallyCasedName(fake);
    if (name.isEmpty()) return null;
  }

  VirtualFileSystemEntry child;
  synchronized (myData) {
    // maybe another doFindChild() sneaked in the middle
    if (myData.isAdoptedName(name)) return NULL_VIRTUAL_FILE;

    int[] array = myData.myChildrenIds;
    int indexInReal = findIndex(array, name, ignoreCase);
    // double check
    if (indexInReal >= 0) {
      return VfsData.getFileById(array[indexInReal], this);
    }
    if (allChildrenLoaded()) {
      return null;
    }

    // do not extract getId outside the synchronized block since it will cause a concurrency problem.
    int id = ourPersistence.getId(this, name, delegate);
    if (id <= 0) {
      myData.addAdoptedName(name, !ignoreCase);
      return null;
    }
    child = createChild(FileNameCache.storeName(name), id, delegate);

    int[] after = myData.myChildrenIds;
    if (after != array)  {
      // in tests when we call assertAccessInTests it can load a huge number of files which lead to children modification
      // so fall back to slow path
      addChild(child);
    }
    else {
      insertChildAt(child, indexInReal);
      assertConsistency(!delegate.isCaseSensitive(), name);
    }
  }

  if (!child.isDirectory()) {
    // access check should only be called when child is actually added to the parent, otherwise it may break VirtualFilePointers validity
    //noinspection TestOnlyProblems
    VfsRootAccess.assertAccessInTests(child, getFileSystem());
  }

  return child;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:71,
代码来源:VirtualDirectoryImpl.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)