Flex 4 clicking on functions and vars from an source path class - eclipse

In my main project I have many libraries referenced by source path instead of referenced through the Library path. These are libs that I want to use in other projects too. Since I am allways changing them I use them as source path. I find it more practical and faster then moving to another project and looking for a class and then back to the main one ... and so on.
Problem is that when I click on a function or a member var to access the source class (ctr click), I get the error Resource '/bla/bla.as' does not exist. Isn't there a way to reference the sourcepath so when I "ctrl click" it opens the right class without showing this problem.
Thanks

Right click > properties > build path > libraries > (Expand the library to which you want to set source) > source attachment > edit(In the right menu)
You will see something like this below. Attach it.

Related

Eclipse to IntelliJ transfer

I have copied my src package structure from eclipse to intellij and it makes this structure within src folder:
How do I make it dz1.drugi so I can one click expand all to my classes?
Another question is how to select default project folder as it is "workspace" at \Users\{Name} for eclipse. Right now, when I create new project like this:
it saves it without workspace (or projects folder) at \Users\{Name}.
Click on the cog icon at the top-right of the explorer view, and check the "Flatten packages" option.
That said, If you get used to keyboard shortcuts top open classes and files, and navigate through recently opened files, you'll quickly see that you'll amost never use the explorer view anymore.
Project view has an option to compact empty middle packages, enable it. You can also use Flatten packages option. Actually, your question is a duplicate of this one.
IntelliJ IDEA remembers the last location you've used when creating a new project. Once you want to create another project, the location one level upper of the previous project directory would be suggested. So, create a project in C:\Users\someuser\workspace\myproject1 and IDE will suggest C:\Users\someuser\workspace\myproject2 for your new myproject2.

Importing a java source file in netbeans

I have a project made, but I had to copy and move the java source file to another location in our clear case. If I want that file to be changed when I make further changes how would I do that? It is now a new name so I will probably have to make a new project but I'm not sure how to just import that one source file into the new project or even the existing project.
Update:
I have a project with a package that has some classes in it. I moved the java source file somewhere else and now need to use that file in that location instead of the original. I created a new project and imported the source file. Now it doesn't recognize the package or the class. Its says class "example" is public, should be declared in a file named "example". And the package error says "incorrect package". I'm not sure how to fix this to where The project runs just like the other except uses the file from the other location, so it can stay updated
Click on the Projects tab to open up your projects. Right click the project you wish to import source code from and choose Properties down at the bottom. You will arrive at the Sources tab automatically.
Under Source Package Folders click the Add Folder button to add the folder containing your source. Once it's been added, you will see it appended in the table. You can then double click the row's text under the Label column to edit the way it appears in the browsing window.
Importing this way means that you don't need a new project just to include files from other places on your computer. You can simply browse for the files you wish to include!

How can I find references to an external class without source code in Eclipse?

Is there a straightforward way to find references in my code to a class in an external library (jar without source) if I don't already have a file open that has a reference to the class?
For instance, say I want to find all references in my code to System.out.println() but I don't already have code open that uses println. How can I do this?
You can open any type (class or interface) via Ctrl+Shift+T (Command+Shift+T on a Mac). When the class/interface source opens, select a method or field (instance variable) in that class, right-click, and choose References.
If you don't have the source code, you'll see the Class File Editor, "Source not found" window. If you don't already have the "link with editor" icon enabled, either enable it or select the Navigate menu, Show In, Package Explorer. Then in the package explorer, select a method or field (instance variable) in that class, right-click, and choose References.
The only way I know to do this is to perform the following (not exactly straightforward) sequence:
Open and edit an existing class by adding a reference to, say, System.out.println()
Organize imports (ctrl-shift-o)
Place the cursor on println and type ctrl-shift-g or search, references, workspace.
Close the class without saving it.
It would be possible to do this using a File Search. Press Ctrl + H and put in System.out.println. Adjust the scope of the search according to your needs (I usually set it to Enclosing Project or Selected Resource).

Moving packages eclipse

