mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-31 20:52:13 +01:00
Let importLibrary use Sketch.SKETCH_EXTENSIONS
For determining if the current file was a sketch file, it previously (indirectly) used a hardcoded "ino" comparison. Now, it uses `SKETCH_EXTENSIONS` so it also applies to .pde files and the hardcoded "ino" (and the methods leading up to it) can be removed.
This commit is contained in:
parent
5e68b66c5e
commit
a4e2e80c1c
@ -800,9 +800,10 @@ public class SketchController {
|
||||
// import statements into the main sketch file (code[0])
|
||||
// if the current code is a .java file, insert into current
|
||||
//if (current.flavor == PDE) {
|
||||
if (hasDefaultExtension(editor.getCurrentTab().getSketchCode())) {
|
||||
SketchCode code = editor.getCurrentTab().getSketchCode();
|
||||
if (code.isExtension(Sketch.SKETCH_EXTENSIONS))
|
||||
editor.selectTab(0);
|
||||
}
|
||||
|
||||
// could also scan the text in the file to see if each import
|
||||
// statement is already in there, but if the user has the import
|
||||
// commented out, then this will be a problem.
|
||||
@ -1043,16 +1044,6 @@ public class SketchController {
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
// 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 code has the default file extension.
|
||||
*/
|
||||
private boolean hasDefaultExtension(SketchCode code) {
|
||||
return code.isExtension(sketch.getDefaultExtension());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the data folder if it does not exist already. As a convenience,
|
||||
* it also returns the data folder, since it's likely about to be used.
|
||||
|
@ -155,13 +155,6 @@ public class Sketch {
|
||||
return codes.toArray(new SketchCode[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default extension for this editor setup.
|
||||
*/
|
||||
public String getDefaultExtension() {
|
||||
return "ino";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a file object for the primary .pde of this sketch.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user