Skip to content

Commit f4f586f

Browse files
author
Paul Verest
committed
PhantomJS, MongoDB, JJS - make own preference page, use CommonDialogs
1 parent 6afc5ca commit f4f586f

File tree

28 files changed

+279
-89
lines changed

28 files changed

+279
-89
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.ui,
1313
org.nodeclipse.ui,
1414
org.nodeclipse.debug,
1515
org.eclipse.wst.jsdt.core;bundle-version="1.1.102",
16-
org.eclipse.wst.jsdt.ui
16+
org.eclipse.wst.jsdt.ui,
17+
org.nodeclipse.common
1718
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
1819
Bundle-ActivationPolicy: lazy
1920
Import-Package: org.nodeclipse.debug.launch,

org.nodeclipse.jjs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22

3+
Depends on `.ui` and `.common`
4+
35
`Import-Package: org.nodeclipse.debug.launch` in MANIFEST.MF is for `org.nodeclipse.debug.launch.LaunchConfigurationEnvironmentTab`
46

57
org.nodeclipse.debug.util is for in org.nodeclipse.phantomjs.launch.LaunchConfigurationDelegate

org.nodeclipse.jjs/plugin.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,24 @@
119119
</launchConfigurationTabGroup>
120120
</extension>
121121

122+
<!-- not used
123+
<extension
124+
point="org.eclipse.core.runtime.preferences">
125+
<initializer
126+
class="org.nodeclipse.phantomjs.preferences.PhantomjsPreferenceInitializer">
127+
</initializer>
128+
</extension>
129+
-->
130+
<extension
131+
point="org.eclipse.ui.preferencePages">
132+
<page
133+
category="org.nodeclipse.ui.preferences.NodePreferencePage"
134+
class="org.nodeclipse.jjs.preferences.JJSPreferencePage"
135+
id="org.nodeclipse.jjs.preferences.JJSPreferencePage"
136+
name="JJS">
137+
</page>
138+
</extension>
139+
122140
<extension
123141
point="org.eclipse.help.toc">
124142
<toc

org.nodeclipse.jjs/src/org/nodeclipse/jjs/Activator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.nodeclipse.jjs;
22

33
import org.eclipse.ui.plugin.AbstractUIPlugin;
4-
import org.nodeclipse.jjs.launch.ConstantsJJS;
4+
import org.nodeclipse.jjs.preferences.JJSConstants;
55
import org.osgi.framework.BundleContext;
66

