Skip to content

Commit 6324247

Browse files
author
zhourenjian
committed
Synchronize with trunks after Java2Script compiler was refactored and
Apache Harmony libraries were used instead of Sun's JRE libraries
1 parent 29334e5 commit 6324247

21 files changed

+8
-532
lines changed

src/net/sf/j2s/ui/classpath/CSSResource.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
public class CSSResource extends Resource implements IExternalResource {
55

6-
// public String getName() {
7-
// return getAbsoluteFile().getName();
8-
// }
96
public String toHTMLString() {
107
Resource p = this.getParent();
118
if (p != null) {

src/net/sf/j2s/ui/classpath/CompositeResources.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
public class CompositeResources extends Resource implements IClasspathContainer {
1717
protected List resources;
1818
protected List abandonedResources;
19-
//private Resource[] children;
2019
private String binRelativePath;
2120

2221
private String compilerStatus;
@@ -29,8 +28,6 @@ public File getAbsoluteFile() {
2928
}
3029
}
3130
public String getName() {
32-
// String path = getRelativePath();
33-
// return path.substring(1, path.indexOf('/', 2));
3431
return super.getName();
3532
}
3633

@@ -46,9 +43,7 @@ public String getBinRelativePath() {
4643
return getRelativePath().substring(0, getRelativePath().lastIndexOf('/') + 1);
4744
} else {
4845
return "";
49-
//return binRelativePath;
5046
}
51-
//return super.getBinRelativePath();
5247
}
5348

5449
public void load() {
@@ -81,8 +76,6 @@ public void load(InputStream fis) {
8176
} catch (IOException e1) {
8277
e1.printStackTrace();
8378
}
84-
//setFolder(file.getParentFile());
85-
//setRelativePath(file.getName());
8679
compilerStatus = props.getProperty("j2s.compiler.status");
8780

8881
binRelativePath = props.getProperty(PathUtil.J2S_OUTPUT_PATH);
@@ -93,14 +86,6 @@ public void load(InputStream fis) {
9386
reses = PathUtil.getAbandonedResources(props);
9487
addResourceByString(abandonedResources, reses);
9588

96-
/*
97-
this.children = new Resource[resources.size()];
98-
for (int i = 0; i < resources.size(); i++) {
99-
Resource res = (Resource) resources.get(i);
100-
this.children[i] = res;
101-
res.setParent(this);
102-
}
103-
*/
10489
}
10590
}
10691

@@ -172,12 +157,10 @@ public void store(Properties props) {
172157
StringBuffer buf = new StringBuffer();
173158
for (int i = 0; i < reses.length; i++) {
174159
String str = reses[i].toResourceString();
175-
//if (str != null) {
176160
buf.append(str);
177161
if (i != reses.length - 1) {
178162
buf.append(",");
179163
}
180-
//}
181164
}
182165
props.setProperty(PathUtil.J2S_RESOURCES_LIST, buf.toString());
183166
props.setProperty(PathUtil.J2S_OUTPUT_PATH, binRelativePath);
@@ -188,7 +171,6 @@ public Resource[] getChildren() {
188171
this.load();
189172
}
190173
return (Resource[]) resources.toArray(new Resource[0]);
191-
//return children;
192174
}
193175
public void addResource(Resource res) {
194176
if (!resources.contains(res)) {
@@ -228,9 +210,6 @@ public void topResource(int res) {
228210
public void bottomResource(int res) {
229211

230212
}
231-
// public String getBinRelativePath() {
232-
// return binRelativePath;
233-
// }
234213

235214
public void setBinRelativePath(String binRelativePath) {
236215
this.binRelativePath = binRelativePath;

src/net/sf/j2s/ui/classpath/ContactedClasses.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111

1212
public class ContactedClasses extends Resource implements IExternalResource, IClasspathContainer {
13-
// private ContactedUnitClass[] children;
14-
// private IExternalResource[] externals;
1513
private String binRelativePath;
1614
private List classList;
1715
private List externalList;
@@ -22,8 +20,6 @@ public void load() {
2220
externalList = new ArrayList();
2321
if (file.exists()) {
2422
Properties props = PathUtil.loadJZ(file);
25-
//setFolder(file.getParentFile());
26-
//setRelativePath(file.getName());
2723
String[] reses = PathUtil.getResources(props);
2824
binRelativePath = props.getProperty(PathUtil.J2S_OUTPUT_PATH);
2925
for (int i = 0; i < reses.length; i++) {
@@ -51,18 +47,6 @@ public void load() {
5147
}
5248
}
5349
}
54-
// this.children = new ContactedUnitClass[classList.size()];
55-
// for (int i = 0; i < classList.size(); i++) {
56-
// ContactedUnitClass res = (ContactedUnitClass) classList.get(i);
57-
// this.children[i] = res;
58-
// res.setParent(this);
59-
// }
60-
// this.externals = new IExternalResource[externalList.size()];
61-
// for (int i = 0; i < externalList.size(); i++) {
62-
// Resource res = (Resource) externalList.get(i);
63-
// this.externals[i] = (IExternalResource) res;
64-
// res.setParent(this);
65-
// }
6650
}
6751
}
6852

@@ -71,12 +55,10 @@ public void store(Properties props) {
7155
StringBuffer buf = new StringBuffer();
7256
for (int i = 0; i < reses.length; i++) {
7357
String str = reses[i].toResourceString();
74-
//if (str != null) {
7558
buf.append(str);
7659
if (i != reses.length - 1) {
7760
buf.append(",");
7861
}
79-
//}
8062
}
8163
props.setProperty(PathUtil.J2S_RESOURCES_LIST, buf.toString());
8264
props.setProperty(PathUtil.J2S_OUTPUT_PATH, binRelativePath);
@@ -95,25 +77,14 @@ public Resource[] getChildren() {
9577
res[i + size] = (Resource) classList.get(i);
9678
}
9779

98-
/*
99-
Resource[] res = new Resource[children.length + externals.length];
100-
for (int i = 0; i < externals.length; i++) {
101-
res[i] = (Resource) externals[i];
102-
}
103-
for (int i = 0; i < children.length; i++) {
104-
res[i + externals.length] = children[i];
105-
}
106-
*/
10780
return res;
10881
}
10982

11083
public ContactedUnitClass[] getClasses() {
111-
//return children;
11284
return (ContactedUnitClass[]) classList.toArray(new ContactedClasses[0]);
11385
}
11486

11587
public IExternalResource[] getExternals() {
116-
//return externals;
11788
return (IExternalResource[]) externalList.toArray(new IExternalResource[0]);
11889
}
11990

src/net/sf/j2s/ui/classpath/PathUtil.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,6 @@ public static void main(String[] args) {
210210
for (int j = 0; j < children.length; j++) {
211211
System.out.println("--" + children[j].getName());
212212
}
213-
// if (item instanceof ContactedClasses) {
214-
// ContactedClasses cc = (ContactedClasses) item;
215-
// ContactedUnitClass[] classes = cc.getChildren();
216-
// for (int j = 0; j < classes.length; j++) {
217-
// System.out.println("--" + classes[j].getName());
218-
// }
219-
// IExternalResource[] externals = cc.getExternals();
220-
// for (int j = 0; j < externals.length; j++) {
221-
// System.out.println("==" + externals[j]);
222-
// }
223-
// }
224213
}
225214
}
226215
}

src/net/sf/j2s/ui/classpath/ProjectResources.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,8 @@ public boolean exists() {
1919
}
2020
public String getBinRelativePath() {
2121
return getRelativePath().substring(0, getRelativePath().lastIndexOf('/') + 1);
22-
//return super.getBinRelativePath();
2322
}
2423
public String toHTMLString() {
25-
// StringBuffer buf = new StringBuffer();
26-
// if (resources == null) {
27-
// this.load();
28-
// }
29-
// new File(".." + getRelativePath()).getParent();
30-
// for (Iterator iter = resources.iterator(); iter.hasNext();) {
31-
// Resource res = (Resource) iter.next();
32-
//
33-
// buf.append(res.toHTMLString());
34-
// }
35-
// return buf.toString();
3624
return super.toHTMLString();
3725
}
3826

src/net/sf/j2s/ui/classpath/Resource.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ public String toHTMLString() {
121121
}
122122

123123
public IClasspathEntry getClasspathEntry() {
124-
// TODO Auto-generated method stub
125124
return null;
126125
}
127126

@@ -130,7 +129,6 @@ public int getClasspathProperty() {
130129
}
131130

132131
public IJavaProject getJavaProject() {
133-
// TODO Auto-generated method stub
134132
return null;
135133
}
136134

@@ -140,11 +138,9 @@ public String getLocation() {
140138

141139
public IPath getPath() {
142140
return Path.fromPortableString(relativePath);
143-
//return null;
144141
}
145142

146143
public IResource getResource() {
147-
//return Path.fromPortableString(relativePath);
148144
if (relativePath != null) {
149145
if (relativePath.startsWith("/") && relativePath.endsWith("/.j2s")) {
150146
IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());

src/net/sf/j2s/ui/classpath/UnitClass.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ public String getName() {
1616
return getClassName();
1717
}
1818

19-
// public void setClassName(String className) {
20-
// this.className = className;
21-
// }
2219
public void parseClassName() {
2320
this.className = PathUtil.convertClassName(getRelativePath(), binRelativePath);
2421
}

src/net/sf/j2s/ui/console/J2SConsoleView.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ private void fillLocalToolBar(IToolBarManager manager) {
218218
manager.add(actionBack);
219219
manager.add(actionForward);
220220
manager.add(actionReload);
221-
// manager.add(actionStop);
222221
}
223222

224223
private void makeActions() {
@@ -258,15 +257,7 @@ public void run() {
258257
if (lastURL == null || lastURL.length() == 0) {
259258
actionReload.setEnabled(false);
260259
}
261-
// actionReload.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
262-
// getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
263260
J2SViewImages.setImageDescriptors(actionReload, J2SViewImages.REFRESH);
264-
// try {
265-
// actionReload.setImageDescriptor(ImageDescriptor.createFromURL(new URL("file:/icons/refresh_nav.gif")));
266-
// } catch (MalformedURLException e) {
267-
// // TODO Auto-generated catch block
268-
// e.printStackTrace();
269-
// }
270261

271262
actionStop = new Action() {
272263
public void run() {
@@ -285,8 +276,6 @@ public void run() {
285276
};
286277
showAddressBarAction.setChecked(showAddressBar);
287278
showAddressBarAction.setToolTipText("Show or hide the address bar"); //$NON-NLS-1$
288-
//J2SViewImages.setImageDescriptors(fScriptWrittenAction, J2SViewImages.ADD_TO_TRAY);
289-
//showAddressBarAction.setEnabled(showAddressBar);
290279

291280
}
292281
protected void performAddressBarAction() {

src/net/sf/j2s/ui/editors/J2SConfigEditor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ void createPage1() {
9090
try {
9191
J2STextEditor readOnlyEditor = new J2STextEditor();
9292
int index = addPage(readOnlyEditor, getEditorInput());
93-
// readOnlyEditor.setReadOnly(true);
9493
editor = readOnlyEditor;
95-
//setPageText(index, editor.getTitle());
9694
setPageText(index, "Source");
9795
} catch (PartInitException e) {
9896
ErrorDialog.openError(

src/net/sf/j2s/ui/editors/J2SConfigEditorContributor.java

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
*******************************************************************************/
1313
package net.sf.j2s.ui.editors;
1414

15-
import org.eclipse.jface.action.*;
16-
import org.eclipse.jface.dialogs.MessageDialog;
15+
import org.eclipse.jface.action.IAction;
16+
import org.eclipse.jface.action.IMenuManager;
17+
import org.eclipse.jface.action.IToolBarManager;
1718
import org.eclipse.ui.IActionBars;
1819
import org.eclipse.ui.IEditorPart;
19-
import org.eclipse.ui.IWorkbenchActionConstants;
20-
import org.eclipse.ui.PlatformUI;
2120
import org.eclipse.ui.actions.ActionFactory;
22-
import org.eclipse.ui.ide.IDE;
2321
import org.eclipse.ui.ide.IDEActionFactory;
2422
import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
2523
import org.eclipse.ui.texteditor.ITextEditor;
@@ -32,13 +30,11 @@
3230
*/
3331
public class J2SConfigEditorContributor extends MultiPageEditorActionBarContributor {
3432
private IEditorPart activeEditorPart;
35-
// private Action sampleAction;
3633
/**
3734
* Creates a multi-page contributor.
3835
*/
3936
public J2SConfigEditorContributor() {
4037
super();
41-
createActions();
4238
}
4339
/**
4440
* Returns the action registed with the given text editor.
@@ -92,24 +88,8 @@ public void setActivePage(IEditorPart part) {
9288
actionBars.updateActionBars();
9389
}
9490
}
95-
private void createActions() {
96-
// sampleAction = new Action() {
97-
// public void run() {
98-
// MessageDialog.openInformation(null, "Java2Script Builder", "Sample Action Executed");
99-
// }
100-
// };
101-
// sampleAction.setText("Sample Action");
102-
// sampleAction.setToolTipText("Sample Action tool tip");
103-
// sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
104-
// getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
105-
}
10691
public void contributeToMenu(IMenuManager manager) {
107-
// IMenuManager menu = new MenuManager("Editor &Menu");
108-
// manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
109-
// menu.add(sampleAction);
11092
}
11193
public void contributeToToolBar(IToolBarManager manager) {
112-
// manager.add(new Separator());
113-
// manager.add(sampleAction);
11494
}
11595
}

0 commit comments

Comments
 (0)