Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » newbie on workspace resource programming
newbie on workspace resource programming [message #213164] Thu, 31 May 2007 20:26 Go to next message
Eclipse UserFriend
Originally posted by: psentosa.yahoo.com

Hi everyone,

I posted a similar question some times ago, but unfortunately I didn't get
any really helpful replies and still get stuck with the problem.
It is about workspace resource programming. I'd like to create a plug-in
which in turns generate another plug-in project.
Luckily I have the Java Dev. Guide to Eclipse book which gives some hints on
creating a project programmaticaly. But then I still can't find any way to
create packages within the project. In the book, there are some codes, which
more or less look like this:

IFolder myFolder = myProject.getFolder("myPackage");
myFolder.create(true,true,null);
IJavaElement myPackageFragment = JavaCore.create(myFolder);

But this only gives me a folder, and not a package.

Can anyone please give me some hints on how I can create packages using the
workspace API? And also, on how to define the src/bin separation on the
project?

Thanks in advance!

Regards
Paul
Re: newbie on workspace resource programming [message #213203 is a reply to message #213164] Thu, 31 May 2007 21:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------020303030902000909090905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Paul,

Below is a block of code that does much of what you are asking for.

public static IProject createEMFProject
(IPath javaSource,
URI projectLocationURI,
List<IProject> referencedProjects,
Monitor monitor,
int style,
List<?> pluginVariables)
{
IProgressMonitor progressMonitor =
BasicMonitor.toIProgressMonitor(monitor);
String projectName = javaSource.segment(0);
IProject project = null;
try
{
List<IClasspathEntry> classpathEntries = new
UniqueEList<IClasspathEntry>();

progressMonitor.beginTask("", 10);
progressMonitor.subTask
(CodeGenEcorePlugin.INSTANCE.getString
("_UI_CreatingEMFProject_message",
new Object [] { projectName, projectLocationURI !=
null ? projectLocationURI.toString() : projectName }));
IWorkspace workspace = ResourcesPlugin.getWorkspace();
project = workspace.getRoot().getProject(projectName);

// Clean up any old project information.
//
if (!project.exists())
{
URI location = projectLocationURI;
if (location == null)
{
location =
URI.createFileURI(workspace.getRoot().getLocation().append(p rojectName).toOSString());
}
location = location.appendSegment(".project");
File projectFile = new File(location.toString());
if (projectFile.exists())
{
projectFile.renameTo(new File(location.toString() +
".old"));
}
}

IJavaProject javaProject = JavaCore.create(project);
IProjectDescription projectDescription = null;
if (!project.exists())
{
projectDescription =
ResourcesPlugin.getWorkspace().newProjectDescription(project Name);
if (projectLocationURI != null)
{
projectDescription.setLocationURI(new
java.net.URI(projectLocationURI.toString()));
}
project.create(projectDescription, new
SubProgressMonitor(progressMonitor, 1));
}
else
{
projectDescription = project.getDescription();

classpathEntries.addAll(Arrays.asList(javaProject.getRawClas spath()));
}

boolean isInitiallyEmpty = classpathEntries.isEmpty();

{
if (referencedProjects.size() != 0 && (style &
(EMF_PLUGIN_PROJECT_STYLE | EMF_EMPTY_PROJECT_STYLE)) == 0)
{
projectDescription.setReferencedProjects
(referencedProjects.toArray(new
IProject[referencedProjects.size()]));
for (IProject referencedProject : referencedProjects)
{
IClasspathEntry referencedProjectClasspathEntry =
JavaCore.newProjectEntry(referencedProject.getFullPath());
classpathEntries.add(referencedProjectClasspathEntry);
}
}

String [] natureIds = projectDescription.getNatureIds();
if (natureIds == null)
{
natureIds = new String [] { JavaCore.NATURE_ID };
}
else
{
boolean hasJavaNature = false;
boolean hasPDENature = false;
for (int i = 0; i < natureIds.length; ++i)
{
if (JavaCore.NATURE_ID.equals(natureIds[i]))
{
hasJavaNature = true;
}
if ("org.eclipse.pde.PluginNature".equals(natureIds[i]))
{
hasPDENature = true;
}
}
if (!hasJavaNature)
{
String [] oldNatureIds = natureIds;
natureIds = new String [oldNatureIds.length + 1];
System.arraycopy(oldNatureIds, 0, natureIds, 0,
oldNatureIds.length);
natureIds[oldNatureIds.length] = JavaCore.NATURE_ID;
}
if (!hasPDENature)
{
String [] oldNatureIds = natureIds;
natureIds = new String [oldNatureIds.length + 1];
System.arraycopy(oldNatureIds, 0, natureIds, 0,
oldNatureIds.length);
natureIds[oldNatureIds.length] =
"org.eclipse.pde.PluginNature";
}
}
projectDescription.setNatureIds(natureIds);

ICommand [] builders = projectDescription.getBuildSpec();
if (builders == null)
{
builders = new ICommand [0];
}
boolean hasManifestBuilder = false;
boolean hasSchemaBuilder = false;
for (int i = 0; i < builders.length; ++i)
{
if
("org.eclipse.pde.ManifestBuilder".equals(builders[i].getBuilderName()))
{
hasManifestBuilder = true;
}
if
("org.eclipse.pde.SchemaBuilder".equals(builders[i].getBuilderName()))
{
hasSchemaBuilder = true;
}
}
if (!hasManifestBuilder)
{
ICommand [] oldBuilders = builders;
builders = new ICommand [oldBuilders.length + 1];
System.arraycopy(oldBuilders, 0, builders, 0,
oldBuilders.length);
builders[oldBuilders.length] =
projectDescription.newCommand();

builders[oldBuilders.length].setBuilderName("org.eclipse.pde.ManifestBuilder ");
}
if (!hasSchemaBuilder)
{
ICommand [] oldBuilders = builders;
builders = new ICommand [oldBuilders.length + 1];
System.arraycopy(oldBuilders, 0, builders, 0,
oldBuilders.length);
builders[oldBuilders.length] =
projectDescription.newCommand();

builders[oldBuilders.length].setBuilderName("org.eclipse.pde.SchemaBuilder ");
}
projectDescription.setBuildSpec(builders);

project.open(new SubProgressMonitor(progressMonitor, 1));
project.setDescription(projectDescription, new
SubProgressMonitor(progressMonitor, 1));

IContainer sourceContainer = project;
if (javaSource.segmentCount() > 1)
{
sourceContainer =
project.getFolder(javaSource.removeFirstSegments(1).makeAbso lute());
if (!sourceContainer.exists())
{
((IFolder)sourceContainer).create(false, true, new
SubProgressMonitor(progressMonitor, 1));
}
}

if (isInitiallyEmpty)
{
IClasspathEntry sourceClasspathEntry =
JavaCore.newSourceEntry(javaSource);
for (Iterator<IClasspathEntry> i =
classpathEntries.iterator(); i.hasNext(); )
{
IClasspathEntry classpathEntry = i.next();
if (classpathEntry.getPath().isPrefixOf(javaSource))
{
i.remove();
}
}
classpathEntries.add(0, sourceClasspathEntry);

IClasspathEntry jreClasspathEntry =
JavaCore.newVariableEntry
(new Path(JavaRuntime.JRELIB_VARIABLE), new
Path(JavaRuntime.JRESRC_VARIABLE), new
Path(JavaRuntime.JRESRCROOT_VARIABLE));
for (Iterator<IClasspathEntry> i =
classpathEntries.iterator(); i.hasNext(); )
{
IClasspathEntry classpathEntry = i.next();
if
(classpathEntry.getPath().isPrefixOf(jreClasspathEntry.getPa th()))
{
i.remove();
}
}

String jreContainer = JavaRuntime.JRE_CONTAINER;
String complianceLevel =
CodeGenUtil.EclipseUtil.getJavaComplianceLevel(project);
if ("1.5".equals(complianceLevel))
{
jreContainer +=
" /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J 2SE-1.5 ";
}
else if ("1.6".equals(complianceLevel))
{
jreContainer +=
" /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J avaSE-1.6 ";
}
classpathEntries.add(JavaCore.newContainerEntry(new
Path(jreContainer)));
}

if ((style & EMF_EMPTY_PROJECT_STYLE) == 0)
{
if ((style & EMF_PLUGIN_PROJECT_STYLE) != 0)
{
classpathEntries.add(JavaCore.newContainerEntry(new
Path("org.eclipse.pde.core.requiredPlugins")));

// Remove variables since the plugin.xml should
provide the complete path information.
//
for (Iterator<IClasspathEntry> i =
classpathEntries.iterator(); i.hasNext(); )
{
IClasspathEntry classpathEntry = i.next();
if (classpathEntry.getEntryKind() ==
IClasspathEntry.CPE_VARIABLE &&

!JavaRuntime.JRELIB_VARIABLE.equals(classpathEntry.getPath() .toString())
||
classpathEntry.getEntryKind() ==
IClasspathEntry.CPE_PROJECT)
{
i.remove();
}
}
}
else
{

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_CORE_RUNTIME", "org.eclipse.core.runtime");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_CORE_RESOURCES", "org.eclipse.core.resources");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_COMMON", "org.eclipse.emf.common");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_ECORE", "org.eclipse.emf.ecore");

if ((style & EMF_XML_PROJECT_STYLE) != 0)
{

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_ECORE_XMI", "org.eclipse.emf.ecore.xmi");
}

if ((style & EMF_MODEL_PROJECT_STYLE) == 0)
{

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_EDIT", "org.eclipse.emf.edit");

if ((style & EMF_EDIT_PROJECT_STYLE) == 0)
{

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_SWT", "org.eclipse.swt");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_JFACE", "org.eclipse.jface");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_UI_VIEWS", "org.eclipse.ui.views");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_UI_EDITORS", "org.eclipse.ui.editors");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_UI_IDE", "org.eclipse.ui.ide");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_UI_WORKBENCH", "org.eclipse.ui.workbench");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_COMMON_UI", "org.eclipse.emf.common.ui");

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_EDIT_UI", "org.eclipse.emf.edit.ui");
if ((style & EMF_XML_PROJECT_STYLE) == 0)
{

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_ECORE_XMI", "org.eclipse.emf.ecore.xmi");
}
}
}

if ((style & EMF_TESTS_PROJECT_STYLE) != 0)
{

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"JUNIT", "org.junit");
}

if (pluginVariables != null)
{
for (Iterator<?> i = pluginVariables.iterator();
i.hasNext(); )
{
Object variable = i.next();
if (variable instanceof IClasspathEntry)
{
classpathEntries.add((IClasspathEntry)variable);
}
else if (variable instanceof String)
{
String pluginVariable = (String)variable;
String name;
String id;
int index = pluginVariable.indexOf("=");
if (index == -1)
{
name =
pluginVariable.replace('.','_').toUpperCase();
id = pluginVariable;
}
else
{
name = pluginVariable.substring(0, index);
id = pluginVariable.substring(index + 1);
}

CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , name, id);
}
}
}
}
}

