Fixed: [Issue 20] protoc should be called only when building .proto files
https://code.google.com/p/protobuf-dt/issues/detail?id=20
Now we check that the extension of the file to build is "proto".
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtobufBuildParticipant.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtobufBuildParticipant.java
index 96f1022..ad2fe4a 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtobufBuildParticipant.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtobufBuildParticipant.java
@@ -51,7 +51,7 @@
IFolder outputFolder = findOrCreateOutputFolder(project, preferences.outputFolderName);
for (Delta d : deltas) {
IResourceDescription newResource = d.getNew();
- String path = filePath(newResource);
+ String path = filePathIfIsProtoFile(newResource);
if (path == null) continue;
IFile source = project.getWorkspace().getRoot().getFile(new Path(path));
generateSingleProto(source, preferences.protocPath, preferences.language, pathOf(outputFolder));
@@ -65,9 +65,10 @@
return outputFolder;
}
- private static String filePath(IResourceDescription r) {
+ private static String filePathIfIsProtoFile(IResourceDescription r) {
if (r == null) return null;
URI uri = r.getURI();
+ if (!uri.fileExtension().equals("proto")) return null;
if (uri.scheme() == null) return uri.toFileString();
StringBuilder b = new StringBuilder();
int segmentCount = uri.segmentCount();