Skip to content

Commit 2d020fb

Browse files
committed
Launch V8Standalone
1 parent 8a93b9c commit 2d020fb

5 files changed

Lines changed: 111 additions & 75 deletions

File tree

org.nodeclipse.debug/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: Nodeclipse
44
Bundle-SymbolicName: org.nodeclipse.debug; singleton:=true
5-
Bundle-Version: 0.1.8
5+
Bundle-Version: 0.1.8.qualifier
66
Bundle-Activator: org.nodeclipse.debug.Activator
77
Require-Bundle: org.eclipse.ui,
88
org.eclipse.core.runtime,

org.nodeclipse.debug/src/org/nodeclipse/debug/launch/LaunchConfigurationDelegate.java

Lines changed: 70 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,88 @@
33
import java.io.File;
44
import java.util.ArrayList;
55
import java.util.List;
6+
67
import org.eclipse.core.resources.ResourcesPlugin;
78
import org.eclipse.core.runtime.CoreException;
89
import org.eclipse.core.runtime.IProgressMonitor;
10+
import org.eclipse.core.runtime.IStatus;
11+
import org.eclipse.core.runtime.Status;
12+
import org.eclipse.core.runtime.jobs.Job;
913
import org.eclipse.debug.core.DebugPlugin;
1014
import org.eclipse.debug.core.ILaunch;
1115
import org.eclipse.debug.core.ILaunchConfiguration;
16+
import org.eclipse.debug.core.ILaunchConfigurationType;
17+
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
1218
import org.eclipse.debug.core.ILaunchManager;
1319
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
20+
import org.eclipse.debug.ui.DebugUITools;
21+
import org.eclipse.swt.widgets.Display;
1422
import org.nodeclipse.debug.util.Constants;
1523
import org.nodeclipse.ui.Activator;
16-
1724
import org.nodeclipse.ui.preferences.PreferenceConstants;
1825

19-
public class LaunchConfigurationDelegate implements ILaunchConfigurationDelegate {
20-
21-
/*
22-
* (non-Javadoc)
23-
*
24-
* @see
25-
* org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.
26-
* eclipse.debug.core.ILaunchConfiguration, java.lang.String,
27-
* org.eclipse.debug.core.ILaunch,
28-
* org.eclipse.core.runtime.IProgressMonitor)
29-
*/
30-
@Override
31-
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
32-
// Using configuration to build command line
33-
List<String> cmdLine = new ArrayList<String>();
34-
// Application path should be stored in preference.
35-
cmdLine.add(Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.NODE_PATH));
36-
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
37-
cmdLine.add("--debug-brk=5858");
38-
}
39-
String file = configuration.getAttribute(Constants.KEY_FILE_PATH, Constants.BLANK_STRING);
40-
String filePath = ResourcesPlugin.getWorkspace().getRoot().findMember(file).getLocation().toOSString();
41-
// path is relative, so can not found it.
42-
cmdLine.add(filePath);
43-
String[] cmds = {};
44-
cmds = cmdLine.toArray(cmds);
45-
// Launch a process to debug.eg,
46-
Process p = DebugPlugin.exec(cmds, (new File(filePath)).getParentFile());
47-
DebugPlugin.newProcess(launch, p, Constants.PROCESS_MESSAGE);
48-
// if (mode.equals(ILaunchManager.DEBUG_MODE)) {
49-
// DebugTarget target = new DebugTarget(launch, process, p);
50-
// launch.addDebugTarget(target);
51-
// }
26+
public class LaunchConfigurationDelegate implements
27+
ILaunchConfigurationDelegate {
5228

53-
}
29+
/*
30+
* (non-Javadoc)
31+
*
32+
* @see
33+
* org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.
34+
* eclipse.debug.core.ILaunchConfiguration, java.lang.String,
35+
* org.eclipse.debug.core.ILaunch,
36+
* org.eclipse.core.runtime.IProgressMonitor)
37+
*/
38+
@Override
39+
public void launch(ILaunchConfiguration configuration, String mode,
40+
ILaunch launch, IProgressMonitor monitor) throws CoreException {
41+
// Using configuration to build command line
42+
List<String> cmdLine = new ArrayList<String>();
43+
// Application path should be stored in preference.
44+
cmdLine.add(Activator.getDefault().getPreferenceStore()
45+
.getString(PreferenceConstants.NODE_PATH));
46+
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
47+
cmdLine.add("--debug-brk=5858");
48+
}
49+
String file = configuration.getAttribute(Constants.KEY_FILE_PATH,
50+
Constants.BLANK_STRING);
51+
String filePath = ResourcesPlugin.getWorkspace().getRoot()
52+
.findMember(file).getLocation().toOSString();
53+
// path is relative, so can not found it.
54+
cmdLine.add(filePath);
55+
String[] cmds = {};
56+
cmds = cmdLine.toArray(cmds);
57+
// Launch a process to debug.eg,
58+
Process p = DebugPlugin
59+
.exec(cmds, (new File(filePath)).getParentFile());
60+
DebugPlugin.newProcess(launch, p, Constants.PROCESS_MESSAGE);
61+
// if (mode.equals(ILaunchManager.DEBUG_MODE)) {
62+
// DebugTarget target = new DebugTarget(launch, process, p);
63+
// launch.addDebugTarget(target);
64+
// }
65+
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
66+
launchStandaloneV8(mode);
67+
}
68+
}
5469

