Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb43530f

Browse files
author
zhourenjian
committed
Add Java2Script preferences so that users can have more debugging options like
open Java2Script application in external browsers, loading chrome://*.js while it is in Firefox, and a ALAA (A Link An Application) link is provided so usercan load application more than one times without refreshing the page and usercan also paste the link in other web pages and get loaded correctly!Some wizards are added. Java2Script project, Java2Script AJAX project, Java2ScriptSWT project, Java2Script SWT AJAX project, Java2Script Servlet project. Userscan create normal Java project with above wizards and get Java2Script compilerenabled by default and related libraries pre-set.In Java2Script Servlet projects, an Ant build.xml is provided. And it will be veryeasy to export the Java2Script Application into a *.war and get deployed to Tomcator other JEE containers.In Java2Script SWT-related projects, an "SWT_LIBRARY" enviroment variable, pointingto SWT jar, is required.
1 parentc36d64d commitb43530f

22 files changed

+1516
-94
lines changed

‎sources/net.sf.j2s.ui/META-INF/MANIFEST.MF‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ Require-Bundle: org.eclipse.ui,
2929
org.eclipse.ui.console,
3030
net.sf.j2s.core,
3131
org.junit,
32-
org.eclipse.jdt.junit
32+
org.eclipse.jdt.junit,
33+
net.sf.j2s.ajax
3334
Eclipse-AutoStart:true
595 Bytes
Loading
-103 Bytes
Binary file not shown.
-1020 Bytes
Binary file not shown.
-1.05 KB
Binary file not shown.

