| Index: plugins/org.chromium.debug.core/src/org/chromium/debug/core/ChromiumSourceDirector.java
|
| diff --git a/plugins/org.chromium.debug.core/src/org/chromium/debug/core/ChromiumSourceDirector.java b/plugins/org.chromium.debug.core/src/org/chromium/debug/core/ChromiumSourceDirector.java
|
| index be1e999c0f1a2875ff43759d3a2fa39a60d23ead..7a29a51d3d5a540df1bf908266c4b24d6f0b3c3a 100644
|
| --- a/plugins/org.chromium.debug.core/src/org/chromium/debug/core/ChromiumSourceDirector.java
|
| +++ b/plugins/org.chromium.debug.core/src/org/chromium/debug/core/ChromiumSourceDirector.java
|
| @@ -13,7 +13,7 @@ import java.util.List;
|
| import org.chromium.debug.core.ScriptNameManipulator.ScriptNamePattern;
|
| import org.chromium.debug.core.model.JavascriptVmEmbedder;
|
| import org.chromium.debug.core.model.LaunchParams;
|
| -import org.chromium.debug.core.model.LaunchParams.LookupAccurateness;
|
| +import org.chromium.debug.core.model.LaunchParams.LookupMode;
|
| import org.chromium.debug.core.model.ResourceManager;
|
| import org.chromium.debug.core.model.StackFrame;
|
| import org.chromium.debug.core.model.VmResource;
|
| @@ -55,56 +55,55 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
| }
|
|
|
| public VmResourceRef findVmResourceRef(IFile file) throws CoreException {
|
| - return getLookupMode().findVmResourceRef(file);
|
| + return getLookupModeHandler().findVmResourceRef(file);
|
| }
|
|
|
| - public static LookupAccurateness readLookupAccurateness(ILaunchConfiguration launchConfiguration)
|
| + public static LookupMode readLookupMode(ILaunchConfiguration launchConfiguration)
|
| throws CoreException {
|
| - String accuratenessValue = launchConfiguration.getAttribute(
|
| - LaunchParams.SOURCE_LOOKUP_ACCURATENESS, (String) null);
|
| - LookupAccurateness value;
|
| - if (accuratenessValue == null) {
|
| - value = LookupAccurateness.DEFAULT_VALUE;
|
| + String lookupStringValue = launchConfiguration.getAttribute(
|
| + LaunchParams.SOURCE_LOOKUP_MODE, (String) null);
|
| + LookupMode value;
|
| + if (lookupStringValue == null) {
|
| + value = LookupMode.DEFAULT_VALUE;
|
| } else {
|
| - value = LookupAccurateness.STRING_CONVERTER.decode(accuratenessValue);
|
| + value = LookupMode.STRING_CONVERTER.decode(lookupStringValue);
|
| }
|
| return value;
|
| }
|
|
|
| - private LookupMode readLookupMode(ILaunchConfiguration launchConfiguration)
|
| - throws CoreException {
|
| - LookupAccurateness value = readLookupAccurateness(launchConfiguration);
|
| - return value.accept(new LookupAccurateness.Visitor<LookupMode>() {
|
| - @Override
|
| - public LookupMode visitAccurate() {
|
| - return ACCURATE_LOOKUP_MODE;
|
| - }
|
| -
|
| - @Override
|
| - public LookupMode visitInaccurate() {
|
| - return INACCURATE_LOOKUP_MODE;
|
| - }
|
| - });
|
| - }
|
| -
|
| - private LookupMode getLookupMode() {
|
| + private LookupModeHandler getLookupModeHandler() {
|
| + LookupMode mode;
|
| try {
|
| - return readLookupMode(getLaunchConfiguration());
|
| + mode = readLookupMode(getLaunchConfiguration());
|
| } catch (CoreException e) {
|
| ChromiumDebugPlugin.log(e);
|
| - return ACCURATE_LOOKUP_MODE;
|
| + mode = LookupMode.DEFAULT_VALUE;
|
| }
|
| + return mode.accept(MODE_TO_HANDLER_VISITOR);
|
| }
|
|
|
| + private final LookupMode.Visitor<LookupModeHandler> MODE_TO_HANDLER_VISITOR =
|
| + new LookupMode.Visitor<LookupModeHandler>() {
|
| + @Override
|
| + public LookupModeHandler visitExactMatch() {
|
| + return exactMatchLookupMode;
|
| + }
|
| +
|
| + @Override
|
| + public LookupModeHandler visitAutoDetect() {
|
| + return autoDetectLookupMode;
|
| + }
|
| + };
|
| +
|
| @Override
|
| public boolean isFindDuplicates() {
|
| - return getLookupMode().forceFindDuplicates() || super.isFindDuplicates();
|
| + return getLookupModeHandler().forceFindDuplicates() || super.isFindDuplicates();
|
| }
|
|
|
| /**
|
| * A single implementation of look participant. This way the participant may decide to become
|
| - * accurate/inaccurate after it is created, because javascriptVm instances comes too late after
|
| - * everything is created.
|
| + * exact match/auto-detect after it is created, because javascriptVm instances comes too late
|
| + * after everything is created.
|
| */
|
| private static class LookupParticipant extends AbstractSourceLookupParticipant {
|
| private final SuperClassAccess superClassAccess = new SuperClassAccess();
|
| @@ -120,7 +119,7 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
|
|
| @Override
|
| public Object[] findSourceElements(Object object) throws CoreException {
|
| - Delegate delegate = chromiumSourceDirector.getLookupMode().getDelegate();
|
| + Delegate delegate = chromiumSourceDirector.getLookupModeHandler().getDelegate();
|
| return delegate.findSourceElements(object, superClassAccess);
|
| }
|
|
|
| @@ -149,7 +148,7 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
| }
|
| }
|
|
|
| - private static final LookupParticipant.Delegate ACCURATE_DELEGATE =
|
| + private static final LookupParticipant.Delegate EXACT_MATCH_DELEGATE =
|
| new LookupParticipant.Delegate() {
|
| @Override
|
| Object[] findSourceElements(Object object, LookupParticipant.SuperClassAccess superClass)
|
| @@ -172,7 +171,7 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
| }
|
| };
|
|
|
| - private static final LookupParticipant.Delegate INACCURATE_DELEGATE =
|
| + private static final LookupParticipant.Delegate AUTO_DETECT_DELEGATE =
|
| new LookupParticipant.Delegate() {
|
| @Override
|
| Object[] findSourceElements(Object object, LookupParticipant.SuperClassAccess superClass)
|
| @@ -398,13 +397,13 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
| }
|
|
|
| private void checkSupportedLookupMode() {
|
| - LookupMode lookupMode = getLookupMode();
|
| + LookupModeHandler lookupMode = getLookupModeHandler();
|
| if (javascriptVmEmbedder != null) {
|
| lookupMode.showUnsupportedWarning(javascriptVmEmbedder);
|
| }
|
| }
|
|
|
| - private static abstract class LookupMode {
|
| + private static abstract class LookupModeHandler {
|
| abstract LookupParticipant.Delegate getDelegate();
|
|
|
| abstract void showUnsupportedWarning(JavascriptVmEmbedder javascriptVmEmbedder);
|
| @@ -414,9 +413,9 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
| abstract VmResourceRef findVmResourceRef(IFile file) throws CoreException;
|
| }
|
|
|
| - private final LookupMode ACCURATE_LOOKUP_MODE = new LookupMode() {
|
| + private final LookupModeHandler exactMatchLookupMode = new LookupModeHandler() {
|
| @Override LookupParticipant.Delegate getDelegate() {
|
| - return ACCURATE_DELEGATE;
|
| + return EXACT_MATCH_DELEGATE;
|
| }
|
|
|
| @Override void showUnsupportedWarning(JavascriptVmEmbedder javascriptVmEmbedder) {
|
| @@ -436,9 +435,9 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
| }
|
| };
|
|
|
| - private final LookupMode INACCURATE_LOOKUP_MODE = new LookupMode() {
|
| + private final LookupModeHandler autoDetectLookupMode = new LookupModeHandler() {
|
| @Override LookupParticipant.Delegate getDelegate() {
|
| - return INACCURATE_DELEGATE;
|
| + return AUTO_DETECT_DELEGATE;
|
| }
|
|
|
| @Override
|
| @@ -456,14 +455,14 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
| public void run() {
|
| Display display = Display.getDefault();
|
| MessageBox messageBox = new MessageBox(display.getActiveShell(), SWT.ICON_WARNING);
|
| - messageBox.setText("Inaccurate Source Look-Up Problem");
|
| - messageBox.setMessage("You are running in 'inaccurate source look-up' mode.\n" +
|
| + messageBox.setText("Auto-Detect Source Look-Up Mode Problem");
|
| + messageBox.setMessage("You are running in 'auto-detect' source look-up mode.\n" +
|
| "However the connected JavaScript VM (version=\"" +
|
| javascriptVmEmbedder.getJavascriptVm().getVersion() +
|
| "\") does not support it.\n" +
|
| "You won't be able to set breakpoints except for on scripts in virtual project.\n" +
|
| "\n" +
|
| - "It is recommended that you switch to accurate look-up mode " +
|
| + "It is recommended that you switch to 'exact match' look-up mode " +
|
| "(or get newer version of JavaScript VM).");
|
| messageBox.open();
|
| }
|
| @@ -495,7 +494,7 @@ public class ChromiumSourceDirector extends AbstractSourceLookupDirector {
|
| }
|
| ScriptNameManipulator scriptNameManipulator = javascriptVmEmbedder.getScriptNameManipulator();
|
| ScriptNamePattern pattern = scriptNameManipulator.createPattern(components);
|
| - return VmResourceRef.forInaccurate(pattern);
|
| + return VmResourceRef.forRegExpBased(pattern);
|
| }
|
| };
|
| }
|
|
|