# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /Users/fanis/repositories/core-main # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/resources/build-impl.xsl --- j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/resources/build-impl.xsl +++ j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/resources/build-impl.xsl @@ -2368,7 +2368,7 @@ have.tests init,compile-test,-pre-test-run - + Index: j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/resources/build-impl.xsl --- j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/resources/build-impl.xsl +++ j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/resources/build-impl.xsl @@ -2345,7 +2345,7 @@ have.tests init,compile-test,-pre-test-run - + Index: java.api.common/manifest.mf --- java.api.common/manifest.mf +++ java.api.common/manifest.mf @@ -1,4 +1,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.java.api.common/0 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.67 +OpenIDE-Module-Specification-Version: 1.68 Index: java.api.common/nbproject/project.xml --- java.api.common/nbproject/project.xml +++ java.api.common/nbproject/project.xml @@ -11,7 +11,7 @@ 3 - 3.73 + 3.74 Index: java.api.common/src/org/netbeans/modules/java/api/common/project/BaseActionProvider.java --- java.api.common/src/org/netbeans/modules/java/api/common/project/BaseActionProvider.java +++ java.api.common/src/org/netbeans/modules/java/api/common/project/BaseActionProvider.java @@ -475,13 +475,21 @@ if (targetNames == null) { return; } + final String command2execute; + if(COMMAND_TEST_SINGLE.equals(command) && targetNames.length == 1 && targetNames[0].equals(COMMAND_TEST)) { + //multiple files or package(s) selected so we need to call test target instead of test-single + command2execute = COMMAND_TEST; + p.put("nb.internal.action.name", command2execute); + } else { + command2execute = command; + } if (isCompileOnSaveEnabled) { - if (COMMAND_BUILD.equals(command) && !allowAntBuild()) { + if (COMMAND_BUILD.equals(command2execute) && !allowAntBuild()) { showBuildActionWarning(context); return ; } Map execProperties = new HashMap(); - execProperties.put("nb.internal.action.name", command); + execProperties.put("nb.internal.action.name", command2execute); copyMultiValue(ProjectProperties.RUN_JVM_ARGS, execProperties); prepareWorkDir(execProperties); @@ -508,7 +516,7 @@ String url = p.getProperty("applet.url"); execProperties.put("applet.url", url); execProperties.put(JavaRunner.PROP_EXECUTE_FILE, file); - prepareSystemProperties(execProperties, command, context, false); + prepareSystemProperties(execProperties, command2execute, context, false); task = JavaRunner.execute(targetNames[0], execProperties); } @@ -517,50 +525,54 @@ } return; } - if (!isServerExecution() && (COMMAND_RUN.equals(command) || COMMAND_DEBUG.equals(command) || COMMAND_DEBUG_STEP_INTO.equals(command) || COMMAND_PROFILE.equals(command))) { - prepareSystemProperties(execProperties, command, context, false); + if (!isServerExecution() && (COMMAND_RUN.equals(command2execute) || COMMAND_DEBUG.equals(command2execute) || COMMAND_DEBUG_STEP_INTO.equals(command2execute) || COMMAND_PROFILE.equals(command2execute))) { + prepareSystemProperties(execProperties, command2execute, context, false); AtomicReference _task = new AtomicReference(); - bypassAntBuildScript(command, context, execProperties, _task); + bypassAntBuildScript(command2execute, context, execProperties, _task); task = _task.get(); return ; } // for example RUN_SINGLE Java file with Servlet must be run on server and not locally boolean serverExecution = p.getProperty(PROPERTY_RUN_SINGLE_ON_SERVER) != null; p.remove(PROPERTY_RUN_SINGLE_ON_SERVER); - if (!serverExecution && (COMMAND_RUN_SINGLE.equals(command) || COMMAND_DEBUG_SINGLE.equals(command) || COMMAND_PROFILE_SINGLE.equals(command))) { - prepareSystemProperties(execProperties, command, context, false); - if (COMMAND_RUN_SINGLE.equals(command)) { + if (!serverExecution && (COMMAND_RUN_SINGLE.equals(command2execute) || COMMAND_DEBUG_SINGLE.equals(command2execute) || COMMAND_PROFILE_SINGLE.equals(command2execute))) { + prepareSystemProperties(execProperties, command2execute, context, false); + if (COMMAND_RUN_SINGLE.equals(command2execute)) { execProperties.put(JavaRunner.PROP_CLASSNAME, p.getProperty("run.class")); - } else if (COMMAND_DEBUG_SINGLE.equals(command)) { + } else if (COMMAND_DEBUG_SINGLE.equals(command2execute)) { execProperties.put(JavaRunner.PROP_CLASSNAME, p.getProperty("debug.class")); } else { execProperties.put(JavaRunner.PROP_CLASSNAME, p.getProperty("profile.class")); } AtomicReference _task = new AtomicReference(); - bypassAntBuildScript(command, context, execProperties, _task); + bypassAntBuildScript(command2execute, context, execProperties, _task); task = _task.get(); return; } String buildDir = evaluator.getProperty(ProjectProperties.BUILD_DIR); - if (COMMAND_TEST_SINGLE.equals(command) || COMMAND_DEBUG_TEST_SINGLE.equals(command) || COMMAND_PROFILE_TEST_SINGLE.equals(command)) { + if (COMMAND_TEST_SINGLE.equals(command2execute) || COMMAND_DEBUG_TEST_SINGLE.equals(command2execute) || COMMAND_PROFILE_TEST_SINGLE.equals(command2execute)) { @SuppressWarnings("MismatchedReadAndWriteOfArray") FileObject[] files = findTestSources(context, true); + if(files == null) { + //user invoked "Test Package" action on a package with one test class + files = findTestSources(context); + } try { - prepareSystemProperties(execProperties, command, context, true); + prepareSystemProperties(execProperties, command2execute, context, true); execProperties.put(JavaRunner.PROP_EXECUTE_FILE, files[0]); if (buildDir != null) { // #211543 execProperties.put("tmp.dir", updateHelper.getAntProjectHelper().resolvePath(buildDir)); } - updateJavaRunnerClasspath(command, execProperties); + updateJavaRunnerClasspath(command2execute, execProperties); task = - JavaRunner.execute(command.equals(COMMAND_TEST_SINGLE) ? JavaRunner.QUICK_TEST : (COMMAND_DEBUG_TEST_SINGLE.equals(command) ? JavaRunner.QUICK_TEST_DEBUG :JavaRunner.QUICK_TEST_PROFILE), + JavaRunner.execute(command2execute.equals(COMMAND_TEST_SINGLE) ? JavaRunner.QUICK_TEST : (COMMAND_DEBUG_TEST_SINGLE.equals(command2execute) ? JavaRunner.QUICK_TEST_DEBUG :JavaRunner.QUICK_TEST_PROFILE), execProperties); } catch (IOException ex) { Exceptions.printStackTrace(ex); } return; } - if (SingleMethod.COMMAND_RUN_SINGLE_METHOD.equals(command) || SingleMethod.COMMAND_DEBUG_SINGLE_METHOD.equals(command)) { + if (SingleMethod.COMMAND_RUN_SINGLE_METHOD.equals(command2execute) || SingleMethod.COMMAND_DEBUG_SINGLE_METHOD.equals(command2execute)) { SingleMethod methodSpec = findTestMethods(context)[0]; try { execProperties.put("methodname", methodSpec.getMethodName());//NOI18N @@ -568,9 +580,9 @@ if (buildDir != null) { execProperties.put("tmp.dir",updateHelper.getAntProjectHelper().resolvePath(buildDir)); } - updateJavaRunnerClasspath(command, execProperties); + updateJavaRunnerClasspath(command2execute, execProperties); task = - JavaRunner.execute(command.equals(SingleMethod.COMMAND_RUN_SINGLE_METHOD) ? JavaRunner.QUICK_TEST : JavaRunner.QUICK_TEST_DEBUG, + JavaRunner.execute(command2execute.equals(SingleMethod.COMMAND_RUN_SINGLE_METHOD) ? JavaRunner.QUICK_TEST : JavaRunner.QUICK_TEST_DEBUG, execProperties); } catch (IOException ex) { Exceptions.printStackTrace(ex); @@ -578,12 +590,12 @@ return; } } - collectStartupExtenderArgs(p, command); - Set concealedProperties = collectAdditionalProperties(p, command, context); + collectStartupExtenderArgs(p, command2execute); + Set concealedProperties = collectAdditionalProperties(p, command2execute, context); if (targetNames.length == 0) { targetNames = null; } - if (isCompileOnSaveEnabled && !NO_SYNC_COMMANDS.contains(command)) { + if (isCompileOnSaveEnabled && !NO_SYNC_COMMANDS.contains(command2execute)) { p.put("nb.wait.for.caches", "true"); } final Callback cb = getCallback(); @@ -599,7 +611,7 @@ DialogDisplayer.getDefault().notify(nd); } else { if (cb2 != null) { - cb2.antTargetInvocationStarted(command, context); + cb2.antTargetInvocationStarted(command2execute, context); } try { task = ActionUtils.runTarget(buildFo, targetNames, p, concealedProperties); @@ -615,19 +627,19 @@ } } finally { if (cb2 != null) { - cb2.antTargetInvocationFinished(command, context, task.result()); + cb2.antTargetInvocationFinished(command2execute, context, task.result()); } } } }); } catch (IOException ex) { if (cb2 != null) { - cb2.antTargetInvocationFailed(command, context); + cb2.antTargetInvocationFailed(command2execute, context); } throw ex; } catch (RuntimeException ex) { if (cb2 != null) { - cb2.antTargetInvocationFailed(command, context); + cb2.antTargetInvocationFailed(command2execute, context); } throw ex; } @@ -792,11 +804,17 @@ targetNames = getCommands().get(command); } else if ( command.equals( COMMAND_TEST_SINGLE ) ) { p.setProperty("ignore.failing.tests", "true"); //NOI18N - final FileObject[] files = findTestSources(context, true); + final FileObject[] files = findTestSources(context); if (files == null) { return null; } + if(files.length == 1) { + //one file or a package containing one file selected targetNames = setupTestSingle(p, files); + } else { + //multiple files or package(s) selected + targetNames = setupTestFilesOrPackages(p, files); + } } else if ( command.equals( COMMAND_DEBUG_TEST_SINGLE ) ) { final FileObject[] files = findTestSources(context, true); if (files == null) { @@ -1366,6 +1384,14 @@ return new String[] {"test-single"}; // NOI18N } + private String[] setupTestFilesOrPackages(Properties p, FileObject[] files) { + if (files != null) { + FileObject root = getRoot(projectTestRoots.getRoots(), files[0]); + p.setProperty("includes", ActionUtils.antIncludesList(files, root)); // NOI18N + } + return new String[]{"test"}; // NOI18N + } + private String[] setupDebugTestSingle(Properties p, FileObject[] files) { FileObject[] testSrcPath = projectTestRoots.getRoots(); FileObject root = getRoot(testSrcPath, files[0]); @@ -1443,8 +1469,8 @@ || findSourcesAndPackages( context, projectTestRoots.getRoots()) != null; } else if ( command.equals( COMMAND_TEST_SINGLE ) ) { - FileObject[] fos = findTestSources(context, true); - return fos != null && fos.length == 1; + FileObject[] fos = findTestSources(context); + return fos != null; } else if ( command.equals( COMMAND_DEBUG_TEST_SINGLE ) ) { FileObject[] fos = findTestSources(context, true); @@ -1545,9 +1571,21 @@ */ @org.netbeans.api.annotations.common.SuppressWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS") private @CheckForNull FileObject[] findSources(Lookup context) { + return findSources(context, true, false); + } + + /** + * Find selected source files + * + * @param context the lookup in which files should be found + * @param strict if true, all files in the selection have to be accepted + * @param findInPackages if true, all files under a selected package in the selection will also be checked + */ + @org.netbeans.api.annotations.common.SuppressWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS") + private @CheckForNull FileObject[] findSources(Lookup context, boolean strict, boolean findInPackages) { FileObject[] srcPath = projectSourceRoots.getRoots(); for (int i=0; i< srcPath.length; i++) { - FileObject[] files = ActionUtils.findSelectedFiles(context, srcPath[i], ".java", true); // NOI18N + FileObject[] files = ActionUtils.findSelectedFiles(context, srcPath[i], ".java", strict, findInPackages); // NOI18N if (files != null) { return files; } @@ -1588,25 +1626,38 @@ */ @org.netbeans.api.annotations.common.SuppressWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS") private @CheckForNull FileObject[] findTestSources(Lookup context, boolean checkInSrcDir) { + return findTestSources(context, checkInSrcDir, true, false); + } + + /** + * Find selected tests and/or tests which belong to selected source files + * + * @param context the lookup in which files should be found + * @param checkInSrcDir if true, tests which belong to selected source files will be searched for + * @param strict if true, all files in the selection have to be accepted + * @param findInPackages if true, all files under a selected package in the selection will also be checked + */ + @org.netbeans.api.annotations.common.SuppressWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS") + private @CheckForNull FileObject[] findTestSources(Lookup context, boolean checkInSrcDir, boolean strict, boolean findInPackages) { //XXX: Ugly, should be rewritten - FileObject[] testSrcPath = projectTestRoots.getRoots(); - for (int i=0; i< testSrcPath.length; i++) { - FileObject[] files = ActionUtils.findSelectedFiles(context, testSrcPath[i], ".java", true); // NOI18N + FileObject[] testSrcPaths = projectTestRoots.getRoots(); + for (FileObject testSrcPath : testSrcPaths) { + FileObject[] files = ActionUtils.findSelectedFiles(context, testSrcPath, ".java", strict, findInPackages); // NOI18N if (files != null) { return files; } } - if (checkInSrcDir && testSrcPath.length>0) { - FileObject[] files = findSources (context); + if (checkInSrcDir && testSrcPaths.length>0) { + FileObject[] files = findSources (context, strict, findInPackages); if (files != null) { //Try to find the test under the test roots FileObject srcRoot = getRoot(projectSourceRoots.getRoots(),files[0]); - for (int i=0; i testFiles = new HashSet<>(); + if(testSourcesFOs == null) { + return findTestSources(context, true, true, true); + } else { + if(sourcesFOs == null) { + return testSourcesFOs; + } else { + testFiles.addAll(Arrays.asList(testSourcesFOs)); + //Try to find the test under the test roots + FileObject srcRoot = getRoot(projectSourceRoots.getRoots(),sourcesFOs[0]); + for (FileObject testRoot : projectTestRoots.getRoots()) { + FileObject[] files2 = ActionUtils.regexpMapFiles(sourcesFOs, srcRoot, SRCDIRJAVA, testRoot, SUBST, true); + if (files2 != null) { + for (FileObject fo : files2) { + if(!testFiles.contains(fo)) { + testFiles.add(fo); + } + } + } + FileObject[] files2NG = ActionUtils.regexpMapFiles(sourcesFOs, srcRoot, SRCDIRJAVA, testRoot, SUBSTNG, true); + if (files2NG != null) { + for (FileObject fo : files2NG) { + if(!testFiles.contains(fo)) { + testFiles.add(fo); + } + } + } + } + } + } + return testFiles.isEmpty() ? null : testFiles.toArray(new FileObject[testFiles.size()]); + } /** * Finds single method specification objects corresponding to JUnit test Index: java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl --- java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl +++ java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl @@ -2397,7 +2397,7 @@ have.tests init,compile-test,-pre-test-run - + Index: java.project/src/org/netbeans/spi/java/project/support/ui/Bundle.properties --- java.project/src/org/netbeans/spi/java/project/support/ui/Bundle.properties +++ java.project/src/org/netbeans/spi/java/project/support/ui/Bundle.properties @@ -75,3 +75,7 @@ ACSD_excludesLabel=Excludes pattern ACSN_IncludeExcludeVisualizerPanel=Include Exclude Panel ACSD_IncludeExcludeVisualizerPanel=Include and Exclude patterns for project + +# Name of package action +# {0} - # of selected packages +LBL_TestPackageAction_Name=T&est {0,choice,0#Package|1#Package|1()); + testPackageAction = FileSensitiveActions.fileCommandAction(ActionProvider.COMMAND_TEST_SINGLE, NbBundle.getMessage(PackageViewChildren.class, "LBL_TestPackageAction_Name"), null); this.root = group.getRootFolder(); this.group = group; visibility_refresh = VISIBILITY_CHANGE_RP.create(new Runnable() { @@ -757,6 +760,7 @@ else if ( superActions[i] instanceof FileSystemAction ) { actionList.add (null); // insert separator and new action actionList.add (FileSensitiveActions.fileCommandAction(ActionProvider.COMMAND_COMPILE_SINGLE, LBL_CompilePackage_Action(), null)); + actionList.add (testPackageAction); actionList.addAll((List) org.openide.util.Utilities.actionsForPath("Projects/package/Actions")); } Index: o.apache.tools.ant.module/apichanges.xml --- o.apache.tools.ant.module/apichanges.xml +++ o.apache.tools.ant.module/apichanges.xml @@ -110,6 +110,24 @@ + + + Added findSelectedFiles(Lookup context, FileObject dir, String suffix, boolean strict, boolean findInPackages) method + + + + + +

