Skip to content

Commit 69d1b87

Browse files
authored
Merge branch 'main' into splitOffSDKs
2 parents 0d3886d + 55fdf22 commit 69d1b87

File tree

32 files changed

+1895
-494
lines changed

32 files changed

+1895
-494
lines changed

plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/projects/IWebAppProjectCreator.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525

2626
import java.io.FileNotFoundException;
2727
import java.io.IOException;
28-
import java.io.InputStream;
2928
import java.io.UnsupportedEncodingException;
3029
import java.net.MalformedURLException;
3130
import java.net.URI;
31+
import java.util.List;
3232

3333
/**
3434
* Creates web app projects populated with files relevant to the selected natures.
@@ -56,10 +56,6 @@ public interface Participant {
5656

5757
void addContainerPath(IPath containerPath);
5858

59-
void addFile(IPath path, InputStream inputStream);
60-
61-
void addFile(IPath path, String content) throws UnsupportedEncodingException;
62-
6359
void addNature(String natureId);
6460

6561
/**
@@ -86,10 +82,6 @@ void create(IProgressMonitor monitor) throws CoreException, MalformedURLExceptio
8682

8783
void setProjectName(String projectName);
8884

89-
void setTemplates(String... templates);
90-
91-
void setTemplateSources(String... sources);
92-
9385
/**
9486
* Build an Ant project.
9587
*
@@ -105,25 +97,24 @@ void create(IProgressMonitor monitor) throws CoreException, MalformedURLExceptio
10597
void setBuildMaven(boolean buildMaven);
10698

10799
/**
108-
* Returns the created Java project. This is available half way through the creation process.
109-
*
110-
* @return the java projeect.
100+
* Returns the created Java projects. This is available half way through the creation process.
101+
* @return the java project.
111102
*/
112-
IJavaProject getCreatedJavaProject();
103+
List<IJavaProject> getCreatedJavaProjects();
113104

114105
/**
115106
* Returns build a Maven Project.
116107
*
117108
* @return Maven selected
118109
*/
119-
boolean getBuildMaven();
110+
boolean isBuildMaven();
120111

121112
/**
122113
* Returns build an ant project.
123114
*
124115
* @return Ant selected
125116
*/
126-
boolean getBuiltAnt();
117+
boolean isBuiltAnt();
127118

