-
Notifications
You must be signed in to change notification settings - Fork 67
/
qs-WorkingWithExistingLayout4.htm
246 lines (223 loc) · 7.86 KB
/
qs-WorkingWithExistingLayout4.htm
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta name="copyright" content=
"Copyright (c) IBM Corporation and others 2000, 2011. 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=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>
Products sharing a common source framework
</title>
<script language="JavaScript" type="text/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.svg" alt=
"Opens the Java perspective" /> <strong>Window > Open Perspective
> Other... > 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.svg" alt=
"Opens the New Java Project wizard" /> <strong>File > New >
Other... > Java Project</strong></a> to open the <strong>New Java
Project</strong> wizard.
</p>
</li>
<li>
<p>
Type "Product1" 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 "Product1" 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.svg" 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 "src" 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 "Product1" and click <strong>Link additional
source</strong> link in <strong>Details</strong> pane or button
<img src="images/add_linked_source_to_buildpath.svg" 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 "src-common" 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 "Product2" 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 "Product2" 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 "src-common" 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 "Product2" properties
changes.
</p>
</li>
<li>You now have two Java projects which respectively contain the sources
of "Product1" and "Product2" and which are using the sources of
"Framework".
<p>
<img src="images/qs-WorkingWithExistingLayout49.png" alt=
"Created Java projects in Workspace" />
</p>
</li>
</ol><em>Note:</em> Files in "src-common" are shared. So editing
"Common.java" in "Product1" will modify "Common.java" in "Product2".
However they are compiled in the context of their respective projects. Two
"Common.class" files will be generated; one for each project. If the two
projects have different compiler options, then different errors could be
reported on each "Common.java" file.
<p class="nav_footer" id="nav_footer">
Next Section: <a href="qs-WorkingWithExistingLayout5.htm">Product nesting
resources in output directory</a>
</p>
<h3 class="related">Related concepts</h3>
<a href="../concepts/concept-java-project.htm">Java projects</a><br />
<a href="../concepts/concept-java-views.htm">Java views</a>
<h3 class="related">Related references</h3>
<a href="../reference/ref-wizard-java-project.htm">New Java Project
Wizard</a><br />
<a href="../reference/views/ref-view-package-explorer.htm">Package
Explorer View</a>
</body>
</html>