70+
private void launchStandaloneV8(final String mode) throws CoreException {
71+
ILaunchConfigurationType type = DebugPlugin
72+
.getDefault()
73+
.getLaunchManager()
74+
.getLaunchConfigurationType(
75+
Constants.STANDALONE_V8_LAUNCH_CONFIGURATION_TYPE_ID);
76+
if (type != null) {
77+
ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(
78+
null, "STANDALNE_V8");
79+
workingCopy.setAttribute("debug_host", "localhost");
80+
workingCopy.setAttribute("debug_port", 5858);
81+
final ILaunchConfiguration config = workingCopy.doSave();
82+
Display.getDefault().asyncExec(new Runnable() {
83+
@Override
84+
public void run() {
85+
DebugUITools.launch(config, mode);
86+
}
87+
});
88+
}
89+
}
5590
}

org.nodeclipse.debug/src/org/nodeclipse/debug/util/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
public class Constants {
88

99
public static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.nodeclipse.debug.launch.LaunchConfigurationType";
10+
public static final String STANDALONE_V8_LAUNCH_CONFIGURATION_TYPE_ID = "org.chromium.debug.ui.LaunchType$StandaloneV8";
1011

1112
public static final String KEY_FILE_PATH = "key_file_path";
1213
public static final String BLANK_STRING = "";

org.nodeclipse.feature/feature.xml

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<feature
3-
id="org.nodeclipse"
4-
label="Nodeclipse"
5-
version="0.1.8">
6-
7-
<description url="http://www.nodeclipse.org/">
8-
Node support for Eclipse
9-
</description>
10-
11-
<copyright url="http://www.nodeclipse.org/">
12-
Copyright@Nodeclipse
13-
</copyright>
14-
15-
<license url="http://www.apache.org/licenses/LICENSE-2.0">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<feature
3+
id="org.nodeclipse"
4+
label="Nodeclipse"
5+
version="0.1.8.qualifier">
6+
7+
<description url="http://www.nodeclipse.org/">
8+
Node support for Eclipse
9+
</description>
10+
11+
<copyright url="http://www.nodeclipse.org/">
12+
Copyright@Nodeclipse
13+
</copyright>
14+
15+
<license url="http://www.apache.org/licenses/LICENSE-2.0">
1616
Apache License
1717
Version 2.0, January 2004
1818
http://www.apache.org/licenses/
@@ -213,26 +213,26 @@ http://www.apache.org/licenses/
213213
distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
214214
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
215215
See the License for the specific language governing permissions and
216-
limitations under the License.
217-
</license>
218-
219-
<url>
220-
<update label="Nodeclipse Updates" url="http://www.nodeclipse.org/updates"/>
221-
<discovery label="Nodeclipse Updates" url="http://www.nodeclipse.org/updates"/>
222-
</url>
223-
224-
<plugin
225-
id="org.nodeclipse.debug"
226-
download-size="0"
227-
install-size="0"
228-
version="0.1.8"
229-
unpack="false"/>
230-
231-
<plugin
232-
id="org.nodeclipse.ui"
233-
download-size="0"
234-
install-size="0"
235-
version="0.1.8"
236-
unpack="false"/>
237-
238-
</feature>
216+
limitations under the License.
217+
</license>
218+
219+
<url>
220+
<update label="Nodeclipse Updates" url="http://www.nodeclipse.org/updates"/>
221+
<discovery label="Nodeclipse Updates" url="http://www.nodeclipse.org/updates"/>
222+
</url>
223+
224+
<plugin
225+
id="org.nodeclipse.debug"
226+
download-size="0"
227+
install-size="0"
228+
version="0.0.0"
229+
unpack="false"/>
230+
231+
<plugin
232+
id="org.nodeclipse.ui"
233+
download-size="0"
234+
install-size="0"
235+
version="0.0.0"
236+
unpack="false"/>
237+
238+
</feature>

org.nodeclipse.ui/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: Nodeclipse
44
Bundle-SymbolicName: org.nodeclipse.ui;singleton:=true
5-
Bundle-Version: 0.1.8
5+
Bundle-Version: 0.1.8.qualifier
66
Bundle-Activator: org.nodeclipse.ui.Activator
77
Require-Bundle: org.eclipse.ui,
88
org.eclipse.core.runtime,

0 commit comments

Comments
 (0)