예제 #1
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);
    }
  }
예제 #2
0
  private boolean canExit() {
    for (ApplicationListener applicationListener : myDispatcher.getListeners()) {
      if (!applicationListener.canExitApplication()) {
        return false;
      }
    }

    ProjectManagerEx projectManager = (ProjectManagerEx) ProjectManager.getInstance();
    Project[] projects = projectManager.getOpenProjects();
    for (Project project : projects) {
      if (!projectManager.canClose(project)) {
        return false;
      }
    }

    return true;
  }