Maybe a stupid question but I have two packages in eclipse and now I would like to move the one package into the other for better structure.
Now I tried move but that generates a copy into the same package.
And with refactoring -> move I even can't select the packages
Can anyone help me....
thx all
If you have com.company.foo and com.company.bar, and want to move foo into bar, then just rename com.company.foo to com.company.bar.foo.
If you package happens to have subpackages, tick Rename subpackages to move the subpackages as well.
Use the package explorer view and rename the package. It asks for renaming updating references, renaming sub packages, update textual references in comments and and also non-Java text files. Click on the preview and then ok.
I have found the solution, when you rename a package to the desired destination, check on the box "rename subpackages" and there you go! :) – user1525788 Jul 10 at 9:14
if you have current package:
com.insect.fly
and would like to add subpackage to it, then renaming will solve the purpose e.g.
com.insect.fly.mosquitto
However, eclipse do not should it in nested style. Just do
Package Explorer > click on v button on the pane next to minimize > package presentation > Hierarchical
Hope that SOLVES !!
This is slightly non-intuitive, but the best way to do it is by right clicking on the package you wish to move, clicking on refactor, and then on rename.
Then proceed to enter the fully qualified path which you desire.
For example, if you wish that a package called dog be moved into a package called mammals which itself is in a package called animals you would essentially rename your dog package to animals.mammals.dog
In other words, the package structure
is represented as animals.mammals.dog in the world of Java packages, and a renaming achieves the desired effect.
Please note that you must not try to achieve this by manually moving the folders in Windows explorer. These actions are best done using your IDE.
this is rlly old but try opening in hierarchy mode. in project explorer click the small arrow (pointing down) > package presentation > hierarchical.

Linking a static library to an iOS project in Xcode 4

I have a project (AQGridView) that compiles to a static library, but I can't seem to add it to my project.
Dragging in the project to my project creates a workspace, and if I try to link the libAQGridView.a file from the DerivedData directory it doesn't recognize it as a library. I'm not sure what I'm doing wrong.
This is the AQGridView project. Does anyone know specifically how to use it in an Xcode 4 project?
I do this as follows:
Drag in the static library project. If you have the static library project open in Xcode, close it now.
Select the main project in the project navigator (the project I'm adding the static library to) and in the editor, under the header TARGETS in the left-hand column, select my main project's target and navigate to the Build Phases tab.
Click the "+" for Target Dependencies and add the library icon target dependency from the added static library project.
Click the "+" for Link Binary with Libraries and add the library icon that is under the folder "Workspace".
It may also be necessary to enter a Header Search Path for the headers of the static library project if that is how the headers are linked in the static library project itself.
If you don't see the static library project as nested under the main project in the main project's project navigator, the most likely reason for that is that the static library's own Xcode project is still open. Quit Xcode and open up the main project that has the nested static library project in it without opening up the original static library project itself, and you should see it appearing as a nested project in your main project.
Xcode menu > View > Utilities > File Inspector
Select the static library file, and then set 'File Type' as 'Mach-O object code' in 'Identity and Type'.
Workspaces are supposed to make this easier, but I don't know that they do. The way I do it is create a workspace, add my main project, add my library project. Then go into the main project's build phases and add the library in the "Link binary with libraries" section and add the library. That should be all that is necessary, at least that's my reading, but it isn't. What I do is go into Xcode preferences, then to the Source Trees pane. Add a source tree that points to your static library's headers, then go back to the build settings for your project, then to the Header Search Paths key, and enter ${foo} there, where "foo" is whatever you called the source tree.
That's what works for me, though I don't know if that's the best or easiest way to do it.
Find your .a file in finder, and drag it into your project.
Select the 'copy items into destination group's folder (if needed)', and add your headers to your project.
Now, Xcode 4 should automatically link against that framework for you.
Here is what the library should look like in your project:
Follow Apple's documentation.
In brief:
Link your target against the library.
Add -ObjC to 'Other Linker Flags' (OTHER_LDFLAGS) under the target's build settings.
Also, I needed to add the library to the scheme of my main project since the library was not visible in the target's dependencies.
The Halle's answer works for me with one addition:
Check in Build Settings of the static library project the Private( or Public) Headers Folder Path value and copy it.
Add copied value to the client project Build Settings Header Search Path or User Header Search Path depending of the include directive you are using