Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 15:40 Go to next message
Steve Cohen is currently offline Steve CohenFriend
Messages: 46
Registered: July 2009
Member

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 16:04]

Report message to a moderator

Re: Organize Imports and import static xxx.yyy.* [message #690714 is a reply to message #690498] Thu, 30 June 2011 04:27 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
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 22:31 Go to previous message
Dennis Hunziker is currently offline Dennis HunzikerFriend
Messages: 1
Registered: October 2013
Junior Member
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: Tue Mar 19 09:40:31 GMT 2024

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

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

Back to the top