Skip to content

Commit 8519b5d

Browse files
Use SketchCode.isExtension in more places
1 parent 3a089e5 commit 8519b5d

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

app/src/processing/app/EditorHeader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void paintComponent(Graphics screen) {
176176
for (int i = 0; i < sketch.getCodeCount(); i++) {
177177
SketchCode code = sketch.getCode(i);
178178

179-
String codeName = sketch.hideExtension(code.getExtension()) ?
179+
String codeName = code.isExtension(sketch.getHiddenExtensions()) ?
180180
code.getPrettyName() : code.getFileName();
181181

182182
// if modified, add the li'l glyph next to the name

app/src/processing/app/Sketch.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ protected void nameCode(String newName) {
425425
if (renamingCode && currentIndex == 0) {
426426
for (int i = 1; i < codeCount; i++) {
427427
if (sanitaryName.equalsIgnoreCase(code[i].getPrettyName()) &&
428-
code[i].getExtension().equalsIgnoreCase("cpp")) {
428+
code[i].isExtension("cpp")) {
429429
Base.showMessage(_("Nope"),
430430
I18n.format(
431431
_("You can't rename the sketch to \"{0}\"\n" +
@@ -836,7 +836,7 @@ protected boolean saveAs() throws IOException {
836836
// resaved (with the same name) to another location/folder.
837837
for (int i = 1; i < codeCount; i++) {
838838
if (newName.equalsIgnoreCase(code[i].getPrettyName()) &&
839-
code[i].getExtension().equalsIgnoreCase("cpp")) {
839+
code[i].isExtension("cpp")) {
840840
Base.showMessage(_("Nope"),
841841
I18n.format(
842842
_("You can't save the sketch as \"{0}\"\n" +
@@ -1819,21 +1819,11 @@ public boolean isReadOnly() {
18191819
// Breaking out extension types in order to clean up the code, and make it
18201820
// easier for other environments (like Arduino) to incorporate changes.
18211821

1822-
1823-
/**
1824-
* True if the specified extension should be hidden when shown on a tab.
1825-
* For Processing, this is true for .pde files. (Broken out for subclasses.)
1826-
*/
1827-
public boolean hideExtension(String what) {
1828-
return getHiddenExtensions().contains(what);
1829-
}
1830-
1831-
18321822
/**
18331823
* True if the specified code has the default file extension.
18341824
*/
18351825
public boolean hasDefaultExtension(SketchCode code) {
1836-
return code.getExtension().equals(getDefaultExtension());
1826+
return code.isExtension(getDefaultExtension());
18371827
}
18381828

18391829

0 commit comments

Comments
 (0)