128119
/**
129120
* Returns the Creation progress monitor.

plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/resources/ProjectResources.java

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@
2626
import org.eclipse.jface.text.Document;
2727
import org.eclipse.text.edits.TextEdit;
2828

29-
import java.io.BufferedReader;
3029
import java.io.BufferedWriter;
3130
import java.io.File;
32-
import java.io.FileReader;
3331
import java.io.FileWriter;
3432
import java.io.FilenameFilter;
3533
import java.io.IOException;
34+
import java.nio.charset.Charset;
35+
import java.nio.file.Files;
3636
import java.util.List;
3737
import java.util.Vector;
3838

3939
/**
4040
* Generates source for files needed by web application projects.
41-
*
41+
*
4242
* TODO: Convert these use to use templates.
4343
*/
4444
@SuppressWarnings("restriction")
@@ -128,13 +128,13 @@ public static List<File> findFilesInDir(File directory, FilenameFilter filter) {
128128
/**
129129
* Given a java.io.File containing Java source, call the Eclipse auto-format
130130
* code on that source and write it back to disk.
131-
*
131+
*
132132
* @param file
133133
* @throws CoreException
134134
*/
135135
public static void reformatJavaSource(File file) throws CoreException {
136136
try {
137-
String generatedSource = textFromFile(file);
137+
String generatedSource = Files.readString(file.toPath(), Charset.defaultCharset());
138138
String reformattedSource = reformatJavaSourceAsString(generatedSource);
139139
if (!reformattedSource.equals(generatedSource)) {
140140
writeStringToFile(reformattedSource, file);
@@ -166,32 +166,6 @@ public static String reformatJavaSourceAsString(String source) {
166166
return source;
167167
}
168168

169-
/*
170-
* TODO: These next two methods might be useful somewhere else in the
171-
* future, but right now, this is the only place where we need to do I/O on
172-
* java.io.Files instead of Eclipse resources.
173-
*/
174-
private static String textFromFile(File file) throws IOException {
175-
char bytes[] = new char[1024];
176-
int nread;
177-
StringBuilder builder = new StringBuilder();
178-
179-
BufferedReader reader = null;
180-
try {
181-
reader = new BufferedReader(new FileReader(file));
182-
while ((nread = reader.read(bytes, 0, 1024)) != -1) {
183-
char toAppend[] = new char[nread];
184-
System.arraycopy(bytes, 0, toAppend, 0, nread);
185-
builder.append(toAppend);
186-
}
187-
} finally {
188-
if (reader != null) {
189-
reader.close();
190-
}
191-
}
192-
return builder.toString();
193-
}
194-
195169
private static void writeStringToFile(String string, File file)
196170
throws IOException {
197171
BufferedWriter bw = null;

plugins/com.gwtplugins.gdt.eclipse.maven/src/com/google/gdt/eclipse/maven/projects/MavenEnablingWebAppCreatorParicipant.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@
1717
import org.eclipse.m2e.core.MavenPlugin;
1818
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
1919

20+
import java.util.List;
21+
2022
public class MavenEnablingWebAppCreatorParicipant implements IWebAppProjectCreator.Participant {
2123

22-
private IJavaProject javaProject;
24+
private List<IJavaProject> javaProjects;
2325

2426
@Override
2527
public void updateWebAppProjectCreator(IWebAppProjectCreator webAppProjectCreator) {
26-
boolean buildMaven = webAppProjectCreator.getBuildMaven();
28+
boolean buildMaven = webAppProjectCreator.isBuildMaven();
2729
if (!buildMaven) {
2830
return;
2931
}
3032

31-
javaProject = webAppProjectCreator.getCreatedJavaProject();
32-
if (javaProject == null) {
33+
javaProjects = webAppProjectCreator.getCreatedJavaProjects();
34+
if (javaProjects == null) {
3335
return;
3436
}
3537

@@ -42,7 +44,10 @@ private void runJob() {
4244
protected IStatus run(IProgressMonitor monitor) {
4345
// Turn on the Maven nature
4446
try {
45-
NatureUtils.addNature(javaProject.getProject(), MavenUtils.MAVEN2_NATURE_ID);
47+
for(int i=0;i<javaProjects.size();i++)
48+
{
49+
NatureUtils.addNature(javaProjects.get(i).getProject(), MavenUtils.MAVEN2_NATURE_ID);
50+
}
4651
} catch (CoreException e1) {
4752
e1.printStackTrace();
4853
return Status.CANCEL_STATUS;
@@ -53,7 +58,10 @@ protected IStatus run(IProgressMonitor monitor) {
5358
// Maven update project will add the Maven dependencies to the classpath
5459
IProjectConfigurationManager projectConfig = MavenPlugin.getProjectConfigurationManager();
5560
try {
56-
projectConfig.updateProjectConfiguration(javaProject.getProject(), monitor);
61+
for(int i=0;i<javaProjects.size();i++)
62+
{
63+
projectConfig.updateProjectConfiguration(javaProjects.get(i).getProject(), monitor);
64+
}
5765
} catch (CoreException e) {
5866
// TODO(${user}): Auto-generated catch block
5967
e.printStackTrace();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
eclipse.preferences.version=1
2+
encoding//project_templates/client_server_shared/client/.settings/org.eclipse.jdt.core.prefs=UTF-8
3+
encoding//project_templates/client_server_shared/server/.settings/org.eclipse.jdt.core.prefs=UTF-8
4+
encoding//project_templates/client_server_shared/shared/.settings/org.eclipse.jdt.core.prefs=UTF-8
25
encoding/<project>=UTF-8

plugins/com.gwtplugins.gdt.eclipse.suite/META-INF/MANIFEST.MF

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ Require-Bundle:
4040
com.gwtplugins.gdt.eclipse.platform,
4141
org.eclipse.equinox.common,
4242
system.bundle,
43-
org.eclipse.core.runtime
43+
org.eclipse.core.runtime,
44+
org.jdom2,
45+
org.apache.commons.commons-io
4446
Import-Package: org.eclipse.core.runtime.preferences

plugins/com.gwtplugins.gdt.eclipse.suite/build.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ bin.includes = META-INF/,\
55
plugin.xml,\
66
icons/,\
77
about.ini,\
8-
plugin.properties
8+
plugin.properties,\
9+
project_templates/
910
javacSource=11
1011
javacTarget=11

plugins/com.gwtplugins.gdt.eclipse.suite/plugin.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@
200200
id="com.gwtplugins.gdt.eclipse.suite.newWizards"
201201
name="%gwt.label.new">
202202
</category>
203+
<wizard
204+
category="com.gwtplugins.gdt.eclipse.suite.newWizards"
205+
class="com.google.gdt.eclipse.suite.wizards.NewWebAppTemplateProjectWizard"
206+
icon="icons/gdt-new-project_16x16.png"
207+
id="com.gwtplugins.gdt.eclipse.suite.wizards.newMultiProjectWizard"
208+
name="GWT Template based Project"
209+
preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
210+
project="true">
211+
</wizard>
203212
<wizard
204213
category="com.gwtplugins.gdt.eclipse.suite.newWizards"
205214
class="com.google.gdt.eclipse.suite.wizards.NewWebAppProjectWizard"
@@ -223,24 +232,36 @@
223232
point="org.eclipse.ui.perspectiveExtensions">
224233
<perspectiveExtension
225234
targetID="org.eclipse.jdt.ui.JavaPerspective">
235+
<newWizardShortcut
236+
id="com.gwtplugins.gdt.eclipse.suite.wizards.newMultiProjectWizard">
237+
</newWizardShortcut>
226238
<newWizardShortcut
227239
id="com.gwtplugins.gdt.eclipse.suite.wizards.newProjectWizard">
228240
</newWizardShortcut>
229241
</perspectiveExtension>
230242
<perspectiveExtension
231243
targetID="org.eclipse.jdt.ui.JavaBrowsingPerspective">
244+
<newWizardShortcut
245+
id="com.gwtplugins.gdt.eclipse.suite.wizards.newMultiProjectWizard">
246+
</newWizardShortcut>
232247
<newWizardShortcut
233248
id="com.gwtplugins.gdt.eclipse.suite.wizards.newProjectWizard">
234249
</newWizardShortcut>
235250
</perspectiveExtension>
236251
<perspectiveExtension
237252
targetID="org.eclipse.jdt.ui.JavaHierarchyPerspective">
253+
<newWizardShortcut
254+
id="com.gwtplugins.gdt.eclipse.suite.wizards.newMultiProjectWizard">
255+
</newWizardShortcut>
238256
<newWizardShortcut
239257
id="com.gwtplugins.gdt.eclipse.suite.wizards.newProjectWizard">
240258
</newWizardShortcut>
241259
</perspectiveExtension>
242260
<perspectiveExtension
243261
targetID="org.eclipse.jst.j2ee.J2EEPerspective">
262+
<newWizardShortcut
263+
id="com.gwtplugins.gdt.eclipse.suite.wizards.newMultiProjectWizard">
264+
</newWizardShortcut>
244265
<newWizardShortcut
245266
id="com.gwtplugins.gdt.eclipse.suite.wizards.newProjectWizard">
246267
</newWizardShortcut>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
When updating your version of GWT, you should also update this DTD reference,
4+
so that your app can take advantage of the latest GWT module capabilities.
5+
-->
6+
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.10.0//EN"
7+
"http://gwtproject.org/doctype/2.10.0/gwt-module.dtd">
8+
<module rename-to='example'>
9+
<!-- Inherit the core Web Toolkit stuff. -->
10+
<inherits name='com.google.gwt.user.User'/>
11+
12+
<!-- Inherit the default GWT style sheet. You can change -->
13+
<!-- the theme of your GWT application by uncommenting -->
14+
<!-- any one of the following lines. -->
15+
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
16+
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
17+
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
18+
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
19+
20+
<!-- Other module inherits -->
21+
<inherits name='${PACKAGENAME}.shared'/>
22+
23+
<!-- Specify the app entry point class. -->
24+
<entry-point class='${PACKAGENAME}.ui.Main'/>
25+
26+
<!-- Specify the paths for translatable code -->
27+
<source path='ui'/>
28+
</module>

0 commit comments

Comments
 (0)