Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Buziuk2016-04-27 23:42:09 +0000
committerIlya Buziuk2016-04-28 23:02:28 +0000
commit8e7a1197289f2d0fbb304b2348a9866949a7fa2b (patch)
treec53562d684d6d49d85628a21a79f6a4472eeb26f
parentee10cb689ad7c100f079b5cf34c7c7be09c0fee7 (diff)
downloadwebtools.jsdt-8e7a1197289f2d0fbb304b2348a9866949a7fa2b.tar.gz
webtools.jsdt-8e7a1197289f2d0fbb304b2348a9866949a7fa2b.tar.xz
webtools.jsdt-8e7a1197289f2d0fbb304b2348a9866949a7fa2b.zip
Bug 492038 - Fixing "Push Source Changes to VM" functionality for Node.js launch
Signed-off-by: Ilya Buziuk <ilyabuziuk@gmail.com> Change-Id: I867257f2298055bc8f67c3c4802d0b6a6e0b8010
-rw-r--r--bundles/org.eclipse.wst.jsdt.chromium.debug.core/src/org/eclipse/wst/jsdt/chromium/debug/core/ChromiumSourceComputer.java1
-rw-r--r--nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/NodeConstants.java44
-rw-r--r--nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/launch/NodeLaunchConfigurationDelegate.java25
3 files changed, 50 insertions, 20 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.chromium.debug.core/src/org/eclipse/wst/jsdt/chromium/debug/core/ChromiumSourceComputer.java b/bundles/org.eclipse.wst.jsdt.chromium.debug.core/src/org/eclipse/wst/jsdt/chromium/debug/core/ChromiumSourceComputer.java
index 16c0c2c6b..ab80b8e3e 100644
--- a/bundles/org.eclipse.wst.jsdt.chromium.debug.core/src/org/eclipse/wst/jsdt/chromium/debug/core/ChromiumSourceComputer.java
+++ b/bundles/org.eclipse.wst.jsdt.chromium.debug.core/src/org/eclipse/wst/jsdt/chromium/debug/core/ChromiumSourceComputer.java
@@ -9,7 +9,6 @@
package org.eclipse.wst.jsdt.chromium.debug.core;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
diff --git a/nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/NodeConstants.java b/nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/NodeConstants.java
index 1cd986697..c18b749e7 100644
--- a/nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/NodeConstants.java
+++ b/nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/NodeConstants.java
@@ -10,29 +10,32 @@
*******************************************************************************/
package org.eclipse.wst.jsdt.js.node.internal;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author "Adalberto Lopez Venegas (adalbert)"
*/
public final class NodeConstants {
// Node.js constants and launch parameters
- public static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.wst.jsdt.js.node.NodeLaunchConfigurationType";
- public static final String EMPTY = "";
- public static final String ATTR_WORKING_DIRECTORY = "attr_working_directory";
- public static final String ATTR_APP_PATH = "attr_app_path";
- public static final String ATTR_NODE_ARGUMENTS = "attr_node_arguments";
- public static final String ATTR_APP_ARGUMENTS = "attr_app_arguments";
- public static final String ATTR_APP_PROJECT = "attr_app_project";
- public static final String ATTR_HOST_FIELD = "attr_host_field";
- public static final String ATTR_PORT_FIELD = "attr_port_field";
- public static final String ATTR_ADD_NETWORK_CONSOLE_FIELD = "attr_add_network_console_field";
- public static final String ATTR_BREAK_FIELD = "attr_break_field";
- public static final String PROCESS_MESSAGE = "Node.js process";
- public static final String PACKAGE_JSON = "package.json";
- public static final String DEFAULT_HOST = "localhost";
+ public static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.wst.jsdt.js.node.NodeLaunchConfigurationType"; //$NON-NLS-1$
+ public static final String EMPTY = ""; //$NON-NLS-1$
+ public static final String ATTR_WORKING_DIRECTORY = "attr_working_directory"; //$NON-NLS-1$
+ public static final String ATTR_APP_PATH = "attr_app_path"; //$NON-NLS-1$
+ public static final String ATTR_NODE_ARGUMENTS = "attr_node_arguments"; //$NON-NLS-1$
+ public static final String ATTR_APP_ARGUMENTS = "attr_app_arguments"; //$NON-NLS-1$
+ public static final String ATTR_APP_PROJECT = "attr_app_project"; //$NON-NLS-1$
+ public static final String ATTR_HOST_FIELD = "attr_host_field"; //$NON-NLS-1$
+ public static final String ATTR_PORT_FIELD = "attr_port_field"; //$NON-NLS-1$
+ public static final String ATTR_ADD_NETWORK_CONSOLE_FIELD = "attr_add_network_console_field"; //$NON-NLS-1$
+ public static final String ATTR_BREAK_FIELD = "attr_break_field"; //$NON-NLS-1$
+ public static final String PROCESS_MESSAGE = "Node.js process"; //$NON-NLS-1$
+ public static final String PACKAGE_JSON = "package.json"; //$NON-NLS-1$
+ public static final String DEFAULT_HOST = "localhost"; //$NON-NLS-1$
public static final int DEFAULT_PORT = 5858;
// Chromium V8 constants and launch parameters
- public static final String CHROMIUM_LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.wst.jsdt.chromium.debug.ui.LaunchType$StandaloneV8";
+ public static final String CHROMIUM_LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.wst.jsdt.chromium.debug.ui.LaunchType$StandaloneV8"; //$NON-NLS-1$
public static final String CHROMIUM_DEBUG_HOST = "debug_host"; //$NON-NLS-1$
public static final String CHROMIUM_DEBUG_PORT = "debug_port"; //$NON-NLS-1$
public static final String ADD_NETWORK_CONSOLE = "add_network_console"; //$NON-NLS-1$
@@ -43,6 +46,15 @@ public final class NodeConstants {
public static final String WIP_BACKEND_ID = "wip_backend_id"; //$NON-NLS-1$
// By default Node.js debug launch should use exact match detection of workspace resources
public static final String EXACT_MATCH = "EXACT_MATCH"; //$NON-NLS-1$
+ public static final String CONFIG_PROPERTY = "predefined_source_wrapperd_ids"; //$NON-NLS-1$
+ // By default source wrappers from {@link HardcodedSourceWrapProvider} must be enabled
+ @SuppressWarnings("serial")
+ public static final List<String> PREDEFIENED_WRAPPERS = new ArrayList<String>() {
+ {
+ add("org.eclipse.wst.jsdt.chromium.debug.core.model.HardcodedSourceWrapProvider$NodeJsStandardEntry"); //$NON-NLS-1$
+ add("org.eclipse.wst.jsdt.chromium.debug.core.model.HardcodedSourceWrapProvider$NodeJsWithDefinedEntry"); //$NON-NLS-1$
+ }
+ };
// NodeUtil constants
public static final String NODE = "node"; //$NON-NLS-1$
@@ -53,7 +65,7 @@ public final class NodeConstants {
public static final String FIND_NODE_SYSTEM_PATH_CONSTANTS_WHICH_LOCATION_3 = "/usr/local/bin/which"; //$NON-NLS-1$
public static final String FIND_NODE_SYSTEM_PATH_ENV_VAR = "PATH"; //$NON-NLS-1$
public static final String FIND_NODE_SYSTEM_PATH_CONSTANTS_NODE_EXTRA_LOCATION = "/usr/local/bin"; //$NON-NLS-1$
-
+
private NodeConstants() {
}
diff --git a/nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/launch/NodeLaunchConfigurationDelegate.java b/nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/launch/NodeLaunchConfigurationDelegate.java
index 21d03642a..f15e968e1 100644
--- a/nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/launch/NodeLaunchConfigurationDelegate.java
+++ b/nodejs/org.eclipse.wst.jsdt.js.node/src/org/eclipse/wst/jsdt/js/node/internal/launch/NodeLaunchConfigurationDelegate.java
@@ -11,6 +11,8 @@
package org.eclipse.wst.jsdt.js.node.internal.launch;
import java.io.File;
+import java.util.Collections;
+import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -126,7 +128,7 @@ public class NodeLaunchConfigurationDelegate extends LaunchConfigurationDelegate
// Launch Chromium V8
if(mode.equals(ILaunchManager.DEBUG_MODE)){
- String projectName = configuration.getAttribute(NodeConstants.ATTR_APP_PROJECT, NodeConstants.EMPTY);
+ String project = configuration.getAttribute(NodeConstants.ATTR_APP_PROJECT, NodeConstants.EMPTY);
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(NodeConstants.CHROMIUM_LAUNCH_CONFIGURATION_TYPE_ID);
IContainer container = null;
@@ -145,9 +147,10 @@ public class NodeLaunchConfigurationDelegate extends LaunchConfigurationDelegate
chromiumLaunch.setAttribute(NodeConstants.SOURCE_LOOKUP_MODE, NodeConstants.EXACT_MATCH);
- chromiumLaunch.setAttribute(NodeConstants.ATTR_APP_PROJECT, projectName);
-
+ chromiumLaunch.setAttribute(NodeConstants.CONFIG_PROPERTY, encode(NodeConstants.PREDEFIENED_WRAPPERS));
+ chromiumLaunch.setAttribute(NodeConstants.ATTR_APP_PROJECT, project);
+
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
@@ -220,4 +223,20 @@ public class NodeLaunchConfigurationDelegate extends LaunchConfigurationDelegate
String args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(nodeArguments);
return args;
}
+
+
+ /**
+ * Encoding predefined source wrappers via {@link MementoFormat} for correct
+ * decoding in {@link PredefinedSourceWrapperIds}
+ */
+ private String encode(List<String> wrappers) {
+ StringBuilder output = new StringBuilder();
+ Collections.sort(wrappers);
+ for (String wrapper : wrappers) {
+ output.append(wrapper.length());
+ output.append('(').append(wrapper).append(')');
+ }
+ return output.toString();
+ }
+
}

Back to the top