示例#1
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);
    }
  }
  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;
  }