Skip to content

Commit 31bb0b4

Browse files
committed
NodeEditor is changed to be based on JSDT editor
1 parent e3c5f54 commit 31bb0b4

File tree

8 files changed

+43
-11
lines changed

8 files changed

+43
-11
lines changed

org.nodeclipse.debug/plugin.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
<extension point="org.eclipse.core.runtime.adapters">
55
<factory
66
class="org.nodeclipse.debug.model.BreakpointAdapterFactory"
7-
adaptableType="org.eclipse.ui.texteditor.ITextEditor">
7+
adaptableType="org.chromium.debug.ui.editors.JsEditor">
8+
<adapter type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget" />
9+
</factory>
10+
<factory
11+
class="org.nodeclipse.debug.model.BreakpointAdapterFactory"
12+
adaptableType="org.nodeclipse.ui.editors.NodeEditor">
813
<adapter type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget" />
914
</factory>
1015
</extension>

org.nodeclipse.debug/src/org/nodeclipse/debug/model/NodeBreakpointAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection)
3838
}
3939

4040
addBreakpoint(resource, lineNumber);
41-
if(res2.exists()) {
41+
if(res2 != null && res2.exists()) {
4242
addBreakpoint(res2, lineNumber);
4343
}
4444
}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Require-Bundle: org.eclipse.ui,
1313
org.eclipse.ui.console,
1414
org.eclipse.debug.ui,
1515
org.eclipse.ui.navigator,
16-
org.chromium.debug.ui;bundle-version="0.3.9"
16+
org.chromium.debug.ui;bundle-version="0.3.9",
17+
org.eclipse.wst.jsdt.core;bundle-version="1.1.102",
18+
org.eclipse.wst.jsdt.ui;bundle-version="1.1.102"
1719
Bundle-ActivationPolicy: lazy
1820
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
1921
Export-Package: org.nodeclipse.ui,

org.nodeclipse.ui/common-templates/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
## Developing
1212

1313

14-
Created with [Nodeclipse v0.4](https://github.com/Nodeclipse/nodeclipse-1)
14+
Created with [Nodeclipse v0.3](https://github.com/Nodeclipse/nodeclipse-1)
1515
([Eclipse Marketplace](http://marketplace.eclipse.org/content/nodeclipse), [site](http://www.nodeclipse.org))

org.nodeclipse.ui/src/org/nodeclipse/ui/editors/NodeEditor.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package org.nodeclipse.ui.editors;
22

3+
import org.eclipse.wst.jsdt.internal.ui.javaeditor.CompilationUnitEditor;
4+
5+
@SuppressWarnings("restriction")
6+
public class NodeEditor extends CompilationUnitEditor {
7+
}
8+
9+
/*
310
import org.eclipse.jface.preference.IPreferenceStore;
411
import org.eclipse.jface.text.IDocumentExtension3;
512
import org.eclipse.jface.text.source.DefaultCharacterPairMatcher;
@@ -26,9 +33,6 @@ protected void initializeEditor() {
2633
setDocumentProvider(new NodeDocumentProvider());
2734
}
2835
29-
/**
30-
* 匹配双括号
31-
*/
3236
@Override
3337
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
3438
super.configureSourceViewerDecorationSupport(support);
@@ -46,3 +50,4 @@ protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupp
4650
}
4751
4852
}
53+
*/

org.nodeclipse.ui/src/org/nodeclipse/ui/wizards/AbstractNodeProjectWizard.java

+18
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.eclipse.core.resources.IFile;
1515
import org.eclipse.core.resources.IProject;
1616
import org.eclipse.core.resources.IProjectDescription;
17+
import org.eclipse.core.resources.IWorkspace;
1718
import org.eclipse.core.resources.IncrementalProjectBuilder;
1819
import org.eclipse.core.resources.ResourcesPlugin;
1920
import org.eclipse.core.runtime.CoreException;
@@ -33,7 +34,9 @@
3334
import org.eclipse.ui.internal.registry.PerspectiveDescriptor;
3435
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
3536
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
37+
import org.eclipse.wst.jsdt.core.JavaScriptCore;
3638
import org.nodeclipse.ui.Activator;
39+
import org.nodeclipse.ui.nature.NodeNature;
3740
import org.nodeclipse.ui.perspectives.NodePerspective;
3841
import org.osgi.framework.Bundle;
3942

@@ -76,6 +79,21 @@ public boolean performFinish() {
7679
}
7780

7881
protected abstract IProject createNewProject();
82+
83+
protected IProjectDescription createProjectDescription(IProject newProjectHandle, URI location) {
84+
IWorkspace workspace = ResourcesPlugin.getWorkspace();
85+
final IProjectDescription description = workspace
86+
.newProjectDescription(newProjectHandle.getName());
87+
description.setLocationURI(location);
88+
String[] natures = description.getNatureIds();
89+
String[] newNatures = new String[natures.length + 2];
90+
System.arraycopy(natures, 0, newNatures, 0, natures.length);
91+
newNatures[natures.length] = NodeNature.NATURE_ID;
92+
newNatures[natures.length+1] = JavaScriptCore.NATURE_ID;
93+
description.setNatureIds(newNatures);
94+
95+
return description;
96+
}
7997

8098
protected void generateTemplates(String path, IProject projectHandle) throws CoreException {
8199
Bundle bundle = Activator.getDefault().getBundle();

org.nodeclipse.ui/src/org/nodeclipse/ui/wizards/ExpressProjectWizard.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected IProject createNewProject() {
8282
if (!mainPage.useDefaults()) {
8383
location = mainPage.getLocationURI();
8484
}
85-
85+
/*
8686
IWorkspace workspace = ResourcesPlugin.getWorkspace();
8787
final IProjectDescription description = workspace
8888
.newProjectDescription(newProjectHandle.getName());
@@ -92,7 +92,8 @@ protected IProject createNewProject() {
9292
System.arraycopy(natures, 0, newNatures, 0, natures.length);
9393
newNatures[natures.length] = NodeNature.NATURE_ID;
9494
description.setNatureIds(newNatures);
95-
95+
*/
96+
final IProjectDescription description = createProjectDescription(newProjectHandle, location);
9697
final boolean exists = isExistsProjectFolder(description);
9798
final String projectName = mainPage.getProjectName();
9899
final String templateEngine = mainPage.getSelectedTemplateEngine();

org.nodeclipse.ui/src/org/nodeclipse/ui/wizards/NodeProjectWizard.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected IProject createNewProject() {
102102
if (!mainPage.useDefaults()) {
103103
location = mainPage.getLocationURI();
104104
}
105-
105+
/*
106106
IWorkspace workspace = ResourcesPlugin.getWorkspace();
107107
final IProjectDescription description = workspace
108108
.newProjectDescription(newProjectHandle.getName());
@@ -112,7 +112,8 @@ protected IProject createNewProject() {
112112
System.arraycopy(natures, 0, newNatures, 0, natures.length);
113113
newNatures[natures.length] = NodeNature.NATURE_ID;
114114
description.setNatureIds(newNatures);
115-
115+
*/
116+
final IProjectDescription description = createProjectDescription(newProjectHandle, location);
116117
final boolean exists = isExistsProjectFolder(description);
117118

118119
IRunnableWithProgress op = new IRunnableWithProgress() {

0 commit comments

Comments
 (0)