mbien commented on code in PR #4792:
URL: https://github.com/apache/netbeans/pull/4792#discussion_r1014698276
##########
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
Review Comment:
a defensive copy would look like:
`List<TabData> tabs = new ArrayList<>(controller.getTabModel().getTabs());`
instead of
`List<TabData> tabs = controller.getTabModel().getTabs();`
now you could simply iterate through `tabs` with a normal for loop since it
is a copy of the original and won't change while you iterate.
--
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