notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r1788 - development/laboratory/ide/idea-plugin/magic/src/main/net/dpml/ide/idea/plugin/magic
- From: herzog AT raffael.ch
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r1788 - development/laboratory/ide/idea-plugin/magic/src/main/net/dpml/ide/idea/plugin/magic
- Date: Wed, 16 Feb 2005 15:01:36 +0100
Author: herzog AT raffael.ch
Date: Wed Feb 16 15:01:34 2005
New Revision: 1788
Modified:
development/laboratory/ide/idea-plugin/magic/src/main/net/dpml/ide/idea/plugin/magic/ProjectBuilder.java
Log:
Fixed various issues with special directories (. or ..) in the project's
basedir (->use File#getCanonicalPath()).
Modified:
development/laboratory/ide/idea-plugin/magic/src/main/net/dpml/ide/idea/plugin/magic/ProjectBuilder.java
==============================================================================
---
development/laboratory/ide/idea-plugin/magic/src/main/net/dpml/ide/idea/plugin/magic/ProjectBuilder.java
(original)
+++
development/laboratory/ide/idea-plugin/magic/src/main/net/dpml/ide/idea/plugin/magic/ProjectBuilder.java
Wed Feb 16 15:01:34 2005
@@ -215,7 +215,7 @@
*
* @param progress A progress indicator.
*/
- public void scanFiles(final ProgressIndicator progress) {
+ public void scanFiles(final ProgressIndicator progress) throws
IOException {
try {
progress.setIndeterminate(true);
progress.setText("Scanning Files...");
@@ -228,6 +228,13 @@
log.info("Scanning " + files[j].toString());
FileUtil.visitFilesRecursively(new
File(files[j].getPath()), new FileUtil.FileVisitor() {
public int accept(File file) {
+ try {
+ file = file.getCanonicalFile();
+ }
+ catch ( IOException exc ) {
+ exception = exc;
+ return FileUtil.FileVisitor.STOP;
+ }
progress.checkCanceled();
if (file.isFile()) {
progress.setText2("Scanning directory "
+ file.getParent());
@@ -253,6 +260,9 @@
return FileUtil.FileVisitor.PROCEED;
}
});
+ if ( exception != null ) {
+ throw (IOException)exception;
+ }
}
else {
log.info("Skipping " + files[j].toString());
@@ -497,7 +507,7 @@
* @throws UnresolvedDependencyException
* @throws ModuleCircularDependencyException
*/
- public void applyDependencies(final ProgressIndicator progress) throws
UnresolvedDependencyException, ModuleCircularDependencyException {
+ public void applyDependencies(final ProgressIndicator progress) throws
UnresolvedDependencyException, ModuleCircularDependencyException, IOException
{
try {
boolean success = false;
@@ -542,6 +552,9 @@
if ( exception instanceof
UnresolvedDependencyException ) {
throw (UnresolvedDependencyException)exception;
}
+ if ( exception instanceof IOException ) {
+ throw (IOException)exception;
+ }
else if ( exception instanceof RuntimeException ) {
throw (RuntimeException)exception;
}
@@ -598,6 +611,10 @@
exception = exc;
throw exc;
}
+ catch ( IOException exc ) {
+ exception = exc;
+ throw exc;
+ }
catch ( RuntimeException exc ) {
exception = exc;
throw exc;
@@ -621,7 +638,7 @@
*
* @throws UnresolvedDependencyException
*/
- private void setupModule(Map modules, Set rootModels, Map libs,
MagicProject magicProject, Module module) throws
UnresolvedDependencyException {
+ private void setupModule(Map modules, Set rootModels, Map libs,
MagicProject magicProject, Module module) throws IOException,
UnresolvedDependencyException {
addMessage(Message.MSG_INFO, "Setting up module " +
module.getName());
ModuleRootManager rootManager =
ModuleRootManager.getInstance(module);
ModifiableRootModel rootModel = rootManager.getModifiableModel();
@@ -688,8 +705,9 @@
if ( !foundTest && testFile != null ) {
mainContent.addSourceFolder(testFile, true);
}
- rootModel.setCompilerOutputPath("file://" +
magicProject.getBasedir().replace(File.separatorChar, '/')+"/target/classes");
- rootModel.setCompilerOutputPathForTests("file://" +
magicProject.getBasedir().replace(File.separatorChar,
'/')+"/target/test-classes");
+ String basedir = "file://"+new File(magicProject.getIndexPath(),
magicProject.getBasedir()).getCanonicalPath().replace(File.separatorChar,
'/');
+ rootModel.setCompilerOutputPath(basedir+"/target/classes");
+
rootModel.setCompilerOutputPathForTests(basedir+"/target/test-classes");
Set currentOrderEntries = new HashSet();
OrderEntry[] orderEntries = rootModel.getOrderEntries();
@@ -784,7 +802,7 @@
*
* @return A map that maps Magic projects to IDEA modules.
*/
- private Map collectModules() {
+ private Map collectModules() throws IOException {
Map modules = new HashMap();
ProjectRootManager projectRootManager =
ProjectRootManager.getInstance(project);
Iterator iter = magicProjects.values().iterator();
@@ -792,9 +810,10 @@
MagicProject magicProject = (MagicProject)iter.next();
addMessage(Message.MSG_INFO, "Checking project " + magicProject);
Module module = null;
- File moduleFile = (File)moduleFiles.get(new
File(magicProject.getIndexPath(), magicProject.getBasedir()).toString());
+ String basedir = new File(magicProject.getIndexPath(),
magicProject.getBasedir()).getCanonicalPath();
+ File moduleFile = (File)moduleFiles.get(basedir);
if ( moduleFile == null ) {
- addMessage(Message.MSG_WARNING, "No IDEA module found in
directory " + magicProject.getIndexPath());
+ addMessage(Message.MSG_WARNING, "No IDEA module found in
directory " + basedir);
continue;
}
else {
- svn commit: r1788 - development/laboratory/ide/idea-plugin/magic/src/main/net/dpml/ide/idea/plugin/magic, herzog, 02/16/2005
Archive powered by MHonArc 2.6.24.