+ Ability to find a file selection also in FileObjects found in + context that represent folders depending on the value of the + findInPackages parameter. The old method is bridged into the new one. +

+
+ + +
+ Added AntTargetExecutor.Env.setConcealedProperties Index: o.apache.tools.ant.module/nbproject/project.properties --- o.apache.tools.ant.module/nbproject/project.properties +++ o.apache.tools.ant.module/nbproject/project.properties @@ -42,7 +42,7 @@ javac.compilerargs=-Xlint:unchecked javac.source=1.7 -spec.version.base=3.73.0 +spec.version.base=3.74.0 compile.ant.jar=${ant.core.lib} src-bridge.cp.extra=build/classes:${compile.ant.jar} extra.module.files=\ Index: o.apache.tools.ant.module/src/org/apache/tools/ant/module/api/support/ActionUtils.java --- o.apache.tools.ant.module/src/org/apache/tools/ant/module/api/support/ActionUtils.java +++ o.apache.tools.ant.module/src/org/apache/tools/ant/module/api/support/ActionUtils.java @@ -154,6 +154,39 @@ * @see ActionProvider.isActionEnabled(...) */ public static FileObject[] findSelectedFiles(Lookup context, FileObject dir, String suffix, boolean strict) { + return findSelectedFiles(context, dir, suffix, strict, false); + } + + /** + * Convenience method to find a file selection in a selection (context). + * All files must exist on disk (according to {@link FileUtil#toFile}). + * If a constraining directory is supplied, they must also be contained in it. + * If a constraining file suffix is supplied, the base names of the files + * must end with that suffix. + * The return value is null if there are no matching files; or if the strict + * parameter is true and some of the files in the selection did not match + * the constraints (disk files, directory, and/or suffix). + *

+ * Typically {@link org.openide.loaders.DataNode}s will form a node selection + * which will be placed in the context. This method does not directly + * look for nodes in the selection; but generally the lookups of the nodes in + * a node selection are spliced into the context as well, so the {@link FileObject}s + * should be available. A corollary of not checking nodes directly is that any + * nodes in the context which do not correspond to files at all (i.e. do not have + * {@link FileObject} in their lookup) are ignored, even with the strict parameter on; + * and that multiple nodes in the context with the same associated file are treated + * as a single entry. + *

+ * @param context a selection as provided to e.g. ActionProvider.isActionEnabled(...) + * @param dir a constraining parent directory, or null to not check for a parent directory + * @param suffix a file suffix (e.g. .java) to constrain files by, + * or null to not check suffixes + * @param strict if true, all files in the selection have to be accepted + * @param findInPackages if true, all files under any package in the selection will also be checked + * @return a nonempty selection of disk files, or null + * @see ActionProvider.isActionEnabled(...) + */ + public static FileObject[] findSelectedFiles(Lookup context, FileObject dir, String suffix, boolean strict, boolean findInPackages) { if (dir != null && !dir.isFolder()) { throw new IllegalArgumentException("Not a folder: " + dir); // NOI18N } @@ -173,7 +206,37 @@ candidates = _candidates; } Collection files = new LinkedHashSet(); // #50644: remove dupes + Collection selectedFiles = findSelectedFiles(candidates, dir, suffix, strict, findInPackages); + if(selectedFiles != null) { + files.addAll(selectedFiles); + } + + if (findInPackages) { + Collection packageCandidates = new ArrayList<>(); for (FileObject f : candidates) { + if (f.isFolder()) { + FileObject[] children = f.getChildren(); + for (FileObject child : children) { + if (child.isData()) { + packageCandidates.add(child); + } + } + } + } + Collection selectedFilesInPackages = findSelectedFiles(packageCandidates, dir, suffix, strict, findInPackages); + if (selectedFilesInPackages != null) { + files.addAll(selectedFilesInPackages); + } + } + if (files.isEmpty()) { + return null; + } + return files.toArray(new FileObject[files.size()]); + } + + private static Collection findSelectedFiles(Collection candidates, FileObject dir, String suffix, boolean strict, boolean findInPackages) { + Collection files = new LinkedHashSet<>(); // #50644: remove dupes + for (FileObject f : candidates) { if (f.hasExt("form")) { continue; // #206309 } @@ -190,13 +253,15 @@ if (matches) { files.add(f); } else if (strict) { + if(!findInPackages) { return null; } } + } if (files.isEmpty()) { return null; } - return files.toArray(new FileObject[files.size()]); + return files; } /** Index: o.apache.tools.ant.module/test/unit/src/org/apache/tools/ant/module/api/support/ActionUtilsTest.java --- o.apache.tools.ant.module/test/unit/src/org/apache/tools/ant/module/api/support/ActionUtilsTest.java +++ o.apache.tools.ant.module/test/unit/src/org/apache/tools/ant/module/api/support/ActionUtilsTest.java @@ -71,8 +71,8 @@ } private FileObject dir, f1, f1form, f2, subdir, f3, fx, subdir2, f3a, f4, subsubdir, f5, f5a; - private DataObject d1, d2, d3, dx; - private Node n1, n2, n3, nx; + private DataObject d1, d2, d3, dx, d4; + private Node n1, n2, n3, nx, n4; @Override protected void setUp() throws Exception { @@ -95,10 +95,12 @@ d2 = DataObject.find(f2); d3 = DataObject.find(f3); dx = DataObject.find(fx); + d4 = DataObject.find(subdir2); n1 = d1.getNodeDelegate(); n2 = d2.getNodeDelegate(); n3 = d3.getNodeDelegate(); nx = dx.getNodeDelegate(); + n4 = d4.getNodeDelegate(); } public void testFindSelectedFiles() throws Exception { @@ -119,6 +121,10 @@ assertEquals("duplicates removed #2 (cf. #50644)", Arrays.asList(new FileObject[] {f1, f2}), filesFrom(new Node[] {n1, n2, n1}, null, null, true)); assertEquals("two selected files", Arrays.asList(new FileObject[] {f1, f2}), files2List(ActionUtils.findSelectedFiles(Lookups.fixed(f1, f2), null, null, true))); assertEquals("one form, one selection", Collections.singletonList(f1), files2List(ActionUtils.findSelectedFiles(Lookups.fixed(f1, f1form), null, ".data", true))); + assertEquals("one selected directory", Collections.singletonList(subdir2), filesFrom(new Node[] {n4}, subdir2, null, true, false)); + assertEquals("one selected directory, two selected files", Arrays.asList(new FileObject[] {subdir2, f5, f4}), filesFrom(new Node[] {n4}, subdir2, null, true, true)); + assertEquals("zero selection", null, filesFrom(new Node[] {n4}, subdir2, ".data", true, false)); + assertEquals("two selected files", Arrays.asList(new FileObject[] {f5, f4}), filesFrom(new Node[] {n4}, subdir2, "data", true, true)); } private static Lookup context(Node[] sel) { @@ -131,9 +137,13 @@ } private static List filesFrom(Node[] sel, FileObject dir, String suffix, boolean strict) { - return files2List(ActionUtils.findSelectedFiles(context(sel), dir, suffix, strict)); + return filesFrom(sel, dir, suffix, strict, false); } + private static List filesFrom(Node[] sel, FileObject dir, String suffix, boolean strict, boolean findInPackages) { + return files2List(ActionUtils.findSelectedFiles(context(sel), dir, suffix, strict, findInPackages)); + } + public void testAntIncludesList() throws Exception { assertEquals("2 includes", "f1.data,sub/f3.data", ActionUtils.antIncludesList(new FileObject[] {f1, f3}, dir)); assertEquals("1 include", "f1.data", ActionUtils.antIncludesList(new FileObject[] {f1}, dir)); Index: projectui/src/org/netbeans/modules/project/ui/actions/Bundle.properties --- projectui/src/org/netbeans/modules/project/ui/actions/Bundle.properties +++ projectui/src/org/netbeans/modules/project/ui/actions/Bundle.properties @@ -80,9 +80,11 @@ LBL_RunMainProjectAction_Name=&Run {0,choice,-1#Main Project|0#Project|1#Project ({1})|1<{0} Projects} +# Name of 1-off actions +# {0} - # of selected files LBL_RunSingleAction_Name=Run &File # {0,choice,0#File|1#"{1}"|1 have.tests init,compile-test,-pre-test-run - +