‎sources/net.sf.j2s.ui/plugin.xml‎

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,96 @@
252252
</action>
253253
</viewerContribution>
254254
</extension>
255+
<extension
256+
point="org.eclipse.jdt.ui.javadocCompletionProcessor">
257+
<javadocCompletionProcessor
258+
class="net.sf.j2s.ui.text.javadoc.JavaDocCompletionEvaluator"
259+
id="net.sf.j2s.javadocCompletionProcessor"/>
260+
</extension>
261+
<extension
262+
point="org.eclipse.ui.preferencePages">
263+
<page
264+
class="net.sf.j2s.ui.preferences.Java2ScriptPreferencePage"
265+
id="net.sf.j2s.ui.preferences.Java2ScriptPreferencePage"
266+
name="Java2Script"/>
267+
</extension>
268+
<extension
269+
point="org.eclipse.core.runtime.preferences">
270+
<initializerclass="net.sf.j2s.ui.preferences.PreferenceInitializer"/>
271+
</extension>
272+
273+
<extension
274+
point="org.eclipse.ui.newWizards">
275+
<category
276+
name="Java2Script"
277+
id="net.sf.j2s.ui.java2script">
278+
</category>
279+
<wizard
280+
name="Java2Script Project"
281+
icon="icons/e/newjprj_wiz.gif"
282+
category="net.sf.j2s.ui.java2script"
283+
class="net.sf.j2s.ui.wizards.Java2ScriptProjectWizard"
284+
preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective,org.eclipse.jdt.ui.JavaBrowsingPerspective,org.eclipse.jdt.ui.JavaHierarchyPerspective"
285+
project="true"
286+
finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
287+
id="net.sf.j2s.ui.wizards.Java2ScriptProjectWizard">
288+
<description>
289+
Create Java Project with Java2Script enabled.
290+
</description>
291+
</wizard>
292+
<wizard
293+
name="Java2Script AJAX Project"
294+
icon="icons/e/newjprj_wiz.gif"
295+
category="net.sf.j2s.ui.java2script"
296+
class="net.sf.j2s.ui.wizards.Java2ScriptAJAXProjectWizard"
297+
preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective,org.eclipse.jdt.ui.JavaBrowsingPerspective,org.eclipse.jdt.ui.JavaHierarchyPerspective"
298+
project="true"
299+
finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
300+
id="net.sf.j2s.ui.wizards.Java2ScriptAJAXProjectWizard">
301+
<description>
302+
Create Java Project with Java2Script AJAX enabled.
303+
</description>
304+
</wizard>
305+
<wizard
306+
name="Java2Script SWT Project"
307+
icon="icons/e/newjprj_wiz.gif"
308+
category="net.sf.j2s.ui.java2script"
309+
class="net.sf.j2s.ui.wizards.Java2ScriptSWTProjectWizard"
310+
preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective,org.eclipse.jdt.ui.JavaBrowsingPerspective,org.eclipse.jdt.ui.JavaHierarchyPerspective"
311+
project="true"
312+
finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
313+
id="net.sf.j2s.ui.wizards.Java2ScriptSWTProjectWizard">
314+
<description>
315+
Create Java Project with Java2Script and SWT enabled.
316+
</description>
317+
</wizard>
318+
<wizard
319+
name="Java2Script SWT AJAX Project"
320+
icon="icons/e/newjprj_wiz.gif"
321+
category="net.sf.j2s.ui.java2script"
322+
class="net.sf.j2s.ui.wizards.Java2ScriptSWTAJAXProjectWizard"
323+
preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective,org.eclipse.jdt.ui.JavaBrowsingPerspective,org.eclipse.jdt.ui.JavaHierarchyPerspective"
324+
project="true"
325+
finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
326+
id="net.sf.j2s.ui.wizards.Java2ScriptSWTAJAXProjectWizard">
327+
<description>
328+
Create Java Project with Java2Script AJAX and SWT enabled.
329+
</description>
330+
</wizard>
331+
<wizard
332+
name="Java2Script Servlet Project"
333+
icon="icons/e/newjprj_wiz.gif"
334+
category="net.sf.j2s.ui.java2script"
335+
class="net.sf.j2s.ui.wizards.Java2ScriptServletProjectWizard"
336+
preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective,org.eclipse.jdt.ui.JavaBrowsingPerspective,org.eclipse.jdt.ui.JavaHierarchyPerspective"
337+
project="true"
338+
finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
339+
id="net.sf.j2s.ui.wizards.Java2ScriptServletProjectWizard">
340+
<description>
341+
Create Java Servlet Project with Java2Script AJAX and SWT enabled.
342+
</description>
343+
</wizard>
344+
</extension>
255345
<!--
256346
<extension
257347
point="org.eclipse.ui.exportWizards">
@@ -264,11 +354,4 @@
264354
</wizard>
265355
</extension>
266356
-->
267-
<extension
268-
point="org.eclipse.jdt.ui.javadocCompletionProcessor">
269-
<javadocCompletionProcessor
270-
class="net.sf.j2s.ui.text.javadoc.JavaDocCompletionEvaluator"
271-
id="net.sf.j2s.javadocCompletionProcessor"/>
272-
</extension>
273-
274357
</plugin>

‎sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/ArgsUtil.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static String outputString(String s) {
127127
returnbuffer.toString();
128128
}
129129