77
/**
@@ -10,7 +10,7 @@
1010
public class Activator extends AbstractUIPlugin {
1111

1212
// The plug-in ID
13-
public static final String PLUGIN_ID = ConstantsJJS.PLUGIN_ID;
13+
public static final String PLUGIN_ID = JJSConstants.PLUGIN_ID;
1414

1515
// The shared instance
1616
private static Activator plugin;

org.nodeclipse.jjs/src/org/nodeclipse/jjs/launch/ConstantsJJS.java

Lines changed: 0 additions & 9 deletions
This file was deleted.

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
1717
import org.eclipse.debug.core.model.RuntimeProcess;
1818
import org.eclipse.jface.preference.IPreferenceStore;
19+
import org.nodeclipse.common.preferences.CommonDialogs;
1920
import org.nodeclipse.debug.util.Constants;
2021
import org.nodeclipse.debug.util.VariablesUtil;
22+
import org.nodeclipse.jjs.preferences.JJSConstants;
2123
import org.nodeclipse.ui.Activator;
22-
import org.nodeclipse.ui.preferences.Dialogs;
2324
import org.nodeclipse.ui.preferences.PreferenceConstants;
2425
import org.nodeclipse.ui.util.NodeclipseConsole;
2526

@@ -49,8 +50,12 @@ public void launch(ILaunchConfiguration configuration, String mode,
4950
File jjsFile = new File(jjsPath);
5051
if(!jjsFile.exists()){
5152
// If the location is not valid than show a dialog which prompts the user to goto the preferences page
52-
Dialogs.showPreferencesDialog("path to jjs util from Java 8 runtime is not correctly configured.\n\n"
53-
+ "Please goto Window -> Prefrences -> Nodeclipse and configure the correct location under 'JJS path:'");
53+
// Dialogs.showPreferencesDialog("path to jjs util from Java 8 runtime is not correctly configured.\n\n"
54+
// + "Please goto Window -> Prefrences -> Nodeclipse and configure the correct location under 'JJS path:'");
55+
CommonDialogs.showPreferencesDialog(JJSConstants.PREFERENCES_PAGE,
56+
"Java 8 Nashorn jjs location is not correctly configured.\n\n"
57+
+ "Please goto Window -> Preferences -> "+JJSConstants.PREFERENCE_PAGE_NAME
58+
+" and configure the correct location");
5459
return;
5560
}
5661
cmdLine.add(jjsPath);
@@ -94,7 +99,7 @@ public void launch(ILaunchConfiguration configuration, String mode,
9499
cmds = cmdLine.toArray(cmds);
95100
// Launch a process to debug.eg,
96101
Process p = DebugPlugin.exec(cmds, workingPath, envp);
97-
RuntimeProcess process = (RuntimeProcess)DebugPlugin.newProcess(launch, p, ConstantsJJS.PROCESS_MESSAGE);
102+
RuntimeProcess process = (RuntimeProcess)DebugPlugin.newProcess(launch, p, JJSConstants.PROCESS_MESSAGE);
98103
if (isDebugMode) {
99104
//TODO research how to debug
100105
}

org.nodeclipse.jjs/src/org/nodeclipse/jjs/launch/LaunchShortcut.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.eclipse.ui.IEditorPart;
1616
import org.eclipse.ui.IEditorInput;
1717
import org.eclipse.ui.IFileEditorInput;
18+
import org.nodeclipse.jjs.preferences.JJSConstants;
1819
import org.nodeclipse.ui.util.NodeclipseConsole;
1920

2021
/**
@@ -74,7 +75,7 @@ private void launchFile(IFile file, String mode) throws CoreException {
7475
// check for an existing launch config for the file
7576
String path = file.getFullPath().toString();
7677
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
77-
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(ConstantsJJS.LAUNCH_CONFIGURATION_TYPE_ID);
78+
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(JJSConstants.LAUNCH_CONFIGURATION_TYPE_ID);
7879
ILaunchConfiguration configuration = createLaunchConfiguration(type, path, file);
7980
DebugUITools.launch(configuration, mode);
8081
// then execution goes in LaunchConfigurationDelegate.java launch() method
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.nodeclipse.jjs.preferences;
2+
3+
public class JJSConstants {
4+
5+
public static final String PLUGIN_ID = "org.nodeclipse.jjs";
6+
public static final String LAUNCH_CONFIGURATION_TYPE_ID = "org.nodeclipse.jjs.launch.LaunchConfigurationType";
7+
8+
public static final String PROCESS_MESSAGE = "JJS Process";
9+
10+
public static final String PREFERENCES_PAGE = "org.nodeclipse.jjs.preferences.JJSPreferencePage";
11+
public static final String PREFERENCE_PAGE_NAME ="Nodeclipse/JJS"; // ! not the same as in plugin.xml
12+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package org.nodeclipse.jjs.preferences;
2+
3+
import org.eclipse.jface.preference.BooleanFieldEditor;
4+
import org.eclipse.jface.preference.FieldEditorPreferencePage;
5+
import org.eclipse.jface.preference.FileFieldEditor;
6+
import org.eclipse.ui.IWorkbench;
7+
import org.eclipse.ui.IWorkbenchPreferencePage;
8+
import org.nodeclipse.ui.Activator;
9+
import org.nodeclipse.ui.preferences.PreferenceConstants;
10+
11+
/**
12+
* @author Paul Verest
13+
* @since 0.11 moved from NodePreferencePage
14+
*/
15+
public class JJSPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
16+
17+
private FileFieldEditor jjsPath;
18+
private BooleanFieldEditor jjsJustJJS;
19+
20+
public JJSPreferencePage(){
21+
super(GRID);
22+
// ! uses .ui
23+
setPreferenceStore(Activator.getDefault().getPreferenceStore());
24+
setDescription("Java 8 Nashorn jjs settings");
25+
}
26+
27+
@Override
28+
public void init(IWorkbench workbench) {
29+
}
30+
31+
@Override
32+
protected void createFieldEditors() {
33+
jjsPath = new FileFieldEditor(PreferenceConstants.JJS_PATH, "`jjs` path:", getFieldEditorParent());
34+
addField(jjsPath);
35+
36+
jjsJustJJS = new BooleanFieldEditor(PreferenceConstants.JJS_JUST_JJS,
37+
"just `jjs` (find `jjs` on PATH. Useful when there are 2 or more JDK 8 instances)", getFieldEditorParent());
38+
addField(jjsJustJJS);
39+
40+
}
41+
42+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.ui,
1010
org.eclipse.ui.ide,
1111
org.eclipse.ui.editors,
1212
org.eclipse.debug.ui,
13-
org.nodeclipse.ui
13+
org.nodeclipse.ui,
14+
org.nodeclipse.common
1415
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
1516
Bundle-ActivationPolicy: lazy
1617
Import-Package: org.nodeclipse.debug.launch,

0 commit comments

Comments
 (0)