1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Removed dialog box warning when auto-renaming from .pde to .ino.

Now both .pde and .ino ext are hidden in IDE tabs.
This commit is contained in:
Cristian Maglie 2011-09-11 23:45:12 +02:00
parent 5d97d467c8
commit 131f7898b6

View File

@ -36,6 +36,7 @@ import java.awt.event.*;
import java.beans.*; import java.beans.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.List;
import java.util.zip.*; import java.util.zip.*;
import javax.swing.*; import javax.swing.*;
@ -718,26 +719,7 @@ public class Sketch {
}); });
if (pdeFiles != null && pdeFiles.length > 0) { if (pdeFiles != null && pdeFiles.length > 0) {
Object[] options = { "YES", "NO, Cancel" }; // Do rename of all .pde files to new .ino extension
String prompt = "From Arduino 1.0, the file extension for sketches changed\n"
+ "from \".pde\" to \".ino\". This version of the software only\n"
+ "supports the new extension.\n\n"
+ "By clicking YES, the following files will be renamed changing the\n"
+ "extension from \".pde\" to \".ino\":\n\n";
for (File f : pdeFiles)
prompt += f.getName() + "\n";
prompt += "\nContinue?";
int result = JOptionPane.showOptionDialog(editor,
prompt,
"New extension",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
options,
options[0]);
if (result != JOptionPane.YES_OPTION)
return false;
for (File pdeFile : pdeFiles) for (File pdeFile : pdeFiles)
renameCodeToInoExtension(pdeFile); renameCodeToInoExtension(pdeFile);
} }
@ -1404,7 +1386,7 @@ public class Sketch {
} }
// sc.setPreprocName(filename); // sc.setPreprocName(filename);
} else if (sc.isExtension("ino")) { } else if (sc.isExtension("ino") || sc.isExtension("pde")) {
// The compiler and runner will need this to have a proper offset // The compiler and runner will need this to have a proper offset
sc.addPreprocOffset(headerOffset); sc.addPreprocOffset(headerOffset);
} }
@ -1809,7 +1791,7 @@ public class Sketch {
* For Processing, this is true for .pde files. (Broken out for subclasses.) * For Processing, this is true for .pde files. (Broken out for subclasses.)
*/ */
public boolean hideExtension(String what) { public boolean hideExtension(String what) {
return what.equals(getDefaultExtension()); return getHiddenExtensions().contains(what);
} }
@ -1849,7 +1831,12 @@ public class Sketch {
return "ino"; return "ino";
} }
static private List<String> hiddenExtensions = Arrays.asList("ino", "pde");
public List<String> getHiddenExtensions() {
return hiddenExtensions;
}
/** /**
* Returns a String[] array of proper extensions. * Returns a String[] array of proper extensions.
*/ */