Creating a SWING app with Eclipse Window Builder - eclipse

I am using Eclipse Indigo on Mac. I just set up the Window Builder tool however for some reason I can not create a new project with it. I select the Swing Designer -> Application Window option another window pops up and asks me for the source folder, project name etc. but when I try to type a name in the source folder it says file cannot be found and when I try to browse there is nothing to select. Does anyone have an idea about whats going on ? thanks

You have to create a Java project then you have to create a source folder and a package, after doing that you can select the created package on the Package explorer and create a new Application Window or JFrame from WindowBuilder menu.

This is the snapshots of my environment. On the eclipse IDE Right click on the package, Open ---File---New---Other---Then type Jframe. Click on Next and complete the wizard.
Underneath the capture you can switch between the source code and design view
snapshots of my environment
snapshots of my environment

Related

remove project explorer from eclipse

I'm writing an Eclipse plugin and seem to have many issues with users using the plugin with the Project Explorer.
Is there a way to remove the Project Explorer from Eclipse so users won't be able to use it (not only hide it)? I provide the users with the Eclipse package so I can edit it and only then send it out.
Why is Project Explorer behaving so differntly than Package Explorer/Navigator?
Example of issues:
Double clicking on a file in the Project Explorer doesn't always open it. Right clicking on the file and choosing the Open option - works. F3 works as well. this issue seems related to the Eclipse bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=131326
My plugin has a tool bar that I set to be seen only when a project of my type is in focus. it works perfectly in Package and Navigator Explorers, but in Project Explorer, if a user points to a sub folder of the project, it is not recognized as my plugin's project and the tool bar does not appear.
Thanks!

Eclipse opens old versions of my project

When opening Eclipse the project version is not the current one(it automatically opens the very beginning version of the project, not the current files on my drive).
I tried modifying the refresh settings in Preferences->Workspace, no luck. Also, when I right click->Refresh the project nothing happens.
I am using the last version of Eclipse Luna and the PyDev perspective.
have you tried go File then Switch Workspace e selected the right one? (even if ther is only one)
Some time it happend to me, maybe when i have eclipse opened and i click again on the eclipse startup app it ask me "load new workspace..." and it messup all
Try to look that its clearly the Workspace you would to use.
Do you have different Workspaces?
Try to check the location of the project.
Right-click on the project in Package Explorer and select "Properties"
Select "Resources" on right side and check the location.
If the location is wrong, try to import the right one using method as follows:
Right-click in Package Explorer and select "Import"
Select General->Existing Projects into Workspace and import the project.

Eclipse changed package view to folder view in Package Explorer?

I have the Problem that Eclipse shows all my packages as normal folders. I have to get back to the normal package View because in the folder view the most plugins like Windowbuilder are not working.
I already tried to change the Package Presentation -> Flat or Hierarchical no change.
I tried to add the folder or the Project as Source Folder but the he is using the he is using the first Folder as a Package and the subfolder also e.g.
the Folder
org
eclipse
wb
swt
tempuri
are shown as
org
eclipse.wb.swt
tempuri
but I need
org.eclipse.wb.swt
org.tempuri
does anyone have a solution for this?
thx for help
Michael
What you are looking for (at least in the Luna Release (4.4.0)) is the Package Explorer view instead of the Navigator view.
You can toggle it from the Window tab:
Window > Show Menu > Package Explorer
This Problem generally appears if you delete a folder and did not consider any adjustment on other structure under that folder. The best thing is to go to the package explorer and click on " Source > Build Path>use as source folder". Refresh the project and restart the eclipse.
I have been through this situation couple of times, and it always works for me. Sorry, if I didnt understand your question properly.
In Package Explorer tab, click the little triangle next to Link with Editor called View Menu, then choose Package Presentation > Hierarchical.

.class file opens instead of .java while debugging

