Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/actions/RunPubAction.java |
=================================================================== |
--- editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/actions/RunPubAction.java (revision 42132) |
+++ editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/actions/RunPubAction.java (working copy) |
@@ -140,6 +140,7 @@ |
if (object instanceof IFile) { |
object = ((IFile) object).getParent(); |
} |
+ IContainer sourceFolder = (IContainer) object; |
while (object != null && ((IContainer) object).findMember(DartCore.PUBSPEC_FILE_NAME) == null) { |
object = ((IContainer) object).getParent(); |
} |
@@ -147,7 +148,7 @@ |
IContainer container = (IContainer) object; |
instrumentation.data("name", container.getName()); |
savePubspecFile(container); |
- runPubJob(container); |
+ runPubJob(container, sourceFolder); |
return; |
} else { |
instrumentation.metric("Problem", "Object was null").log(); |
@@ -199,15 +200,7 @@ |
} |
protected void runPubJob(IContainer container) { |
- if (container.findMember(DartCore.PUBSPEC_FILE_NAME) != null) { |
- RunPubJob runPubJob = new RunPubJob(container, command, false); |
- runPubJob.schedule(); |
- } else { |
- MessageDialog.openError( |
- getShell(), |
- ActionMessages.RunPubAction_fail, |
- ActionMessages.RunPubAction_fileNotFound); |
- } |
+ runPubJob(container, null); |
} |
private void copy(InputStream in, MessageConsole console) throws IOException { |
@@ -222,6 +215,23 @@ |
} |
} |
+ private void runPubJob(IContainer container, IContainer sourceFolder) { |
+ if (container.findMember(DartCore.PUBSPEC_FILE_NAME) != null) { |
+ RunPubJob runPubJob; |
+ if (command.equals(RunPubJob.BUILD_COMMAND) && container != sourceFolder) { |
+ runPubJob = new RunPubJob(container, command, false, sourceFolder); |
+ } else { |
+ runPubJob = new RunPubJob(container, command, false); |
+ } |
+ runPubJob.schedule(); |
+ } else { |
+ MessageDialog.openError( |
+ getShell(), |
+ ActionMessages.RunPubAction_fail, |
+ ActionMessages.RunPubAction_fileNotFound); |
+ } |
+ } |
+ |
private void savePubspecFile(IContainer container) { |
IResource resource = container.findMember(DartCore.PUBSPEC_FILE_NAME); |
if (resource != null) { |