diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index c5c5738..1f8029e 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -29,6 +29,7 @@
  • Associates .ino and .pde files as C++ source, so you get syntax highlighting and prediction, etc.
  • Create a new sketch file in any directory. If you omit the extension, it will add .ino automatically
  • Adds import for Arduino.h to all newly created sketch files to enable code completion
  • +
  • Compiled with Java 6 for compatibility with OS X out of the box
  • ]]> diff --git a/README.md b/README.md index 403200a..889627b 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,5 @@ Future features are to add menu option to easily change the board type, port num * Convert a project to Arduino CMake. This replaces CMakeLists.txt with a default one, deletes the default main.cpp file, copies in the Arduino CMake toolchain files, and deletes the build direcory to start fresh * Associates .ino and .pde files as C++ source, so you get syntax highlighting and prediction, etc. * Create a new sketch file in any directory. If you omit the extension, it will add .ino automatically -* Adds import for Arduino.h to all newly created sketch files to enable code completion \ No newline at end of file +* Adds import for Arduino.h to all newly created sketch files to enable code completion +* Compiled with Java 6 for compatibility with OS X out of the box \ No newline at end of file diff --git a/src/io/github/francoiscambell/clionarduinoplugin/components/ArduinoFileTypeRegistration.java b/src/io/github/francoiscambell/clionarduinoplugin/components/ArduinoFileTypeRegistration.java index 47ffa1d..13f1c3a 100644 --- a/src/io/github/francoiscambell/clionarduinoplugin/components/ArduinoFileTypeRegistration.java +++ b/src/io/github/francoiscambell/clionarduinoplugin/components/ArduinoFileTypeRegistration.java @@ -3,12 +3,14 @@ import com.intellij.openapi.application.*; import com.intellij.openapi.components.*; import com.intellij.openapi.fileTypes.*; +import io.github.francoiscambell.clionarduinoplugin.resources.*; import org.jetbrains.annotations.*; /** * Created by francois on 15-08-03. */ public class ArduinoFileTypeRegistration implements ApplicationComponent { + public void initComponent() { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override @@ -16,9 +18,9 @@ public void run() { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { - FileType cpp = FileTypeManager.getInstance().getFileTypeByExtension("cpp"); - FileTypeManager.getInstance().associateExtension(cpp, "ino"); - FileTypeManager.getInstance().associateExtension(cpp, "pde"); + FileType cpp = FileTypeManager.getInstance().getFileTypeByExtension(Strings.CPP_EXT); + FileTypeManager.getInstance().associateExtension(cpp, Strings.INO_EXT); + FileTypeManager.getInstance().associateExtension(cpp, Strings.PDE_EXT); } }); } @@ -32,9 +34,9 @@ public void run() { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { - FileType cpp = FileTypeManager.getInstance().getFileTypeByExtension("cpp"); - FileTypeManager.getInstance().removeAssociatedExtension(cpp, "ino"); - FileTypeManager.getInstance().removeAssociatedExtension(cpp, "pde"); + FileType cpp = FileTypeManager.getInstance().getFileTypeByExtension(Strings.CPP_EXT); + FileTypeManager.getInstance().removeAssociatedExtension(cpp, Strings.INO_EXT); + FileTypeManager.getInstance().removeAssociatedExtension(cpp, Strings.PDE_EXT); } }); } diff --git a/src/io/github/francoiscambell/clionarduinoplugin/resources/Strings.java b/src/io/github/francoiscambell/clionarduinoplugin/resources/Strings.java index 6a0e6d3..c263e29 100644 --- a/src/io/github/francoiscambell/clionarduinoplugin/resources/Strings.java +++ b/src/io/github/francoiscambell/clionarduinoplugin/resources/Strings.java @@ -5,6 +5,7 @@ */ public class Strings { public static final String CMAKE_LISTS_FILENAME = "CMakeLists.txt"; + public static final String CPP_EXT = "cpp"; public static final String DEFAULT_ARDUINO_SKETCH_CONTENTS = "#include \n\nvoid setup() {\n\n}\n\nvoid loop() {\n\n}"; public static final String ENTER_FILENAME = "Enter filename"; public static final String ERROR = "Error";