public XBreakpointManagerImpl(final Project project, final XDebuggerManagerImpl debuggerManager, StartupManager startupManager) { myProject = project; myDebuggerManager = debuggerManager; myAllBreakpointsDispatcher = EventDispatcher.create(XBreakpointListener.class); myDependentBreakpointManager = new XDependentBreakpointManager(this); myLineBreakpointManager = new XLineBreakpointManager(project, myDependentBreakpointManager, startupManager); if (!project.isDefault()) { if (!ApplicationManager.getApplication().isUnitTestMode()) { HttpVirtualFileListener httpVirtualFileListener = new HttpVirtualFileListener() { @Override public void fileDownloaded(@NotNull final VirtualFile file) { updateBreakpointInFile(file); } }; HttpFileSystem.getInstance().addFileListener(httpVirtualFileListener, project); } for (XBreakpointType<?, ?> type : XBreakpointUtil.getBreakpointTypes()) { addDefaultBreakpoint(type); } } }
private <T extends XBreakpointProperties> void addBreakpoint(final XBreakpointBase<?, T, ?> breakpoint, final boolean defaultBreakpoint, boolean initUI) { XBreakpointType type = breakpoint.getType(); if (defaultBreakpoint) { LOG.assertTrue(!myDefaultBreakpoints.containsKey(type), "Cannot have more than one default breakpoint (type " + type.getId() + ")"); myDefaultBreakpoints.put(type, breakpoint); } else { myBreakpoints.put(type, breakpoint); } myAllBreakpoints.add(breakpoint); if (breakpoint instanceof XLineBreakpointImpl) { myLineBreakpointManager.registerBreakpoint((XLineBreakpointImpl)breakpoint, initUI); } EventDispatcher<XBreakpointListener> dispatcher = myDispatchers.get(type); if (dispatcher != null) { //noinspection unchecked dispatcher.getMulticaster().breakpointAdded(breakpoint); } getBreakpointDispatcherMulticaster().breakpointAdded(breakpoint); }
private void doRemoveBreakpoint(XBreakpoint<?> breakpoint) { if (isDefaultBreakpoint(breakpoint)) { // removing default breakpoint should just disable it breakpoint.setEnabled(false); } else { XBreakpointType type = breakpoint.getType(); XBreakpointBase<?,?,?> breakpointBase = (XBreakpointBase<?,?,?>)breakpoint; myBreakpoints.remove(type, breakpointBase); myAllBreakpoints.remove(breakpointBase); if (breakpointBase instanceof XLineBreakpointImpl) { myLineBreakpointManager.unregisterBreakpoint((XLineBreakpointImpl)breakpointBase); } breakpointBase.dispose(); EventDispatcher<XBreakpointListener> dispatcher = myDispatchers.get(type); if (dispatcher != null) { //noinspection unchecked dispatcher.getMulticaster().breakpointRemoved(breakpoint); } getBreakpointDispatcherMulticaster().breakpointRemoved(breakpoint); } }
public XDependentBreakpointManager(final XBreakpointManagerImpl breakpointManager) { myBreakpointManager = breakpointManager; myDispatcher = EventDispatcher.create(XDependentBreakpointListener.class); myBreakpointManager.addBreakpointListener(new XBreakpointAdapter<XBreakpoint<?>>() { public void breakpointRemoved(@NotNull final XBreakpoint<?> breakpoint) { XDependentBreakpointInfo info = mySlave2Info.remove(breakpoint); if (info != null) { myMaster2Info.remove(info.myMasterBreakpoint, info); } Collection<XDependentBreakpointInfo> infos = myMaster2Info.removeAll((XBreakpointBase)breakpoint); if (infos != null) { for (XDependentBreakpointInfo breakpointInfo : infos) { XDependentBreakpointInfo removed = mySlave2Info.remove(breakpointInfo.mySlaveBreakpoint); if (removed != null) { myDispatcher.getMulticaster().dependencyCleared(breakpointInfo.mySlaveBreakpoint); } } } } }); }
private void onFacetAdded(final Facet facet) { boolean firstFacet = myFacetsByType.isEmpty(); final FacetTypeId typeId = facet.getTypeId(); WeakHashMap<Facet, Boolean> facets = myFacetsByType.get(typeId); if (facets == null) { facets = new WeakHashMap<Facet, Boolean>(); myFacetsByType.put(typeId, facets); } boolean firstFacetOfType = facets.isEmpty(); facets.put(facet, true); if (firstFacet) { getAllFacetsMulticaster().firstFacetAdded(); } getAllFacetsMulticaster().facetAdded(facet); final EventDispatcher<ProjectWideFacetListener> dispatcher = myDispatchers.get(typeId); if (dispatcher != null) { if (firstFacetOfType) { dispatcher.getMulticaster().firstFacetAdded(); } //noinspection unchecked dispatcher.getMulticaster().facetAdded(facet); } }
public XBreakpointManagerImpl(final Project project, final XDebuggerManagerImpl debuggerManager, StartupManager startupManager) { myProject = project; myDebuggerManager = debuggerManager; myAllBreakpointsDispatcher = EventDispatcher.create(XBreakpointListener.class); myDependentBreakpointManager = new XDependentBreakpointManager(this); myLineBreakpointManager = new XLineBreakpointManager(project, myDependentBreakpointManager, startupManager); if (!project.isDefault() && !ApplicationManager.getApplication().isUnitTestMode()) { HttpVirtualFileListener httpVirtualFileListener = new HttpVirtualFileListener() { @Override public void fileDownloaded(@NotNull final VirtualFile file) { updateBreakpointInFile(file); } }; HttpFileSystem.getInstance().addFileListener(httpVirtualFileListener, project); for (XBreakpointType<?, ?> type : XBreakpointUtil.getBreakpointTypes()) { addDefaultBreakpoint(type); } } }
private void doRemoveBreakpoint(XBreakpoint<?> breakpoint) { XBreakpointType type = breakpoint.getType(); XBreakpointBase<?,?,?> breakpointBase = (XBreakpointBase<?,?,?>)breakpoint; myBreakpoints.remove(type, breakpointBase); myAllBreakpoints.remove(breakpointBase); if (breakpointBase instanceof XLineBreakpointImpl) { myLineBreakpointManager.unregisterBreakpoint((XLineBreakpointImpl)breakpointBase); } breakpointBase.dispose(); EventDispatcher<XBreakpointListener> dispatcher = myDispatchers.get(type); if (dispatcher != null) { //noinspection unchecked dispatcher.getMulticaster().breakpointRemoved(breakpoint); } getBreakpointDispatcherMulticaster().breakpointRemoved(breakpoint); }
public XBreakpointManagerImpl(final Project project, final XDebuggerManagerImpl debuggerManager, StartupManager startupManager) { myProject = project; myDebuggerManager = debuggerManager; myAllBreakpointsDispatcher = EventDispatcher.create(XBreakpointListener.class); myDependentBreakpointManager = new XDependentBreakpointManager(this); myLineBreakpointManager = new XLineBreakpointManager(project, myDependentBreakpointManager, startupManager); if (!project.isDefault()) { if (!ApplicationManager.getApplication().isUnitTestMode()) { HttpVirtualFileListener httpVirtualFileListener = this::updateBreakpointInFile; HttpFileSystem.getInstance().addFileListener(httpVirtualFileListener, project); } for (XBreakpointType<?, ?> type : XBreakpointUtil.getBreakpointTypes()) { addDefaultBreakpoint(type); } } }
private void doRemoveBreakpoint(XBreakpoint<?> breakpoint) { if (isDefaultBreakpoint(breakpoint)) { // removing default breakpoint should just disable it breakpoint.setEnabled(false); } else { XBreakpointType type = breakpoint.getType(); XBreakpointBase<?, ?, ?> breakpointBase = (XBreakpointBase<?, ?, ?>)breakpoint; myBreakpoints.remove(type, breakpointBase); myAllBreakpoints.remove(breakpointBase); if (breakpointBase instanceof XLineBreakpointImpl) { myLineBreakpointManager.unregisterBreakpoint((XLineBreakpointImpl)breakpointBase); } breakpointBase.dispose(); EventDispatcher<XBreakpointListener> dispatcher = myDispatchers.get(type); if (dispatcher != null) { //noinspection unchecked dispatcher.getMulticaster().breakpointRemoved(breakpoint); } getBreakpointDispatcherMulticaster().breakpointRemoved(breakpoint); } }
public XDependentBreakpointManager(final XBreakpointManagerImpl breakpointManager) { myBreakpointManager = breakpointManager; myDispatcher = EventDispatcher.create(XDependentBreakpointListener.class); myBreakpointManager.addBreakpointListener(new XBreakpointAdapter<XBreakpoint<?>>() { public void breakpointRemoved(@Nonnull final XBreakpoint<?> breakpoint) { XDependentBreakpointInfo info = mySlave2Info.remove(breakpoint); if (info != null) { myMaster2Info.remove(info.myMasterBreakpoint, info); } Collection<XDependentBreakpointInfo> infos = myMaster2Info.removeAll((XBreakpointBase)breakpoint); if (infos != null) { for (XDependentBreakpointInfo breakpointInfo : infos) { XDependentBreakpointInfo removed = mySlave2Info.remove(breakpointInfo.mySlaveBreakpoint); if (removed != null) { myDispatcher.getMulticaster().dependencyCleared(breakpointInfo.mySlaveBreakpoint); } } } } }); }
@NotNull @Override public <T extends EventListener> T getPublisher(Class<T> listenerClass) { EventDispatcher<?> dispatcher = myDispatchers.get(listenerClass); if (dispatcher == null) { dispatcher = EventDispatcher.create(listenerClass); myDispatchers.put(listenerClass, dispatcher); } //noinspection unchecked return (T)dispatcher.getMulticaster(); }
public ArtifactImpl(@NotNull String name, @NotNull ArtifactType artifactType, boolean buildOnMake, @NotNull CompositePackagingElement<?> rootElement, String outputPath, EventDispatcher<ArtifactListener> dispatcher) { myName = name; myArtifactType = artifactType; myBuildOnMake = buildOnMake; myRootElement = rootElement; myOutputPath = outputPath; myDispatcher = dispatcher; myProperties = new HashMap<ArtifactPropertiesProvider, ArtifactProperties<?>>(); resetProperties(); }
public ArtifactImpl createCopy(EventDispatcher<ArtifactListener> dispatcher) { final ArtifactImpl artifact = new ArtifactImpl(myName, myArtifactType, myBuildOnMake, myRootElement, myOutputPath, dispatcher); for (Map.Entry<ArtifactPropertiesProvider, ArtifactProperties<?>> entry : myProperties.entrySet()) { final ArtifactProperties newProperties = artifact.myProperties.get(entry.getKey()); //noinspection unchecked newProperties.loadState(entry.getValue().getState()); } return artifact; }
public CheckboxTreeTable(CheckedTreeNode root, CheckboxTree.CheckboxTreeCellRenderer renderer, final ColumnInfo[] columns) { super(new ListTreeTableModelOnColumns(root, columns)); final TreeTableTree tree = getTree(); myEventDispatcher = EventDispatcher.create(CheckboxTreeListener.class); CheckboxTreeHelper helper = new CheckboxTreeHelper(CheckboxTreeHelper.DEFAULT_POLICY, myEventDispatcher); helper.initTree(tree, this, renderer); tree.setSelectionRow(0); }
public void fireBreakpointChanged(XBreakpointBase<?, ?, ?> breakpoint) { if (!myAllBreakpoints.contains(breakpoint)) { return; } if (breakpoint instanceof XLineBreakpointImpl) { myLineBreakpointManager.breakpointChanged((XLineBreakpointImpl)breakpoint); } EventDispatcher<XBreakpointListener> dispatcher = myDispatchers.get(breakpoint.getType()); if (dispatcher != null) { //noinspection unchecked dispatcher.getMulticaster().breakpointChanged(breakpoint); } getBreakpointDispatcherMulticaster().breakpointChanged(breakpoint); }
private <T extends XBreakpointProperties> EventDispatcher<XBreakpointListener> getOrCreateDispatcher(final XBreakpointType<?,T> type) { EventDispatcher<XBreakpointListener> dispatcher = myDispatchers.get(type); if (dispatcher == null) { dispatcher = EventDispatcher.create(XBreakpointListener.class); myDispatchers.put(type, dispatcher); } return dispatcher; }
public void doNotify(final EventDispatcher<ChangeListListener> dispatcher) { if ((myMovedFrom != null) && (myListCopy != null)) { for(LocalChangeList fromList: myMovedFrom.keySet()) { final Collection<Change> changesInList = myMovedFrom.get(fromList); dispatcher.getMulticaster().changesMoved(changesInList, fromList, myListCopy); } } }
public void doNotify(final EventDispatcher<ChangeListListener> dispatcher) { if (myRemoved) { final ChangeListListener multicaster = dispatcher.getMulticaster(); multicaster.changesMoved(myListCopy.getChanges(), myListCopy, myDefaultListCopy); multicaster.changeListRemoved(myListCopy); } }
private Pair<SimpleModificationTracker, EventDispatcher<ModificationTrackerListener>> getFacetInfo(final Facet facet) { Pair<SimpleModificationTracker, EventDispatcher<ModificationTrackerListener>> pair = myModificationsTrackers.get(facet); if (pair == null) { pair = Pair.create(new SimpleModificationTracker(), EventDispatcher.create(ModificationTrackerListener.class)); myModificationsTrackers.put(facet, pair); } return pair; }
@Override public void facetConfigurationChanged(@NotNull final Facet facet) { final Pair<SimpleModificationTracker, EventDispatcher<ModificationTrackerListener>> pair = myModificationsTrackers.get(facet); if (pair != null) { pair.first.incModificationCount(); pair.second.getMulticaster().modificationCountChanged(facet); } }
private void onFacetRemoved(final Facet facet, final boolean before) { final FacetTypeId typeId = facet.getTypeId(); WeakHashMap<Facet, Boolean> facets = myFacetsByType.get(typeId); boolean lastFacet; if (facets != null) { facets.remove(facet); lastFacet = facets.isEmpty(); if (lastFacet) { myFacetsByType.remove(typeId); } } else { lastFacet = true; } final EventDispatcher<ProjectWideFacetListener> dispatcher = myDispatchers.get(typeId); if (dispatcher != null) { if (before) { //noinspection unchecked dispatcher.getMulticaster().beforeFacetRemoved(facet); } else { //noinspection unchecked dispatcher.getMulticaster().facetRemoved(facet); if (lastFacet) { dispatcher.getMulticaster().allFacetsRemoved(); } } } if (before) { getAllFacetsMulticaster().beforeFacetRemoved(facet); } else { getAllFacetsMulticaster().facetRemoved(facet); if (myFacetsByType.isEmpty()) { getAllFacetsMulticaster().allFacetsRemoved(); } } }
private void onFacetChanged(final Facet facet) { final EventDispatcher<ProjectWideFacetListener> dispatcher = myDispatchers.get(facet.getTypeId()); if (dispatcher != null) { //noinspection unchecked dispatcher.getMulticaster().facetConfigurationChanged(facet); } getAllFacetsMulticaster().facetConfigurationChanged(facet); }
@Override public <F extends Facet> void registerListener(@NotNull FacetTypeId<F> typeId, @NotNull ProjectWideFacetListener<? extends F> listener) { EventDispatcher<ProjectWideFacetListener> dispatcher = myDispatchers.get(typeId); if (dispatcher == null) { dispatcher = EventDispatcher.create(ProjectWideFacetListener.class); myDispatchers.put(typeId, dispatcher); } dispatcher.addListener(listener); }
@Override public <F extends Facet> void unregisterListener(@NotNull FacetTypeId<F> typeId, @NotNull ProjectWideFacetListener<? extends F> listener) { final EventDispatcher<ProjectWideFacetListener> dispatcher = myDispatchers.get(typeId); if (dispatcher != null) { dispatcher.removeListener(listener); } }
@Override public <F extends Facet> void addListener(final Class<F> facetClass, final FacetPointerListener<F> listener) { EventDispatcher<FacetPointerListener> dispatcher = myDispatchers.get(facetClass); if (dispatcher == null) { dispatcher = EventDispatcher.create(FacetPointerListener.class); myDispatchers.put(facetClass, dispatcher); } dispatcher.addListener(listener); }
@Override public <F extends Facet> void removeListener(final Class<F> facetClass, final FacetPointerListener<F> listener) { EventDispatcher<FacetPointerListener> dispatcher = myDispatchers.get(facetClass); if (dispatcher != null) { dispatcher.removeListener(listener); } }
public Object add(final Consumer<Pair<VcsKey,Consumer<T>>> consumer) { final Object key = new Object(); synchronized (myLock) { EventListenerWrapper<T> listenerWrapper = new EventListenerWrapper<T>(consumer); myListenersMap.put(key, listenerWrapper); for (EventDispatcher<EventListenerWrapperI> eventDispatcher : myExistingMulticasters.values()) { eventDispatcher.addListener(listenerWrapper); } } return key; }
public void remove(Object key) { synchronized (myLock) { final EventListenerWrapperI listenerWrapper = myListenersMap.remove(key); if (listenerWrapper != null) { for (EventDispatcher<EventListenerWrapperI> dispatcher : myExistingMulticasters.values()) { dispatcher.removeListener(listenerWrapper); } } } }
private Pair<FacetModificationTracker, EventDispatcher<ModificationTrackerListener>> getFacetInfo(final Facet facet) { Pair<FacetModificationTracker, EventDispatcher<ModificationTrackerListener>> pair = myModificationsTrackers.get(facet); if (pair == null) { pair = Pair.create(new FacetModificationTracker(), EventDispatcher.create(ModificationTrackerListener.class)); myModificationsTrackers.put(facet, pair); } return pair; }