@@ -1754,46 +1754,15 @@ protected boolean handleOpenInternal(File sketchFile) {
1754
1754
} else {
1755
1755
String properParent = fileName .substring (0 , fileName .length () - 4 );
1756
1756
1757
- Object [] options = {tr ("OK" ), tr ( "Cancel" ) };
1757
+ Object [] options = {tr ("OK" )};
1758
1758
String prompt = I18n .format (tr ("The file \" {0}\" needs to be inside\n " +
1759
- "a sketch folder named \" {1}\" .\n " +
1760
- "Create this folder, move the file, and continue?" ),
1759
+ "a sketch folder named \" {1}\" .\n " ),
1761
1760
fileName ,
1762
1761
properParent );
1763
1762
1764
- int result = JOptionPane .showOptionDialog (this , prompt , tr ("Moving" ), JOptionPane .YES_NO_OPTION , JOptionPane .QUESTION_MESSAGE , null , options , options [0 ]);
1765
-
1766
- if (result != JOptionPane .YES_OPTION ) {
1767
- return false ;
1768
- }
1769
-
1770
- // create properly named folder
1771
- File properFolder = new File (sketchFile .getParent (), properParent );
1772
- if (properFolder .exists ()) {
1773
- Base .showWarning (tr ("Error" ), I18n .format (tr ("A folder named \" {0}\" already exists. " +
1774
- "Can't open sketch." ), properParent ), null );
1775
- return false ;
1776
- }
1777
- if (!properFolder .mkdirs ()) {
1778
- //throw new IOException("Couldn't create sketch folder");
1779
- Base .showWarning (tr ("Error" ), tr ("Could not create the sketch folder." ), null );
1780
- return false ;
1781
- }
1782
- // copy the sketch inside
1783
- File properPdeFile = new File (properFolder , sketchFile .getName ());
1784
- try {
1785
- FileUtils .copy (new File (sketchFile .getParent ()), properFolder );
1786
- } catch (IOException e ) {
1787
- Base .showWarning (tr ("Error" ), tr ("Could not copy to a proper location." ), e );
1788
- return false ;
1789
- }
1790
-
1791
- // remove the original file, so user doesn't get confused
1792
- sketchFile .delete ();
1793
-
1794
- // update with the new path
1795
- file = properPdeFile ;
1763
+ int result = JOptionPane .showOptionDialog (this , prompt , tr ("Error" ), JOptionPane .OK_OPTION , JOptionPane .ERROR_MESSAGE , null , options , options [0 ]);
1796
1764
1765
+ return false ;
1797
1766
}
1798
1767
}
1799
1768
0 commit comments