コード例 #1
0
  public void removeCoverageSuite(final CoverageSuite suite) {
    final String fileName = suite.getCoverageDataFileName();

    boolean deleteTraces = suite.isTracingEnabled();
    if (!FileUtil.isAncestor(PathManager.getSystemPath(), fileName, false)) {
      String message = "Would you like to delete file \'" + fileName + "\' ";
      if (deleteTraces) {
        message +=
            "and traces directory \'"
                + FileUtil.getNameWithoutExtension(new File(fileName))
                + "\' ";
      }
      message += "on disk?";
      if (Messages.showYesNoDialog(
              myProject, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon())
          == Messages.YES) {
        deleteCachedCoverage(fileName, deleteTraces);
      }
    } else {
      deleteCachedCoverage(fileName, deleteTraces);
    }

    myCoverageSuites.remove(suite);
    if (myCurrentSuitesBundle != null && myCurrentSuitesBundle.contains(suite)) {
      CoverageSuite[] suites = myCurrentSuitesBundle.getSuites();
      suites = ArrayUtil.remove(suites, suite);
      chooseSuitesBundle(suites.length > 0 ? new CoverageSuitesBundle(suites) : null);
    }
  }
コード例 #2
0
 @Nullable
 private static InjectionPlace[] dropKnownInvalidPlaces(InjectionPlace[] places) {
   InjectionPlace[] result = places;
   for (InjectionPlace place : places) {
     if (place.getText().contains("matches(\"[^${}/\\\\]+\")")) {
       result = ArrayUtil.remove(result, place);
     }
   }
   return places.length != 0 && result.length == 0 ? null : result;
 }
コード例 #3
0
  public static void deleteRootRecord(int id) throws IOException {
    try {
      w.lock();
      DbConnection.markDirty();
      final DataInputStream input = readAttribute(1, CHILDREN_ATT);
      assert input != null;
      int count;
      int[] names;
      int[] ids;
      try {
        count = DataInputOutputUtil.readINT(input);

        names = ArrayUtil.newIntArray(count);
        ids = ArrayUtil.newIntArray(count);
        for (int i = 0; i < count; i++) {
          names[i] = DataInputOutputUtil.readINT(input);
          ids[i] = DataInputOutputUtil.readINT(input);
        }
      } finally {
        input.close();
      }

      final int index = ArrayUtil.find(ids, id);
      assert index >= 0;

      names = ArrayUtil.remove(names, index);
      ids = ArrayUtil.remove(ids, index);

      final DataOutputStream output = writeAttribute(1, CHILDREN_ATT, false);
      try {
        DataInputOutputUtil.writeINT(output, count - 1);
        for (int i = 0; i < names.length; i++) {
          DataInputOutputUtil.writeINT(output, names[i]);
          DataInputOutputUtil.writeINT(output, ids[i]);
        }
      } finally {
        output.close();
      }
    } finally {
      w.unlock();
    }
  }
コード例 #4
0
 private void removeFromMap(int id, int index) {
   id = unwrap(myFactory.getValue(id)).getID();
   int[] classes = myIdToEqClassesIndices.get(id);
   if (classes != null) {
     int i = ArrayUtil.indexOf(classes, index);
     if (i != -1) {
       classes = ArrayUtil.remove(classes, i);
       myIdToEqClassesIndices.put(id, classes);
     }
   }
 }
コード例 #5
0
 private void removeFromArray(int index) {
   myChildren =
       ArrayUtil.remove(
           myChildren,
           index,
           new ArrayFactory<VirtualFileSystemEntry>() {
             @NotNull
             @Override
             public VirtualFileSystemEntry[] create(int count) {
               return new VirtualFileSystemEntry[count];
             }
           });
 }
コード例 #6
0
 private static int rearrangeOrderEntryOfType(
     ModifiableRootModel rootModel, Class<? extends OrderEntry> orderEntryClass) {
   OrderEntry[] orderEntries = rootModel.getOrderEntries();
   int moduleSourcesIdx = 0;
   for (OrderEntry orderEntry : orderEntries) {
     if (orderEntryClass.isAssignableFrom(orderEntry.getClass())) {
       break;
     }
     moduleSourcesIdx++;
   }
   orderEntries = ArrayUtil.append(orderEntries, orderEntries[moduleSourcesIdx]);
   orderEntries = ArrayUtil.remove(orderEntries, moduleSourcesIdx);
   rootModel.rearrangeOrderEntries(orderEntries);
   return orderEntries.length - 1;
 }
コード例 #7
0
ファイル: PersistentFSImpl.java プロジェクト: ernestp/consulo
  private static void removeIdFromParentList(
      final int parentId, final int id, @NotNull VirtualFile parent, VirtualFile file) {
    int[] childList = FSRecords.list(parentId);

    int index = ArrayUtil.indexOf(childList, id);
    if (index == -1) {
      throw new RuntimeException(
          "Cannot find child ("
              + id
              + ")"
              + file
              + "\n\tin ("
              + parentId
              + ")"
              + parent
              + "\n\tactual children:"
              + Arrays.toString(childList));
    }
    childList = ArrayUtil.remove(childList, index);
    FSRecords.updateList(parentId, childList);
  }
コード例 #8
0
 @Override
 public boolean unregisterMultiHostInjector(@NotNull MultiHostInjector injector) {
   boolean removed = false;
   Iterator<Map.Entry<Class, MultiHostInjector[]>> iterator = injectors.entrySet().iterator();
   while (iterator.hasNext()) {
     Map.Entry<Class, MultiHostInjector[]> entry = iterator.next();
     MultiHostInjector[] infos = entry.getValue();
     int i = ArrayUtil.find(infos, injector);
     if (i != -1) {
       MultiHostInjector[] newInfos = ArrayUtil.remove(infos, i);
       if (newInfos.length == 0) {
         iterator.remove();
       } else {
         injectors.put(entry.getKey(), newInfos);
       }
       removed = true;
     }
   }
   cachedInjectors.clearCache();
   return removed;
 }