private synchronized void manageMenu(){
  if ((game != null) || (hasBoard && (null == client))) {
    fileGameNew.setEnabled(false);
    fileGameOpen.setEnabled(false);
    fileGameScenario.setEnabled(false);
    fileGameConnectBot.setEnabled(false);
    fileGameConnect.setEnabled(false);
    replacePlayer.setEnabled(false);
    if ((phase != IGame.Phase.PHASE_UNKNOWN) && (phase != IGame.Phase.PHASE_LOUNGE) && (phase != IGame.Phase.PHASE_SELECTION)&& (phase != IGame.Phase.PHASE_EXCHANGE)&& (phase != IGame.Phase.PHASE_VICTORY)&& (phase != IGame.Phase.PHASE_STARTING_SCENARIO)) {
      fileGameSave.setEnabled(true);
      fileGameSaveServer.setEnabled(true);
      replacePlayer.setEnabled(true);
    }
 else {
      fileGameSave.setEnabled(false);
      fileGameSaveServer.setEnabled(false);
      replacePlayer.setEnabled(false);
    }
  }
 else {
    fileGameNew.setEnabled(true);
    fileGameOpen.setEnabled(true);
    fileGameSave.setEnabled(false);
    fileGameSaveServer.setEnabled(false);
    fileGameScenario.setEnabled(true);
    fileGameConnectBot.setEnabled(true);
    fileGameConnect.setEnabled(true);
    replacePlayer.setEnabled(true);
  }
  if (game != null) {
    viewGameOptions.setEnabled(true);
    viewPlayerSettings.setEnabled(true);
  }
 else {
    viewGameOptions.setEnabled(false);
    viewPlayerSettings.setEnabled(false);
  }
  filePrint.setEnabled(false);
  if (client != null) {
    fileBoardNew.setEnabled(false);
    fileBoardOpen.setEnabled(false);
    fileBoardSave.setEnabled(false);
    fileBoardSaveAs.setEnabled(false);
    fileBoardSaveAsImage.setEnabled(false);
  }
 else {
    fileBoardNew.setEnabled(true);
    fileBoardOpen.setEnabled(true);
    fileBoardSave.setEnabled(false);
    fileBoardSaveAs.setEnabled(false);
    fileBoardSaveAsImage.setEnabled(false);
  }
  if (hasBoard) {
    fileBoardSave.setEnabled(true);
    fileBoardSaveAs.setEnabled(true);
    fileBoardSaveAsImage.setEnabled(true);
    viewMiniMap.setEnabled(true);
    viewZoomIn.setEnabled(true);
    viewZoomOut.setEnabled(true);
  }
 else {
    fileBoardSave.setEnabled(false);
    fileBoardSaveAs.setEnabled(false);
    fileBoardSaveAsImage.setEnabled(false);
    viewMiniMap.setEnabled(false);
    viewZoomIn.setEnabled(false);
    viewZoomOut.setEnabled(false);
  }
  if (hasUnitList) {
    fileUnitsOpen.setEnabled(phase == IGame.Phase.PHASE_LOUNGE);
    fileUnitsClear.setEnabled(phase == IGame.Phase.PHASE_LOUNGE);
  }
 else {
    fileUnitsOpen.setEnabled(phase == IGame.Phase.PHASE_LOUNGE);
    fileUnitsClear.setEnabled(false);
  }
  fileUnitsReinforce.setEnabled(phase != IGame.Phase.PHASE_LOUNGE);
  fileUnitsReinforceRAT.setEnabled(phase != IGame.Phase.PHASE_LOUNGE);
  if (entity != null) {
    viewMekDisplay.setEnabled(true);
  }
 else {
    viewMekDisplay.setEnabled(false);
  }
  if ((client == null) && hasBoard) {
    viewLOSSetting.setEnabled(false);
    viewUnitOverview.setEnabled(false);
    viewPlayerList.setEnabled(false);
  }
 else   if ((phase == IGame.Phase.PHASE_SET_ARTYAUTOHITHEXES) || (phase == IGame.Phase.PHASE_DEPLOY_MINEFIELDS) || (phase == IGame.Phase.PHASE_MOVEMENT)|| (phase == IGame.Phase.PHASE_FIRING)|| (phase == IGame.Phase.PHASE_PHYSICAL)|| (phase == IGame.Phase.PHASE_OFFBOARD)|| (phase == IGame.Phase.PHASE_TARGETING)|| (phase == IGame.Phase.PHASE_DEPLOYMENT)) {
    viewLOSSetting.setEnabled(true);
    viewMiniMap.setEnabled(true);
    viewZoomIn.setEnabled(true);
    viewZoomOut.setEnabled(true);
    viewUnitOverview.setEnabled(true);
    viewPlayerList.setEnabled(true);
  }
 else {
    viewLOSSetting.setEnabled(false);
    viewMiniMap.setEnabled(false);
    viewZoomIn.setEnabled(false);
    viewZoomOut.setEnabled(false);
    viewUnitOverview.setEnabled(false);
    viewPlayerList.setEnabled(false);
  }
  if ((phase == IGame.Phase.PHASE_INITIATIVE) || (phase == IGame.Phase.PHASE_MOVEMENT) || (phase == IGame.Phase.PHASE_FIRING)|| (phase == IGame.Phase.PHASE_PHYSICAL)|| (phase == IGame.Phase.PHASE_OFFBOARD)|| (phase == IGame.Phase.PHASE_TARGETING)|| (phase == IGame.Phase.PHASE_END)|| (phase == IGame.Phase.PHASE_DEPLOYMENT)) {
    viewRoundReport.setEnabled(true);
  }
 else {
    viewRoundReport.setEnabled(false);
  }
  viewClientSettings.setEnabled(true);
  if ((phase != IGame.Phase.PHASE_FIRING) || (entity == null)) {
    fireCancel.setEnabled(false);
  }
 else {
    fireCancel.setEnabled(true);
  }
  updateSaveWeaponOrderMenuItem();
}

