Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Organize Imports and import static xxx.yyy.*(Feature Request)
Organize Imports and import static xxx.yyy.* [message #690498] Wed, 29 June 2011 11:40 Go to next message
Eclipse UserFriend

Should "Organize Imports" be customized to allow import static xxx.yyy.* to be left alone?[ 2 votes ]
1.No 0 / 0%
2.Yes 2 / 100%

It would be nice if Organize Imports worked differently with import static, at least optionally.

While I DO agree that Organize Imports should convert stuff like

import javax.swing.*;


to a list of imports actually used, since I consider the above an abomination when reading someone else's code, I would rather not have Eclipse perform the same logic on something like

import static java.awt.event.KeyEvent.*;


I might, for example, want to do that in developing a custom keyboard handling class that did a lot of referencing of VK_this and VK_that. But, since I am in the habit of using OrganizeImports a lot, this always messes with me, and forces me to change my import list whenever I want to reference a new VK_something that wasn't used before.

Could Eclipse be enhanced to allow some customizing of how Organize Imports works?

[Updated on: Wed, 29 June 2011 12:04] by Moderator

Re: Organize Imports and import static xxx.yyy.* [message #690714 is a reply to message #690498] Thu, 30 June 2011 00:27 Go to previous messageGo to next message
Eclipse UserFriend
Are you talking about expanding the '*'. There is already a preference in Java->Code Style->OrganizeImports where one can choose the number of imports/static imports required for '*'. Just setting the preference to 1 should work for you.
Re: Organize Imports and import static xxx.yyy.* [message #1129697 is a reply to message #690498] Tue, 08 October 2013 18:31 Go to previous message
Eclipse UserFriend
This seems to be a rather old topic. However, it came to my mind recently while writing lots of unit tests using JUnit's Asset and Mockito.

In my opinion it would be nice to have the ability to specify a list of classes or packages for which the import optimizer would recognize each of its static members.

This could be a simple list on the bottom half of the settings dialog, similar to the import order definition. This way, typing often used static methods / constants etc. would compile after optimizing imports.
Previous Topic:Multiple Source Folders By Default
Next Topic:Matlab?
Goto Forum:
  


Current Time: Sun Jul 06 00:14:02 EDT 2025

Powered by FUDForum. Page generated in 0.04342 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top