javaProject.setRawClasspath
(classpathEntries.toArray(new
IClasspathEntry[classpathEntries.size()]),
new SubProgressMonitor(progressMonitor, 1));
}

if (isInitiallyEmpty)
{
javaProject.setOutputLocation(new Path("/" +
javaSource.segment(0) + "/bin"), new
SubProgressMonitor(progressMonitor, 1));
}
}
catch (Exception exception)
{
exception.printStackTrace();
CodeGenEcorePlugin.INSTANCE.log(exception);
}
finally
{
progressMonitor.done();
}

return project;
}



Paul Sentosa wrote:
> Hi everyone,
>
> I posted a similar question some times ago, but unfortunately I didn't get
> any really helpful replies and still get stuck with the problem.
> It is about workspace resource programming. I'd like to create a plug-in
> which in turns generate another plug-in project.
> Luckily I have the Java Dev. Guide to Eclipse book which gives some hints on
> creating a project programmaticaly. But then I still can't find any way to
> create packages within the project. In the book, there are some codes, which
> more or less look like this:
>
> IFolder myFolder = myProject.getFolder("myPackage");
> myFolder.create(true,true,null);
> IJavaElement myPackageFragment = JavaCore.create(myFolder);
>
> But this only gives me a folder, and not a package.
>
> Can anyone please give me some hints on how I can create packages using the
> workspace API? And also, on how to define the src/bin separation on the
> project?
>
> Thanks in advance!
>
> Regards
> Paul
>
>
>
>
>


