Import statements disappearing in FB3
I am trying create an actionscript file in Flex Builder 3 and
I noticed that after I put in all my imports and I start declaring
variables, most of my import statements will just disappear. I did
some searching on the net and heard some people mention about using
wildcards in there import statements, but I am not using any
wildcards. Is this a function of Flex Builder and if so, how do I
turn it off?
Hi,
You can turn it off. Go to
Window -> Preferences... -> Flex -> Editors ->
ActionScript Code
deselect the check box for "Remove unused imports while
organizing"
Hope this helps.
Similar Messages
-
Newbie question : import statements
So, i'm a complete java newbie trying to make his first swing application, a basic calc. I download NetBeans 6.5, install it, and begin to code. I quickly learn about the Matisse GUI editor, find it very easy to use, and in a couple hours, the work is done and runs very fine.
But looking at my code, I realize I have forgotten all import statements (like import javax.swing, import java.awt.event ....), nevertheless the application runs fine. I suppose then that the Netbeans compiler automatically corrects my mistakes, but I want to do it right.
So, I write the import statements explicitly in my code and I get a warning message : "import unused". After that, I find out about the "fix import" tool in Netbeans, use it and all my import statements disappear. I guess i'm missing something here.
I thought import of swing classes were mandatory to write a swing application. I have NO import statement in my code, even if I'm using jFrames, jButtons, event handlers and the program works fine, why ?
Would I be able to compile this importless code in another environment (let's say Eclipse or even javac) ?
I'm using JDK 1.6 and Netbeans 6.5 with Windows XP.
TIAglawen wrote:
Ok, thanks for the answers, and sorry for my misinterpretation of BigDaddyLoveHandles's first post. I understand now, the import statements are useful only if you don't want to write full class names, and the generated code uses full class names so no import needed.Please also understand BigDaddyLoveHandles's latest post. If you learn to code Swing with NetBeans' Matisse, then you will be learning Matisse, not Swing. When it comes time to try to tweak or upgrade your program, you will be lost. Better is to learn Swing from the ground up by going through the Sun Swing tutorials. Though having said that, if you are very new to the language, better still is to learn the fundamentals of Java first before embarking in the murky waters of GUI programming. Best of luck to you in your endeavors. -
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.
-
Import statement .. what does it do ??
Hi All,
What is IMPORT statement doing ??
IMPORT order_items_in to w_order_items_in from MEMORY ID
'FREEGOODSTERMS'.
can you kindly explain what this statement is doing ?
I was by my friend that this is used to pass order_items from one session to this sesssion, but when I searched for FREEGOODSTERMS, I could find export after this statment. I was wondering how can import me first and then export.
Please let me know.
Thanks
venkat.Hello Venkat,
Sorry for late reply..
Please see the program which other program submitting somewhere.
if they are using multiple purpose then export and import statement may possible in one include.
Best way just use where used list for that include and other programs searching like export and submit..
For better understanding about export and import then see the below sample programs.
Create one program and paste below code :
REPORT ZTEST_AMEM1.
tables : lfa1.
data : begin of i_lfa1 occurs 0 ,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
land1 like lfa1-land1,
end of i_lfa1.
start-of-selection.
select lifnr
name1
land1 from lfa1
into table i_lfa1 up to 100 rows.
Export
export i_lfa1 to memory id 'SAP'.
submit ztest_amem2 and return.
write:/ 'hello'.
Now create one more program and paste below code :
REPORT ZTEST_AMEM2.
data : begin of j_lfa1 occurs 0,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
land1 like lfa1-land1,
end of j_lfa1.
start-of-selection.
import i_lfa1 to j_lfa1 from memory id 'SAP'.
loop at j_lfa1.
write:/ j_lfa1-lifnr,j_lfa1-name1,j_lfa1-land1.
endloop.
Thanks
Seshu -
Import statement for DateCalculator
Hi
What import statement should I add in my wed dynpro implementation for DateCalculator, I already added
import java.util.Date;Hi,
If you want to perform some opperation with date in webdynpro,we have to import the some more along with above mentioned.like
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
Thanks,
Murthy. -
Hi,
If 2 import statements happen to import the same class implicitly (as opposed to naming the exact class in the import statement), then how does the compiler decide which one is used? Apparently the order of the import statements doesn't matter... already tried that.
For example:
//class Test.java
import java.lang.*; /redundant, but shows that we're importing Object
import org.omg.CORBA.Object;
public class Test {
public static void main(String[] args) {
Object obj = new String();
... here, the compiler complains about "found: java.lang.String" and "required: org.omg.CORBA.Object". Switching the order of the import statements had no effect... same issue. How are name clashes handled with import statements?The conflict is not resolved -- if there is any ambiguity the compiler complains. In these cases you need to use the fully qualified class name; e.g. java.lang.Object or org.omg.CORBA.Object -- it's not allowed to use the simple name "Object" because there's no way to know which of the two is meant.
-
Import statement and directory structure
First of all, sorry for such a long post, I believe part of it is because I am unsure of the concept of importing in Java. Secondly, Thanks to anyone who can ultimately enlighten me to the concept of import. I did ask this question before in the "erorr and error handling" forum, and the people who have helped me there did a great job. But, I believe I require a little more clarification and thus have decided to post here.
Anyhow, my question..
Could someone explain to me the concept of the import statement, or direct me to a webpage with sort of explanation for newbies? For some reason, I am having a hard time grasping the concept.
As I understand it, the import statement in Java, is very similar to the namespace keyword in C. That is to say, import doesn't actually "import" any source code, the way that the #include statement does in C.
So I suppose what my question is, say I have a java class file like below:
//filename: sentence.java
//located: c:\school\csc365
package csc365;
class sentence
//some variables here..
//some constructor here..
//some methods here..
And some sample program like the one below which implements the above..
//filename: test.java
//located: c:\school\csc365
import csc365.*;
import java.io.*;
class test.java
//creates some sentence object
//uses the object's methods
//some other things.
As I understand it, the test.java file should not compile because the csc365 package is not in the correct directory. (assuming of course, the classpath is like c:\school\csc365;c:\school )
But, ... where then should the sentence.java be located? In a subdirectory of c:\school called csc365 (i.e c:\school\csc365\) ?
And thus that would mean the test.java file could be located anywhere on the hard drive?
I suppose, I just need a little clarification on the correlation between a package's "name" (i.e package csc365; ) and its corresponding directory's name, and also how the javac compiler searches the classpath for java classes.
..So, theoretically if I were to set the classpath to look in every conceivable directory(provided the directory names were all unique) of the harddrive, then I could compile a test.java anywhere?
As a note: I have been able to get the test.java file to compile, by leaving out the import statement in the test.java file, and also leaving out the package statement for the sentence class, but I assume this is because the files are defaulted to the same package?Hi Mary,
No, import isn't analogous to C++ namespace - Java package is closer to the namespace mark.
import is just a convenience for the programmer. You can go your whole Java career without ever writing an import statement if you wish. All that means is that you'll have to type out the fully-resolved class name every time you want to use a class that's in a package other than java.lang. Example:
// NOTE: No import statements
public class Family
// NOTE: fully-resolved class names
private java.util.List children = new java.util.ArrayList();
}If you use the import statement, you can save yourself from typing:
import java.util.ArrayList;
import java.util.List;
public class Family
// NOTE: fully-resolved class names
private List children = new ArrayList();
}import isn't the same as class loader. It does not bring in any source code at all.
import comes into play when you're compiling or running your code. Java will check to make sure that any "shorthand" class names you give it live in one of the packages you've imported. If it can't find a matching fully-resolved class name, it'll give you a message like "Symbol not found" or something like that.
I arrange Java source in a directory structure that matches the package structure in the .class files.
If I've got a Java source file like this:
package foo.bar;
public class Baz
public static void main(String [] args)
Baz baz = new Baz();
System.out.println(baz);
public String toString()
return "I am a Baz";
}I'll store it in a directory structure like this:
root
+---classes
+---src
+---foo
+---bar
+---Baz.javaWhen I compile, I go to root and compile by typing this:
javac -d classes foo/bar/*.javaI can run the code from root by typing:
java -classpath classes foo.bar.BazI hope this wasn't patronizing or beneath you. I don't mean to be insulting. - MOD -
Hi All,
Can some one give me a code sample of exact syntax for IMPORT statement.
I tried the following way
IMPORT gt_dispute_data FROM MEMORY ID co_memory_id.
but giving an error.
shyleshHello,
Please declare gt_dispute_data and try the following:
IMPORT gt_dispute_data FROM MEMORY ID 'CO_MEMORY_ID'.
Thanks,
Venu
Maybe you are looking for
-
My iPhone 5 won't appear in my iPhoto
My iPhone 5 won't appear in my iPhoto library so that I can import my pictures from my phone.
-
Inconsistence in standard sap report MCE1 and ME2N
Hi Team, one of my user is using purchasing reports to analyse their spend in saphowever in some cases the purchis reports are incorrect, Using transaction MCE1 these are showing so many inconsistencies: Also while riuning ME2N for the same purchasin
-
How to delete Icon file in Safari folder?
In Safari v2.0.4 the Icon file contains the Favicons. In v3.0.4 WebepageIcons.db contains the Favicons. My Safari 3.0.4 folder still has an alias Icon file. SafariSpeed will not remove the Favicons. I assume this is because of the alias Icon. If I tr
-
What is the best way to clean up Contacts?
After synching multiple email address books and 3 Mac devices into Contacts, then that backing up to iCloud, I now have a mess in my Contacts App. There are so many duplicated entries! I thought the smartest thing to do was to link duplicates, since
-
Web-site as iframe in webdynpro for abap
Hello, we want to integrate an external website like google maps as iframe in webdynpro for abap-window. Is it possible? Regards Oliver Edited by: Oliver Prodinger on Apr 18, 2010 11:41 AM