This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 256633 - Multiple project run - projects do not run in display order
Summary: Multiple project run - projects do not run in display order
Status: REOPENED
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jan Peska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-16 22:29 UTC by mclaborn
Modified: 2016-06-21 10:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (553.78 KB, text/plain)
2015-11-16 22:29 UTC, mclaborn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mclaborn 2015-11-16 22:29:50 UTC
Product Version = NetBeans IDE 8.1 (Build 201510222201)
Operating System = Linux version 3.13.0-68-generic running on amd64
Java; VM; Vendor = 1.8.0_51
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.51-b03

Reproducibility: Happens every time

Using the projects view, selecting multiple projects, right click and "run". The projects should run in the order displayed in the Projects view, but do not.  This makes it difficult to determine if all of them have finished running. (Regression from 8.0.2)

STEPS:
  * Select several projects in hte Projects view
  * Right click and choose "Run"

ACTUAL:
  The projects run in apparently random order. 

EXPECTED:
  The projects should run in the order in which they are displayed in the Projects view.
Comment 1 mclaborn 2015-11-16 22:29:55 UTC
Created attachment 157367 [details]
IDE log
Comment 2 mclaborn 2016-01-09 18:12:16 UTC
Update on this.  If you click once on the first project and then once on the last project, they seem to run in order. If you do that, then ctrl + click to de-select some in the middle of the list, the order is messed up.
Comment 3 Jiri Prox 2016-01-14 13:46:00 UTC
Can you please provide more details. I've tried to reproduce it, but the project always run in the order, I've selected them.
Comment 4 mclaborn 2016-01-14 14:34:52 UTC
This is 100% repeatable for me.

I have 4 projects that are next to each other, call them A, B, C and D.

Scenario 1:
- Click on A
- Shift+Click on D
- All 4 projects are selected
- Right click and Run
- Projects run in order A,B,C,D (this is good)

Scenario 2:
- Click on A
- Shift+Click on D
- Ctrl+Click on B to deselect it
- Right click and Run
- Projects run in this order: D,C,A (this is bad)
Comment 5 Jiri Prox 2016-01-15 19:43:54 UTC
Reproducible

Thanks for scenarios.
Comment 6 Tomas Zezula 2016-06-21 06:49:35 UTC
Probably not related to java/projects but generic projects.
But I will take a look.
Comment 7 Tomas Zezula 2016-06-21 10:51:37 UTC
The order of selected nodes is done by BeanTreeView, reassigning to explorer.
However while debugging I've found the problematic part which is in the JDK's DefaultTreeSelectionModel. Removing the node calls DefaultTreeSelectionModel.removeSelectionPaths(TreePath[] paths) which does:


/* Find the paths that can be removed. */
                for (int removeCounter = paths.length - 1; removeCounter >= 0;
                     removeCounter--) {
                    if(paths[removeCounter] != null) {
                        if (uniquePaths.get(paths[removeCounter]) != null) {
                            if(pathsToRemove == null)
                                pathsToRemove = new Vector<PathPlaceHolder>(paths.length);
                            uniquePaths.remove(paths[removeCounter]);
                            pathsToRemove.addElement(new PathPlaceHolder
                                         (paths[removeCounter], false));
                        }
                    }
                }


And later:

Enumeration<TreePath> pEnum = uniquePaths.keys();
                        int                  validCount = 0;

                        selection = new TreePath[selection.length -
                                                removeCount];
                        while (pEnum.hasMoreElements()) {
                            selection[validCount++] = pEnum.nextElement();
                        }


The problem is that uniquePaths is a Hashtable which does not preserve order.
So the composite selection does not preserve order.