| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.debug.ui.actions; | 5 package org.chromium.debug.ui.actions; |
| 6 | 6 |
| 7 import java.io.IOException; | 7 import java.io.IOException; |
| 8 import java.util.Collection; |
| 8 import java.util.List; | 9 import java.util.List; |
| 9 | 10 |
| 10 import org.chromium.debug.core.ChromiumDebugPlugin; | 11 import org.chromium.debug.core.ChromiumDebugPlugin; |
| 12 import org.chromium.debug.core.model.VmResource; |
| 13 import org.chromium.debug.core.model.VmResource.ScriptHolder; |
| 11 import org.chromium.debug.core.util.ChromiumDebugPluginUtil; | 14 import org.chromium.debug.core.util.ChromiumDebugPluginUtil; |
| 12 import org.chromium.debug.core.util.ScriptTargetMapping; | 15 import org.chromium.debug.core.util.ScriptTargetMapping; |
| 13 import org.chromium.debug.ui.liveedit.LiveEditDiffViewer; | 16 import org.chromium.debug.ui.liveedit.LiveEditDiffViewer; |
| 14 import org.chromium.debug.ui.liveedit.LiveEditResultDialog; | 17 import org.chromium.debug.ui.liveedit.LiveEditResultDialog; |
| 15 import org.chromium.sdk.Script; | 18 import org.chromium.sdk.Script; |
| 16 import org.chromium.sdk.SyncCallback; | 19 import org.chromium.sdk.SyncCallback; |
| 17 import org.chromium.sdk.UpdatableScript; | 20 import org.chromium.sdk.UpdatableScript; |
| 18 import org.chromium.sdk.UpdatableScript.ChangeDescription; | 21 import org.chromium.sdk.UpdatableScript.ChangeDescription; |
| 19 import org.eclipse.core.runtime.CoreException; | 22 import org.eclipse.core.runtime.CoreException; |
| 20 import org.eclipse.core.runtime.IStatus; | 23 import org.eclipse.core.runtime.IStatus; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 dialog.open(); | 56 dialog.open(); |
| 54 } | 57 } |
| 55 }); | 58 }); |
| 56 } | 59 } |
| 57 }; | 60 }; |
| 58 execute(filePair, callback, null, false); | 61 execute(filePair, callback, null, false); |
| 59 } | 62 } |
| 60 | 63 |
| 61 public static void execute(final ScriptTargetMapping filePair, | 64 public static void execute(final ScriptTargetMapping filePair, |
| 62 UpdatableScript.UpdateCallback callback, SyncCallback syncCallback, boolea
n previewOnly) { | 65 UpdatableScript.UpdateCallback callback, SyncCallback syncCallback, boolea
n previewOnly) { |
| 63 Script script = filePair.getScriptHolder().getSingleScript(); | 66 // TODO: fix the rough behavior (inside this call). |
| 64 | 67 Script script = filePair.getSingleScript(); |
| 65 byte[] fileData; | 68 byte[] fileData; |
| 66 try { | 69 try { |
| 67 fileData = ChromiumDebugPluginUtil.readFileContents(filePair.getFile()); | 70 fileData = ChromiumDebugPluginUtil.readFileContents(filePair.getFile()); |
| 68 } catch (IOException e) { | 71 } catch (IOException e) { |
| 69 throw new RuntimeException(e); | 72 throw new RuntimeException(e); |
| 70 } catch (CoreException e) { | 73 } catch (CoreException e) { |
| 71 throw new RuntimeException(e); | 74 throw new RuntimeException(e); |
| 72 } | 75 } |
| 73 | 76 |
| 74 // We are using default charset here like usually. | 77 // We are using default charset here like usually. |
| 75 String newSource = new String(fileData); | 78 String newSource = new String(fileData); |
| 76 | 79 |
| 77 if (previewOnly) { | 80 if (previewOnly) { |
| 78 script.previewSetSource(newSource, callback, syncCallback); | 81 script.previewSetSource(newSource, callback, syncCallback); |
| 79 } else { | 82 } else { |
| 80 script.setSourceOnRemote(newSource, callback, syncCallback); | 83 script.setSourceOnRemote(newSource, callback, syncCallback); |
| 81 } | 84 } |
| 82 } | 85 } |
| 83 } | 86 } |
| OLD | NEW |