Index: Actions.java =================================================================== RCS file: /cvs/ant/freeform/src/org/netbeans/modules/ant/freeform/Actions.java,v retrieving revision 1.4 diff -r1.4 Actions.java 16a17 > import java.io.*; 17a19 > import java.util.*; 24a27,28 > import org.netbeans.api.java.project.*; > import org.netbeans.api.project.*; 30a35 > import org.openide.filesystems.*; 86a92 > 87a94,143 > > // Set properties to the selected file if the command is *-single or debug.fix. > > Properties p = null; > > if (COMMAND_COMPILE_SINGLE.equals(command) || COMMAND_RUN_SINGLE.equals(command) > || COMMAND_DEBUG_SINGLE.equals(command) || JavaProjectConstants.COMMAND_DEBUG_FIX.equals(command)) { > FileObject root = null; > String path = null; > // First, assume that it is a Java source file. > SourceGroup[] groups = ProjectUtils.getSources(project).getSourceGroups("java"); > for (int gi = 0; gi < groups.length; ++gi) { > root = groups[gi].getRootFolder(); > FileObject[] files = ActionUtils.findSelectedFiles(context, root, ".java", true); // NOI18N > if (files != null && files.length > 0) { > path = FileUtil.getRelativePath(root, files[0]); > break; > } > } > // Didn't find it. Perhaps it is a JSP file. > if (path == null && COMMAND_COMPILE_SINGLE.equals(command)) { > root = null; > groups = ProjectUtils.getSources(project).getSourceGroups("doc_root"); > for (int gi = 0; gi < groups.length; ++gi) { > root = groups[gi].getRootFolder(); > FileObject[] files = ActionUtils.findSelectedFiles(context, root, ".jsp", true); // NOI18N > if (files != null && files.length > 0) { > path = FileUtil.getRelativePath(root, files[0]); > break; > } > } > // What else? Replace the command with e g 'compile-single-jsp'? For now the Ant script will have > // to make the distinction. > } > // If found, set properties. > if (path != null) { > p = new Properties(); > p.setProperty("context.path", path); > if (path.endsWith(".java")) { > String base = path.substring(0, path.length()-5); > p.setProperty("context.base", base); > String clazz = base.replace('/', '.'); > p.setProperty("context.class", clazz); > } > String relRoot = FileUtil.getRelativePath(project.getProjectDirectory(), root); > p.setProperty("context.root", relRoot); > } > } > > 97c153 < runConfiguredAction(project, actionEl); --- > runConfiguredAction(project, actionEl, p); 107c163 < private static void runConfiguredAction(FreeformProject project, Element actionEl) { --- > private static void runConfiguredAction(FreeformProject project, Element actionEl, Properties props) { 138c194 < ActionUtils.runTarget(scriptFile, targetNameArray, null); --- > ActionUtils.runTarget(scriptFile, targetNameArray, props); 200c256 < runConfiguredAction(p, actionEl); --- > runConfiguredAction(p, actionEl, null);