Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public class AddFileToGistController extends Application {
@FXML
public Button addFileButton, cancelButton;
@FXML
private ComboBox<String> extention;
private ComboBox<String> extension;
@FXML // fx:id="langaugeIcon"
private ImageView langaugeIcon; // Value injected by FXMLLoader
private String extentionStr = ".groovy";
private String extensionStr = ".groovy";
private String gitRepo;
@FXML
private TextArea description;
Expand Down Expand Up @@ -102,7 +102,7 @@ public void start(Stage primaryStage) throws Exception {
tmp=12;
root.setStyle("-fx-font-size: "+tmp+"pt");
});
extention.getItems().clear();
extension.getItems().clear();
if (getGitRepo() != null) {
newProject.getChildren().clear();
} else {
Expand All @@ -112,11 +112,11 @@ public void start(Stage primaryStage) throws Exception {
ObservableList<String> options = FXCollections.observableArrayList(langs);
//
for (String s : options) {
extention.getItems().add(s);
extension.getItems().add(s);
}
extention.getSelectionModel().select("Groovy");
extension.getSelectionModel().select("Groovy");
Image icon;
String asset = "Script-Tab-" + extention.getSelectionModel().getSelectedItem() + ".png";
String asset = "Script-Tab-" + extension.getSelectionModel().getSelectedItem() + ".png";

try {

Expand All @@ -131,10 +131,10 @@ public void start(Stage primaryStage) throws Exception {
e2.printStackTrace();
}

extention.setOnAction(event -> {
extension.setOnAction(event -> {
try {

String selectedItem = extention.getSelectionModel().getSelectedItem();
String selectedItem = extension.getSelectionModel().getSelectedItem();
setSelected(selectedItem);
} catch (Exception e1) {
// Auto-generated catch block
Expand Down Expand Up @@ -167,11 +167,11 @@ private void setSelected(String selectedItem) throws Exception {
IScriptingLanguage l = ScriptingEngine.getLangaugesMap().get(key);

if (l != null) {
extentionStr = l.getFileExtenetion().get(0);
extensionStr = l.getFileExtension().get(0);
} else
extentionStr = ".groovy";
if(!extentionStr.startsWith(".")) {
extentionStr="."+extentionStr;
extensionStr = ".groovy";
if(!extensionStr.startsWith(".")) {
extensionStr="."+extensionStr;
}
isArduino = ArduinoLoader.class.isInstance(l);

Expand All @@ -187,10 +187,10 @@ public void onAddFile(ActionEvent event) {
});
String filename = filenameField.getText();

if (!filename.endsWith(extentionStr)) {
filename = filename + extentionStr;
if (!filename.endsWith(extensionStr)) {
filename = filename + extensionStr;
}
String fileSlug = filename.replace(extentionStr, "");
String fileSlug = filename.replace(extensionStr, "");
String message = description.getText();
if (message == null || message.length() == 0) {
message = filename;
Expand All @@ -206,7 +206,7 @@ public void onAddFile(ActionEvent event) {
String fullBranch = ScriptingEngine.getFullBranch(getGitRepo());
if (fullBranch == null)
fullBranch = ScriptingEngine.newBranch(getGitRepo(), "main");
ScriptingEngine.getLangaugeByExtention(extentionStr).getDefaultContents(getGitRepo(), filename );
ScriptingEngine.getLangaugeByExtension(extensionStr).getDefaultContents(getGitRepo(), filename );
ScriptingEngine.pushCodeToGit(getGitRepo(), fullBranch, filename, null, message);
File nf = ScriptingEngine.fileFromGit(getGitRepo(), filename);
try {
Expand Down Expand Up @@ -330,8 +330,8 @@ public void setFileExtensionType(IScriptingLanguage lang) {
try {
setSelected(string);
BowlerStudio.runLater(() -> {
extention.setValue(string);
extention.setDisable(true);
extension.setValue(string);
extension.setDisable(true);
});
} catch (Exception e) {
// Auto-generated catch block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private static String createGistFromBuilder(GHGistBuilder builder, String filena
}

com.neuronrobotics.sdk.common.Log.error("Creating gist at " + filename);
ScriptingEngine.getLangaugeByExtention(filename).getDefaultContents(gist.getGitPullUrl(), filename);
ScriptingEngine.getLangaugeByExtension(filename).getDefaultContents(gist.getGitPullUrl(), filename);
return gist.getGitPullUrl();
}
catch (IOException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public interface IExternalEditor {

public abstract List<Class> getSupportedLangauge();

default boolean isSupportedByExtention(File file) {
default boolean isSupportedByExtension(File file) {
if(getSupportedLangauge()!=null)
for(Class c:getSupportedLangauge())
if (c.isInstance(ScriptingEngine.getLangaugeByExtention(file.getAbsolutePath()))) {
if (c.isInstance(ScriptingEngine.getLangaugeByExtension(file.getAbsolutePath()))) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public ExternalEditorController(File f, CheckBox autoRun, Runnable OnComplete){
loadEditors();
this.currentFile = f;
for(IExternalEditor e:editors) {
if(e.isSupportedByExtention(f)) {
if(e.isSupportedByExtension(f)) {
hasEditor=true;
myEditor=e;
image.setImage(e.getImage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void requestTextAreaFocus() {
});
});
}
public static void setExtentionSyntaxType(String shellType, String syntax) {
public static void setExtensionSyntaxType(String shellType, String syntax) {
langaugeMapping.put(shellType, syntax);
}

Expand Down
Loading