@NotNull private InlineProgressIndicator createInlineDelegate( @NotNull TaskInfo info, @NotNull ProgressIndicatorEx original, final boolean compact) { final Collection<InlineProgressIndicator> inlines = myOriginal2Inlines.get(original); if (inlines != null) { for (InlineProgressIndicator eachInline : inlines) { if (eachInline.isCompact() == compact) return eachInline; } } final InlineProgressIndicator inline = new MyInlineProgressIndicator(compact, info, original); myInline2Original.put(inline, original); myOriginal2Inlines.put(original, inline); if (compact) { inline .getComponent() .addMouseListener( new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { handle(e); } @Override public void mouseReleased(MouseEvent e) { handle(e); } }); } return inline; }
private static MultiValuesMap<String, BaseInjection> createInjectionMap( final Collection<BaseInjection> injections) { final MultiValuesMap<String, BaseInjection> existingMap = new MultiValuesMap<String, BaseInjection>(); for (BaseInjection injection : injections) { for (InjectionPlace place : injection.getInjectionPlaces()) { existingMap.put(place.getText(), injection); } } return existingMap; }
private ProgressIndicatorEx removeFromMaps(@NotNull InlineProgressIndicator progress) { final ProgressIndicatorEx original = myInline2Original.get(progress); myInline2Original.remove(progress); myOriginal2Inlines.remove(original, progress); if (myOriginal2Inlines.get(original) == null) { final int originalIndex = myOriginals.indexOf(original); myOriginals.remove(originalIndex); myInfos.remove(originalIndex); } return original; }
static void importInjections( final Collection<BaseInjection> existingInjections, final Collection<BaseInjection> importingInjections, final Collection<BaseInjection> originalInjections, final Collection<BaseInjection> newInjections) { final MultiValuesMap<InjectionPlace, BaseInjection> placeMap = new MultiValuesMap<InjectionPlace, BaseInjection>(); for (BaseInjection exising : existingInjections) { for (InjectionPlace place : exising.getInjectionPlaces()) { placeMap.put(place, exising); } } main: for (BaseInjection other : importingInjections) { final List<BaseInjection> matchingInjections = ContainerUtil.concat( other.getInjectionPlaces(), new Function<InjectionPlace, Collection<? extends BaseInjection>>() { public Collection<? extends BaseInjection> fun(final InjectionPlace o) { final Collection<BaseInjection> collection = placeMap.get(o); return collection == null ? Collections.<BaseInjection>emptyList() : collection; } }); if (matchingInjections.isEmpty()) { newInjections.add(other); } else { BaseInjection existing = null; for (BaseInjection injection : matchingInjections) { if (injection.equals(other)) continue main; if (existing == null && injection.sameLanguageParameters(other)) { existing = injection; } } if (existing == null) continue main; // skip!! language changed final BaseInjection newInjection = existing.copy(); newInjection.mergeOriginalPlacesFrom(other, true); if (!newInjection.equals(existing)) { originalInjections.add(existing); newInjections.add(newInjection); } } } }
@Override public void dispose() { setRefreshVisible(false); InlineProgressIndicator[] indicators = getCurrentInlineIndicators().toArray(new InlineProgressIndicator[0]); for (InlineProgressIndicator indicator : indicators) { Disposer.dispose(indicator); } myInline2Original.clear(); myOriginal2Inlines.clear(); }