--------------020303030902000909090905
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Paul,<br>
<br>
Below is a block of code that does much of what you are asking for.<br>
<br>
<blockquote><small>&nbsp;&nbsp; public static IProject createEMFProject</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (IPath javaSource,</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; URI projectLocationURI,</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;IProject&gt; referencedProjects,</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Monitor monitor,</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int style,</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;?&gt; pluginVariables)</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IProgressMonitor progressMonitor =
BasicMonitor.toIProgressMonitor(monitor);</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String projectName = javaSource.segment(0);</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IProject project = null;</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; List&lt;IClasspathEntry&gt; classpathEntries = new
UniqueEList&lt;IClasspathEntry&gt;();</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; progressMonitor.beginTask("", 10);</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; progressMonitor.subTask</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (CodeGenEcorePlugin.INSTANCE.getString</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ("_UI_CreatingEMFProject_message", </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; new Object [] { projectName, projectLocationURI
!= null ? projectLocationURI.toString() : projectName }));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; IWorkspace workspace = ResourcesPlugin.getWorkspace();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; project = workspace.getRoot().getProject(projectName);</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; // Clean up any old project information.</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; //</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (!project.exists())</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; URI location = projectLocationURI;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (location == null)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location =
URI.createFileURI(workspace.getRoot().getLocation().append(p rojectName).toOSString()); </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; location = location.appendSegment(".project");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; File projectFile = new File(location.toString());</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (projectFile.exists())</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; projectFile.renameTo(new File(location.toString()
+ ".old"));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; IJavaProject javaProject = JavaCore.create(project);</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; IProjectDescription projectDescription = null;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (!project.exists())</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; projectDescription =
ResourcesPlugin.getWorkspace().newProjectDescription(project Name); </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (projectLocationURI != null)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; projectDescription.setLocationURI(new
java.net.URI(projectLocationURI.toString()));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; project.create(projectDescription, new
SubProgressMonitor(progressMonitor, 1));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; projectDescription = project.getDescription();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
classpathEntries.addAll(Arrays.asList(javaProject.getRawClas spath())); </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; boolean isInitiallyEmpty = classpathEntries.isEmpty();</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (referencedProjects.size() != 0 &amp;&amp; (style
&amp; (EMF_PLUGIN_PROJECT_STYLE | EMF_EMPTY_PROJECT_STYLE)) == 0)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; projectDescription.setReferencedProjects</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; (referencedProjects.toArray(new
IProject[referencedProjects.size()]));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (IProject referencedProject :
referencedProjects)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; IClasspathEntry referencedProjectClasspathEntry
= JavaCore.newProjectEntry(referencedProject.getFullPath());</small ><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
classpathEntries.add(referencedProjectClasspathEntry);</small ><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String [] natureIds =
projectDescription.getNatureIds();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (natureIds == null)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; natureIds = new String [] { JavaCore.NATURE_ID };</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; boolean hasJavaNature = false;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; boolean hasPDENature = false;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; natureIds.length; ++i)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (JavaCore.NATURE_ID.equals(natureIds[i]))</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; hasJavaNature = true;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if
("org.eclipse.pde.PluginNature".equals(natureIds[i]))</small ><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; hasPDENature = true;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!hasJavaNature)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; String [] oldNatureIds = natureIds;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; natureIds = new String [oldNatureIds.length + 1];</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; System.arraycopy(oldNatureIds, 0, natureIds, 0,
oldNatureIds.length);</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; natureIds[oldNatureIds.length] =
JavaCore.NATURE_ID;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!hasPDENature)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; String [] oldNatureIds = natureIds;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; natureIds = new String [oldNatureIds.length + 1];</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; System.arraycopy(oldNatureIds, 0, natureIds, 0,
oldNatureIds.length);</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; natureIds[oldNatureIds.length] =
"org.eclipse.pde.PluginNature";</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; projectDescription.setNatureIds(natureIds);</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ICommand [] builders =
projectDescription.getBuildSpec();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (builders == null)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; builders = new ICommand [0];</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; boolean hasManifestBuilder = false;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; boolean hasSchemaBuilder = false;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; builders.length; ++i)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
("org.eclipse.pde.ManifestBuilder".equals(builders[i].getBuilderName())) </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; hasManifestBuilder = true;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
("org.eclipse.pde.SchemaBuilder".equals(builders[i].getBuilderName())) </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; hasSchemaBuilder = true;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!hasManifestBuilder)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ICommand [] oldBuilders = builders;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; builders = new ICommand [oldBuilders.length + 1];</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.arraycopy(oldBuilders, 0, builders, 0,
oldBuilders.length);</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; builders[oldBuilders.length] =
projectDescription.newCommand();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
builders[oldBuilders.length].setBuilderName("org.eclipse.pde.ManifestBuilder ");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!hasSchemaBuilder)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ICommand [] oldBuilders = builders;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; builders = new ICommand [oldBuilders.length + 1];</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.arraycopy(oldBuilders, 0, builders, 0,
oldBuilders.length);</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; builders[oldBuilders.length] =
projectDescription.newCommand();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
builders[oldBuilders.length].setBuilderName("org.eclipse.pde.SchemaBuilder ");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; projectDescription.setBuildSpec(builders);</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; project.open(new SubProgressMonitor(progressMonitor,
1));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; project.setDescription(projectDescription, new
SubProgressMonitor(progressMonitor, 1));</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; IContainer sourceContainer = project;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (javaSource.segmentCount() &gt; 1)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sourceContainer =
project.getFolder(javaSource.removeFirstSegments(1).makeAbso lute()); </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!sourceContainer.exists())</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ((IFolder)sourceContainer).create(false, true,
new SubProgressMonitor(progressMonitor, 1));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (isInitiallyEmpty)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IClasspathEntry sourceClasspathEntry = </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; JavaCore.newSourceEntry(javaSource);</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (Iterator&lt;IClasspathEntry&gt; i =
classpathEntries.iterator(); i.hasNext(); )</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; IClasspathEntry classpathEntry = i.next();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if
(classpathEntry.getPath().isPrefixOf(javaSource))</small><br >
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; i.remove();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; classpathEntries.add(0, sourceClasspathEntry);</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IClasspathEntry jreClasspathEntry =</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; JavaCore.newVariableEntry</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (new Path(JavaRuntime.JRELIB_VARIABLE), new
Path(JavaRuntime.JRESRC_VARIABLE), new
Path(JavaRuntime.JRESRCROOT_VARIABLE));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (Iterator&lt;IClasspathEntry&gt; i =
classpathEntries.iterator(); i.hasNext(); )</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; IClasspathEntry classpathEntry = i.next();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if
(classpathEntry.getPath().isPrefixOf(jreClasspathEntry.getPa th())) </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; i.remove();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String jreContainer = JavaRuntime.JRE_CONTAINER;</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String complianceLevel =
CodeGenUtil.EclipseUtil.getJavaComplianceLevel(project);</small ><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ("1.5".equals(complianceLevel))</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; jreContainer +=
" /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J 2SE-1.5 ";</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if ("1.6".equals(complianceLevel))</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; jreContainer +=
" /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J avaSE-1.6 ";</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
classpathEntries.add(JavaCore.newContainerEntry(new
Path(jreContainer)));</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((style &amp; EMF_EMPTY_PROJECT_STYLE) == 0)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((style &amp; EMF_PLUGIN_PROJECT_STYLE) != 0)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
classpathEntries.add(JavaCore.newContainerEntry(new
Path("org.eclipse.pde.core.requiredPlugins")));</small><br >
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; // Remove variables since the plugin.xml should
provide the complete path information.</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; //</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; for (Iterator&lt;IClasspathEntry&gt; i =
classpathEntries.iterator(); i.hasNext(); )</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; IClasspathEntry classpathEntry = i.next();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (classpathEntry.getEntryKind() ==
IClasspathEntry.CPE_VARIABLE &amp;&amp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
!JavaRuntime.JRELIB_VARIABLE.equals(classpathEntry.getPath() .toString())
||</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; classpathEntry.getEntryKind() ==
IClasspathEntry.CPE_PROJECT)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i.remove();</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_CORE_RUNTIME", "org.eclipse.core.runtime");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_CORE_RESOURCES", "org.eclipse.core.resources");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_COMMON", "org.eclipse.emf.common");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_ECORE", "org.eclipse.emf.ecore");</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if ((style &amp; EMF_XML_PROJECT_STYLE) != 0)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_ECORE_XMI", "org.eclipse.emf.ecore.xmi");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if ((style &amp; EMF_MODEL_PROJECT_STYLE) == 0)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"EMF_EDIT", "org.eclipse.emf.edit");</small><br>
<small>&nbsp; </small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((style &amp; EMF_EDIT_PROJECT_STYLE) == 0)</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_SWT", "org.eclipse.swt");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_JFACE", "org.eclipse.jface");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_UI_VIEWS", "org.eclipse.ui.views");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_UI_EDITORS", "org.eclipse.ui.editors");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_UI_IDE", "org.eclipse.ui.ide");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries ,
"ECLIPSE_UI_WORKBENCH", "org.eclipse.ui.workbench");</small><br>
<small> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Re: newbie on workspace resource programming [message #213419 is a reply to message #213203] Sat, 02 June 2007 14:36 Go to previous message
Eclipse UserFriend
Originally posted by: psentosa.yahoo.com

This is a multi-part message in MIME format.

------=_NextPart_000_0013_01C7A534.28A80190
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

thanks for the code and sorry for the late reply.
I already had a look at the code when you told me last time about this =
method. But somehow I overlook some important parts so I couldn't get =
the result I wanted.
But after I get the very same answer from you, I gave it a try once more =
and now it works.
Thanks again and sorry for the double post. Hope you don't get bored =
with this kind of newbie question.

Have a nice weekend!

Regards
Paul
"Ed Merks" <merks@ca.ibm.com> schrieb im Newsbeitrag =
news:f3nels$b99$1@build.eclipse.org...
Paul,

Below is a block of code that does much of what you are asking for.


public static IProject createEMFProject
(IPath javaSource,
URI projectLocationURI,
List<IProject> referencedProjects,
Monitor monitor,
int style,
List<?> pluginVariables)
{
IProgressMonitor progressMonitor =3D =
BasicMonitor.toIProgressMonitor(monitor);
String projectName =3D javaSource.segment(0);
IProject project =3D null;
try
{
List<IClasspathEntry> classpathEntries =3D new =
UniqueEList<IClasspathEntry>();
=20
progressMonitor.beginTask("", 10);
progressMonitor.subTask
(CodeGenEcorePlugin.INSTANCE.getString
("_UI_CreatingEMFProject_message",=20
new Object [] { projectName, projectLocationURI !=3D =
null ? projectLocationURI.toString() : projectName }));
IWorkspace workspace =3D ResourcesPlugin.getWorkspace();
project =3D workspace.getRoot().getProject(projectName);
=20
// Clean up any old project information.
//
if (!project.exists())
{
URI location =3D projectLocationURI;
if (location =3D=3D null)
{
location =3D =
URI.createFileURI(workspace.getRoot().getLocation().append(p rojectName).t=
oOSString());
}
location =3D location.appendSegment(".project");
File projectFile =3D new File(location.toString());
if (projectFile.exists())
{
projectFile.renameTo(new File(location.toString() + =
".old"));
}
}
=20
IJavaProject javaProject =3D JavaCore.create(project);
IProjectDescription projectDescription =3D null;
if (!project.exists())
{
projectDescription =3D =
ResourcesPlugin.getWorkspace().newProjectDescription(project Name);
if (projectLocationURI !=3D null)
{
projectDescription.setLocationURI(new =
java.net.URI(projectLocationURI.toString()));
}
project.create(projectDescription, new =
SubProgressMonitor(progressMonitor, 1));
}
else=20
{
projectDescription =3D project.getDescription();
=
classpathEntries.addAll(Arrays.asList(javaProject.getRawClas spath()));
}
=20
boolean isInitiallyEmpty =3D classpathEntries.isEmpty();
=20
{
if (referencedProjects.size() !=3D 0 && (style & =
(EMF_PLUGIN_PROJECT_STYLE | EMF_EMPTY_PROJECT_STYLE)) =3D=3D 0)
{
projectDescription.setReferencedProjects
(referencedProjects.toArray(new =
IProject[referencedProjects.size()]));
for (IProject referencedProject : referencedProjects)
{
IClasspathEntry referencedProjectClasspathEntry =3D =
JavaCore.newProjectEntry(referencedProject.getFullPath());
classpathEntries.add(referencedProjectClasspathEntry);
}
}
=20
String [] natureIds =3D projectDescription.getNatureIds();
if (natureIds =3D=3D null)
{
natureIds =3D new String [] { JavaCore.NATURE_ID };
}
else
{
boolean hasJavaNature =3D false;
boolean hasPDENature =3D false;
for (int i =3D 0; i < natureIds.length; ++i)
{
if (JavaCore.NATURE_ID.equals(natureIds[i]))
{
hasJavaNature =3D true;
}
if =
("org.eclipse.pde.PluginNature".equals(natureIds[i]))
{
hasPDENature =3D true;
}
}
if (!hasJavaNature)
{
String [] oldNatureIds =3D natureIds;
natureIds =3D new String [oldNatureIds.length + 1];
System.arraycopy(oldNatureIds, 0, natureIds, 0, =
oldNatureIds.length);
natureIds[oldNatureIds.length] =3D JavaCore.NATURE_ID;
}
if (!hasPDENature)
{
String [] oldNatureIds =3D natureIds;
natureIds =3D new String [oldNatureIds.length + 1];
System.arraycopy(oldNatureIds, 0, natureIds, 0, =
oldNatureIds.length);
natureIds[oldNatureIds.length] =3D =
"org.eclipse.pde.PluginNature";
}
}
projectDescription.setNatureIds(natureIds);
=20
ICommand [] builders =3D =
projectDescription.getBuildSpec();
if (builders =3D=3D null)
{
builders =3D new ICommand [0];
}
boolean hasManifestBuilder =3D false;
boolean hasSchemaBuilder =3D false;
for (int i =3D 0; i < builders.length; ++i)
{
if =
("org.eclipse.pde.ManifestBuilder".equals(builders[i].getBuilderName()))
{
hasManifestBuilder =3D true;
}
if =
("org.eclipse.pde.SchemaBuilder".equals(builders[i].getBuilderName()))
{
hasSchemaBuilder =3D true;
}
}
if (!hasManifestBuilder)
{
ICommand [] oldBuilders =3D builders;
builders =3D new ICommand [oldBuilders.length + 1];
System.arraycopy(oldBuilders, 0, builders, 0, =
oldBuilders.length);
builders[oldBuilders.length] =3D =
projectDescription.newCommand();
=
builders[oldBuilders.length].setBuilderName("org.eclipse.pde.ManifestBuil=
der");
}
if (!hasSchemaBuilder)
{
ICommand [] oldBuilders =3D builders;
builders =3D new ICommand [oldBuilders.length + 1];
System.arraycopy(oldBuilders, 0, builders, 0, =
oldBuilders.length);
builders[oldBuilders.length] =3D =
projectDescription.newCommand();
=
builders[oldBuilders.length].setBuilderName("org.eclipse.pde.SchemaBuilde=
r");
}
projectDescription.setBuildSpec(builders);
=20
project.open(new SubProgressMonitor(progressMonitor, 1));
project.setDescription(projectDescription, new =
SubProgressMonitor(progressMonitor, 1));
=20
IContainer sourceContainer =3D project;
if (javaSource.segmentCount() > 1)
{
sourceContainer =3D =
project.getFolder(javaSource.removeFirstSegments(1).makeAbso lute());
if (!sourceContainer.exists())
{
((IFolder)sourceContainer).create(false, true, new =
SubProgressMonitor(progressMonitor, 1));
}
}
=20
if (isInitiallyEmpty)
{
IClasspathEntry sourceClasspathEntry =3D=20
JavaCore.newSourceEntry(javaSource);
for (Iterator<IClasspathEntry> i =3D =
classpathEntries.iterator(); i.hasNext(); )
{
IClasspathEntry classpathEntry =3D i.next();
if (classpathEntry.getPath().isPrefixOf(javaSource))
{
i.remove();
}
}
classpathEntries.add(0, sourceClasspathEntry);
=20
IClasspathEntry jreClasspathEntry =3D
JavaCore.newVariableEntry
(new Path(JavaRuntime.JRELIB_VARIABLE), new =
Path(JavaRuntime.JRESRC_VARIABLE), new =
Path(JavaRuntime.JRESRCROOT_VARIABLE));
for (Iterator<IClasspathEntry> i =3D =
classpathEntries.iterator(); i.hasNext(); )
{
IClasspathEntry classpathEntry =3D i.next();
if =
(classpathEntry.getPath().isPrefixOf(jreClasspathEntry.getPa th()))
{
i.remove();
}
}
=20
String jreContainer =3D JavaRuntime.JRE_CONTAINER;
String complianceLevel =3D =
CodeGenUtil.EclipseUtil.getJavaComplianceLevel(project);
if ("1.5".equals(complianceLevel))
{
jreContainer +=3D =
" /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J 2SE-1.5 ";
}
else if ("1.6".equals(complianceLevel))
{
jreContainer +=3D =
" /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J avaSE-1.6 ";
}
classpathEntries.add(JavaCore.newContainerEntry(new =
Path(jreContainer)));
}
=20
if ((style & EMF_EMPTY_PROJECT_STYLE) =3D=3D 0)
{
if ((style & EMF_PLUGIN_PROJECT_STYLE) !=3D 0)
{
classpathEntries.add(JavaCore.newContainerEntry(new =
Path("org.eclipse.pde.core.requiredPlugins")));
=20
// Remove variables since the plugin.xml should =
provide the complete path information.
//
for (Iterator<IClasspathEntry> i =3D =
classpathEntries.iterator(); i.hasNext(); )
{
IClasspathEntry classpathEntry =3D i.next();
if (classpathEntry.getEntryKind() =3D=3D =
IClasspathEntry.CPE_VARIABLE &&=20
=
!JavaRuntime.JRELIB_VARIABLE.equals(classpathEntry.getPath() .toString()) =
||
classpathEntry.getEntryKind() =3D=3D =
IClasspathEntry.CPE_PROJECT)
{
i.remove();
}
}
}
else
{
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"ECLIPSE_CORE_RUNTIME", "org.eclipse.core.runtime");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"ECLIPSE_CORE_RESOURCES", "org.eclipse.core.resources");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"EMF_COMMON", "org.eclipse.emf.common");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"EMF_ECORE", "org.eclipse.emf.ecore");
=20
if ((style & EMF_XML_PROJECT_STYLE) !=3D 0)
{
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"EMF_ECORE_XMI", "org.eclipse.emf.ecore.xmi");
}
=20
if ((style & EMF_MODEL_PROJECT_STYLE) =3D=3D 0)
{
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"EMF_EDIT", "org.eclipse.emf.edit");
=20
if ((style & EMF_EDIT_PROJECT_STYLE) =3D=3D 0)
{
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"ECLIPSE_SWT", "org.eclipse.swt");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"ECLIPSE_JFACE", "org.eclipse.jface");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"ECLIPSE_UI_VIEWS", "org.eclipse.ui.views");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"ECLIPSE_UI_EDITORS", "org.eclipse.ui.editors");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"ECLIPSE_UI_IDE", "org.eclipse.ui.ide");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"ECLIPSE_UI_WORKBENCH", "org.eclipse.ui.workbench");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"EMF_COMMON_UI", "org.eclipse.emf.common.ui");
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"EMF_EDIT_UI", "org.eclipse.emf.edit.ui");
if ((style & EMF_XML_PROJECT_STYLE) =3D=3D 0)
{
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , =
"EMF_ECORE_XMI", "org.eclipse.emf.ecore.xmi");
}
}
}
=20
if ((style & EMF_TESTS_PROJECT_STYLE) !=3D 0)
{
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , "JUNIT", =
"org.junit");
}
=20
if (pluginVariables !=3D null)
{
for (Iterator<?> i =3D pluginVariables.iterator(); =
i.hasNext(); )
{
Object variable =3D i.next();
if (variable instanceof IClasspathEntry)
{
classpathEntries.add((IClasspathEntry)variable);
}
else if (variable instanceof String)
{
String pluginVariable =3D (String)variable;
String name;
String id;
int index =3D pluginVariable.indexOf("=3D");
if (index =3D=3D -1)
{
name =3D =
pluginVariable.replace('.','_').toUpperCase();
id =3D pluginVariable;
}
else
{
name =3D pluginVariable.substring(0, index);
id =3D pluginVariable.substring(index + 1);
}
=
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , name, id);
}
}
}
}
}
=20
javaProject.setRawClasspath
(classpathEntries.toArray(new =
IClasspathEntry[classpathEntries.size()]),
new SubProgressMonitor(progressMonitor, 1));
}
=20
if (isInitiallyEmpty)
{
javaProject.setOutputLocation(new Path("/" + =
javaSource.segment(0) + "/bin"), new SubProgressMonitor(progressMonitor, =
1));
}
}
catch (Exception exception)
{
exception.printStackTrace();
CodeGenEcorePlugin.INSTANCE.log(exception);
}
finally
{
progressMonitor.done();
}
=20
return project;
}



