Exemplo n.º 1
0
  /**
   * 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);
    }
  }
Exemplo n.º 2
0
  /**
   * 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);
    }
  }
Exemplo n.º 3
0
  /**
   * 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);
    }
  }
Exemplo n.º 4
0
  /**
   * 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);
    }
  }
Exemplo n.º 5
0
 /** 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);
     }
   }
 }
Exemplo n.º 6
0
 /**
  * Register a listener for class events.
  *
  * @param listener
  */
 public void addClassListener(ClassListener listener) {
   if (listener != null) {
     synchronized (classListeners) {
       classListeners.add(listener);
     }
   }
 }
Exemplo n.º 7
0
 /** Removes the specified listener so that it no longer receives events. */
 public void removeExtensionEventListener(ExtensionEventListener listener) {
   if (listener != null) {
     synchronized (eventListeners) {
       eventListeners.remove(listener);
     }
   }
 }
Exemplo n.º 8
0
 /** Registers a listener for invocation events. */
 public void addInvocationListener(InvocationListener listener) {
   if (listener != null) {
     synchronized (invocationListeners) {
       invocationListeners.add(listener);
     }
   }
 }
Exemplo n.º 9
0
 /** Removes the specified listener so that it no longer receives events. */
 public void removeCompileListener(CompileListener listener) {
   if (listener != null) {
     synchronized (compileListeners) {
       compileListeners.remove(listener);
     }
   }
 }
Exemplo n.º 10
0
 /** Registers a listener for compile events. */
 public void addCompileListener(CompileListener listener) {
   if (listener != null) {
     synchronized (compileListeners) {
       compileListeners.add(listener);
     }
   }
 }
Exemplo n.º 11
0
 /** Removes the specified listener so that it no longer receives events. */
 public void removePackageListener(PackageListener listener) {
   if (listener != null) {
     synchronized (packageListeners) {
       packageListeners.remove(listener);
     }
   }
 }
Exemplo n.º 12
0
 /** Registers a listener for package events. */
 public void addPackageListener(PackageListener listener) {
   if (listener != null) {
     synchronized (packageListeners) {
       packageListeners.add(listener);
     }
   }
 }
Exemplo n.º 13
0
 /** Removes the specified listener so that it no longer receives events. */
 public void removeApplicationListener(ApplicationListener listener) {
   if (listener != null) {
     synchronized (applicationListeners) {
       applicationListeners.remove(listener);
     }
   }
 }
Exemplo n.º 14
0
 /** Registers a listener for application events. */
 public void addApplicationListener(ApplicationListener listener) {
   if (listener != null) {
     synchronized (applicationListeners) {
       applicationListeners.add(listener);
     }
   }
 }
Exemplo n.º 15
0
 /** 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);
     }
   }
 }
Exemplo n.º 16
0
 /** Registers a listener for all the events generated by BlueJ. */
 public void addExtensionEventListener(ExtensionEventListener listener) {
   if (listener != null) {
     synchronized (eventListeners) {
       eventListeners.add(listener);
     }
   }
 }
Exemplo n.º 17
0
  /**
   * 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);
    }
  }
Exemplo n.º 18
0
  /**
   * 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);
    }
  }