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 206330 - Organize imports - Option 'Separate groups' is not working
Summary: Organize imports - Option 'Separate groups' is not working
Status: RESOLVED WORKSFORME
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.2
Hardware: Macintosh (x86) Mac OS X
: P3 normal with 4 votes (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-13 14:02 UTC by dzielnywoj
Modified: 2012-10-26 11:48 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project to demonstrate lack of splitting out the import groups. (25.39 KB, application/zip)
2012-09-23 06:59 UTC, webigrator
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dzielnywoj 2011-12-13 14:02:10 UTC
When i try organize import section NB don't separate groups.

I Expect to see something like that:

---
import com.scc.gcmsetup.SchedulerDB;

import electric.xml.Document;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
---

but i get this:

---
import com.scc.gcmsetup.SchedulerDB;
import electric.xml.Document;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
---

There are no separating new line between groups
Comment 1 Jiri Prox 2011-12-13 14:23:10 UTC
Just for sure, did you check 'separate groups' in formatting setting?
Comment 2 dzielnywoj 2011-12-13 14:48:19 UTC
Of course:)
Comment 3 Dusan Balek 2012-04-12 11:56:43 UTC
Unfortunately, I cannot reproduce the problem in the current dev build. Could you please create a simple test project (containing a simple test source together with the corresponding formatting options) and attach it to the issue? Thanks.
Comment 4 webigrator 2012-09-23 06:59:30 UTC
Created attachment 124767 [details]
Project to demonstrate lack of splitting out the import groups.

7.2 on Mac OS X (Mountain Lion) exhibits this behavior.
Comment 5 Jiri Prox 2012-09-24 10:54:27 UTC
The separate groups works fine for the given file. 

The only thing which is maybe not so user friendly is that the user have to define the groups himself - e.g. there is not automatic detection of the groups but user has to enter java.text, java.util, etc in the formatting dialog.
Comment 6 rmuller 2012-10-25 09:56:42 UTC
I can confirm that this feature is working correctly @ Netbeans 7.2.1 (both on Windows and Linux) BUT it is important that the package group names do NOT end with a dot. So this works:
java
javax
eu.infomas
<all other imports>

And this dus NOT work:
java.
javax.
eu.infomas.
<all other imports>

This behaviour is not documented.
Comment 7 neilwightman 2012-10-26 11:10:02 UTC
I still never see any empty lines between groups like in the past versions of Netbeans.

I get 

---
import com.scc.gcmsetup.SchedulerDB;
import electric.xml.Document;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
---

when I would expect

---
import com.scc.gcmsetup.SchedulerDB;

import electric.xml.Document;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
---

Also I never allow * for any imports.

This appears to be the change with a standard installation of Netbeans.

Now it appears you must enter the groups you want to have groups yourself instead of the automatic process like in the past.

Is there no way to get the previous type functionality back?
Comment 8 Arthemiz 2012-10-26 11:47:13 UTC
In order option 'Separate groups' will work, you need to specify package names in the table above the option.