Paul Sentosa wrote:=20
Hi everyone,

I posted a similar question some times ago, but unfortunately I didn't =
get
any really helpful replies and still get stuck with the problem.
It is about workspace resource programming. I'd like to create a plug-in
which in turns generate another plug-in project.
Luckily I have the Java Dev. Guide to Eclipse book which gives some =
hints on
creating a project programmaticaly. But then I still can't find any way =
to
create packages within the project. In the book, there are some codes, =
which
more or less look like this:

IFolder myFolder =3D myProject.getFolder("myPackage");
myFolder.create(true,true,null);
IJavaElement myPackageFragment =3D JavaCore.create(myFolder);

But this only gives me a folder, and not a package.

Can anyone please give me some hints on how I can create packages using =
the
workspace API? And also, on how to define the src/bin separation on the
project?

Thanks in advance!

Regards
Paul




=20

------=_NextPart_000_0013_01C7A534.28A80190
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1561" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks for the code and sorry for the =
late=20
reply.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I already&nbsp;had a look at the code =
when you told=20
me last time about this method. But somehow I overlook some important =
parts so I=20
couldn't get the result I wanted.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>But after I get the very same answer =
from you, I=20
gave it a try once more and now it works.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks again and sorry for the double =
post. Hope=20
you don't get bored with this kind of newbie question.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Have a nice weekend!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regards</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Paul</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
schrieb im Newsbeitrag <A=20
=
href=3D"news:f3nels$b99$1@build.eclipse.org">news:f3nels$b99$1@build.ecli=
pse.org</A>...</DIV>Paul,<BR><BR>Below=20
is a block of code that does much of what you are asking for.<BR><BR>
<BLOCKQUOTE><SMALL>&nbsp;&nbsp; public static IProject=20
createEMFProject</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
(IPath=20
javaSource,</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
URI=20
=
projectLocationURI,</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
List&lt;IProject&gt;=20
=
referencedProjects,</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
Monitor =
monitor,</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int=20
style,</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
List&lt;?&gt;=20
pluginVariables)</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=20
{</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IProgressMonitor=20
progressMonitor =3D=20
=
BasicMonitor.toIProgressMonitor(monitor);</SMALL><BR><SMALL >&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
String projectName =3D=20
=
javaSource.segment(0);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
IProject project =3D =
null;</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
try</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
List&lt;IClasspathEntry&gt; classpathEntries =3D new=20
UniqueEList&lt;IClasspathEntry&gt;();</SMALL><BR><SMALL >&nbsp;=20
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
progressMonitor.beginTask("",=20
10);</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
=
progressMonitor.subTask</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;=20
=
(CodeGenEcorePlugin.INSTANCE.getString</SMALL><BR><SMALL>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;=20
("_UI_CreatingEMFProject_message",=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;=20
new Object [] { projectName, projectLocationURI !=3D null ?=20
projectLocationURI.toString() : projectName=20
}));</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; =
IWorkspace=20
workspace =3D=20
=
ResourcesPlugin.getWorkspace();</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
project =3D=20
=
workspace.getRoot().getProject(projectName);</SMALL><BR><SMALL >&nbsp;=20
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; // =
Clean up=20
any old project=20
=
information.</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=
=20
//</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if=20
=
(!project.exists())</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
URI location =3D=20
=
projectLocationURI;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
if (location =3D=3D=20
=
null)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
location =3D=20
=
URI.createFileURI(workspace.getRoot().getLocation().append(p rojectName).t=
oOSString());</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
location =3D=20
=
location.appendSegment(".project");</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
File projectFile =3D new=20
=
File(location.toString());</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
if=20
=
(projectFile.exists())</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
projectFile.renameTo(new File(location.toString() +=20
=
".old"));</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp;=20
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
}</SMALL><BR><SMALL>&nbsp;=20
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; =
IJavaProject=20
javaProject =3D=20
=
JavaCore.create(project);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
IProjectDescription projectDescription =3D=20
null;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; =
if=20
=
(!project.exists())</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
projectDescription =3D=20
=
ResourcesPlugin.getWorkspace().newProjectDescription(project Name); </SMALL=
><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
if (projectLocationURI !=3D=20
=
null)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
projectDescription.setLocationURI(new=20
=
java.net.URI(projectLocationURI.toString()));</SMALL><BR><SMALL >&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
project.create(projectDescription, new =
SubProgressMonitor(progressMonitor,=20
1));</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; else=20
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
projectDescription =3D=20
=
project.getDescription();</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
classpathEntries.addAll(Arrays.asList(javaProject.getRawClas spath())); </S=
MALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
}</SMALL><BR><SMALL>&nbsp;=20
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; =
boolean=20
isInitiallyEmpty =3D =
classpathEntries.isEmpty();</SMALL><BR><SMALL>&nbsp;=20
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
if (referencedProjects.size() !=3D 0 &amp;&amp; (style &amp;=20
(EMF_PLUGIN_PROJECT_STYLE | EMF_EMPTY_PROJECT_STYLE)) =3D=3D=20
=
0)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbs=
p;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
=
projectDescription.setReferencedProjects</SMALL><BR><SMALL >&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
(referencedProjects.toArray(new=20
=
IProject[referencedProjects.size()]));</SMALL><BR><SMALL>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;=20
for (IProject referencedProject :=20
=
referencedProjects)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
IClasspathEntry referencedProjectClasspathEntry =3D=20
=
JavaCore.newProjectEntry(referencedProject.getFullPath());</SMALL ><BR><SM=
ALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
=
classpathEntries.add(referencedProjectClasspathEntry);</SMALL ><BR><SMALL>=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
}</SMALL><BR><SMALL>&nbsp;=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
=20
String [] natureIds =3D=20
=
projectDescription.getNatureIds();</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
if (natureIds =3D=3D=20
=
null)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
natureIds =3D new String [] { JavaCore.NATURE_ID=20
=
};</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbs=
p;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
=
else</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
boolean hasJavaNature =3D=20
=
false;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;=20
boolean hasPDENature =3D=20
=
false;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;=20
for (int i =3D 0; i &lt; natureIds.length;=20
=
++i)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
if=20
=
(JavaCore.NATURE_ID.equals(natureIds[i]))</SMALL><BR><SMALL >&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;=20
hasJavaNature =3D=20
=
true;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
if=20
=
("org.eclipse.pde.PluginNature".equals(natureIds[i]))</SMALL ><BR><SMALL>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& n=
bsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;=20
hasPDENature =3D=20
=
true;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
if=20
=
(!hasJavaNature)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
String [] oldNatureIds =3D=20
=
natureIds;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
natureIds =3D new String [oldNatureIds.length +=20
=
1];</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;=20
System.arraycopy(oldNatureIds, 0, natureIds, 0,=20
=
oldNatureIds.length);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;=20
natureIds[oldNatureIds.length] =3D=20
=
JavaCore.NATURE_ID;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
if=20
=
(!hasPDENature)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
String [] oldNatureIds =3D=20
=
natureIds;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
natureIds =3D new String [oldNatureIds.length +=20
=
1];</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;=20
System.arraycopy(oldNatureIds, 0, natureIds, 0,=20
=
oldNatureIds.length);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;=20
natureIds[oldNatureIds.length] =3D=20
=
"org.eclipse.pde.PluginNature";</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
projectDescription.setNatureIds(natureIds);</SMALL><BR><SMALL >&nbsp; =

