Use SketchCode.isExtension in more places

This commit is contained in:
Matthijs Kooijman 2014-07-08 15:26:59 +02:00 committed by Cristian Maglie
parent af0d8c7f5c
commit 43dac3a902
2 changed files with 4 additions and 14 deletions

View File

@ -176,7 +176,7 @@ public class EditorHeader extends JComponent {
for (int i = 0; i < sketch.getCodeCount(); i++) {
SketchCode code = sketch.getCode(i);
String codeName = sketch.hideExtension(code.getExtension()) ?
String codeName = code.isExtension(sketch.getHiddenExtensions()) ?
code.getPrettyName() : code.getFileName();
// if modified, add the li'l glyph next to the name

View File

@ -425,7 +425,7 @@ public class Sketch {
if (renamingCode && currentIndex == 0) {
for (int i = 1; i < codeCount; i++) {
if (sanitaryName.equalsIgnoreCase(code[i].getPrettyName()) &&
code[i].getExtension().equalsIgnoreCase("cpp")) {
code[i].isExtension("cpp")) {
Base.showMessage(_("Nope"),
I18n.format(
_("You can't rename the sketch to \"{0}\"\n" +
@ -835,7 +835,7 @@ public class Sketch {
// resaved (with the same name) to another location/folder.
for (int i = 1; i < codeCount; i++) {
if (newName.equalsIgnoreCase(code[i].getPrettyName()) &&
code[i].getExtension().equalsIgnoreCase("cpp")) {
code[i].isExtension("cpp")) {
Base.showMessage(_("Nope"),
I18n.format(
_("You can't save the sketch as \"{0}\"\n" +
@ -1818,21 +1818,11 @@ public class Sketch {
// Breaking out extension types in order to clean up the code, and make it
// easier for other environments (like Arduino) to incorporate changes.
/**
* True if the specified extension should be hidden when shown on a tab.
* For Processing, this is true for .pde files. (Broken out for subclasses.)
*/
public boolean hideExtension(String what) {
return getHiddenExtensions().contains(what);
}
/**
* True if the specified code has the default file extension.
*/
public boolean hasDefaultExtension(SketchCode code) {
return code.getExtension().equals(getDefaultExtension());
return code.isExtension(getDefaultExtension());
}