I would prefer the second option. The argument "I'm often using diff" is pointless. You need to find a common agreement with your coworkers on how to layout import statements, than there will be a cut one time (where you optimize all your imports) and after that no problems occur anymore.
Best regards Thomas Singer At 09:55 20.12.01 +0900, you wrote: >+1.0E-10 for the second option > >the first option would really annoy my coleagues who often use diff > >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On >Behalf Of Scott Sirovy >Sent: Thursday, December 20, 2001 1:15 AM >To: '[EMAIL PROTECTED]' >Subject: RE: [Eap-list] Import ordering broken? > > > > ... it would not be possible to unambigously choose the insertion point > > when imports are not intially ordered alphabetically. > > >Well, then you have a couple of options: > >1) Always re-order all import statements prior to inserting a new one. This >is a fast and relatively rare occurrence that would not be a performance >hit, but would guarantee proper ordering. It would work for single import >statement inserts, as well as multiple inserts (like when pasting a block of >code). > >2) *Try* to put the import statement where it should go. Scan the imports >from the top, skipping over those lines that, according to the code style >options, go BEFORE the to-be-inserted import statement. Insert the new line >just before the first import that belongs AFTER the to-be-inserted >statement. > >For example, assume my code style options say to have java.* imports first, >then javax.*, then all others. Also assume the following code that does NOT >obey said rules: > > package test; > > import java.awt.BorderLayout; > import javax.swing.BorderFactory; > import java.awt.Font; > import java.awt.GridLayout; > import javax.swing.SwingUtilities; > import com.deephaven.gui.Util; > import com.deephaven.gui.widgets.CollapsiblePanelHeader; > import com.deephaven.gui.widgets.CollapsiblePanelSummary; > >If I cause an insertion of "javax.swing.UIManager" IDEA will put it AFTER >"javax.swing.SwingUtilities" because it after all the java.* lines and >alphabetically falls at the end of the javax.* lines. > >However, when "java.awt.event.MouseAdapter" is inserted, it will fall BEFORE >"javax.swing.BorderFactory" since the next line seems to be the beginning of >the "javax.*" block. > >The results from both would look like this: > > package test; > > import java.awt.BorderLayout; > import java.awt.event.MouseAdapter; > import javax.swing.BorderFactory; > import java.awt.Font; > import java.awt.GridLayout; > import javax.swing.SwingUtilities; > import javax.swing.UIManager; > import com.deephaven.gui.Util; > import com.deephaven.gui.widgets.CollapsiblePanelHeader; > import com.deephaven.gui.widgets.CollapsiblePanelSummary; > >Any thoughts? > >-sms > > >-----Original Message----- >From: Valentin Kipiatkov [mailto:[EMAIL PROTECTED]] >Sent: Wed, December 19, 2001 4:26 AM >To: [EMAIL PROTECTED] >Subject: Re: [Eap-list] Import ordering broken? > > >Yes, actually import insertion does not respect alphabetical ordering, only >the ordering in the Code Style options. The reason is that it would not be >possible to unambigously choose the insertion point when imports are not >intially ordered alphabetically. >The alphabetical sorting is performed by optimize imports only. > >Best regards, >Valentin Kipiatkov >----------------------------------------------------------- > IntelliJ Software, http://www.intellij.com/ > "Develop with pleasure" >----------------------------------------------------------- > >----- Original Message ----- >From: "Erb" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Tuesday, December 18, 2001 8:13 PM >Subject: Re: [Eap-list] Import ordering broken? > > > > OK, I found one scenario (using enclosed style), thopugh I think this > > does not have to > > do with the style, as you will see. > > > > Create a new class, type a line that includes "JLabel", and alt-enter to > > add the import. > > Then type a line using "JDialog", and include that import. It is > > included below the JLabel import. > > But Optimize Imports then alphabetizes them. I'll have to see if I can > > find another case > > other than alphabetical order. > > > > > > Valentin Kipiatkov wrote: > > > > > I checked this and could not reproduce it. Could you please provide some >way > > > to reproduce this? For example, send your code.style.xml settings and a > > > small example when the imports are inserted in a wrong order. > > > > > > Best regards, > > > Valentin Kipiatkov > > > ----------------------------------------------------------- > > > IntelliJ Software, http://www.intellij.com/ > > > "Develop with pleasure" > > > ----------------------------------------------------------- > > > > > > ----- Original Message ----- > > > From: "Erb" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Friday, December 14, 2001 7:01 PM > > > Subject: Re: [Eap-list] Import ordering broken? > > > > > > > > > > > >>I have also noticed that the import rules are not respected when IDEA > > >>auto-creates > > >>an import statement. I have often run Optimize Imports, then added some > > >>code > > >>that caused imports to be inserted, then did Optimize Imports again, and > > >> > > > the > > > > > >>imports changed their ordering. Perhaps Ariadna release could address > > >> > > > this. > > > > > >>Marc Palmer wrote: > > >> > > >> > > >>>2.5 build #535 > > >>> > > >>>My imports don't seem to be obeying the import ordering rules set out >in > > >>>IDE Options. The default settings too... Any others, java, javax... I > > >>> > > > had > > > > > >>>a list like this: > > >>> > > >>>import org.... > > >>>import org.... > > >>>import org.... > > >>> > > >>>import java. > > >>> > > >>>import px.... > > >>> > > >>>...and a reformat / save did not fix it. I changed the options in the > > >>> > > > IDE > > > > > >>>to use java, javax, then any others, and still no change after reformat > > >>> > > > / > > > > > >>>save. > > >>> > > >>>Am I missing something? > > >>> > > >>>Cheers > > >>> > > >>> > > >>> > > >>>_______________________________________________ > > >>>Eap-list mailing list > > >>>[EMAIL PROTECTED] > > >>>http://www.intellij.com/mailman/listinfo/eap-list > > >>> > > >>> > > >>> > > >> > > >>-- > > >> > > >>Erb > > >> > > >>============================================================== > > >>"The only time I like in the morning is afternoon." > > >> - Russell D. Cooper > > >> > > >>"If you do everything, then you're all done." > > >> - Melissa F. Cooper > > >> > > >>"Most of you are familiar with the virtues of a programmer. > > >>There are three, of course: laziness, impatience, and hubris." > > >> - Larry Wall > > >>============================================================== > > >> > > >> > > >>_______________________________________________ > > >>Eap-list mailing list > > >>[EMAIL PROTECTED] > > >>http://www.intellij.com/mailman/listinfo/eap-list > > >> > > > > > > > > > _______________________________________________ > > > Eap-list mailing list > > > [EMAIL PROTECTED] > > > http://www.intellij.com/mailman/listinfo/eap-list > > > > > > > > > > > > -- > > > > Erb > > > > ============================================================== > > "The only time I like in the morning is afternoon." > > - Russell D. Cooper > > > > "If you do everything, then you're all done." > > - Melissa F. Cooper > > > > "Most of you are familiar with the virtues of a programmer. > > There are three, of course: laziness, impatience, and hubris." > > - Larry Wall > > ============================================================== > > > > >---------------------------------------------------------------------------- >---- > > > > <?xml version="1.0"?> > > > > <application> > > <component class="com.intellij.psi.codeStyle.CodeStyleManager"> > > <option name="LINE_SEPARATOR" value=" " /> > > <option name="INDENT_SIZE" value="4" /> > > <option name="CONTINUATION_INDENT_SIZE" value="2" /> > > <option name="KEEP_LINE_BREAKS" value="true" /> > > <option name="KEEP_FIRST_COLUMN_COMMENT" value="true" /> > > <option name="TAB_SIZE" value="4" /> > > <option name="USE_TAB_CHARACTER" value="false" /> > > <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="true" /> > > <option name="BRACE_STYLE" value="1" /> > > <option name="CLASS_BRACE_STYLE" value="1" /> > > <option name="METHOD_BRACE_STYLE" value="1" /> > > <option name="ELSE_ON_NEW_LINE" value="true" /> > > <option name="WHILE_ON_NEW_LINE" value="false" /> > > <option name="CATCH_ON_NEW_LINE" value="true" /> > > <option name="FINALLY_ON_NEW_LINE" value="true" /> > > <option name="INDENT_CASE_FROM_SWITCH" value="true" /> > > <option name="SPECIAL_ELSE_IF_TREATMENT" value="true" /> > > <option name="ALIGN_MULTILINE_PARAMETERS" value="true" /> > > <option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="false" /> > > <option name="ALIGN_MULTILINE_FOR" value="true" /> > > <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" /> > > <option name="KEEP_BLANK_LINES_IN_CODE" value="2" /> > > <option name="BLANK_LINES_BEFORE_PACKAGE" value="1" /> > > <option name="BLANK_LINES_AFTER_PACKAGE" value="1" /> > > <option name="BLANK_LINES_BEFORE_IMPORTS" value="1" /> > > <option name="BLANK_LINES_AFTER_IMPORTS" value="1" /> > > <option name="BLANK_LINES_AROUND_CLASS" value="1" /> > > <option name="BLANK_LINES_AROUND_FIELD" value="0" /> > > <option name="BLANK_LINES_AROUND_METHOD" value="1" /> > > <option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" /> > > <option name="SPACE_AROUND_ASSIGNMENT_OPERATORS" value="true" /> > > <option name="SPACE_AROUND_LOGICAL_OPERATORS" value="true" /> > > <option name="SPACE_AROUND_EQUALITY_OPERATORS" value="true" /> > > <option name="SPACE_AROUND_RELATIONAL_OPERATORS" value="true" /> > > <option name="SPACE_AROUND_BITWISE_OPERATORS" value="true" /> > > <option name="SPACE_AROUND_ADDITIVE_OPERATORS" value="true" /> > > <option name="SPACE_AROUND_MULTIPLICATIVE_OPERATORS" value="true" /> > > <option name="SPACE_AROUND_SHIFT_OPERATORS" value="true" /> > > <option name="SPACE_AFTER_COMMA" value="true" /> > > <option name="SPACE_BEFORE_COMMA" value="false" /> > > <option name="SPACE_AFTER_SEMICOLON" value="true" /> > > <option name="SPACE_BEFORE_SEMICOLON" value="false" /> > > <option name="SPACE_WITHIN_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_METHOD_CALL_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_METHOD_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_IF_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_WHILE_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_FOR_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_CATCH_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_SWITCH_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_SYNCHRONIZED_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_CAST_PARENTHESES" value="false" /> > > <option name="SPACE_WITHIN_BRACKETS" value="false" /> > > <option name="SPACE_AFTER_TYPE_CAST" value="false" /> > > <option name="SPACE_BEFORE_METHOD_CALL_PARENTHESES" value="false" /> > > <option name="SPACE_BEFORE_METHOD_PARENTHESES" value="false" /> > > <option name="SPACE_BEFORE_IF_PARENTHESES" value="true" /> > > <option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" /> > > <option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" /> > > <option name="SPACE_BEFORE_CATCH_PARENTHESES" value="false" /> > > <option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" /> > > <option name="SPACE_BEFORE_SYNCHRONIZED_PARENTHESES" value="false" /> > > <option name="SPACE_BEFORE_CLASS_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_METHOD_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_IF_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_ELSE_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_WHILE_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_FOR_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_DO_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_SWITCH_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_TRY_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_CATCH_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_FINALLY_LBRACE" value="true" /> > > <option name="SPACE_BEFORE_SYNCHRONIZED_LBRACE" value="true" /> > > <option name="CLASS_TEMPLATE" value="/* * $NAME$ $Revision: $ >$Date:$ * * Copyright, 2001 LN Holdings Corporation. All Rights >Reserved. * Liquidnet Holdings, Inc. * >498 Seventh Ave, New York, New York 10018 * * UNPUBLISHED -- >Rights reserved under the copyright laws of * The United States. Use >of a copyright notice is precautionary * only and does not imply >publication or disclosure. * * This documentation contains >proprietary and confidential * information of LN Holdings Corporation. >use, disclosure, or * reproduction is prohibited without the prior >express written * permission of LN Holdings Corporation. * >* */ package $PACKAGE_NAME$; public class $NAME$ { }" >/> > > <option name="ADJUST_CLASS_TEMPLATE" value="true" /> > > <option name="INTERFACE_TEMPLATE" value="/* * $NAME$ $Revision: >$ $Date: $ * * Copyright, 2001 LN Holdings Corporation. All >Rights Reserved. * Liquidnet Holdings, Inc. * >498 Seventh Ave, New York, New York 10018 * * UNPUBLISHED -- >Rights reserved under the copyright laws of * The United States. Use >of a copyright notice is precautionary * only and does not imply >publication or disclosure. * * This documentation contains >proprietary and confidential * information of LN Holdings Corporation. >use, disclosure, or * reproduction is prohibited without the prior >express written * permission of LN Holdings Corporation. * >* */ package $PACKAGE_NAME$; public interface $NAME$ > }" /> > > <option name="ADJUST_INTERFACE_TEMPLATE" value="true" /> > > <option name="FIELD_NAME_PREFIX" value="_" /> > > <option name="STATIC_FIELD_NAME_PREFIX" value="_" /> > > <option name="PARAMETER_NAME_PREFIX" value="" /> > > <option name="LOCAL_VARIABLE_NAME_PREFIX" value="" /> > > <option name="FIELD_TYPE_TO_NAME"> > > <value /> > > </option> > > <option name="STATIC_FIELD_TYPE_TO_NAME"> > > <value /> > > </option> > > <option name="PARAMETER_TYPE_TO_NAME"> > > <value> > > <pair type="int" name="i" /> > > <pair type="byte" name="b" /> > > <pair type="char" name="c" /> > > <pair type="long" name="l" /> > > <pair type="short" name="i" /> > > <pair type="boolean" name="b" /> > > <pair type="double" name="v" /> > > <pair type="float" name="v" /> > > <pair type="java.lang.Object" name="o" /> > > <pair type="java.lang.String" name="s" /> > > <pair type="*Exception" name="x" /> > > <pair type="*Event" name="event" /> > > </value> > > </option> > > <option name="LOCAL_VARIABLE_TYPE_TO_NAME"> > > <value> > > <pair type="int" name="i" /> > > <pair type="byte" name="b" /> > > <pair type="char" name="c" /> > > <pair type="long" name="l" /> > > <pair type="short" name="i" /> > > <pair type="boolean" name="b" /> > > <pair type="double" name="v" /> > > <pair type="float" name="v" /> > > <pair type="java.lang.Object" name="o" /> > > <pair type="java.lang.String" name="s" /> > > <pair type="*Event" name="event" /> > > </value> > > </option> > > <option name="USE_FQ_CLASS_NAMES" value="false" /> > > <option name="USE_SINGLE_CLASS_IMPORTS" value="true" /> > > <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="7" /> > > <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND"> > > <value /> > > </option> > > <option name="IMPORT_LAYOUT_TABLE"> > > <value> > > <package name="java" withSubpackages="true" /> > > <emptyLine /> > > <package name="javax" withSubpackages="true" /> > > <emptyLine /> > > <package name="com.smartsockets" withSubpackages="true" /> > > <emptyLine /> > > <package name="junit" withSubpackages="true" /> > > <emptyLine /> > > <package name="com.liquidnet" withSubpackages="true" /> > > <emptyLine /> > > <package name="com.liquidnet.trader" withSubpackages="true" /> > > <emptyLine /> > > <package name="com.liquidnet.trader.swing" withSubpackages="true" >/> > > <emptyLine /> > > <package name="com.liquidnet.member" withSubpackages="true" /> > > <emptyLine /> > > <package name="com.liquidnet.member.swing" withSubpackages="true" >/> > > <emptyLine /> > > <package name="" withSubpackages="true" /> > > </value> > > </option> > > <option name="FIELDS_ORDER_WEIGHT" value="1" /> > > <option name="METHODS_ORDER_WEIGHT" value="3" /> > > <option name="CONSTRUCTORS_ORDER_WEIGHT" value="2" /> > > <option name="INNER_CLASSES_ORDER_WEIGHT" value="4" /> > > </component> > > </application> > > > > > > >_______________________________________________ >Eap-list mailing list >[EMAIL PROTECTED] >http://www.intellij.com/mailman/listinfo/eap-list > >-------------------------------------------------- >DISCLAIMER >This e-mail, and any attachments thereto, is intended only for use by the >addressee(s) named herein and may contain legally privileged and/or >confidential information. If you are not the intended recipient of this >e-mail, you are hereby notified that any dissemination, distribution or >copying of this e-mail, and any attachments thereto, is strictly prohibited. >If you have received this e-mail in error, please immediately notify me and >permanently delete the original and any copy of any e-mail and any printout >thereof. > >E-mail transmission cannot be guaranteed to be secure or error-free. The >sender therefore does not accept liability for any errors or omissions in >the contents of this message which arise as a result of e-mail transmission. > >NOTICE REGARDING PRIVACY AND CONFIDENTIALITY > >Knight Trading Group may, at its discretion, monitor and review the content >of all e-mail communications. > > >_______________________________________________ >Eap-list mailing list >[EMAIL PROTECTED] >http://www.intellij.com/mailman/listinfo/eap-list > >_______________________________________________ >Eap-list mailing list >[EMAIL PROTECTED] >http://www.intellij.com/mailman/listinfo/eap-list _______________________________________________ Eap-list mailing list [EMAIL PROTECTED] http://www.intellij.com/mailman/listinfo/eap-list
