Skip to content

Commit

Permalink
Revised plugin.xml and README
Browse files Browse the repository at this point in the history
  • Loading branch information
francoiscampbell committed Aug 5, 2015
1 parent 295aeaa commit e965555
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<li>Associates .ino and .pde files as C++ source, so you get syntax highlighting and prediction, etc.</li>
<li>Create a new sketch file in any directory. If you omit the extension, it will add .ino automatically</li>
<li>Adds import for Arduino.h to all newly created sketch files to enable code completion</li>
<li>Compiled with Java 6 for compatibility with OS X out of the box</li>
</ul>
]]>
</change-notes>
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
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
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);
}
});
}
Expand All @@ -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);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Arduino.h>\n\nvoid setup() {\n\n}\n\nvoid loop() {\n\n}";
public static final String ENTER_FILENAME = "Enter filename";
public static final String ERROR = "Error";
Expand Down

0 comments on commit e965555

Please sign in to comment.