Auto-organization of import statements broken
Anyone else having this problem?
it happens pretty regularly, when I use auto-complete on a new object type, then flexbuilder goes and totally screws up all my imports, causing me to have to go through and ctrl-space (alt+"/" ) each one.
Also, it seems to never put in the correct import statement for an MXML component that I refer to in my AS block. I finally just used the fully qualified name because I was sick of FlashBuilder removint the import after I added it 5 times.
Known bug http://bugs.adobe.com/jira/browse/FB-23179 or one of the related bugs.
Jason San Jose
Quality Engineer, Flash Builder
Similar Messages
-
How to organize the import statements in FXML Files?
Hello,
I'm a user of NetBeans IDE and it can organize the import statements in *.java files. Now, I'm using JavaFX and editing the *.fxml files as well. I want to know how to organize the import statements in *.fxml files?
Thanks a lot.You should use Scene Builder, it will make all these import statements for you.
Moreover, it will greatly simplify the writing of your FXML files, since you only have to Drag&Drop JavaFX objects on the scene. Then, it automatically generates FXML files. -
Auto Complete import statements
When I create a new Module and select "optimize for application" when I am writing actionscript I seem to have a 50/50 chance of Flash Builder auto inserting the import statements. In preferences I've selected restore defaults and under Project 'Build Automatically' is selected. AutoComplete works great just not inserting import statements. Am I missing something?
The idea behind "Organize imports" is that it should remove used imports only if it detects they aren't needed in your document anymore, either because they are duplicates, don't exist or are in the same package as your current context.
If this feature is removing imports that don't fit within those conditions, please file a bug and include a test file we can use to reproduce it on our side. The bugbase url is here: http://bugs.adobe.com/flex.
Thanks!
-David -
Auto created import statements
I create a var of some type and the builder adds the import
statement and then if I change the type later on it adds another
import statement, is there a way to cleanup the unused import
statements?
Thanks,
MikeSadly, no.
There are a couple of different ways we might do this in
future. If we are able to get to an "organize imports" feature in
the next release, we could attempt to identify and remove obsolute
imports in addition to putting the imports in order.
Alternatively, if we can talk the compiler team into adding a
compiler warning for unused imports (which I don't believe it does
this currently), then we could make a quick fix that targets the
problem directly.
I'll make sure there's an enhancement request filed for this.
Rebecca Hyatt
Adobe -
FB Beta 2 removing import statements
I have a project that was started in FB Beta 1 (everything was working great) and updated to FB Beta 2 SDK 4.0.0.10988. I have a frequent but inconsistent problem in which while working in a module I'll have import statements in my script removed. The last instance two import statements for user created MXML components were removed, and the code I was modifying didn't have anything to do with these components. Previously I had import statements for ConversionType and TextConverter removed, this time I put the import statements in right before writing code to use them.
I still have problems with Flash Builder Beta 2 output folder issues this is a previous post that was unanswered.
If it helps: using MAC OSX and FB Beta 2 standalone.The issue with comments being removed when organize imports is run is a known issue captured by a small set of bugs:
https://bugs.adobe.com/jira/browse/FB-18479 Comments do not remain with currect import statements when performing 'organize imports'
https://bugs.adobe.com/jira/browse/FB-11396 Any data in between imports are deleted when doing an "organize imports" operation
https://bugs.adobe.com/jira/browse/FB-17160 Import inserted into wrong location when existing import is followed by a single line comment
Essentially, what it boils down to, we follow the same behavior as the JDT with one glaring exception: Turn off organizing imports when auto importing from code hints:
https://bugs.adobe.com/jira/browse/FB-23179 Change code hints auto import behavior so that imports are inserted in order, but unused imports should not be removed
With the FB-23179 fix, your imports will only be removed when you explicitly organize imports. I hope this info helps.
Jason San Jose
Quality Engineer, Flash Builder -
Problems with IMPORT STATEMENT
Please, can someone assist me? I am using Java Studio Enterprise 8.1 & Netbeans to design a java application and input form. But the wizard keeps on generating repeated class and subclasses even after I have used the import statement. Its making my program looks clumsy.
I just want to use import statement once and start using the variable in the program without repeating the declaration.
For instance, after importing javax.swing.*, I just want to be able to specify in my program (e.g JPanel Coylogo) without the wizard generating another private javax.swing.JPanel Coylogo.
How can I do it. Please help. I will appreciate
You look at the following section of the program to unstand what I mean. Thank you.
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import javax.swing.*;
import java.sql.Date;
* @author */
public class inputForm extends JFrame
private Connection con;
private Statement stmt;
private int k;
ResultSet rs=null;
// Variables declaration - do not modify
private javax.swing.JLabel ClassLabel;
private javax.swing.JPanel Connectivitypanel;
private javax.swing.JPanel Coylogo;
private javax.swing.JCheckBox DataCapable;
private javax.swing.JLabel DateLabel;
// End of variables declaration
* Creates new form inputForm
public inputForm()
//con = new dbConnect();
initComponents();
con = dbconnection();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents()
Coylogo = new javax.swing.JPanel();
PhoneType = new javax.swing.JPanel();
PhoneIdLabel = new javax.swing.JLabel();
ClassLabel = new javax.swing.JLabel();
phoneid = new javax.swing.JTextField();
DateLabel = new javax.swing.JLabel();
Connectivitypanel.setBorder(javax.swing.BorderFactory.createTitledBorder("CONNECTIVITY"));
pbluetooth.setText("Bluetooth");
pbluetooth.setActionCommand("bluetooth");
pbluetooth.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
pbluetooth.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
pbluetooth.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
pbluetooth.setMargin(new java.awt.Insets(0, 0, 0, 0));
}// </editor-fold>
private void allPhonesTypeActionPerformed(java.awt.event.ActionEvent evt)
}disable add imports or organize imports in your IDE
-
When is necessary to use import statements to import classes?
Hi,
I'm sure that it must be necessary to use import statements
in some situations, I'm finding that my code often works fine
without them. For example, some instructions will say it is
necessary to use import.flash.events.MouseEvent; before
MouseEvent.CLICK will work, or that I must import the loader class
before loading an SWF, but I'm finding that I can skip timporting
and it works fine. Could anyone please explain why this it, and
give me some idea of how to knew when to import and when I don't
have to?
Thank you in advance!Importing is only necessary when you create you own classes
or are using a class that Flash doesn't auto import such as the
fscommand package. Any time you create your own custom
package/class, it is also necessary to use import statements unless
you add the folder containing your custom packages to the default
class path. -
Hi srinivas bobbala,
Thank you for your response.But I think my quesition was not clear.My ques... is for suppose there is one datafile for importing like.. "datafile_21" Here my intention is it takes file from datafile_21 only but it appears in import statement like datafile_21<<curmon>>.
import database sample.sample data from data_file "c:\\ABC\datafile_21_AUG.txt" using server rules_file datafile on error abort;
In this it takes datafile from datafile_21.But it appears like datafile_21_AUG in import statement.This AUG coming from batch file.
Essmsh c:\\ABC\loadmxl.mxl %curmon%No it is not possible.
I assume the data file "datafile_21" is first renamed to datafile_21_${CurrMth} in the batchscript.
After that this data file *datafile_21_${CurrMth}* is pointed in the import statement.
In the logs you will see this file as datafile_21_Aug. -
Import Statement Different ways to refer ???
Dear Friends,
Can any one help me the difference between the usage of import statement....
1. using import statement
2. using the class directly
that is,
for example ;
1. import java.util.Date;
Date dt = new Date();
2. java.util.Date dt = new java.util.Date();
what's the difference between two reference of Date class...is there any meaning beyond this ?????
Regards,
V.Prasannawhat's the difference between two reference of Date
class...is there any meaning beyond this ?????there is no difference once the code is compiled - the compiler resolves single class names to their fully-qualified names (ie with the package prefix) and that appears in the .class file constant pool
before compilation then my opinion is that having all the imports at the top of the file is good practice because you can see what is being used easily -
Does anyone know what is wrong with these import statement?
import Reduction;
import Mapper;
import ApplyObj;
import ApplyObjUnary;
import java.lang.String;
public class Driver{
public static Driver me = new Driver();
public static void main(String[] args){
int i;
I places all my *.java file in the same directory as Driver.java
But when i try to compile Driver.java, it says :-
C:\assignment1>javac Driver.java
Driver.java:10: '.' expected
import Reduction;
^
Driver.java:11: '.' expected
import Mapper;
^
Driver.java:12: '.' expected
import ApplyObj;
^
Driver.java:13: '.' expected
import ApplyObjUnary;
^
4 errors
I set my class path as
C:\>SET CLASSPATH = .;C:\j2sdk1.4.0_01;c:\assignment1
Apparently, the current directory has been set and my assignment1 directory has been set.
Did i miss out anything? Why does it can't recognize the existence of other class file in the same directory?
thanks.You don't need to import classes that are in the default package (i.e. you didn't put them in a package). And in Java 1.4, you can't import them. Just remove the import statements, you shouldn't need them.
-
IMPORT Statement Issue (Internal Table)
Hi All,
I am using an IMPORT statement to get all the data from other report's internal table. Now whenever this (the other report's internal table) is changed (for field addition, etc), my report throws a dump. Hence, everytime I have to add these fields in my program as well.
Is there any way by which I can include the whole internal table of that report in my program just like
'INCLUDE STRUCTURE VBRK'.
Thanks in advanceHi, CHeck this code related to your problem..This will helpful to you...
I have done this program earlier..I hope it will helpful to u..
This programa calling the other program to import the data..
Check it out...
*" Tables declarations.................................................
TABLES:
spfli.
*" Type declarations...................................................
Type declaration of the structure to hold data from table SPFLI *
TYPES:
BEGIN OF type_s_spfli,
carrid LIKE spfli-carrid, " Carrier Id
connid LIKE spfli-connid, " Connection Number
cityfrom LIKE spfli-cityfrom, " City from
cityto LIKE spfli-cityto, " City to
airpfrom LIKE spfli-airpfrom, " Airport from
airpto LIKE spfli-airpto, " Airport to
countryfr LIKE spfli-countryfr, " Country from
countryto LIKE spfli-countryto, " Country to
END OF type_s_spfli.
Data Declaration...................................................*
Field String To Hold Flight Details Record from SPFLI *
DATA
fs_spfli TYPE type_s_spfli.
Data Declaration...................................................*
Internal Table To Hold Flight Details Records from SPFLI *
DATA
t_spfli LIKE STANDARD TABLE OF fs_spfli.
TYPES:
BEGIN OF types_s_itab,
carrid LIKE sflight-carrid, " Carrier id
connid LIKE sflight-connid, " Connection number
fldate LIKE sflight-fldate, " Flight date
END OF types_s_itab.
Data Declaration...................................................*
Field String To Hold Flight Details Record from SFLIGHT *
DATA
fs_itab TYPE types_s_itab.
Data Declaration...................................................*
Internal Table To Hold Flight Details Records from SFLIGHT *
DATA
t_itab LIKE STANDARD TABLE OF fs_itab.
*" Type declarations...................................................
Type declaration of the structure to hold data from table SBOOK *
TYPES:
BEGIN OF type_s_sbook,
carrid LIKE sbook-carrid, " Carrier Id
connid LIKE sbook-connid, " Connection Number
fldate LIKE sbook-fldate, " Flight date
bookid LIKE sbook-bookid, " Booking number
loccuram LIKE sbook-loccuram, " Local currency
loccurkey LIKE sbook-loccurkey,
order_date LIKE sbook-order_date, " Booking date
END OF type_s_sbook.
Data Declaration...................................................*
Field String To Hold Flight Details Record from BOOK *
DATA
fs_sbook TYPE type_s_sbook.
Data Declaration...................................................*
Internal Table To Hold Flight Details Records from SBOOK *
DATA
t_sbook LIKE STANDARD TABLE OF fs_sbook.
DATA
w_checkbox. " Checkbox
SELECT-OPTIONS:
s_carr FOR spfli-carrid. " Carrier id range
START-OF-SELECTION EVENT *
START-OF-SELECTION.
PERFORM selectq.
END-OF-SELECTION EVENT *
END-OF-SELECTION.
SET PF-STATUS 'YH1314_030502'.
PERFORM display_basic.
AT USER-COMMAND.
PERFORM ucomm.
*& Form selectq
This subroutine retreive data from SPFLI table
There are no interface parameters to be passed to this subroutine.
FORM selectq .
SELECT carrid " Carrier id
connid " Connection number
cityfrom " City from
cityto " City to
airpfrom " Airport from
airpto " Airport to
countryfr " Country from
countryto " Country to
INTO CORRESPONDING FIELDS OF TABLE t_spfli
FROM spfli
WHERE carrid IN s_carr.
ENDFORM. " Selectq
*& Form display_basic
This subroutine displays data from internal table
There are no interface parameters to be passed to this subroutine.
FORM display_basic .
LOOP AT t_spfli INTO fs_spfli.
WRITE:
/ w_checkbox AS CHECKBOX,
fs_spfli-carrid,
fs_spfli-connid,
fs_spfli-cityfrom,
fs_spfli-cityto,
fs_spfli-airpfrom,
fs_spfli-airpto,
fs_spfli-countryfr,
fs_spfli-countryto.
ENDLOOP. " LOOP AT T-SPFLI INTO...
ENDFORM. " Display_basic
*& Form UCOMM
This subroutine for at user-command event
There are no interface parameters to be passed to this subroutine.
FORM ucomm .
RANGES :
r_carr FOR spfli-carrid,
r_conn FOR spfli-connid,
r_carrid FOR sflight-carrid,
r_connid FOR sflight-connid,
r_fldate FOR sflight-fldate.
CASE sy-ucomm.
WHEN 'DISPLAY'.
DATA:
lw_lines TYPE i,
lw_lineno TYPE i VALUE 3.
DESCRIBE TABLE t_spfli LINES lw_lines.
DO lw_lines TIMES.
READ LINE lw_lineno FIELD
VALUE w_checkbox INTO w_checkbox
fs_spfli-carrid INTO fs_spfli-carrid
fs_spfli-connid INTO fs_spfli-connid.
IF sy-subrc = 0.
IF w_checkbox = 'X'.
r_carr-sign = 'I'.
r_carr-option = 'EQ'.
r_carr-low = fs_spfli-carrid.
APPEND r_carr.
r_conn-sign = 'I'.
r_conn-option = 'EQ'.
r_conn-low = fs_spfli-connid.
APPEND r_conn.
ENDIF. " IF W_CHECKBOX = 'X'
ENDIF. " IF SY-SUBRC = 0
ADD 1 TO lw_lineno.
ENDDO. " DO LW_LINES TIMES
SUBMIT yh1314_030502_call
WITH s_carr IN r_carr
WITH s_conn IN r_conn
AND RETURN.
IMPORT t_itab FROM MEMORY ID 'YH1314'.
LOOP AT t_itab INTO fs_itab.
r_carrid-sign = 'I'.
r_carrid-option = 'EQ'.
r_carrid-low = fs_itab-carrid.
APPEND r_carrid.
r_connid-sign = 'I'.
r_connid-option = 'EQ'.
r_connid-low = fs_itab-connid.
APPEND r_connid.
r_fldate-sign = 'I'.
r_fldate-option = 'EQ'.
r_fldate-low = fs_itab-fldate.
APPEND r_fldate.
ENDLOOP. " LOOP AT T_ITAB INTO.....
SELECT carrid " Carriee Id
connid " Connection number
fldate " Flight date
bookid " Booking number
loccuram " Local Currency
order_date " Booking date
INTO CORRESPONDING FIELDS OF TABLE t_sbook
FROM sbook
WHERE carrid IN r_carrid AND
connid IN r_connid AND
fldate IN r_fldate.
IF SY-SUBRC NE 0.
MESSAGE 'NO RECORDS FOUND'(006) TYPE 'S'.
ENDIF. " IF SY-SUBRC NE 0
LOOP AT t_sbook INTO fs_sbook.
AT FIRST.
WRITE: /5 'Carrier Id'(001),
20 'Conn Id'(002),
35 'Flight date'(003),
50 'Book Id'(004),
65 'Local Currency'(005).
ENDAT. " AT FIRST
WRITE: /5 fs_sbook-carrid,
20 fs_sbook-connid,
35 fs_sbook-fldate,
50 fs_sbook-bookid,
65 fs_sbook-loccuram CURRENCY fs_sbook-loccurkey.
ENDLOOP. " LOOP AT T_SBOOK INTO.....
ENDCASE. " CASE SY-UCOMM
ENDFORM. " UCOMM
Regards
Kiran -
Import statement is not working
hi everybody,
I have a directory under which I have a number of sub-directories. Lets call this directory "parent_directory". under this directory I have another directory called "child_1". Under "child_1" I have another subdirectory called "child_2". Now I have a code in child_2 that has the following statement:
import program_1;
//this is a program present in the parent directory. lets call it
//program_1.java
when I am compiling I am getting an error saying:
program_2.java:28: '.' expected
import program_1;
^
1 error
program_2.java is the program present in child_2 in which I have included the import statement.
If I change the ";" to "." then again error appears as the import statement only needs the name of the class and doesnot need the extension.
I will be very grateful to you if you could please suggest me a way around this.This questions belongs in the "New to Java" forum ...
sigh
Anyways, import works on package names with trailing * or full qualified class names, e.g.import mypackage1.*; // imports all classes in mypackage1
import mypackage2.MyClass2; // imports MyClass2 from mypackage2So instead of import program_1; you need to do
1. ensure that program_1 is in some package
2. ensure that your directory structure mirrors your package structure (same names!)
3. ensure that your CLASSPATH is either not set at all or points to the parent dir of your topmost package
Example:
Directory structure:C:\tmp\java\top\
C:\tmp\java\top\MyClass1.java
C:\tmp\java\top\bottom\
C:\tmp\java\top\bottom\MyClass2.java
CLASSPATH=".;<java install dir>\jre\lib\rt.jar;C:\tmp\java"Source for MyClass1.java:package top;
public class MyClass1 {
}Source for MyClass2.java:package top.bottom;
import top.MyClass1;
public class MyClass2 {
private MyClass1 myClass1;
} -
Import Statement without ID Specification
There is an import statement
IMPORT tab g_acc_tab FROM MEMORY.
While UCChecking it.. it saying that
import statement without id specification is only used for the sake of r/2 ......
Can i Comment it ? If so won't my application go into dump while running on 6.0cc???It has to do with packages. Most java classes are in a package, the name of which must conform to its place on the filesystem relative to the classpath. By that I mean that if you have com.mystuff.One.java, it must be in a folder com/mystuff where com is located somewhere in the classpath.
What you've done is a little different. I'm assuming a couple of things:
1. you have no package declaration at the top of one.java or two.java
2. you have the current directory "." in your classpath.
Java has the concept of the "default package", which covers classes without a declared package, and in your case is the current directory.
So when you're in c:\sourcefolder and run the compiler, then "."="c:\sourcefolder", and that directory is part of the default package. No import statements are necessary for classes that are in the same package. This is why two.java can call methods in one.java without an import statement.
When you run your jsp, the "current directory" part of your classpath is not c:\sourcefolder, but some other value (probably the directory you start your jsp engine from) You will have to import all non-java-library classes because the jsp itself becomes a java class, with a package that is determined by the jsp engine. -
Import statement -- Filesize^
How does the import statement work anyway?
Will it just "paste" the imported files in front of th class like a C preprocessor?
If so, is there a way to import packages only once?
I use (e. g.) java.awt.point in nearly ALL classes in my project, and at the moment, I import the class in every single file. If it will be pasted, this will significantly enlarge my project, I fear. Or does the compiler recognize double imports?How does the import statement work anyway?The import statement just gives the compiler some info so you don't have to fully qualify the class names.
Will it just "paste" the imported files in front of th
class like a C preprocessor?No
It doesn't put anything into the compiled class, so won't affect the file size. -
Import Statement - Which is Better ???
Which import statement is better? Are there any performance advantages of calling the ones you need explicitly instead of using the shorthand (.*)?
import java.util.*
or
import java.util.Vector;
import java.util.TreeMap;there is no runtime performance difference. There could be a difference in compliation time if you use wildcards, but even that difference would probably be insignificant (plus, is compile time usually a concern in java?). The main advantage to importing only the classes you need, as the previous poster pointed out, is to reduce compilation ambiguities (e.g. does 'Date' refer to java.sql.Date or java.util.Date). For example, a recent poster just reported a problem where he imported java.beans.* and java.sql.* and, after upgrading to 1.4, none of his code compiles because both packages now have a Statement class, which causes ambiguities. As a general rule, it is best to import only the classes you need.
Maybe you are looking for
-
SAP Query PNPCE LDB with additional table.
Hi ABAP Gurus, I am developing a SAP Query. I have created an infoset with the custom infotype 9050 and added the table ZPA9050 into the Infoset. The fields of ZPA9050 is not available as selection fields when I try to Query through SQ01. (How do I i
-
Why my ipad have problem with the rotation screen
i have a problem with the rotation screen is locked, i try everything but nothing is happening help
-
What wireless NIC should I Deploy?!?
I know this is going to be somewhat biased, but I have the unique opportunity to choose a wireless NIC for our company. It's like this... We have been rolling out many different types of laptops from Dell over the last couple of years and each one ha
-
English Hello guys, there is any option to hide elements on muse site for no printing, I'm working on a catalog with pront option but i dont want the navigation menu buttons on my print sheets, any idea? Spanish Hola a todos, hay alguna opcion que bl
-
Informatica partially truncating double byte characters
I am running Business Intelligence Applications 7.9.5. We have a case where Japanese and Chinese data from the OLTP is being truncated when being transferred to the SRMW through Informatica. For example: From Siebel ジョン From s_contact From SRWM ジ fro