예제 #1
0
파일: BlueJ.java 프로젝트: tordf/Greenfoot
  /**
   * 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);
    }
  }
예제 #2
0
파일: BlueJ.java 프로젝트: tordf/Greenfoot
  /**
   * 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);
    }
  }
예제 #3
0
파일: BlueJ.java 프로젝트: tordf/Greenfoot
  /**
   * 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);
    }
  }
예제 #4
0
파일: BlueJ.java 프로젝트: tordf/Greenfoot
  /**
   * 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);
    }
  }
예제 #5
0
파일: BlueJ.java 프로젝트: tordf/Greenfoot
  /**
   * 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);
    }
  }
예제 #6
0
파일: BlueJ.java 프로젝트: tordf/Greenfoot
  /**
   * 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);
    }
  }