/** * Dispatch this event to the listeners for the Invocation events. * * @param event The event to dispatch */ private void delegateInvocationEvent(InvocationEvent event) { InvocationListener[] listeners; synchronized (invocationListeners) { listeners = (InvocationListener[]) invocationListeners.toArray(new InvocationListener[invocationListeners.size()]); } for (int i = 0; i < listeners.length; i++) { listeners[i].invocationFinished(event); } }
/** * Dispatch this event to the listeners for the ALL events. * * @param event Description of the Parameter */ private void delegateExtensionEvent(ExtensionEvent event) { ExtensionEventListener[] listeners; synchronized (eventListeners) { listeners = (ExtensionEventListener[]) eventListeners.toArray(new ExtensionEventListener[eventListeners.size()]); } for (int i = 0; i < listeners.length; i++) { ExtensionEventListener eventListener = listeners[i]; eventListener.eventOccurred(event); } }
/** * Dispatch a class event to the appropriate listeners. * * @param event The event to dispatch */ private void delegateClassEvent(ClassEvent event) { // We'll make a copy of the current list to prevent // ConcurrentModification problems. ClassListener[] listeners; synchronized (classListeners) { listeners = (ClassListener[]) classListeners.toArray(new ClassListener[classListeners.size()]); } for (int i = 0; i < listeners.length; i++) { listeners[i].classStateChanged(event); } }
/** * Dispatch this event to the listeners for the Application events. * * @param event Description of the Parameter */ private void delegateApplicationEvent(ApplicationEvent event) { ApplicationListener[] listeners; synchronized (applicationListeners) { listeners = (ApplicationListener[]) applicationListeners.toArray(new ApplicationListener[applicationListeners.size()]); } for (int i = 0; i < listeners.length; i++) { ApplicationListener eventListener = listeners[i]; // Just this for the time being. eventListener.blueJReady(event); } }
/** Removes the specified class listener so no that it no longer receives class events. */ public void removeClassListener(ClassListener listener) { if (listener != null) { synchronized (classListeners) { classListeners.remove(listener); } } }
/** * Register a listener for class events. * * @param listener */ public void addClassListener(ClassListener listener) { if (listener != null) { synchronized (classListeners) { classListeners.add(listener); } } }
/** Removes the specified listener so that it no longer receives events. */ public void removeExtensionEventListener(ExtensionEventListener listener) { if (listener != null) { synchronized (eventListeners) { eventListeners.remove(listener); } } }
/** Registers a listener for invocation events. */ public void addInvocationListener(InvocationListener listener) { if (listener != null) { synchronized (invocationListeners) { invocationListeners.add(listener); } } }
/** Removes the specified listener so that it no longer receives events. */ public void removeCompileListener(CompileListener listener) { if (listener != null) { synchronized (compileListeners) { compileListeners.remove(listener); } } }
/** Registers a listener for compile events. */ public void addCompileListener(CompileListener listener) { if (listener != null) { synchronized (compileListeners) { compileListeners.add(listener); } } }
/** Removes the specified listener so that it no longer receives events. */ public void removePackageListener(PackageListener listener) { if (listener != null) { synchronized (packageListeners) { packageListeners.remove(listener); } } }
/** Registers a listener for package events. */ public void addPackageListener(PackageListener listener) { if (listener != null) { synchronized (packageListeners) { packageListeners.add(listener); } } }
/** Removes the specified listener so that it no longer receives events. */ public void removeApplicationListener(ApplicationListener listener) { if (listener != null) { synchronized (applicationListeners) { applicationListeners.remove(listener); } } }
/** Registers a listener for application events. */ public void addApplicationListener(ApplicationListener listener) { if (listener != null) { synchronized (applicationListeners) { applicationListeners.add(listener); } } }
/** Removes the specified listener so no that it no longer receives events. */ public void removeInvocationListener(InvocationListener listener) { if (listener != null) { synchronized (invocationListeners) { invocationListeners.remove(listener); } } }
/** Registers a listener for all the events generated by BlueJ. */ public void addExtensionEventListener(ExtensionEventListener listener) { if (listener != null) { synchronized (eventListeners) { eventListeners.add(listener); } } }
/** * Dispatch this event to the listeners for the Package events. * * @param event Description of the Parameter */ private void delegatePackageEvent(PackageEvent event) { PackageListener[] listeners; synchronized (packageListeners) { listeners = (PackageListener[]) packageListeners.toArray(new PackageListener[packageListeners.size()]); } int thisEvent = event.getEvent(); for (int i = 0; i < listeners.length; i++) { PackageListener eventListener = listeners[i]; if (thisEvent == PackageEvent.PACKAGE_OPENED) eventListener.packageOpened(event); if (thisEvent == PackageEvent.PACKAGE_CLOSING) eventListener.packageClosing(event); } }
/** * Dispatch this event to the listeners for the Compile events. * * @param event Description of the Parameter */ private void delegateCompileEvent(CompileEvent event) { CompileListener[] listeners; synchronized (compileListeners) { listeners = (CompileListener[]) compileListeners.toArray(new CompileListener[compileListeners.size()]); } int thisEvent = event.getEvent(); for (int i = 0; i < listeners.length; i++) { CompileListener eventListener = listeners[i]; if (thisEvent == CompileEvent.COMPILE_START_EVENT) eventListener.compileStarted(event); if (thisEvent == CompileEvent.COMPILE_ERROR_EVENT) eventListener.compileError(event); if (thisEvent == CompileEvent.COMPILE_WARNING_EVENT) eventListener.compileWarning(event); if (thisEvent == CompileEvent.COMPILE_FAILED_EVENT) eventListener.compileFailed(event); if (thisEvent == CompileEvent.COMPILE_DONE_EVENT) eventListener.compileSucceeded(event); } }