Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/dartium/CssScriptManager.java

Issue 371253002: Version 1.5.7 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.5/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/dartium/CssScriptManager.java
===================================================================
--- dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/dartium/CssScriptManager.java (revision 38051)
+++ dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/dartium/CssScriptManager.java (working copy)
@@ -22,6 +22,10 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import java.io.IOException;
import java.util.List;
@@ -32,6 +36,35 @@
* about, send the new contents to the browser using the Webkit inspector protocol.
*/
class CssScriptManager implements ResourceChangeParticipant {
+
+ private class UpdateCssFileJob extends Job {
+
+ IFile file;
+
+ public UpdateCssFileJob(IFile file) {
+ super("Updating file");
+ this.file = file;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ String fileUrl = target.getResourceResolver().getUrlForResource(file);
+
+ if (fileUrl != null) {
+ List<WebkitStyleSheetRef> scripts = target.getConnection().getCSS().getStyleSheets();
+
+ for (WebkitStyleSheetRef ref : scripts) {
+ if (fileUrl.equals(ref.getSourceURL())) {
+ uploadNewSource(ref, file);
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ }
+
private DartiumDebugTarget target;
public CssScriptManager(DartiumDebugTarget target) {
@@ -52,17 +85,8 @@
@Override
public void handleFileChanged(IFile file) {
if ("css".equals(file.getFileExtension())) {
- String fileUrl = target.getResourceResolver().getUrlForResource(file);
-
- if (fileUrl != null) {
- List<WebkitStyleSheetRef> scripts = target.getConnection().getCSS().getStyleSheets();
-
- for (WebkitStyleSheetRef ref : scripts) {
- if (fileUrl.equals(ref.getSourceURL())) {
- uploadNewSource(ref, file);
- }
- }
- }
+ UpdateCssFileJob job = new UpdateCssFileJob(file);
+ job.schedule();
}
}
« no previous file with comments | « no previous file | dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/dartium/DartCodeManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698