tmysik commented on code in PR #8196:
URL: https://github.com/apache/netbeans/pull/8196#discussion_r1929721891
##########
php/php.project/src/org/netbeans/modules/php/project/ComputeTestMethodAnnotations.java:
##########
@@ -142,59 +178,72 @@ public void run() {
}
}
- private List<TestMethod> getTestMethods(Document document) {
- List<TestMethod> testMethods = new ArrayList<>();
- FileObject fileObject = NbEditorUtilities.getFileObject(document);
- if (fileObject != null) {
- PhpProject project = PhpProjectUtils.getPhpProject(fileObject);
- assert project != null;
- PhpModule phpModule = project.getPhpModule();
- for (PhpTestingProvider testingProvider :
project.getTestingProviders()) {
+ /**
+ * Get test methods for the first available testing provider.
+ *
+ * @return test methods
+ */
+ private List<TestMethod> getTestMethods() {
+ FileObject fileObject =
NbEditorUtilities.getFileObject(handledDocument);
+ if (fileObject == null) {
+ return Collections.emptyList();
+ }
+ PhpProject project = PhpProjectUtils.getPhpProject(fileObject);
+ if (project == null) {
+ return Collections.emptyList();
+ }
+ PhpTestingProvider testingProvider =
getFirstTestingProvider(handledDocument);
+ if (testingProvider == null) {
+ return Collections.emptyList();
+ }
+ return getTestMethods(fileObject, testingProvider,
project.getPhpModule());
+ }
- if (!document.equals(handledDocument)) {
+ private List<TestMethod> getTestMethods(FileObject fileObject,
PhpTestingProvider testingProvider, PhpModule phpModule) {
+ List<TestMethod> testMethods = new ArrayList<>();
+ Collection<PhpClass> phpClasses = getPhpClasses(fileObject);
+ for (PhpClass phpClass : phpClasses) {
+ // check whether the document tab has already been switched to
another one
+ if (!handledDocument.equals(getLastFocusedDocument())) {
Review Comment:
The purpose was to quit fast if the focused document has already changed.
Maybe, your code does the same?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists