コード例 #1
0
 public void replace(
     final List<BaseInjection> originalInjections, final List<BaseInjection> newInjections) {
   for (Iterator<InjInfo> it = injectionInfos.iterator(); it.hasNext(); ) {
     final InjInfo info = it.next();
     if (originalInjections.contains(info.injection)) it.remove();
   }
   for (BaseInjection newInjection : newInjections) {
     injectionInfos.add(new InjInfo(newInjection, this));
   }
 }
コード例 #2
0
 private void mousePressedInFoldingArea(MouseEvent e) {
   for (Iterator<AbstractFoldingAreaPainter> it = myFoldingAreaPainters.descendingIterator();
       it.hasNext(); ) {
     AbstractFoldingAreaPainter painter = it.next();
     painter.mousePressed(e);
     if (e.isConsumed()) {
       break;
     }
   }
 }
コード例 #3
0
  public static String print(Collection c) {
    StringBuilder result = new StringBuilder();
    for (Iterator iterator = c.iterator(); iterator.hasNext(); ) {
      Object each = iterator.next();
      result.append(toString(each, null));
      if (iterator.hasNext()) {
        result.append("\n");
      }
    }

    return result.toString();
  }
コード例 #4
0
 public void removeAllIconRenderers(IconRendererType type) {
   assert SwingUtilities.isEventDispatchThread()
       : "LeftEditorHighlighter.removeAllIconRenderers() should be called in eventDispatchThread";
   boolean wasModified = false;
   for (Iterator<EditorMessageIconRenderer> it = myIconRenderers.iterator(); it.hasNext(); ) {
     EditorMessageIconRenderer renderer = it.next();
     if (renderer.getType() == type) {
       it.remove();
       wasModified = true;
     }
   }
   if (wasModified) {
     relayoutOnIconRendererChanges();
   }
 }
コード例 #5
0
  private void recalculateIconRenderersWidth() {
    myLineToRenderersMap.clear();
    for (EditorMessageIconRenderer renderer : myIconRenderers) {
      int yCoordinate = getIconCoordinate(renderer);
      if (yCoordinate < 0) {
        continue;
      }
      List<IconRendererLayoutConstraint> renderersForLine = myLineToRenderersMap.get(yCoordinate);
      if (renderersForLine == null) {
        renderersForLine = new SortedList(myIconRenderersComparator);
        myLineToRenderersMap.put(yCoordinate, renderersForLine);
      }
      renderersForLine.add(new IconRendererLayoutConstraint(renderer));
    }

    myIconRenderersWidth = MIN_ICON_RENDERERS_WIDTH;
    myMaxIconHeight = 0;
    int[] sortedYCoordinates = myLineToRenderersMap.keys();
    Arrays.sort(sortedYCoordinates);

    int initialOffset = getIconRenderersOffset();
    for (int y : sortedYCoordinates) {
      List<IconRendererLayoutConstraint> row = myLineToRenderersMap.get(y);
      assert row.size() != 0;
      int maxIconHeight = 0;
      for (IconRendererLayoutConstraint rendererConstraint : row) {
        maxIconHeight =
            Math.max(maxIconHeight, rendererConstraint.getIconRenderer().getIcon().getIconHeight());
      }
      myMaxIconHeight = Math.max(myMaxIconHeight, maxIconHeight);
      int offset = initialOffset + LEFT_GAP;
      for (Iterator<IconRendererLayoutConstraint> it = row.iterator(); it.hasNext(); ) {
        IconRendererLayoutConstraint rendererConstraint = it.next();
        rendererConstraint.setX(offset);
        offset += rendererConstraint.getIconRenderer().getIcon().getIconWidth();
        if (it.hasNext()) {
          offset += GAP_BETWEEN_ICONS;
        }
      }
      myIconRenderersWidth = Math.max(myIconRenderersWidth, offset - initialOffset);
    }
  }
コード例 #6
0
 @NotNull
 public static Collection<GitRemote> getRemotesWithCommonNames(
     @NotNull Collection<GitRepository> repositories) {
   if (repositories.isEmpty()) {
     return Collections.emptyList();
   }
   Iterator<GitRepository> iterator = repositories.iterator();
   List<GitRemote> commonRemotes = new ArrayList<GitRemote>(iterator.next().getRemotes());
   while (iterator.hasNext()) {
     GitRepository repository = iterator.next();
     Collection<String> remoteNames = getRemoteNames(repository);
     for (Iterator<GitRemote> commonIter = commonRemotes.iterator(); commonIter.hasNext(); ) {
       GitRemote remote = commonIter.next();
       if (!remoteNames.contains(remote.getName())) {
         commonIter.remove();
       }
     }
   }
   return commonRemotes;
 }