public void closeDocViewer(DocViewerPanel docPanel){
  if (openDocs.size() == 1) {
    return;
  }
  if (docPanel.hasBeenModfiedSinceSave()) {
    Object[] options={"Close Anyway","Cancel"};
    int n=JOptionPane.showOptionDialog(null,"Changes have been made to this document since you last saved.\n" + "Would you like to continue closing this tab?","Important Data May Be Lost",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[1]);
    if (n == 1) {
      return;
    }
  }
  openDocs.remove(docPanel);
  docPanel.destroyAllUndoStates();
  destroyDoc(docPanel.getDoc());
  justClosedTab=true;
  docTabs.remove(docPanel);
  justClosedTab=false;
}

public void closeDocViewer ( DocViewerPanel docPanel ) { if ( openDocs . size ( ) == 1 ) { return ; } if ( docPanel . hasBeenModfiedSinceSave ( ) ) { Object [ ] options = { "Close Anyway" , "Cancel" } ; int n = JOptionPane . showOptionDialog ( null , "Changes have been made to this document since you last saved.\n" + "Would you like to continue closing this tab?" , "Important Data May Be Lost" , JOptionPane . YES_NO_CANCEL_OPTION , JOptionPane . WARNING_MESSAGE , null , options , options [ 1 ] ) ; if ( n == 1 ) { return ; } } openDocs . remove ( docPanel ) ; docPanel . destroyAllUndoStates ( ) ; destroyDoc ( docPanel . getDoc ( ) ) ; justClosedTab = true ; docTabs . remove ( docPanel ) ; justClosedTab = false ; }
used to remove an editor from the tabs . todo - should be modified to ask if user wants to save first .
