07-31-2010 12:19 AM
I have a bunch of projects in Eclipse, they are all stored in one folder:
WORKSPACE_FOLDER:
PROJ1_FOLDER
src
res
...
PROJ2_FOLDER
src
res
...
PROJ3_FOLDER
src
res
...
...
Everything compiled fine like this.
Recently I moved a couple classes to their own dedicated folder because they were similar:
WORKSPACE_FOLDER:
GROUP_FOLDER
PROJ1_FOLDER
src
res
...
PROJ2_FOLDER
src
res
...
PROJ3_FOLDER
src
res
...
...
Now Proj3 compiles fine but Proj1 and Proj2 get exceptions and won't compile. If I do a search in Eclipse it gets an exception and when I compile I get an exception (different exceptions).
The exception I get is:
java.lang.NullPointerException at net.rim.ejde.A.D.E.A(RIMEIDE:1956) at net.rim.ejde.A.D.E.A(RIMEIDE:3520) at net.rim.ejde.A.D.A.run(RIMEIDE:3521) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) at net.rim.ejde.A.D.C.runInWorkspace(RIMEIDE:3462) at org.eclipse.core.internal.resources.InternalWorksp aceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.j ava:55)
The preprocessor won't work either and I tried restarting Eclipse, removing then re-adding the projects, etc.
I am using:
So has anyone encountered this before? Is this an Eclipse problem or BB Plug-In error? Anyone have a fix for it if they encountered this before?
07-31-2010 12:48 AM
Don't panic -- this is easy to fix. When you moved projects 1 and 2 into the GROUP_DIRECTORY, the full path names to your files no longer match the declared package names in each of your source files.
My first thought was to tell you to go through all your source files and update the package names to match the files' new path names. Instead, we will let the computer do the work.
I'm using Eclipse 3.5.0, so YMMV. In the left panel, right-click on the package name (example com.companyname.blah.projectname) for package 1 which is probably just under the src directory in the tree. In the context menu, select Refactor->Rename...
In the dialog that appears, update the package name to include the GROUP_DIRECTORY. Click Ok. I got a warning because my application has a main() method, just like every other Blackberry application. Take heed, then click Continue.
Isn't Eclipse great? Not only did it update the package name in _ALL_ your source files, but it created the GROUP_DIRECTORY and moved your files inside it automatically. Now please do the same thing for Project 2. Now, in the Project menu, select Blackberry->Clean Simulator... Click Select All and click Ok. Wait for this to complete. Clean your project and build it again. This time it builds and runs without those annoying errors, right? Well, it actually builds and runs with the same number of errors and warnings that existed before you decided to do some interior decorating.
Eclipse tip: Eclipse is a full service IDE that takes responsibility for managing the files in your project. If you want to do anything with your project or its files, it's best to ask Eclipse and let it make the changes you want.
I know, I know. How "Apple" of me. =)
Success!!
I_Mudd
P.S. Blue is the new red.
07-31-2010 03:22 AM
Well, I'm very embarrassed now. After I posted that last response to your question, I realized that it doesn't quite solve your problem. My last set of instructions creates two GROUP_FOLDERs, one inside each of the two projects you're trying to move. I'm sorry.
I have a correct solution for you, but I don't think you're going to like it. Once you do this, the projects will exist inside the GROUP_FOLDER in your file system, but Eclipse won't change its display all your projects in the left panel. Therefore, I don't think it's worth doing.
Anyway, in Eclipse's left panel, right-click on Project 1. In the context menu that appears, select Refactor->Move...
In the dialog box that appears, insert the name of your GROUP_FOLDER in the project's full path name between your Blackberry Workspace directory and Project 1. Some red error text will appear while you're typing. Just ignore it; it will go away when you're finished. Don't forget to use backslashes where needed. Click Ok.
Eclipse will create the GROUP_FOLDER and move your project inside it. If you perform the same procedure for Project 2, they will both reside inside the GROUP_FOLDER. Eclipse's display of your projects will not change.
If your Blackberry workspace is getting too full of projects, my advice is to create more Blackberry workspaces and separate your projects as much as possible. I realize that there are probably some dependency issues amongst your projects, but odds are you'll be able to reduce the clutter a little.
Best of luck to you,
I_Mudd
P.S. It's better to seek forgiveness than to seek permission.
ERROR: Wise proverb does not apply to current situation. Forgiveness denied.
07-31-2010 04:32 PM
Thanks for trying but to no avail. Refactor->Move does not work, my project basically gets deleted before Eclipse tries to move it, thus I end up with no project.
Luckily I had encountered this before (lost that whole project
) so I had a backup of the projects. Re-adding source code didn't work either.
I tried creating an entire new project in the folder, I got a error message saying that "Projects must be located in the workspace folder" and couldn't be in a subfolder. So that killed that experiment.
I did some testing and decompiliation and found the problem comes from trying to get the output folder for... something. I can't get it to working right now, I'm going to try remaking the project in the workspace folder.
For now my work around is copying the projects to the single folder (it's for source control). I'll need to play around with automating it for now but it seems like an Eclipse problem right now.
08-07-2010 08:04 PM
That's very disappointing. I was using Eclipse version 3.5.0. I executed these instructions while I typed both of my earlier responses to make sure the instructions were right. I moved two test projects into a common subdirectory just as I described, and then I successfully moved them back to the Blackberry Workspace directory. Sorry things didn't work out for you.
One thing that might make the difference comes to mind. My GROUP_DIRECTORY was located inside my Blackberry Workspace directory. Are you trying to locate a project outside of the BB Workspace, somewhere else on your file system? Eclipse might not like that.
If you're doing this for backup purposes, why not backup the entire Blackberry Workspace directory and
copy all your projects?
I_Mudd
P.S. I've spun my top totem, and I'm waiting for it to fall. I INSIST that this is reality!
P.P.S. I'm still waiting...
08-07-2010 09:59 PM
Yea it is a little disappointing. My "GROUP_DIRECTORY" is located in the Workspace directory as well. But when I import the project from that directory it doesn't compile. When I try to create the project in that directory, Eclipse says that it isn't a valid location.
It isn't a backup process, the project I am talking about is open source so I push the projects in the open source project to the website.