()
| 1900 | |
| 1901 | |
| 1902 | private boolean handleSave2() { |
| 1903 | toolbar.activateSave(); |
| 1904 | statusNotice(tr("Saving...")); |
| 1905 | boolean saved = false; |
| 1906 | try { |
| 1907 | if (PreferencesData.getBoolean("editor.autoformat_currentfile_before_saving")) { |
| 1908 | Tool formatTool = getOrCreateToolInstance("cc.arduino.packages.formatter.AStyle"); |
| 1909 | formatTool.run(); |
| 1910 | } |
| 1911 | |
| 1912 | boolean wasReadOnly = sketchController.isReadOnly(); |
| 1913 | String previousMainFilePath = sketch.getMainFilePath(); |
| 1914 | saved = sketchController.save(); |
| 1915 | if (saved) { |
| 1916 | statusNotice(tr("Done Saving.")); |
| 1917 | if (wasReadOnly) { |
| 1918 | base.removeRecentSketchPath(previousMainFilePath); |
| 1919 | } |
| 1920 | base.storeRecentSketches(sketchController); |
| 1921 | base.rebuildRecentSketchesMenuItems(); |
| 1922 | } else { |
| 1923 | statusEmpty(); |
| 1924 | } |
| 1925 | // rebuild sketch menu in case a save-as was forced |
| 1926 | // Disabling this for 0125, instead rebuild the menu inside |
| 1927 | // the Save As method of the Sketch object, since that's the |
| 1928 | // only one who knows whether something was renamed. |
| 1929 | //sketchbook.rebuildMenus(); |
| 1930 | //sketchbook.rebuildMenusAsync(); |
| 1931 | |
| 1932 | } catch (Exception e) { |
| 1933 | // show the error as a message in the window |
| 1934 | statusError(e); |
| 1935 | |
| 1936 | // zero out the current action, |
| 1937 | // so that checkModified2 will just do nothing |
| 1938 | //checkModifiedMode = 0; |
| 1939 | // this is used when another operation calls a save |
| 1940 | } |
| 1941 | //toolbar.clear(); |
| 1942 | toolbar.deactivateSave(); |
| 1943 | return saved; |
| 1944 | } |
| 1945 | |
| 1946 | |
| 1947 | public boolean handleSaveAs() { |
no test coverage detected