private synchronized void manageMenu ( ) { if ( ( game != null ) || ( hasBoard && ( null == client ) ) ) { fileGameNew . setEnabled ( false ) ; fileGameOpen . setEnabled ( false ) ; fileGameScenario . setEnabled ( false ) ; fileGameConnectBot . setEnabled ( false ) ; fileGameConnect . setEnabled ( false ) ; replacePlayer . setEnabled ( false ) ; if ( ( phase != IGame . Phase . PHASE_UNKNOWN ) && ( phase != IGame . Phase . PHASE_LOUNGE ) && ( phase != IGame . Phase . PHASE_SELECTION ) && ( phase != IGame . Phase . PHASE_EXCHANGE ) && ( phase != IGame . Phase . PHASE_VICTORY ) && ( phase != IGame . Phase . PHASE_STARTING_SCENARIO ) ) { fileGameSave . setEnabled ( true ) ; fileGameSaveServer . setEnabled ( true ) ; replacePlayer . setEnabled ( true ) ; } else { fileGameSave . setEnabled ( false ) ; fileGameSaveServer . setEnabled ( false ) ; replacePlayer . setEnabled ( false ) ; } } else { fileGameNew . setEnabled ( true ) ; fileGameOpen . setEnabled ( true ) ; fileGameSave . setEnabled ( false ) ; fileGameSaveServer . setEnabled ( false ) ; fileGameScenario . setEnabled ( true ) ; fileGameConnectBot . setEnabled ( true ) ; fileGameConnect . setEnabled ( true ) ; replacePlayer . setEnabled ( true ) ; } if ( game != null ) { viewGameOptions . setEnabled ( true ) ; viewPlayerSettings . setEnabled ( true ) ; } else { viewGameOptions . setEnabled ( false ) ; viewPlayerSettings . setEnabled ( false ) ; } filePrint . setEnabled ( false ) ; if ( client != null ) { fileBoardNew . setEnabled ( false ) ; fileBoardOpen . setEnabled ( false ) ; fileBoardSave . setEnabled ( false ) ; fileBoardSaveAs . setEnabled ( false ) ; fileBoardSaveAsImage . setEnabled ( false ) ; } else { fileBoardNew . setEnabled ( true ) ; fileBoardOpen . setEnabled ( true ) ; fileBoardSave . setEnabled ( false ) ; fileBoardSaveAs . setEnabled ( false ) ; fileBoardSaveAsImage . setEnabled ( false ) ; } if ( hasBoard ) { fileBoardSave . setEnabled ( true ) ; fileBoardSaveAs . setEnabled ( true ) ; fileBoardSaveAsImage . setEnabled ( true ) ; viewMiniMap . setEnabled ( true ) ; viewZoomIn . setEnabled ( true ) ; viewZoomOut . setEnabled ( true ) ; } else { fileBoardSave . setEnabled ( false ) ; fileBoardSaveAs . setEnabled ( false ) ; fileBoardSaveAsImage . setEnabled ( false ) ; viewMiniMap . setEnabled ( false ) ; viewZoomIn . setEnabled ( false ) ; viewZoomOut . setEnabled ( false ) ; } if ( hasUnitList ) { fileUnitsOpen . setEnabled ( phase == IGame . Phase . PHASE_LOUNGE ) ; fileUnitsClear . setEnabled ( phase == IGame . Phase . PHASE_LOUNGE ) ; } else { fileUnitsOpen . setEnabled ( phase == IGame . Phase . PHASE_LOUNGE ) ; fileUnitsClear . setEnabled ( false ) ; } fileUnitsReinforce . setEnabled ( phase != IGame . Phase . PHASE_LOUNGE ) ; fileUnitsReinforceRAT . setEnabled ( phase != IGame . Phase . PHASE_LOUNGE ) ; if ( entity != null ) { viewMekDisplay . setEnabled ( true ) ; } else { viewMekDisplay . setEnabled ( false ) ; } if ( ( client == null ) && hasBoard ) { viewLOSSetting . setEnabled ( false ) ; viewUnitOverview . setEnabled ( false ) ; viewPlayerList . setEnabled ( false ) ; } else if ( ( phase == IGame . Phase . PHASE_SET_ARTYAUTOHITHEXES ) || ( phase == IGame . Phase . PHASE_DEPLOY_MINEFIELDS ) || ( phase == IGame . Phase . PHASE_MOVEMENT ) || ( phase == IGame . Phase . PHASE_FIRING ) || ( phase == IGame . Phase . PHASE_PHYSICAL ) || ( phase == IGame . Phase . PHASE_OFFBOARD ) || ( phase == IGame . Phase . PHASE_TARGETING ) || ( phase == IGame . Phase . PHASE_DEPLOYMENT ) ) { viewLOSSetting . setEnabled ( true ) ; viewMiniMap . setEnabled ( true ) ; viewZoomIn . setEnabled ( true ) ; viewZoomOut . setEnabled ( true ) ; viewUnitOverview . setEnabled ( true ) ; viewPlayerList . setEnabled ( true ) ; } else { viewLOSSetting . setEnabled ( false ) ; viewMiniMap . setEnabled ( false ) ; viewZoomIn . setEnabled ( false ) ; viewZoomOut . setEnabled ( false ) ; viewUnitOverview . setEnabled ( false ) ; viewPlayerList . setEnabled ( false ) ; } if ( ( phase == IGame . Phase . PHASE_INITIATIVE ) || ( phase == IGame . Phase . PHASE_MOVEMENT ) || ( phase == IGame . Phase . PHASE_FIRING ) || ( phase == IGame . Phase . PHASE_PHYSICAL ) || ( phase == IGame . Phase . PHASE_OFFBOARD ) || ( phase == IGame . Phase . PHASE_TARGETING ) || ( phase == IGame . Phase . PHASE_END ) || ( phase == IGame . Phase . PHASE_DEPLOYMENT ) ) { viewRoundReport . setEnabled ( true ) ; } else { viewRoundReport . setEnabled ( false ) ; } viewClientSettings . setEnabled ( true ) ; if ( ( phase != IGame . Phase . PHASE_FIRING ) || ( entity == null ) ) { fireCancel . setEnabled ( false ) ; } else { fireCancel . setEnabled ( true ) ; } updateSaveWeaponOrderMenuItem ( ) ; }
a helper function that will manage the enabled states of the items in this menu , based upon the object ' s current state .