130-
publicstaticStringwrapAsArgumentArray(Strings) {
130+
publicstaticStringwrapAsArgumentArray(Strings,booleanwhitespace) {
131131
String[]args =splitArguments(s);
132132
StringBufferbuffer =newStringBuffer();
133133
buffer.append('[');
@@ -136,7 +136,10 @@ public static String wrapAsArgumentArray(String s) {
136136
buffer.append(outputString(args[i]));
137137
buffer.append('\"');
138138
if (i !=args.length -1) {
139-
buffer.append(", ");
139+
buffer.append(",");
140+
if (whitespace) {
141+
buffer.append(" ");
142+
}
140143
}
141144
}
142145
buffer.append(']');

‎sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/IJ2SLauchingConfiguration.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
publicinterfaceIJ2SLauchingConfiguration {
44

5+
publicstaticfinalStringVIEW_IN_INNER_J2S_CONSOLE ="view.in.j2s.console";
56
publicstaticfinalStringFAST_VIEW_J2S_CONSOLE ="fast.view.j2s.console";
67
publicstaticfinalStringMAXIMIZE_J2S_CONSOLE ="maximize.j2s.console";
78

@@ -11,6 +12,9 @@ public interface IJ2SLauchingConfiguration {
1112
publicstaticfinalStringTAIL_HEADER_HTML ="tail.header.html";
1213
publicstaticfinalStringHEAD_HEADER_HTML ="head.header.html";
1314

15+
publicstaticfinalStringJ2S_MOZILLA_ADDON_COMPATIABLE ="j2s.mozilla.addon.compatiable";
16+
publicstaticfinalStringJ2S_MOZILLA_ADDON_COMPATIABLE_JS ="j2s.mozilla.addon.compatiable.js";
17+
1418
publicstaticfinalStringJ2S_CLASS_PATH ="j2s.class.path";
1519
publicstaticfinalStringJ2S_ABANDON_CLASS_PATH ="j2s.abandon.class.path";
1620
}

‎sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/J2SApplicationRunnable.java‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
packagenet.sf.j2s.ui.launching;
22

3+
importjava.io.File;
4+
importjava.net.MalformedURLException;
5+
importjava.net.URL;
36
importnet.sf.j2s.ui.Java2ScriptUIPlugin;
47
importnet.sf.j2s.ui.console.J2SConsoleView;
8+
importnet.sf.j2s.ui.preferences.PreferenceConstants;
59

610
importorg.eclipse.core.runtime.CoreException;
711
importorg.eclipse.debug.core.ILaunchConfiguration;
12+
importorg.eclipse.jface.preference.IPreferenceStore;
13+
importorg.eclipse.swt.program.Program;
814
importorg.eclipse.ui.IViewPart;
915
importorg.eclipse.ui.IViewReference;
1016
importorg.eclipse.ui.IWorkbenchPage;
@@ -23,16 +29,41 @@ public J2SApplicationRunnable(ILaunchConfiguration configuration, String url) {
2329
}
2430

2531
publicvoidrun() {
32+
booleanisToViewInConsole =true;
2633
booleanisViewFast =false;
2734
booleanisViewMaximize =false;
2835
try {
36+
IPreferenceStorestore =Java2ScriptUIPlugin.getDefault().getPreferenceStore();
37+
38+
booleanpreferred =store.getBoolean(PreferenceConstants.INNER_CONSOLE);
39+
40+
isToViewInConsole =configuration.getAttribute(
41+
IJ2SLauchingConfiguration.VIEW_IN_INNER_J2S_CONSOLE,preferred);
2942
isViewMaximize =configuration.getAttribute(
3043
IJ2SLauchingConfiguration.MAXIMIZE_J2S_CONSOLE,false);
3144
isViewFast =configuration.getAttribute(
3245
IJ2SLauchingConfiguration.FAST_VIEW_J2S_CONSOLE,false);
3346
}catch (CoreExceptione1) {
3447
e1.printStackTrace();
3548
}
49+
50+
if (!isToViewInConsole) {
51+
if (url !=null &&url.length() !=0) {
52+
try {
53+
Stringfile =newURL(url).getFile();
54+
booleanwin32 = ((System.getProperty("os.name").indexOf("Windows") != -1)//$NON-NLS-1$ //$NON-NLS-2$
55+
|| (System.getProperty("os.name").indexOf("windows") != -1));//$NON-NLS-1$ //$NON-NLS-2$
56+
if (win32 &&file.startsWith("/")) {
57+
file =file.substring(1);
58+
}
59+
file =file.replace('/',File.separatorChar);
60+
Program.launch(file);
61+
}catch (MalformedURLExceptione1) {
62+
e1.printStackTrace();
63+
}
64+
}
65+
return;
66+
}
3667
IWorkbenchPageactivePage =Java2ScriptUIPlugin.getDefault()
3768
.getWorkbench().getWorkbenchWindows()[0].getActivePage();
3869
IViewPartconsole =activePage

‎sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/J2SConsoleOptionsTab.java‎

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
packagenet.sf.j2s.ui.launching;
22

3+
importnet.sf.j2s.ui.Java2ScriptUIPlugin;
4+
importnet.sf.j2s.ui.preferences.PreferenceConstants;
35
importorg.eclipse.core.runtime.CoreException;
46
importorg.eclipse.debug.core.ILaunchConfiguration;
57
importorg.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
68
importorg.eclipse.debug.ui.AbstractLaunchConfigurationTab;
79
importorg.eclipse.jdt.internal.debug.ui.JavaDebugImages;
10+
importorg.eclipse.jface.preference.IPreferenceStore;
811
importorg.eclipse.swt.SWT;
912
importorg.eclipse.swt.events.SelectionAdapter;
1013
importorg.eclipse.swt.events.SelectionEvent;
@@ -17,6 +20,12 @@
1720
importorg.eclipse.swt.widgets.Group;
1821

1922
publicclassJ2SConsoleOptionsTabextendsAbstractLaunchConfigurationTab {
23+
24+
privateButtonbtnInner;
25+
26+
privateButtonbtnCompatiable;
27+
28+
privateButtonbtnCompatiableJS;// whether import or include mozilla.addon.js
2029

2130
privateButtonbtnFastView;
2231

@@ -43,11 +52,24 @@ public void createControl(Composite parent) {
4352
group.setLayout(layout);
4453
group.setLayoutData(newGridData(GridData.FILL_BOTH));
4554

46-
StringcontrolName ="ConsoleUI Options";
55+
StringcontrolName ="ConsoleMisc Options";
4756
group.setText(controlName);
57+
58+
btnInner =newButton(group,SWT.CHECK);
59+
btnInner.setText("View Java2Script application in J2S console");
60+
btnInner.addSelectionListener(newSelectionAdapter() {
61+
publicvoidwidgetSelected(SelectionEvente) {
62+
updateLaunchConfigurationDialog();
63+
btnFastView.setEnabled(btnInner.getSelection());
64+
btnMaximize.setEnabled(btnInner.getSelection());
65+
}
66+
});
4867

4968
btnFastView =newButton(group,SWT.CHECK);
5069
btnFastView.setText("Make J2S console as fast view automatically");
70+
GridDatagdfv =newGridData();
71+
gdfv.horizontalIndent =32;
72+
btnFastView.setLayoutData(gdfv);
5173
btnFastView.addSelectionListener(newSelectionAdapter() {
5274
publicvoidwidgetSelected(SelectionEvente) {
5375
updateLaunchConfigurationDialog();
@@ -56,18 +78,57 @@ public void widgetSelected(SelectionEvent e) {
5678

5779
btnMaximize =newButton(group,SWT.CHECK);
5880
btnMaximize.setText("Maximize J2S console automatically");
81+
GridDatagdm =newGridData();
82+
gdm.horizontalIndent =32;
83+
btnMaximize.setLayoutData(gdm);
5984
btnMaximize.addSelectionListener(newSelectionAdapter() {
6085
publicvoidwidgetSelected(SelectionEvente) {
6186
updateLaunchConfigurationDialog();
6287
}
6388
});
89+
90+
btnCompatiable =newButton(group,SWT.CHECK);
91+
btnCompatiable.setText("Generate codes with Mozilla Addon compatiabilities");
92+
btnCompatiable.addSelectionListener(newSelectionAdapter() {
93+
publicvoidwidgetSelected(SelectionEvente) {
94+
updateLaunchConfigurationDialog();
95+
btnCompatiableJS.setEnabled(btnCompatiable.getSelection());
96+
}
97+
});
98+
99+
btnCompatiableJS =newButton(group,SWT.CHECK);
100+
GridDatagdjs =newGridData();
101+
gdjs.horizontalIndent =32;
102+
btnCompatiableJS.setLayoutData(gdjs);
103+
btnCompatiableJS.setText("Write compatiable JavaScript instead of including mozilla.addon.js");
104+
btnCompatiableJS.addSelectionListener(newSelectionAdapter() {
105+
publicvoidwidgetSelected(SelectionEvente) {
106+
updateLaunchConfigurationDialog();
107+
}
108+
});
64109
}
65110

66111
publicvoidsetDefaults(ILaunchConfigurationWorkingCopyconfiguration) {
67112
configuration.setAttribute(IJ2SLauchingConfiguration.FAST_VIEW_J2S_CONSOLE,
68113
false);
69114
configuration.setAttribute(
70115
IJ2SLauchingConfiguration.MAXIMIZE_J2S_CONSOLE,false);
116+
117+
IPreferenceStorestore =Java2ScriptUIPlugin.getDefault()
118+
.getPreferenceStore();
119+
120+
booleanpreferred =store.getBoolean(PreferenceConstants.INNER_CONSOLE);
121+
122+
configuration.setAttribute(
123+
IJ2SLauchingConfiguration.VIEW_IN_INNER_J2S_CONSOLE,preferred);
124+
125+
preferred =store.getBoolean(PreferenceConstants.ADDON_COMPATIABLE);
126+
127+
configuration.setAttribute(
128+
IJ2SLauchingConfiguration.J2S_MOZILLA_ADDON_COMPATIABLE,preferred);
129+
130+
configuration.setAttribute(
131+
IJ2SLauchingConfiguration.J2S_MOZILLA_ADDON_COMPATIABLE_JS,false);
71132
}
72133

73134
publicvoidinitializeFrom(ILaunchConfigurationconfiguration) {
@@ -76,6 +137,27 @@ public void initializeFrom(ILaunchConfiguration configuration) {
76137
IJ2SLauchingConfiguration.FAST_VIEW_J2S_CONSOLE,false));
77138
btnMaximize.setSelection(configuration.getAttribute(
78139
IJ2SLauchingConfiguration.MAXIMIZE_J2S_CONSOLE,false));
140+
btnCompatiableJS.setSelection(configuration.getAttribute(
141+
IJ2SLauchingConfiguration.J2S_MOZILLA_ADDON_COMPATIABLE_JS,false));
142+
143+
IPreferenceStorestore =Java2ScriptUIPlugin.getDefault()
144+
.getPreferenceStore();
145+
146+
booleanpreferred =store.getBoolean(PreferenceConstants.INNER_CONSOLE);
147+
148+
booleanexternal =configuration.getAttribute(
149+
IJ2SLauchingConfiguration.VIEW_IN_INNER_J2S_CONSOLE,preferred);
150+
btnInner.setSelection(external);
151+
btnFastView.setEnabled(external);
152+
btnMaximize.setEnabled(external);
153+
154+
preferred =store.getBoolean(PreferenceConstants.ADDON_COMPATIABLE);
155+
156+
booleancompatiable =configuration.getAttribute(
157+
IJ2SLauchingConfiguration.J2S_MOZILLA_ADDON_COMPATIABLE,preferred);
158+
btnCompatiable.setSelection(compatiable);
159+
btnCompatiableJS.setEnabled(compatiable);
160+
79161
}catch (CoreExceptione) {
80162
e.printStackTrace();
81163
}
@@ -86,10 +168,16 @@ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
86168
btnFastView.getSelection());
87169
configuration.setAttribute(
88170
IJ2SLauchingConfiguration.MAXIMIZE_J2S_CONSOLE,btnMaximize.getSelection());
171+
configuration.setAttribute(
172+
IJ2SLauchingConfiguration.VIEW_IN_INNER_J2S_CONSOLE,btnInner.getSelection());
173+
configuration.setAttribute(
174+
IJ2SLauchingConfiguration.J2S_MOZILLA_ADDON_COMPATIABLE,btnCompatiable.getSelection());
175+
configuration.setAttribute(
176+
IJ2SLauchingConfiguration.J2S_MOZILLA_ADDON_COMPATIABLE_JS,btnCompatiableJS.getSelection());
89177
}
90178

91179
publicStringgetName() {
92-
return"Console UI";
180+
return"Misc";
93181
}
94182

95183
publicImagegetImage() {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp