# HG changeset patch # User Eugene Ostroukhov # Date 1276107711 25200 # Node ID f8c2079946be8730186974ce8b9be66f407ce557 # Parent 08e920dda3d91c37e0a15073cbd014b3f3dd8808# Parent dd7d3426144c5598686b8e8cf6d86bdb6708c575 Heads merge diff -r dd7d3426144c -r f8c2079946be chrome-dev-tools-patches/doc --- a/chrome-dev-tools-patches/doc Tue Jun 08 16:12:51 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -hg import [OPTION]... PATCH... - -aliases: patch - -import an ordered set of patches - - Import a list of patches and commit them individually (unless --no-commit - is specified). - - If there are outstanding changes in the working directory, import will - abort unless given the -f/--force flag. - - You can import a patch straight from a mail message. Even patches as - attachments work (to use the body part, it must have type text/plain or - text/x-patch). From and Subject headers of email message are used as - default committer and commit message. All text/plain body parts before - first diff are added to commit message. - - If the imported patch was generated by hg export, user and description - from patch override values from message headers and body. Values given on - command line with -m/--message and -u/--user override these. - - If --exact is specified, import will set the working directory to the - parent of each patch before applying it, and will abort if the resulting - changeset has a different ID than the one recorded in the patch. This may - happen due to character set problems or other deficiencies in the text - patch format. - - With -s/--similarity, hg will attempt to discover renames and copies in - the patch in the same way as 'addremove'. - - To read a patch from standard input, use "-" as the patch name. If a URL - is specified, the patch will be downloaded from it. See 'hg help dates' - for a list of formats valid for -d/--date. - -options: - - -p --strip directory strip option for patch. This has the same - meaning as the corresponding patch option (default: 1) - -b --base base path - -f --force skip check for outstanding uncommitted changes - --no-commit don't commit, just update the working directory - --exact apply patch to the nodes from which it was generated - --import-branch use any branch information in patch (implied by --exact) - -m --message use as commit message - -l --logfile read commit message from - -d --date record datecode as commit date - -u --user record the specified user as committer - -s --similarity guess renamed files by similarity (0<=s<=100) - -global options: - -R --repository repository root directory or name of overlay bundle file - --cwd change working directory - -y --noninteractive do not prompt, assume 'yes' for any required answers - -q --quiet suppress output - -v --verbose enable additional output - --config set/override config option - --debug enable debugging output - --debugger start debugger - --encoding set the charset encoding (default: cp1251) - --encodingmode set the charset encoding mode (default: strict) - --traceback always print a traceback on exception - --time time how long the command takes - --profile print command execution profile - --version output version information and exit - -h --help display help and exit diff -r dd7d3426144c -r f8c2079946be chrome-dev-tools-patches/stack-line-numbers-patch.txt --- a/chrome-dev-tools-patches/stack-line-numbers-patch.txt Tue Jun 08 16:12:51 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -Index: src/org/chromium/debug/core/model/DebugTargetImpl.java -=================================================================== ---- src/org/chromium/debug/core/model/DebugTargetImpl.java (revision 307) -+++ src/org/chromium/debug/core/model/DebugTargetImpl.java (working copy) -@@ -474,6 +474,10 @@ - public WorkspaceBridge.JsLabelProvider getLabelProvider() { - return workspaceBridgeFactory.getLabelProvider(); - } -+ -+ public int getLineNumber(CallFrame stackFrame) { -+ return workspaceRelations.getLineNumber(stackFrame); -+ } - - private static class ListenerBlock { - private volatile boolean isBlocked = true; -Index: src/org/chromium/debug/core/model/StackFrame.java -=================================================================== ---- src/org/chromium/debug/core/model/StackFrame.java (revision 307) -+++ src/org/chromium/debug/core/model/StackFrame.java (working copy) -@@ -194,8 +194,7 @@ - } - - public int getLineNumber() throws DebugException { -- // convert 0-based to 1-based -- return stackFrame.getLineNumber() + 1; -+ return getDebugTarget().getLineNumber(stackFrame); - } - - public int getCharStart() throws DebugException { -Index: src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java -=================================================================== ---- src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java (revision 307) -+++ src/org/chromium/debug/core/model/VProjectWorkspaceBridge.java (working copy) -@@ -230,6 +230,11 @@ - } - }; - -+ public int getLineNumber(CallFrame stackFrame) { -+ // convert 0-based to 1-based -+ return stackFrame.getLineNumber() + 1; -+ } -+ - /** - * This very simple source locator works because we provide our own source files. - * We'll have to try harder, once we link with resource js files. -@@ -282,4 +287,5 @@ - return name; - } - }; -+ - } -Index: src/org/chromium/debug/core/model/WorkspaceBridge.java -=================================================================== ---- src/org/chromium/debug/core/model/WorkspaceBridge.java (revision 307) -+++ src/org/chromium/debug/core/model/WorkspaceBridge.java (working copy) -@@ -7,6 +7,7 @@ - import java.util.Collection; - - import org.chromium.sdk.Breakpoint; -+import org.chromium.sdk.CallFrame; - import org.chromium.sdk.JavascriptVm; - import org.chromium.sdk.Script; - import org.eclipse.core.resources.IFile; -@@ -86,6 +87,12 @@ - BreakpointHandler getBreakpointHandler(); - - /** -+ * Returns editor line number for the provided call stack frame applying all required -+ * editor-specific translations. -+ */ -+ int getLineNumber(CallFrame stackFrame); -+ -+ /** - * Breakpoint-related aspect of {@link WorkspaceBridge} interface. - */ - interface BreakpointHandler extends IBreakpointListener { diff -r dd7d3426144c -r f8c2079946be org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/DebugUtil.java --- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/DebugUtil.java Tue Jun 08 16:12:51 2010 -0700 +++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/DebugUtil.java Wed Jun 09 11:21:51 2010 -0700 @@ -36,7 +36,28 @@ return new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, exeption)); } + public static IProject getProject(ILaunch configuration) { + try { + if (WidgetLaunchDelegate.ID.equals(configuration.getLaunchConfiguration().getType().getIdentifier())) { + String projectName = configuration.getLaunchConfiguration().getAttribute(IConstants.PROP_PROJECT_NAME, + (String) null); + if (projectName != null) { + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + if (project.isAccessible()) { + return project; + } + } + } + } catch (CoreException e) { + Activator.log(e); + } + return null; + } + public static IProject getProject(ILaunchConfiguration configuration) throws CoreException { + if (!WidgetLaunchDelegate.ID.equals(configuration.getType().getIdentifier())) { + return null; + } String projectName = configuration.getAttribute(IConstants.PROP_PROJECT_NAME, (String) null); if (projectName == null) { throw createCoreException("Project is not selected", null); diff -r dd7d3426144c -r f8c2079946be org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/ResourcesChangeListener.java --- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/ResourcesChangeListener.java Tue Jun 08 16:12:51 2010 -0700 +++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/ResourcesChangeListener.java Wed Jun 09 11:21:51 2010 -0700 @@ -85,4 +85,150 @@ return false; } + // // TODO Progress indicator - ... files updated of ... + // + // public void resourceChanged(IResourceChangeEvent event) { + // try { + // if (event.getDelta() != null) { + // + // processDelta(event.getDelta()); + // } else { + // // TODO Can't refresh + // } + // } catch (CoreException e) { + // Activator.log(e); + // } + // + // } + // + // private static final class DeltaProcessor implements IResourceDeltaVisitor { + // private final Map targets; + // private final Map updateList = new HashMap(); + // private boolean hasUnupdatables = false; + // + // public DeltaProcessor(Map targets) { + // this.targets = targets; + // } + // + // public boolean visit(IResourceDelta delta) throws CoreException { + // final IResource resource = delta.getResource(); + // switch (resource.getType()) { + // case IResource.PROJECT: + // return targets.containsKey(resource); + // case IResource.FILE: + // processFile((IFile) resource, targets.get(resource.getProject())); + // return false; + // default: + // return true; + // } + // } + // + // private void processFile(final IFile resource, final DebugTargetImpl debugTargetImpl) throws CoreException { + // if (!ProjectUtils.isExcluded(resource)) { + // final VmResource vmResource = debugTargetImpl.getVmResource(resource); + // if (vmResource != null) { + // updateList.put(resource, vmResource.getScript()); + // } else { + // if (!JavaScriptCore.isJavaScriptLikeFileName(resource.getName())) { + // hasUnupdatables = true; + // } + // } + // } + // } + // + // public Map getUpdateList() { + // return updateList; + // } + // + // public boolean hasUnupdatables() { + // return hasUnupdatables; + // } + // } + // + // private void processDelta(final IResourceDelta delta) throws CoreException { + // final ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); + // final Map targets = new HashMap(); + // for (ILaunch launch : launches) { + // final IDebugTarget target = launch.getDebugTarget(); + // if (!launch.isTerminated() && target instanceof DebugTargetImpl) { + // IProject project = DebugUtil.getProject(launch); + // if (project != null) { + // targets.put(project, (DebugTargetImpl) target); + // } + // } + // } + // + // DeltaProcessor processor = new DeltaProcessor(targets); + // delta.accept(processor); + // + // if (processor.getUpdateList().size() > 0) { + // final Collection statuses = new LinkedList(); + // for (Entry entry : processor.getUpdateList().entrySet()) { + // statuses.add(updateScript(entry.getValue(), entry.getKey())); + // } + // } else if (processor.hasUnupdatables()) { + // + // } + // } + // + // private IStatus updateScript(Script script, final IFile file) { + // UpdatableScript updatableScript = LiveEditExtension.castToUpdatableScript(script); + // + // if (updatableScript == null) { + // throw new RuntimeException(); + // } + // + // byte[] fileData; + // try { + // fileData = readFileContents(file); + // } catch (IOException e) { + // throw new RuntimeException(e); + // } catch (CoreException e) { + // throw new RuntimeException(e); + // } + // final IStatus[] res = new IStatus[1]; + // // We are using default charset here like usually. + // String newSource = new String(fileData); + // + // UpdatableScript.UpdateCallback callback = new UpdatableScript.UpdateCallback() { + // public void success(Object report) { + // res[0] = new Status( + // IStatus.OK, + // ChromiumDebugPlugin.PLUGIN_ID, + // String.format( + // "Script %s was successfully updated on remote: %s", file.getProjectRelativePath().toString(), report)); //$NON-NLS-1$ + // } + // + // public void failure(String message) { + // res[0] = new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID, String.format( + // "Script %s cannot be updated: %s", file.getProjectRelativePath().toString(), message)); //$NON-NLS-1$ + // } + // }; + // + // updatableScript.setSourceOnRemote(newSource, callback, null); + // return res[0]; + // } + // + // private static byte[] readFileContents(IFile file) throws IOException, CoreException { + // InputStream inputStream = file.getContents(); + // try { + // return readBytes(inputStream); + // } finally { + // inputStream.close(); + // } + // } + // + // private static byte[] readBytes(InputStream inputStream) throws IOException { + // ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + // byte[] array = new byte[1024]; + // while (true) { + // int len = inputStream.read(array); + // if (len == -1) { + // break; + // } + // buffer.write(array, 0, len); + // } + // return buffer.toByteArray(); + // } + } diff -r dd7d3426144c -r f8c2079946be org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge.java --- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge.java Tue Jun 08 16:12:51 2010 -0700 +++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WRTProjectWorkspaceBridge.java Wed Jun 09 11:21:51 2010 -0700 @@ -1,6 +1,5 @@ package org.symbian.tools.wrttools.debug.internal.launch; -import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -8,14 +7,13 @@ import org.chromium.debug.core.model.BreakpointSynchronizer.Direction; import org.chromium.debug.core.model.ChromiumLineBreakpoint; import org.chromium.debug.core.model.DebugTargetImpl; -import org.chromium.debug.core.model.StackFrame; import org.chromium.debug.core.model.VmResource; +import org.chromium.debug.core.model.VmResourceId; import org.chromium.debug.core.model.WorkspaceBridge; import org.chromium.sdk.CallFrame; import org.chromium.sdk.JavascriptVm; import org.chromium.sdk.JavascriptVm.ScriptsCallback; import org.chromium.sdk.Script; -import org.eclipse.core.filesystem.EFS; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; @@ -23,158 +21,153 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.debug.core.model.IStackFrame; +import org.eclipse.debug.core.sourcelookup.ISourceContainer; +import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector; +import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer; import org.symbian.tools.wrttools.debug.internal.Activator; import org.symbian.tools.wrttools.debug.internal.model.ResourceManager; import org.symbian.tools.wrttools.debug.internal.model.WorkspaceBreakpointHandler; -import org.symbian.tools.wrttools.previewer.PreviewerPlugin; public class WRTProjectWorkspaceBridge implements WorkspaceBridge { - public static final class Factory implements WorkspaceBridge.Factory { - private final IProject project; + public static final class Factory implements WorkspaceBridge.Factory { + private final IProject project; - public Factory(IProject project) { - this.project = project; - } + public Factory(IProject project) { + this.project = project; + } - public WorkspaceBridge attachedToVm(DebugTargetImpl debugTargetImpl, - JavascriptVm javascriptVm) { - return new WRTProjectWorkspaceBridge(debugTargetImpl, javascriptVm, - project); - } + public WorkspaceBridge attachedToVm(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm) { + return new WRTProjectWorkspaceBridge(debugTargetImpl, javascriptVm, project); + } - public String getDebugModelIdentifier() { - return DEBUG_MODEL_ID; - } + public String getDebugModelIdentifier() { + return DEBUG_MODEL_ID; + } - public JsLabelProvider getLabelProvider() { - return new WrtLabelProvider(); - } + public JsLabelProvider getLabelProvider() { + return new WrtLabelProvider(); + } + } - } - - public final static String DEBUG_MODEL_ID = "org.symbian.debug"; + public final static String DEBUG_MODEL_ID = "org.symbian.debug"; - private final BreakpointHandler breakpointHandler; - private final JavascriptVm javascriptVm; - private final IProject project; - private final ResourceManager resourceManager; + private final BreakpointHandler breakpointHandler; + private final JavascriptVm javascriptVm; + private final IProject project; + private final ResourceManager resourceManager; - public WRTProjectWorkspaceBridge(DebugTargetImpl debugTargetImpl, - JavascriptVm javascriptVm, IProject project) { - this.javascriptVm = javascriptVm; - this.project = project; + public WRTProjectWorkspaceBridge(DebugTargetImpl debugTargetImpl, JavascriptVm javascriptVm, IProject project) { + this.javascriptVm = javascriptVm; + this.project = project; this.resourceManager = new ResourceManager(); + this.sourceLocator = new WebApplicationSourceLocator(resourceManager); breakpointHandler = new WorkspaceBreakpointHandler(debugTargetImpl, resourceManager); - ILaunch launch = debugTargetImpl.getLaunch(); - launch.setSourceLocator(sourceLocator); - } + ILaunch launch = debugTargetImpl.getLaunch(); + try { + sourceLocator.initializeDefaults(launch.getLaunchConfiguration()); + sourceLocator.setSourceContainers(new ISourceContainer[] { new ProjectSourceContainer(project, false) }); + } catch (CoreException e) { + throw new RuntimeException(e); + } + launch.setSourceLocator(sourceLocator); + } - public void beforeDetach() { - // Do nothing - } - - public BreakpointHandler getBreakpointHandler() { - return breakpointHandler; - } - - public void handleVmResetEvent() { - resourceManager.clear(); - } + public void beforeDetach() { + // Do nothing + } - public void launchRemoved() { - // Do nothing - } + public BreakpointHandler getBreakpointHandler() { + return breakpointHandler; + } + + public void handleVmResetEvent() { + resourceManager.clear(); + } - public void reloadScriptsAtStart() { - javascriptVm.getScripts(new ScriptsCallback() { - public void failure(String errorMessage) { - Activator.log(errorMessage); - } + public void launchRemoved() { + // Do nothing + } - public void success(Collection