Пример #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);
    }
  }
Пример #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);
    }
  }
Пример #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);
    }
  }
Пример #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);
    }
  }
Пример #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);
     }
   }
 }
Пример #6
0
 /**
  * Register a listener for class events.
  *
  * @param listener
  */
 public void addClassListener(ClassListener listener) {
   if (listener != null) {
     synchronized (classListeners) {
       classListeners.add(listener);
     }
   }
 }
Пример #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);
     }
   }
 }
Пример #8
0
 /** Registers a listener for invocation events. */
 public void addInvocationListener(InvocationListener listener) {
   if (listener != null) {
     synchronized (invocationListeners) {
       invocationListeners.add(listener);
     }
   }
 }
Пример #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);
     }
   }
 }
Пример #10
0
 /** Registers a listener for compile events. */
 public void addCompileListener(CompileListener listener) {
   if (listener != null) {
     synchronized (compileListeners) {
       compileListeners.add(listener);
     }
   }
 }
Пример #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);
     }
   }
 }
Пример #12
0
 /** Registers a listener for package events. */
 public void addPackageListener(PackageListener listener) {
   if (listener != null) {
     synchronized (packageListeners) {
       packageListeners.add(listener);
     }
   }
 }
Пример #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);
     }
   }
 }
Пример #14
0
 /** Registers a listener for application events. */
 public void addApplicationListener(ApplicationListener listener) {
   if (listener != null) {
     synchronized (applicationListeners) {
       applicationListeners.add(listener);
     }
   }
 }
Пример #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);
     }
   }
 }
Пример #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);
     }
   }
 }
Пример #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);
    }
  }
Пример #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);
    }
  }