Search in sources :

Example 1 with FacetPointerListener

use of com.intellij.facet.pointers.FacetPointerListener in project intellij-community by JetBrains.

the class FacetPointersManagerImpl method refreshPointers.

private void refreshPointers(@NotNull final Module module) {
    //todo[nik] refresh only pointers related to renamed module/facet?
    List<Pair<FacetPointerImpl, String>> changed = new ArrayList<>();
    for (FacetPointerImpl pointer : myPointers.values()) {
        final String oldId = pointer.getId();
        pointer.refresh();
        if (!oldId.equals(pointer.getId())) {
            changed.add(Pair.create(pointer, oldId));
        }
    }
    for (Pair<FacetPointerImpl, String> pair : changed) {
        FacetPointerImpl pointer = pair.getFirst();
        final Facet facet = pointer.getFacet();
        Class facetClass = facet != null ? facet.getClass() : Facet.class;
        while (facetClass != Object.class) {
            final EventDispatcher<FacetPointerListener> dispatcher = myDispatchers.get(facetClass);
            if (dispatcher != null) {
                //noinspection unchecked
                dispatcher.getMulticaster().pointerIdChanged(pointer, pair.getSecond());
            }
            facetClass = facetClass.getSuperclass();
        }
    }
}
Also used : ArrayList(java.util.ArrayList) FacetPointerListener(com.intellij.facet.pointers.FacetPointerListener) Pair(com.intellij.openapi.util.Pair) Facet(com.intellij.facet.Facet)

Aggregations

Facet (com.intellij.facet.Facet)1 FacetPointerListener (com.intellij.facet.pointers.FacetPointerListener)1 Pair (com.intellij.openapi.util.Pair)1 ArrayList (java.util.ArrayList)1