blob: 4013b21c3c0f3e2040b986b9036439c7c80109c3 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>
Products sharing a common source framework
</title>
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
</head>
<body>
<h1>
Products sharing a common source framework
</h1>
<h3>Layout on file system</h3>
<ul>
<li>The Java source files for two products require a common framework.</li>
<li>Projects and common framework are in separate directories which have their own source and output folders.
<p><img src="images/qs-WorkingWithExistingLayout40.png" alt="Layout on file system"></p></li>
</ul>
<h3>Steps for defining corresponding projects</h3>
<ol>
<li>
<p>Click
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.jdt.ui.JavaPerspective)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Java perspective">
<strong>Window &gt; Open Perspective &gt; Other... &gt; Java</strong></a>
to change to the Java perspective.
</p>
</li>
<li>
<p>
Click
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.newWizard(newWizardId=org.eclipse.jdt.ui.wizards.JavaProjectWizard)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the New Java Project wizard">
<strong>File &gt; New &gt; Other... &gt; Java Project</strong></a>
to open the <strong>New Java Project</strong> wizard.
</p>
</li>
<li>
<p>Type &quot;Product1&quot; in the <strong>Project name</strong> field. Click <strong>Next</strong>.</p>
<p><img src="images/qs-WorkingWithExistingLayout41.png" alt="New Java Project wizard"></p>
</li>
<li>
<p>On the next page, Select &quot;Product1&quot; source folder.</p>
<p>Click <strong>Link additional source</strong> link in <strong>Details</strong> pane or button <img src="images/add_linked_source_to_buildpath.png" alt="Link Additional Source to Project"> in view bar.</p>
<p><img src="images/qs-WorkingWithExistingLayout42.png" alt="Java Project Source setup"></p>
</li>
<li>
<p>In <strong>Link Source</strong> click <strong>Browse....</strong> and choose the <i><code>D:\Product1\JavaSourceFiles</code></i> directory.</p>
<p>Type &quot;src&quot; in the <strong>Folder name</strong> field.</p>
<p><img src="images/qs-WorkingWithExistingLayout43.png" alt="Link Source dialog"></p>
</li>
<li>
<p>Click <strong>Finish</strong> to validate and close the dialog.</p>
</li>
<li>
<p>Again, Select &quot;Product1&quot; and click <strong>Link additional source</strong> link in <strong>Details</strong> pane or button <img src="images/add_linked_source_to_buildpath.png" alt="Link Additional Source to Project"> in view bar.</p>
<p><img src="images/qs-WorkingWithExistingLayout44.png" alt="Java Project Source setup"></p>
</li>
<li>
<p>In <strong>Link Source</strong> click <strong>Browse....</strong> and choose the <i><code>D:\Framework\JavaSourceFiles</code></i> directory.</p>
<p>Type &quot;src-common&quot; in the <strong>Folder name</strong> field.</p>
<p><img src="images/qs-WorkingWithExistingLayout45.png" alt="Link Source dialog"></p>
</li>
<li>
<p>Click <strong>Finish</strong> to validate and close the dialog.</p>
<p>Your project source setup now looks as follows:</p>
<p><img src="images/qs-WorkingWithExistingLayout46.png" alt="Java Project Source final setup"></p>
</li>
<li>
Click <strong>Finish</strong>.
</li>
<li>
<p>Create project &quot;Product2&quot; repeating steps 2 to 5 choosing <i><code>D:\Product2\JavaSourceFiles</code></i>
directory for source folder instead.</p>
</li>
<li>
<p>Click on <strong>Finish</strong> to create the project immediately.</p>
</li>
<li>
<p>Now, we'll see how to add a linked source folder when project is already created in workspace...</p>
<p>Edit project &quot;Product2&quot; properties and select <strong>Java Builder Path</strong> page.</p>
<p>On <strong>Source</strong> tab, click <strong>Link Source...</strong>.</p>
<p><img src="images/qs-WorkingWithExistingLayout47.png" alt="Java Build Path Properties Source tab"></p>
</li>
<li>
<p>In <strong>Link Source</strong> click <strong>Browse....</strong> and choose the <i><code>D:\Framework\JavaSourceFiles</code></i> directory.</p>
<p>Type &quot;src-common&quot; in the <strong>Folder name</strong> field.</p>
<p><img src="images/qs-WorkingWithExistingLayout48.png" alt="Link Source dialog"></p>
</li>
<li>
<p>Click <strong>Finish</strong> to validate and close the dialog.</p>
<p>Click <strong>OK</strong> to apply project &quot;Product2&quot; properties changes.</p>
</li>
<li>
You now have two Java projects which respectively contain the sources of &quot;Product1&quot; and &quot;Product2&quot;
and which are using the sources of &quot;Framework&quot;.
<p><img src="images/qs-WorkingWithExistingLayout49.png" alt="Created Java projects in Workspace"></p>
</li>
</ol>
<em>Note: </em>Files in &quot;src-common&quot; are shared. So editing &quot;Common.java&quot; in &quot;Product1&quot;
will modify &quot;Common.java&quot; in &quot;Product2&quot;. However they are compiled in the context of their
respective projects. Two &quot;Common.class&quot; files will be generated; one for each project. If the two projects have
different compiler options, then different errors could be reported on each &quot;Common.java&quot; file.
<P class="nav_footer" id="nav_footer">Next Section: <A href="qs-WorkingWithExistingLayout5.htm">Product nesting resources in output directory</A>
</P>
<p>
<img border="0" src="../images/ngrelc.png" alt="Related concepts" >
</p>
<p>
<a href="../concepts/concepts-3.htm">Java projects</a><br>
<a href="../concepts/cjavaviews.htm">Java views</a><br>
</p>
<p>
<img src="../images/ngrelr.png" alt="Related reference">
</p>
<p>
<a href="../reference/ref-121.htm">New Java Project Wizard</a><br>
<a href="../reference/ref-view-package-explorer.htm">Package Explorer View</a><br>
</p>
</body>
</html>