diff --git a/plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/projects/IWebAppProjectCreator.java b/plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/projects/IWebAppProjectCreator.java index e9b0063b..244ad181 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/projects/IWebAppProjectCreator.java +++ b/plugins/com.gwtplugins.gdt.eclipse.core/src/com/google/gdt/eclipse/core/projects/IWebAppProjectCreator.java @@ -28,6 +28,7 @@ import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URI; +import java.util.List; /** * Creates web app projects populated with files relevant to the selected natures. @@ -96,11 +97,10 @@ void create(IProgressMonitor monitor) throws CoreException, MalformedURLExceptio void setBuildMaven(boolean buildMaven); /** - * Returns the created Java project. This is available half way through the creation process. - * - * @return the java projeect. + * Returns the created Java projects. This is available half way through the creation process. + * @return the java project. */ - IJavaProject[] getCreatedJavaProjects(); + List getCreatedJavaProjects(); /** * Returns build a Maven Project. diff --git a/plugins/com.gwtplugins.gdt.eclipse.maven/src/com/google/gdt/eclipse/maven/projects/MavenEnablingWebAppCreatorParicipant.java b/plugins/com.gwtplugins.gdt.eclipse.maven/src/com/google/gdt/eclipse/maven/projects/MavenEnablingWebAppCreatorParicipant.java index 5a6f8048..9fc0fc91 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.maven/src/com/google/gdt/eclipse/maven/projects/MavenEnablingWebAppCreatorParicipant.java +++ b/plugins/com.gwtplugins.gdt.eclipse.maven/src/com/google/gdt/eclipse/maven/projects/MavenEnablingWebAppCreatorParicipant.java @@ -17,9 +17,11 @@ import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.project.IProjectConfigurationManager; +import java.util.List; + public class MavenEnablingWebAppCreatorParicipant implements IWebAppProjectCreator.Participant { - private IJavaProject[] javaProjects; + private List javaProjects; @Override public void updateWebAppProjectCreator(IWebAppProjectCreator webAppProjectCreator) { @@ -42,9 +44,9 @@ private void runJob() { protected IStatus run(IProgressMonitor monitor) { // Turn on the Maven nature try { - for(int i=0;i=UTF-8 diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite/project_templates/client_server_shared/client/src/_PACKAGENAME_/ui.gwt.xml b/plugins/com.gwtplugins.gdt.eclipse.suite/project_templates/client_server_shared/client/src/_PACKAGENAME_/ui.gwt.xml index 6c6f6fb8..b5d72b4b 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite/project_templates/client_server_shared/client/src/_PACKAGENAME_/ui.gwt.xml +++ b/plugins/com.gwtplugins.gdt.eclipse.suite/project_templates/client_server_shared/client/src/_PACKAGENAME_/ui.gwt.xml @@ -25,7 +25,4 @@ - - - diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/NewWebAppTemplateProjectWizard.java b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/NewWebAppTemplateProjectWizard.java index 2705bd21..4a030b16 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/NewWebAppTemplateProjectWizard.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/NewWebAppTemplateProjectWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2011 Google Inc. All Rights Reserved. + * Copyright 2024 GWT Eclipse Plugin. All Rights Reserved. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -45,6 +45,12 @@ public class NewWebAppTemplateProjectWizard extends NewElementWizard implements INewWizard { private NewWebAppTemplateProjectWizardPage newProjectWizardPage; + private String projectName; + private boolean useGWT; + private IPath gwtSdkContainerPath; + private String packageName; + private URI locationURI; + private ProjectTemplate template; public NewWebAppTemplateProjectWizard() { } @@ -74,6 +80,12 @@ public void init(IWorkbench workbench, IStructuredSelection selection) { */ @Override public boolean performFinish() { + projectName = newProjectWizardPage.getProjectName(); + useGWT = newProjectWizardPage.useGWT(); + gwtSdkContainerPath = newProjectWizardPage.getGWTSdkContainerPath(); + packageName = newProjectWizardPage.getPackage(); + locationURI = newProjectWizardPage.getCreationLocationURI(); + template = newProjectWizardPage.getTemplate(); /** * HACK: We need to make sure that the DebugUITools plugin (and the DebugUIPlugin plugin) is loaded via the main @@ -96,13 +108,7 @@ public boolean performFinish() { @Override protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException { try { - String projectName = newProjectWizardPage.getProjectName(); - boolean useGWT = newProjectWizardPage.useGWT(); - IPath gwtSdkContainerPath = newProjectWizardPage.getGWTSdkContainerPath(); - String packageName = newProjectWizardPage.getPackage(); - URI locationURI = newProjectWizardPage.getCreationLocationURI(); - - WebAppTemplateProjectCreator wapc = new WebAppTemplateProjectCreator(newProjectWizardPage.getTemplate()); + WebAppTemplateProjectCreator wapc = new WebAppTemplateProjectCreator(template); wapc.setProjectName(projectName); wapc.setPackageName(packageName); wapc.setLocationURI(locationURI); diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/NewWebAppTemplateProjectWizardPage.java b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/NewWebAppTemplateProjectWizardPage.java index 61297944..a18611d9 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/NewWebAppTemplateProjectWizardPage.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/NewWebAppTemplateProjectWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2011 Google Inc. All Rights Reserved. + * Copyright 2024 GWT Eclipse Plugin. All Rights Reserved. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/ProjectTemplate.java b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/ProjectTemplate.java index 8780c435..15110839 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/ProjectTemplate.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/ProjectTemplate.java @@ -1,6 +1,17 @@ -/** +/******************************************************************************* + * Copyright 2024 GWT Eclipse Plugin. All Rights Reserved. * - */ + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *******************************************************************************/ package com.google.gdt.eclipse.suite.wizards; import org.apache.commons.io.FileUtils; diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/WebAppProjectCreator.java b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/WebAppProjectCreator.java index 4fa7f16c..7d9dcb51 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/WebAppProjectCreator.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/WebAppProjectCreator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2011 Google Inc. All Rights Reserved. + * Copyright 2024 GWT Eclipse Plugin. All Rights Reserved. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -77,6 +77,7 @@ import java.net.URI; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -654,8 +655,10 @@ public IStatus runInWorkspace(IProgressMonitor monitor) { * Return the Java project created. This will only work half way through the process. */ @Override - public IJavaProject[] getCreatedJavaProjects() { - return new IJavaProject[] {createdJavaProject}; + public List getCreatedJavaProjects() { + List list = new ArrayList<>(); + list.add(createdJavaProject); + return Collections.unmodifiableList(list); } /** diff --git a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/WebAppTemplateProjectCreator.java b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/WebAppTemplateProjectCreator.java index e16daaa6..72fadb7a 100644 --- a/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/WebAppTemplateProjectCreator.java +++ b/plugins/com.gwtplugins.gdt.eclipse.suite/src/com/google/gdt/eclipse/suite/wizards/WebAppTemplateProjectCreator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2011 Google Inc. All Rights Reserved. + * Copyright 2024 GWT Eclipse Plugin. All Rights Reserved. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -51,16 +51,18 @@ import org.eclipse.jdt.ui.PreferenceConstants; import org.osgi.service.prefs.BackingStoreException; -import java.io.BufferedWriter; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.net.URI; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Stack; @@ -112,7 +114,7 @@ private static void reformatJavaFiles(File outDir) throws CoreException { private URI locationURI; private String packageBaseName; private String projectBaseName; - private IJavaProject[] createdJavaProjects; + private List createdJavaProjects; private IProgressMonitor monitor; private Sdk gwtSdk; private ProjectTemplate projectTemplate; @@ -149,7 +151,7 @@ public void create(IProgressMonitor monitor) List projectNames = projectTemplate.getProjectNames(projectBaseName); IProject[] project = new IProject[projectNames.size()]; - createdJavaProjects = new IJavaProject[projectNames.size()]; + createdJavaProjects = new ArrayList<>(); for(int i=0;i 1000000) { @@ -257,9 +267,7 @@ public static void replaceInFile(String file, String pattern, String replacement byte[] data = Files.readAllBytes(path); String str = new String(data, cset); String newStr = str.replaceAll(pattern, replacement); - BufferedWriter writer = Files.newBufferedWriter(path, cset); - writer.write(newStr); - writer.close(); + Files.writeString(path, newStr, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE); } } @@ -407,8 +415,8 @@ private Sdk getSdk(String containerId, SdkManager sdkManager) { * Return the Java project created. This will only work half way through the process. */ @Override - public IJavaProject[] getCreatedJavaProjects() { - return createdJavaProjects; + public List getCreatedJavaProjects() { + return Collections.unmodifiableList(createdJavaProjects); } /** diff --git a/plugins/com.gwtplugins.gwt.eclipse.wtp/src/com/google/gwt/eclipse/wtp/projects/WtpFacetCreatorParicipant.java b/plugins/com.gwtplugins.gwt.eclipse.wtp/src/com/google/gwt/eclipse/wtp/projects/WtpFacetCreatorParicipant.java index 4b648769..89852b36 100644 --- a/plugins/com.gwtplugins.gwt.eclipse.wtp/src/com/google/gwt/eclipse/wtp/projects/WtpFacetCreatorParicipant.java +++ b/plugins/com.gwtplugins.gwt.eclipse.wtp/src/com/google/gwt/eclipse/wtp/projects/WtpFacetCreatorParicipant.java @@ -1,5 +1,7 @@ package com.google.gwt.eclipse.wtp.projects; +import java.util.List; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -19,7 +21,7 @@ public class WtpFacetCreatorParicipant implements IWebAppProjectCreator.Participant { - private IJavaProject[] javaProjects; + private List javaProjects; private IFacetedProjectListener projectFacetListener; @Override diff --git a/pom.xml b/pom.xml index 517403a2..b4e937dc 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ 3.0.1 UTF-8 - 2023-09 + 2023-09 https://download.eclipse.org/releases/${eclipse.target}