Current setup:
MainProject which is a Library Project
BranchProject which is a new projects and has MainProject as a Reference
Whenever I debug and a file from MainProject is on focus (actually BranchProject has only graphic and xml layout changes) the Debug window opens a .class file which is read only. I want it to open the .java file so I can edit it directly.
Skyler's answer from this post worked for me:
Opening source code from debug view edits .class after Android R18 update
Here is a summary:
The fix is to right click the Project name in the debug view, and select "Edit Source Lookup..." from the menu. From there, remove the Default lookup path. After that, manually add the associated projects (not jars) that your project references. This is done by clicking Add, selecting Java Project, then checking the appropriate projects.
When you're using a Library project one of the things you're in fact doing is compiling your Library project into a jar and then referencing that jar in your calling Project.
If you right click the Project, and select "Configure Build Path" you'll see a tab called "Libraries", if you look inside "Android Dependencies" you'll notice a list of jar's corresponding to your Library projects.
These jars are expandable, showing you that they have a slot for a source attachment. Usually this would be editable allowing you to directly link the source but in terms of ADT these are already filled and are uneditable.
When debugging these files you're linked to a read-only class file with this attached source. This is because you're not running against source files directly, you're running against a pre-compiled class file. Until the ADT team get this functionality in place, you're pretty much forced to jump to the direct source code and rebuild everything.
EDIT
See #Steven linked answer :)
I faced the same issue while debugging the a .java file using Eclipse IDE. As per my understanding this issue comes when we put the xyz.class file of xyz.java file or JAR at the project build path. Delete the .class or JAR file from the project class path and rerun .java file in the debug mode. This time you see a source not found window. Click on "Source not found" button and check "Find duplicates..." at the bottom of the window. Done your problem is solved :)
The problem is that the class file is preferred over the java (by default), here is how you can change that for Eclipse (tested on NEON 2):
Right-click on the Project in the Project-Explorer, click Properties
On the new window select: Run/Debug Settings
Create a new configuration (or duplicate another one)
Select the new config and click Edit...
Go to the tab Source
Select the Default and Remove
Create a new path with Add..., select Java Library, then JRE System Library
Create a new path with Add..., select the location where the sourcecode is by Workspace folder (if it is a project in the same workspace) or File System directory (it it is not)
I think this depends on, how you set up the dependency in eclipse. You should set up your BranchProject to depend on the source-Files of your MainProject. If you depend on compiles Class-Files is obvious that the debugger opens the class files, because it does not know about the source files.
I found a good solution for me here:
Using Android library in eclipse and jumping to class files instead of source file that is within eclipse workspace
Simply, select each library project your project depends on, and use Top or Up to move it above the projects outputs. Eg. move all library projects to the top.
Open main project properties -> Java Build Path -> Projects tab and add there projects the main project depend on.
Switch to Order and Export tab and uncheck Android Dependencies
Enjoy
If you tried all above hints and it still doesn't work try this solution, it worked form me:
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path...
Select tab Order and Export
select library that you can't reach code and then click on button Bottom
Then click on Apply and Close
hope this can help you
Most of the time it happens when specific source folder are not added in build path Sources tab.
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path -> Source Tab
Add the source folder if your project source folder is not there.
Select Add folder -> select your project source folder specifically. Eg: project_name/src . Then Apply it and restart server.

Open directory containing a source file via Eclipse

In Visual Studio, or MyEclipse, you have a button which is able to locate a source file on disk, and open the containing directory in Windows explorer.
This is useful, for example, to browse images, or to use an other tool when a conflict occurs in CVS or SVN.
What would be the way to do it in Eclipse with a free plugin, or without any plugin ?
I found it :
"In eclipse, it is common requirement to open the folder containing source file but there is no direct method to do that like in Visual studio of Microsoft."
http://shivasoft.in/blog/others/tips/locate-source-file-on-local-disc-in-eclipse-external-tool/
An actual plugin can be found at http://blog.samsonis.me/2009/02/open-explorer-plugin-for-eclipse/
And version 1.5 can be found here http://blog.samsonis.me/2011/08/openexplorer-eclipse-plugin-1-5-0/
One that I've since upgraded to & find more useful
http://basti1302.github.io/startexplorer/
I always do this:
right click on file/folder, show in..., system explorer. Done.
I guess we don't need a plugin to do that, or I am misunderstanding the question?? I am using Luna 4.4.2 on Windows 7.
On Mac you can follow this steps to add it without a plug-in:
Click the disclosure icon to the right of the External Tools icon:
Select External Tools Configuration:
The External Tools Configuration window will appear. Select Programs and then click New Launch Configuration:
This will create a new launch configuration. Enter a name of the configuration in the name field:
In the Location field enter the path to the Open Finder, "/usr/bin/open" without quotes:
In the Arguments field enter the following argument, "${container_loc}" with quotes:
Click Apply. It should look like the following:
Switch to the build tab and deselect Build before launch:
Switch to the Common tab and select the External Tools checkbox in Favorites. Click Apply again and close out of the window.
You are done. Now to use:
Select a file or folder in Eclipse Package Explorer.
Click the disclosure icon to the right of the External Tools icon:
Select the Open Containing Folder from the drop down menu:
You're file or folder should open in Finder.
PRO TIP: After you use the external tool once you can click the External Tools icon again and it will run the last used external tool. In other words, you won't need to select it from the pop up menu each time.
You can also look up the source directory by right clicking on the project, going to properties, and looking at "Location: ... "