Hi Thomas, there are two actions: fix imports and organize imports
I think fix imports will only try to make it compile, while organize imports is doing the sorting/formatting you are asking for.
Regarding inserting new imports at the right place: I don't know tbh, could be potentially a bug, but it could be also intended that the organize imports action is supposed to run after that.
-mbien On 01.08.23 10:13, Thomas Kellerer wrote:
I have noticed that "Fix Imports" does not sort the imports. I _think_ NetBeans did sort the imports at some point. But now it's always appended at the end - or somewhere near the end. E.g. I have existing imports like this: import javax.portlet.Portlet; import javax.portlet.PortletException; import javax.portlet.PortletPreferences; import javax.portlet.PortletRequestDispatcher; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.portlet.PortletFileUpload; import org.apache.commons.lang.StringUtils; import com.liferay.portal.kernel.model.Organization; import com.liferay.portal.kernel.model.User; import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet; import com.liferay.portal.kernel.theme.ThemeDisplay; import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.WebKeys; import org.apache.log4j.Logger; import org.osgi.service.component.annotations.Component; Now I add a reference to PortletSession and "Fix Imports" inserts that after the com. but before the org. packages: import javax.portlet.Portlet; import javax.portlet.PortletException; import javax.portlet.PortletPreferences; import javax.portlet.PortletRequestDispatcher; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.portlet.PortletFileUpload; import org.apache.commons.lang.StringUtils; import com.liferay.portal.kernel.model.Organization; import com.liferay.portal.kernel.model.User; import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet; import com.liferay.portal.kernel.theme.ThemeDisplay; import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.WebKeys; import javax.portlet.PortletSession; ----<<<<< Why is this added here? And not import org.apache.log4j.Logger; import org.osgi.service.component.annotations.Component; Why isn't the new import added after to the group of "javax.portlet.*" imports? (or even better after the line with PortletRequestDispatcher) I tried to turn on and off "Separate Groups" but that doesn't change the behaviour. This is with NetBeans 18 and 19-rc3 Is there a setting I have changed but can't find any more? Or am I remembering this incorrectly and NetBeans never sorted the imports at all? Regards Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org For additional commands, e-mail: users-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists