1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
public class CreationDeProjet {
...
public void creeProjet(String nomProjet){
IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(nomProjet);
JavaCapabilityConfigurationPage jccpage = new JavaCapabilityConfigurationPage();
IPath iPath = Platform.getLocation();
try {
JavaCapabilityConfigurationPage.createProject(iProject, URIUtil.toURI(iPath), null);
} catch (CoreException e) {
e.printStackTrace();
}
//Avant
IJavaProject iJavaProject = JavaCore.create(iProject);
//Après
jccpage.init(iJavaProject, null, null, false);
try {
jccpage.configureJavaProject(null);
} catch (CoreException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
Partager