You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/11/05 18:43:51 UTC

[GitHub] [netbeans] Richard7111 commented on a diff in pull request #4792: Close whole documents list at once

Richard7111 commented on code in PR #4792:
URL: https://github.com/apache/netbeans/pull/4792#discussion_r1014678543


##########
platform/core.multitabs/src/org/netbeans/core/multitabs/impl/DocumentSwitcherTable.java:
##########
@@ -174,7 +177,27 @@ public String getToolTipText( MouseEvent event ) {
         }
         return null;
     }
-
+    
+    boolean closeSelectedDocumentList() {
+        List<TabData> tabs = controller.getTabModel().getTabs();
+        Item item = ( Item ) getModel().getValueAt( getSelectedRow(), getSelectedColumn());
+        ProjectProxy project = item.getProject();
+        ProjectSupport projectSupport = ProjectSupport.getDefault();
+        int numOfOtherTabs = 0;
+        for ( int i = tabs.size(); i-- > 0; ) {  //reverse iteration to close tabs from the end so tabIndex does not change
+            TabData projectTab = tabs.get( i );
+            ProjectProxy projectForTab = projectSupport.getProjectForTab( projectTab );
+            if (( project == null && projectForTab == null ) || ( projectForTab != null && projectForTab.equals( project ))) {

Review Comment:
   There is a case, when no project is associated when file and variables projectForTab and project are null. Such as here for example: 
   ![image](https://user-images.githubusercontent.com/94047859/200135894-ab5d695b-9fd7-4203-a3f0-65d293dc3090.png)
   



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists