Close a sketch as specified by its editor window. @param editor Editor object of the sketch to be closed. @return true if succeeded in closing, false if canceled.
(Editor editor)
| 950 | * @return true if succeeded in closing, false if canceled. |
| 951 | */ |
| 952 | public boolean handleClose(Editor editor) { |
| 953 | |
| 954 | if (editors.size() == 1) { |
| 955 | if (!handleQuit()) { |
| 956 | return false; |
| 957 | } |
| 958 | // Everything called after handleQuit will only affect OSX |
| 959 | editor.setVisible(false); |
| 960 | editors.remove(editor); |
| 961 | } else { |
| 962 | // More than one editor window open, |
| 963 | // proceed with closing the current window. |
| 964 | // Check if modified |
| 965 | if (!editor.checkModified()) { |
| 966 | return false; |
| 967 | } |
| 968 | editor.setVisible(false); |
| 969 | editor.dispose(); |
| 970 | editors.remove(editor); |
| 971 | } |
| 972 | return true; |
| 973 | } |
| 974 | |
| 975 | |
| 976 | /** |
no test coverage detected