Lines 23-32
Link Here
|
23 |
import java.io.IOException; |
23 |
import java.io.IOException; |
24 |
import java.util.HashSet; |
24 |
import java.util.HashSet; |
25 |
import java.util.Set; |
25 |
import java.util.Set; |
|
|
26 |
import java.util.concurrent.CountDownLatch; |
27 |
import java.util.concurrent.TimeUnit; |
26 |
import javax.swing.JComponent; |
28 |
import javax.swing.JComponent; |
27 |
import javax.swing.event.ChangeEvent; |
29 |
import javax.swing.event.ChangeEvent; |
28 |
import javax.swing.event.ChangeListener; |
30 |
import javax.swing.event.ChangeListener; |
29 |
import javax.swing.event.EventListenerList; |
31 |
import javax.swing.event.EventListenerList; |
|
|
32 |
import org.netbeans.api.java.classpath.ClassPath; |
33 |
import org.netbeans.api.java.classpath.GlobalPathRegistry; |
34 |
import org.netbeans.api.java.source.CompilationController; |
35 |
import org.netbeans.api.java.source.CancellableTask; |
36 |
import org.netbeans.api.java.source.JavaSource; |
30 |
import org.netbeans.spi.project.ui.support.ProjectChooser; |
37 |
import org.netbeans.spi.project.ui.support.ProjectChooser; |
31 |
import org.openide.WizardDescriptor; |
38 |
import org.openide.WizardDescriptor; |
32 |
import org.openide.filesystems.FileObject; |
39 |
import org.openide.filesystems.FileObject; |
Lines 213-230
Link Here
|
213 |
Set resultSet = new HashSet(); |
220 |
Set resultSet = new HashSet(); |
214 |
Set subResults = null; |
221 |
Set subResults = null; |
215 |
|
222 |
|
216 |
// let the app shell wizard do the additional configuration |
223 |
final ClassPath srcPath = ClassPath.getClassPath(mainFrameFO, ClassPath.SOURCE); |
217 |
if (appShellIterator != null) { |
224 |
assert srcPath != null; |
218 |
subResults = appShellIterator.instantiate(); |
225 |
final ClassPath compilePath = ClassPath.getClassPath(mainFrameFO, ClassPath.COMPILE); |
219 |
} |
226 |
assert compilePath != null; |
220 |
|
227 |
final ClassPath bootPath = ClassPath.getClassPath(mainFrameFO, ClassPath.BOOT); |
221 |
resultSet.add(projectFolderFO); |
228 |
assert bootPath != null; |
222 |
if (subResults != null) |
229 |
|
223 |
resultSet.addAll(subResults); |
230 |
final GlobalPathRegistry regs = GlobalPathRegistry.getDefault(); |
224 |
if (mainFrameFO != null) |
231 |
assert regs != null; |
225 |
resultSet.add(mainFrameFO); |
232 |
regs.register(ClassPath.SOURCE, new ClassPath[] {srcPath}); |
|
|
233 |
try { |
234 |
regs.register(ClassPath.COMPILE, new ClassPath[] {compilePath}); |
235 |
try { |
236 |
regs.register(ClassPath.BOOT, new ClassPath[] {bootPath}); |
237 |
try { |
238 |
//This is waiting to the end of the scan of the added path |
239 |
//I am not sure if it's needed. The form alredy provided some |
240 |
//kind of such a waiting. |
241 |
final CountDownLatch condition = new CountDownLatch (1); |
242 |
JavaSource.forFileObject(mainFrameFO).runWhenScanFinished(new CancellableTask<CompilationController>() { |
243 |
public void run (final CompilationController c) { |
244 |
condition.countDown(); |
245 |
} |
246 |
|
247 |
public void cancel () {} |
248 |
},true); |
249 |
try { |
250 |
condition.await(60, TimeUnit.SECONDS); |
251 |
} catch (InterruptedException e) { |
252 |
e.printStackTrace(); |
253 |
} |
254 |
// let the app shell wizard do the additional configuration |
255 |
if (appShellIterator != null) { |
256 |
subResults = appShellIterator.instantiate(); |
257 |
} |
226 |
|
258 |
|
227 |
return resultSet; |
259 |
resultSet.add(projectFolderFO); |
|
|
260 |
if (subResults != null) |
261 |
resultSet.addAll(subResults); |
262 |
if (mainFrameFO != null) |
263 |
resultSet.add(mainFrameFO); |
264 |
|
265 |
return resultSet; |
266 |
} finally { |
267 |
regs.unregister(ClassPath.BOOT, new ClassPath[] {bootPath}); |
268 |
} |
269 |
} finally { |
270 |
regs.unregister(ClassPath.COMPILE, new ClassPath[] {compilePath}); |
271 |
} |
272 |
} finally { |
273 |
regs.unregister(ClassPath.SOURCE, new ClassPath[] {srcPath}); |
274 |
} |
228 |
} |
275 |
} |
229 |
|
276 |
|
230 |
public void uninitialize(WizardDescriptor wiz) { |
277 |
public void uninitialize(WizardDescriptor wiz) { |