diff --git a/org.eclipse.jdt.ui/plugin.properties b/org.eclipse.jdt.ui/plugin.properties index b011063..2bf44c2 100644 --- a/org.eclipse.jdt.ui/plugin.properties +++ b/org.eclipse.jdt.ui/plugin.properties @@ -499,6 +499,11 @@ GenerateJavadocAction.label= &Generate Javadoc... ########################################################################## +# Module Support +########################################################################## +create.module.info.label= Create module-info.java + +########################################################################## # Java Working Set Support ########################################################################## JavaWorkingSetPage.name= Java diff --git a/org.eclipse.jdt.ui/plugin.xml b/org.eclipse.jdt.ui/plugin.xml index 5db8127..685dbbd 100644 --- a/org.eclipse.jdt.ui/plugin.xml +++ b/org.eclipse.jdt.ui/plugin.xml @@ -6932,4 +6932,29 @@ + + + + + + + + + + + + diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.java index ffb95c6..b414510 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.java @@ -1,9 +1,13 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * 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 + * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. * * Contributors: * IBM Corporation - initial API and implementation @@ -432,6 +436,11 @@ public static String CollapsAllAction_tooltip; public static String CollapsAllAction_description; + public static String CreateModuleInfoAction_error_message_compliance; + public static String CreateModuleInfoAction_error_message_no_source_folder; + public static String CreateModuleInfoAction_error_title; + public static String CreateModuleInfoAction_question_message_overwrite_module_info; + public static String GenerateToStringAction_label; public static String GenerateToStringAction_description; public static String GenerateToStringAction_tooltip; diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.properties index f0123a6..8e0981f 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.properties +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/ActionMessages.properties @@ -1,9 +1,13 @@ ############################################################################### -# Copyright (c) 2000, 2013 IBM Corporation and others. +# Copyright (c) 2000, 2016 IBM Corporation and others. # 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 +# +# This is an implementation of an early-draft specification developed under the Java +# Community Process (JCP) and is made available for testing and evaluation purposes +# only. The code is not compatible with any specification of the JCP. # # Contributors: # IBM Corporation - initial API and implementation @@ -461,6 +465,11 @@ CollapsAllAction_tooltip= Collapse All CollapsAllAction_description= Collapse All +CreateModuleInfoAction_error_message_compliance=Project requires compliance level of 9 or above. +CreateModuleInfoAction_error_message_no_source_folder=No source folder exists in the project. +CreateModuleInfoAction_error_title=Create module-info.java +CreateModuleInfoAction_question_message_overwrite_module_info=The module-info.java file already exists in the source folder ''{0}''. Do you want to overwrite it? + # DO NOT REMOVE, used in a product, see https://bugs.eclipse.org/296836 OrganizeImportsAction_summary_added={0} import(s) added. diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CreateModuleInfoAction.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CreateModuleInfoAction.java new file mode 100644 index 0000000..1247f5e --- /dev/null +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/CreateModuleInfoAction.java @@ -0,0 +1,203 @@ +/******************************************************************************* + * Copyright (c) 2016 IBM Corporation and others. + * 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 + * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.internal.ui.actions; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.swt.widgets.Display; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; + +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; + +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IModuleDescription; +import org.eclipse.jdt.core.IModuleDescription.IModuleReference; +import org.eclipse.jdt.core.IModuleDescription.IPackageExport; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.JavaCore; + +import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility; +import org.eclipse.jdt.internal.corext.util.InfoFilesUtil; +import org.eclipse.jdt.internal.corext.util.JavaModelUtil; +import org.eclipse.jdt.internal.corext.util.Messages; + +import org.eclipse.jdt.internal.ui.JavaPlugin; + +public class CreateModuleInfoAction implements IObjectActionDelegate { + + private static final String MODULE_INFO_JAVA_FILENAME= JavaModelUtil.MODULE_INFO_JAVA; + + private ISelection fSelection; + + @Override + public void selectionChanged(IAction action, ISelection selection) { + fSelection= selection; + } + + @Override + public void setActivePart(IAction action, IWorkbenchPart targetPart) { + // not used + } + + @Override + public void run(IAction action) { + IJavaProject javaProject= null; + + if (fSelection instanceof IStructuredSelection) { + Object selectedElement= ((IStructuredSelection) fSelection).getFirstElement(); + + if (selectedElement instanceof IProject) { + javaProject= JavaCore.create((IProject) selectedElement); + } else if (selectedElement instanceof IJavaProject) { + javaProject= (IJavaProject) selectedElement; + } else { + return; + } + + try { + if (!JavaModelUtil.is9OrHigher(javaProject)) { + MessageDialog.openError(getDisplay().getActiveShell(), ActionMessages.CreateModuleInfoAction_error_title, ActionMessages.CreateModuleInfoAction_error_message_compliance); + return; + } + + IPackageFragmentRoot[] packageFragmentRoots= javaProject.getPackageFragmentRoots(); + List packageFragmentRootsAsList= new ArrayList<>(Arrays.asList(packageFragmentRoots)); + for (IPackageFragmentRoot packageFragmentRoot : packageFragmentRoots) { + IResource res= packageFragmentRoot.getCorrespondingResource(); + if (res == null || res.getType() != IResource.FOLDER || packageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) { + packageFragmentRootsAsList.remove(packageFragmentRoot); + } + } + packageFragmentRoots= packageFragmentRootsAsList.toArray(new IPackageFragmentRoot[packageFragmentRootsAsList.size()]); + + if (packageFragmentRoots.length == 0) { + MessageDialog.openError(getDisplay().getActiveShell(), ActionMessages.CreateModuleInfoAction_error_title, ActionMessages.CreateModuleInfoAction_error_message_no_source_folder); + return; + } + + IPackageFragmentRoot targetPkgFragmentRoot= null; + + for (IPackageFragmentRoot packageFragmentRoot : packageFragmentRoots) { + if (packageFragmentRoot.getPackageFragment("").getCompilationUnit(MODULE_INFO_JAVA_FILENAME).exists()) { //$NON-NLS-1$ + String message= Messages.format(ActionMessages.CreateModuleInfoAction_question_message_overwrite_module_info, packageFragmentRoot.getElementName()); + boolean overwrite= MessageDialog.openQuestion(getDisplay().getActiveShell(), ActionMessages.CreateModuleInfoAction_error_title, message); + if (!overwrite) { + return; + } + targetPkgFragmentRoot= packageFragmentRoot; + break; + } + } + + if (targetPkgFragmentRoot == null) { + targetPkgFragmentRoot= packageFragmentRoots[0]; + } + + createAndOpenFile(targetPkgFragmentRoot); + + } catch (CoreException e) { + JavaPlugin.log(e); + } + } + } + + private void createAndOpenFile(IPackageFragmentRoot pkgFragmentRoot) throws CoreException { + createModuleInfoJava(pkgFragmentRoot); + + IFile file= ((IFolder) pkgFragmentRoot.getCorrespondingResource()).getFile(MODULE_INFO_JAVA_FILENAME); + if (file.exists()) { + BasicNewResourceWizard.selectAndReveal(file, JavaPlugin.getActiveWorkbenchWindow()); + openFile(file); + } + } + + private void createModuleInfoJava(IPackageFragmentRoot pkgFragmentRoot) throws CoreException { + IJavaProject javaProject= pkgFragmentRoot.getJavaProject(); + IModuleDescription module= JavaCore.createModuleFromPackageRoot(null, javaProject); + StringBuilder fileContent= new StringBuilder(); + if (module != null) { + String lineDelimiter= StubUtility.getLineDelimiterUsed(javaProject); + fileContent.append("module "); //$NON-NLS-1$ + fileContent.append(module.getElementName()); + fileContent.append(" {"); //$NON-NLS-1$ + fileContent.append(lineDelimiter); + IPackageExport[] exportedPackages= module.getExportedPackages(); + for (IPackageExport iPackageExport : exportedPackages) { + fileContent.append('\t'); + fileContent.append("exports "); //$NON-NLS-1$ + fileContent.append(iPackageExport.getPackageName()); + fileContent.append(";"); //$NON-NLS-1$ + fileContent.append(lineDelimiter); + } + IModuleReference[] requiredModules= module.getRequiredModules(); + for (IModuleReference iModuleReference : requiredModules) { + fileContent.append('\t'); + fileContent.append("requires "); //$NON-NLS-1$ + fileContent.append(iModuleReference.getModuleName()); + fileContent.append(';'); + fileContent.append(lineDelimiter); + } + fileContent.append('}'); + } + IPackageFragment defaultPkg= pkgFragmentRoot.getPackageFragment(""); //$NON-NLS-1$ + InfoFilesUtil.createInfoJavaFile(MODULE_INFO_JAVA_FILENAME, fileContent.toString(), defaultPkg, new NullProgressMonitor()); + } + + private void openFile(final IFile file) { + final IWorkbenchPage activePage= JavaPlugin.getActivePage(); + if (activePage != null) { + final Display display= getDisplay(); + if (display != null) { + display.asyncExec(new Runnable() { + @Override + public void run() { + try { + IDE.openEditor(activePage, file, true); + } catch (PartInitException e) { + JavaPlugin.log(e); + } + } + }); + } + } + } + + private Display getDisplay() { + Display display= Display.getCurrent(); + if (display == null) + display= Display.getDefault(); + return display; + } +} diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderCreationWizard.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderCreationWizard.java index 3370b26..0a3f204 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderCreationWizard.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderCreationWizard.java @@ -1,13 +1,9 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * 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 - * - * This is an implementation of an early-draft specification developed under the Java - * Community Process (JCP) and is made available for testing and evaluation purposes - * only. The code is not compatible with any specification of the JCP. * * Contributors: * IBM Corporation - initial API and implementation @@ -17,12 +13,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; - import org.eclipse.jdt.core.IJavaElement; - -import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.internal.ui.JavaPlugin; import org.eclipse.jdt.internal.ui.JavaPluginImages; @@ -59,11 +50,7 @@ public boolean performFinish() { boolean res= super.performFinish(); if (res) { - IResource resource= fPage.getCorrespondingResource(); - selectAndReveal(resource); - if (resource instanceof IFile && resource.getName().equals(JavaModelUtil.MODULE_INFO_JAVA)) { - openResource((IFile) resource); - } + selectAndReveal(fPage.getCorrespondingResource()); } return res; } diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderWizardPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderWizardPage.java index 3f1b18a..6e98d51 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderWizardPage.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewSourceFolderWizardPage.java @@ -1,13 +1,9 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * 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 - * - * This is an implementation of an early-draft specification developed under the Java - * Community Process (JCP) and is made available for testing and evaluation purposes - * only. The code is not compatible with any specification of the JCP. * * Contributors: * IBM Corporation - initial API and implementation @@ -44,7 +40,6 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.util.BidiUtils; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -65,13 +60,11 @@ import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModelStatus; import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaConventions; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.corext.util.InfoFilesUtil; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.internal.corext.util.Messages; @@ -107,10 +100,6 @@ private SelectionButtonDialogField fExcludeInOthersFields; private SelectionButtonDialogField fIgnoreOptionalProblemsField; - private SelectionButtonDialogField fCreateModuleInfoJavaField; - - private static final String MODULE_INFO_JAVA_FILENAME= JavaModelUtil.MODULE_INFO_JAVA; - private static final String SETTINGS_CREATE_MODULE_INFO_JAVA= "create_module_info_java"; //$NON-NLS-1$ private IWorkspaceRoot fWorkspaceRoot; @@ -155,11 +144,6 @@ fIgnoreOptionalProblemsField.setLabelText(NewWizardMessages.NewSourceFolderWizardPage_ignore_optional_problems_label); fIgnoreOptionalProblemsField.setSelection(false); - fCreateModuleInfoJavaField= new SelectionButtonDialogField(SWT.CHECK); - fCreateModuleInfoJavaField.setDialogFieldListener(adapter); - fCreateModuleInfoJavaField.setLabelText(NewWizardMessages.NewSourceFolderWizardPage_create_module_info_java); - fCreateModuleInfoJavaField.setSelection(false); - fRootStatus= new StatusInfo(); fProjectStatus= new StatusInfo(); } @@ -170,14 +154,6 @@ String projPath= getProjectPath(selection); fProjectField.setText(projPath != null ? projPath : ""); //$NON-NLS-1$ fRootDialogField.setText(""); //$NON-NLS-1$ - - IDialogSettings dialogSettings= getDialogSettings(); - if (dialogSettings != null) { - IDialogSettings section= dialogSettings.getSection(PAGE_NAME); - if (section != null) { - fCreateModuleInfoJavaField.setSelection(section.getBoolean(SETTINGS_CREATE_MODULE_INFO_JAVA)); - } - } } private String getProjectPath(IStructuredSelection selection) { @@ -222,7 +198,6 @@ fRootDialogField.doFillIntoGrid(composite, 3); fExcludeInOthersFields.doFillIntoGrid(composite, 3); fIgnoreOptionalProblemsField.doFillIntoGrid(composite, 3); - fCreateModuleInfoJavaField.doFillIntoGrid(composite, 3); int maxFieldWidth= convertWidthInCharsToPixels(40); LayoutUtil.setWidthHint(fProjectField.getTextControl(null), maxFieldWidth); @@ -291,8 +266,6 @@ } else if (field == fExcludeInOthersFields) { updateRootStatus(); } else if (field == fIgnoreOptionalProblemsField) { - updateRootStatus(); - } else if (field == fCreateModuleInfoJavaField) { updateRootStatus(); } updateStatus(new IStatus[] { fProjectStatus, fRootStatus }); @@ -392,10 +365,7 @@ IClasspathEntry curr= fEntries[i]; if (curr.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (path.equals(curr.getPath())) { - boolean createModuleInfoJava= isCreateModuleInfoJava() && !moduleInfoJavaAlreadyExists(fCurrJProject.getPackageFragmentRoot(res)); - if (!createModuleInfoJava) { - fRootStatus.setError(NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExisting); - } + fRootStatus.setError(NewWizardMessages.NewSourceFolderWizardPage_error_AlreadyExisting); return; } if (projPath.equals(curr.getPath())) { @@ -461,27 +431,6 @@ } } - /** - * Checks if the module-info.java file already exists in any package in the given package - * fragment root. - * - * @param root the package fragment root - * @return true if module-info.java exists in any package in the given - * root, false otherwise - */ - private boolean moduleInfoJavaAlreadyExists(IPackageFragmentRoot root) { - try { - for (IJavaElement pkgFragment : root.getChildren()) { - if (((IPackageFragment) pkgFragment).getCompilationUnit(MODULE_INFO_JAVA_FILENAME).exists()) { - return true; - } - } - } catch (JavaModelException e) { - // pretend that the file does not exist - } - return false; - } - private void insertAtEndOfCategory(IClasspathEntry entry, List entries) { int length= entries.size(); IClasspathEntry[] elements= entries.toArray(new IClasspathEntry[length]); @@ -539,70 +488,40 @@ return fCreatedRoot; } - /** - * @return true if module-info.java should be created, false otherwise - */ - private boolean isCreateModuleInfoJava() { - return JavaModelUtil.is9OrHigher(fCurrJProject) && fCreateModuleInfoJavaField.isSelected(); - } - public IResource getCorrespondingResource() { - IFolder folder= fCurrJProject.getProject().getFolder(fRootDialogField.getText()); - if (isCreateModuleInfoJava()) { - return folder.getFile(MODULE_INFO_JAVA_FILENAME); - } - return folder; + return fCurrJProject.getProject().getFolder(fRootDialogField.getText()); } public void createPackageFragmentRoot(IProgressMonitor monitor) throws CoreException, InterruptedException { if (monitor == null) { monitor= new NullProgressMonitor(); } - String relPath= fRootDialogField.getText(); - IFolder folder= fCurrJProject.getProject().getFolder(relPath); - fCreatedRoot= fCurrJProject.getPackageFragmentRoot(folder); - - if (!fCreatedRoot.exists()) { - monitor.beginTask(NewWizardMessages.NewSourceFolderWizardPage_operation, 3); - try { - IPath projPath= fCurrJProject.getProject().getFullPath(); - if (fOutputLocation.equals(projPath) && !fNewOutputLocation.equals(projPath)) { - if (BuildPathsBlock.hasClassfiles(fCurrJProject.getProject())) { - if (BuildPathsBlock.getRemoveOldBinariesQuery(getShell()).doQuery(false, projPath)) { - BuildPathsBlock.removeOldClassfiles(fCurrJProject.getProject()); - } + monitor.beginTask(NewWizardMessages.NewSourceFolderWizardPage_operation, 3); + try { + IPath projPath= fCurrJProject.getProject().getFullPath(); + if (fOutputLocation.equals(projPath) && !fNewOutputLocation.equals(projPath)) { + if (BuildPathsBlock.hasClassfiles(fCurrJProject.getProject())) { + if (BuildPathsBlock.getRemoveOldBinariesQuery(getShell()).doQuery(false, projPath)) { + BuildPathsBlock.removeOldClassfiles(fCurrJProject.getProject()); } } - - if (!folder.exists()) { - CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 1)); - } - if (monitor.isCanceled()) { - throw new InterruptedException(); - } - - fCurrJProject.setRawClasspath(fNewEntries, fNewOutputLocation, new SubProgressMonitor(monitor, 2)); - - } finally { - monitor.done(); } - } - if (isCreateModuleInfoJava()) { - // default package always exists - IPackageFragment pack= fCreatedRoot.getPackageFragment(""); //$NON-NLS-1$ - String fileContent= JavaCore.createModuleFromPackageRoot(null, fCreatedRoot); - InfoFilesUtil.createInfoJavaFile(MODULE_INFO_JAVA_FILENAME, fileContent, pack, monitor); - } + String relPath= fRootDialogField.getText(); - // save dialog settings for create_module_info_java - IDialogSettings dialogSettings= getDialogSettings(); - if (dialogSettings != null) { - IDialogSettings section= dialogSettings.getSection(PAGE_NAME); - if (section == null) { - section= dialogSettings.addNewSection(PAGE_NAME); + IFolder folder= fCurrJProject.getProject().getFolder(relPath); + if (!folder.exists()) { + CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 1)); } - section.put(SETTINGS_CREATE_MODULE_INFO_JAVA, fCreateModuleInfoJavaField.isSelected()); + if (monitor.isCanceled()) { + throw new InterruptedException(); + } + + fCurrJProject.setRawClasspath(fNewEntries, fNewOutputLocation, new SubProgressMonitor(monitor, 2)); + + fCreatedRoot= fCurrJProject.getPackageFragmentRoot(folder); + } finally { + monitor.done(); } } diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java index 458d5aa..36a134a 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java @@ -1,13 +1,9 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2015 IBM Corporation and others. * 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 - * - * This is an implementation of an early-draft specification developed under the Java - * Community Process (JCP) and is made available for testing and evaluation purposes - * only. The code is not compatible with any specification of the JCP. * * Contributors: * IBM Corporation - initial API and implementation @@ -268,7 +264,6 @@ public static String NewSourceFolderWizardPage_operation; public static String NewSourceFolderWizardPage_exclude_label; public static String NewSourceFolderWizardPage_ignore_optional_problems_label; - public static String NewSourceFolderWizardPage_create_module_info_java; public static String NewSourceFolderWizardPage_ChooseExistingRootDialog_title; public static String NewSourceFolderWizardPage_ChooseExistingRootDialog_description; public static String NewSourceFolderWizardPage_ChooseProjectDialog_title; diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties index fd92433..bc55d7e 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties @@ -1,13 +1,9 @@ ############################################################################### -# Copyright (c) 2000, 2016 IBM Corporation and others. +# Copyright (c) 2000, 2015 IBM Corporation and others. # 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 -# -# This is an implementation of an early-draft specification developed under the Java -# Community Process (JCP) and is made available for testing and evaluation purposes -# only. The code is not compatible with any specification of the JCP. # # Contributors: # IBM Corporation - initial API and implementation @@ -243,7 +239,6 @@ NewSourceFolderWizardPage_exclude_label=&Update exclusion filters in other source folders to solve nesting NewSourceFolderWizardPage_ignore_optional_problems_label=&Ignore optional compile problems -NewSourceFolderWizardPage_create_module_info_java=&Create module-info.java (9 or higher) NewSourceFolderWizardPage_ChooseExistingRootDialog_title=Existing Folder Selection NewSourceFolderWizardPage_ChooseExistingRootDialog_description=&Choose folder as source folder: