Java Code Examples for com.intellij.util.ArrayUtil#remove()

The following examples show how to use com.intellij.util.ArrayUtil#remove() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoverageDataManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void removeCoverageSuite(final CoverageSuite suite) {
  final String fileName = suite.getCoverageDataFileName();

  boolean deleteTraces = suite.isTracingEnabled();
  if (!FileUtil.isAncestor(ContainerPathManager.get().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);
  }
}
 
Example 2
Source File: VirtualDirectoryImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void removeChild(@Nonnull VirtualFile file) {
  boolean caseSensitive = getFileSystem().isCaseSensitive();
  String name = file.getName();
  synchronized (myData) {
    int indexInReal = findIndex(myData.myChildrenIds, name, caseSensitive);
    if (indexInReal >= 0) {
      // there suddenly can be that we ask to add name to adopted whereas it already contained in the real part
      // in this case we should remove it from there
      myData.myChildrenIds = ArrayUtil.remove(myData.myChildrenIds, indexInReal);
    }
    if (!allChildrenLoaded()) {
      myData.addAdoptedName(name, caseSensitive);
    }

    assertConsistency(caseSensitive, file);
  }
}
 
Example 3
Source File: CsvTableEditor.java    From intellij-csv-validator with Apache License 2.0 5 votes vote down vote up
public final Object[][] removeRows(int[] indices) {
    List<Integer> currentRows = Ints.asList(indices);
    currentRows.sort(Collections.reverseOrder());
    TableDataHandler dataHandler = getDataHandler();
    Object[][] currentData = dataHandler.getCurrentState();
    int offset = getFileEditorState().getFixedHeaders() ? 1 : 0;
    for (int currentRow : currentRows) {
        currentData = ArrayUtil.remove(currentData, currentRow + offset);
    }
    updateTableComponentData(dataHandler.addState(currentData));
    return currentData;
}
 
Example 4
Source File: CsvTableEditor.java    From intellij-csv-validator with Apache License 2.0 5 votes vote down vote up
public final Object[][] removeColumns(int[] indices) {
    List<Integer> currentColumns = Ints.asList(indices);
    currentColumns.sort(Collections.reverseOrder());
    TableDataHandler dataHandler = getDataHandler();
    Object[][] currentData = dataHandler.getCurrentState();
    for (int currentColumn : currentColumns) {
        for (int i = 0; i < currentData.length; ++i) {
            currentData[i] = ArrayUtil.remove(currentData[i], currentColumn);
        }
    }
    updateTableComponentData(dataHandler.addState(currentData));
    return currentData;
}
 
Example 5
Source File: LockFreeCOWSortedArray.java    From consulo with Apache License 2.0 5 votes vote down vote up
boolean remove(@Nonnull T listener) {
  while (true) {
    T[] oldListeners = listeners;
    T[] newListeners = ArrayUtil.remove(oldListeners, listener, arrayFactory);
    //noinspection ArrayEquality
    if (oldListeners == newListeners) return false;
    if (UPDATER.compareAndSet(this, oldListeners, newListeners)) break;
  }
  return true;
}
 
Example 6
Source File: NonProjectFilesScope.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static NamedScope[] removeFromList(@Nonnull NamedScope[] scopes) {
  int nonProjectIdx = -1;
  for (int i = 0, length = scopes.length; i < length; i++) {
    NamedScope scope = scopes[i];
    if (scope instanceof NonProjectFilesScope) {
      nonProjectIdx = i;
      break;
    }
  }
  if (nonProjectIdx > -1) {
    scopes = ArrayUtil.remove(scopes, nonProjectIdx);
  }
  return scopes;
}
 
Example 7
Source File: IconDescriptor.java    From consulo with Apache License 2.0 4 votes vote down vote up
public IconDescriptor removeLayerIcon(@Nonnull Image icon) {
  myLayerIcons = ArrayUtil.remove(myLayerIcons, icon);
  return this;
}