=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
=20
ICommand [] builders =3D=20
=
projectDescription.getBuildSpec();</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
if (builders =3D=3D=20
=
null)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
builders =3D new ICommand=20
=
[0];</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
boolean hasManifestBuilder =3D=20
=
false;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp;=20
boolean hasSchemaBuilder =3D=20
=
false;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp;=20
for (int i =3D 0; i &lt; builders.length;=20
=
++i)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
if=20
=
("org.eclipse.pde.ManifestBuilder".equals(builders[i].getBuilderName())) <=
/SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
hasManifestBuilder =3D=20
=
true;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
if=20
=
("org.eclipse.pde.SchemaBuilder".equals(builders[i].getBuilderName())) </S=
MALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
hasSchemaBuilder =3D=20
=
true;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
if=20
=
(!hasManifestBuilder)</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
ICommand [] oldBuilders =3D=20
=
builders;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
builders =3D new ICommand [oldBuilders.length +=20
=
1];</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
System.arraycopy(oldBuilders, 0, builders, 0,=20
=
oldBuilders.length);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
builders[oldBuilders.length] =3D=20
=
projectDescription.newCommand();</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;=20
=
builders[oldBuilders.length].setBuilderName("org.eclipse.pde.ManifestBuil=
der");</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
if=20
=
(!hasSchemaBuilder)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
ICommand [] oldBuilders =3D=20
=
builders;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
builders =3D new ICommand [oldBuilders.length +=20
=
1];</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
System.arraycopy(oldBuilders, 0, builders, 0,=20
=
oldBuilders.length);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
builders[oldBuilders.length] =3D=20
=
projectDescription.newCommand();</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;=20
=
builders[oldBuilders.length].setBuilderName("org.eclipse.pde.SchemaBuilde=
r");</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
projectDescription.setBuildSpec(builders);</SMALL><BR><SMALL >&nbsp;=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
=20
project.open(new SubProgressMonitor(progressMonitor,=20
=
1));</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;=20
project.setDescription(projectDescription, new=20
SubProgressMonitor(progressMonitor, 1));</SMALL><BR><SMALL>&nbsp;=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
=20
IContainer sourceContainer =3D=20
=
project;</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp;=20
if (javaSource.segmentCount() &gt;=20
=
1)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbs=
p;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
sourceContainer =3D=20
=
project.getFolder(javaSource.removeFirstSegments(1).makeAbso lute()); </SMA=
LL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
if=20
=
(!sourceContainer.exists())</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
((IFolder)sourceContainer).create(false, true, new=20
SubProgressMonitor(progressMonitor,=20
=
1));</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;=20
}</SMALL><BR><SMALL>&nbsp;=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
if=20
=
(isInitiallyEmpty)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
IClasspathEntry sourceClasspathEntry =3D=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;=20
=
JavaCore.newSourceEntry(javaSource);</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=20
for (Iterator&lt;IClasspathEntry&gt; i =3D =
classpathEntries.iterator();=20
i.hasNext();=20
=
)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
IClasspathEntry classpathEntry =3D=20
=
i.next();</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
if=20
=
(classpathEntry.getPath().isPrefixOf(javaSource))</SMALL><BR ><SMALL>&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;=
=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;=20
=
i.remove();</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
classpathEntries.add(0, =
sourceClasspathEntry);</SMALL><BR><SMALL>&nbsp;=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
IClasspathEntry jreClasspathEntry=20
=
=3D</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
JavaCore.newVariableEntry</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;=20
(new Path(JavaRuntime.JRELIB_VARIABLE), new=20
Path(JavaRuntime.JRESRC_VARIABLE), new=20
=
Path(JavaRuntime.JRESRCROOT_VARIABLE));</SMALL><BR><SMALL >&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;=20
for (Iterator&lt;IClasspathEntry&gt; i =3D =
classpathEntries.iterator();=20
i.hasNext();=20
=
)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
IClasspathEntry classpathEntry =3D=20
=
i.next();</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
if=20
=
(classpathEntry.getPath().isPrefixOf(jreClasspathEntry.getPa th())) </SMALL=
><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;=20
=
i.remove();</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
}</SMALL><BR><SMALL>&nbsp;=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
String jreContainer =3D=20
=
JavaRuntime.JRE_CONTAINER;</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;=20
String complianceLevel =3D=20
=
CodeGenUtil.EclipseUtil.getJavaComplianceLevel(project);</SMALL ><BR><SMAL=
L> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
if=20
=
("1.5".equals(complianceLevel))</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
jreContainer +=3D=20
=
" /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J 2SE-1.5 ";</S=
MALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
else if=20
=
("1.6".equals(complianceLevel))</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
jreContainer +=3D=20
=
" /org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J avaSE-1.6 ";<=
/SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;=20
=
}</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
classpathEntries.add(JavaCore.newContainerEntry(new=20
=
Path(jreContainer)));</SMALL><BR><SMALL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
}</SMALL><BR><SMALL>&nbsp;=20
=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
if=20
((style &amp; EMF_EMPTY_PROJECT_STYLE) =3D=3D=20
=
0)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbs=
p;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;=20
if ((style &amp; EMF_PLUGIN_PROJECT_STYLE) !=3D=20
=
0)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;=20
=
{</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
classpathEntries.add(JavaCore.newContainerEntry(new=20
=
Path("org.eclipse.pde.core.requiredPlugins")));</SMALL><BR ><SMALL>&nbsp; =

=
</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;=20
// Remove variables since the plugin.xml should provide the complete =
path=20
=
information.</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =20
=
//</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
for (Iterator&lt;IClasspathEntry&gt; i =3D =
classpathEntries.iterator();=20
i.hasNext();=20
=
)</SMALL><BR><SMALL> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20<
Previous Topic:Can I build eclipse for Solaris on Windows PC?
Next Topic:Plug In development - Wizard creation
Goto Forum:
  


Current Time: Wed Sep 25 09:57:33 GMT 2024

Powered by FUDForum. Page generated in 0.09280 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top