Moving to our "IDEs" forum, where discussions of the Eclipse APIs would be more appropriate. I'll point out that "projects" and "plugins" are utterly different things, and you should certainly know which of the two you're interested in counting.
I think 1 is probably right as thats the number you likely have in your runtime workspace. If you installed that plugin in your current workspace, then it would probably count all the projects there when it ran.
As for counting plugins you can try the 'configurator' but I am not aware of any other way. Maybe a call to the osgi layer.
I think you need to be more specific in what you're asking for.
There are always precisely zero "plugins in the workspace." There may be plugin projects in the workspace, and of course there may be other kinds of projects in the workspace as well. This is code you're working on. Code that isn't running. Things you can click on in the "Navigator" view. Source code.
On the other hand, there are many plugins installed in the workbench -- runtime plugins that are actually being used. You don't necessarily have the source for these.
Then there is the plugins directory on your disk. This contains a superset of the installed plugins: not all the plugins in this directory will be installed. Some will be broken and refuse to install; others will just not be loaded yet.
Now, being very careful about all the words you use: exactly what do you want to make a list of?
How are you running the code, exactly? If you run it from Eclipse's "run" menu, then it will run in another copy of Eclipse, and will count the projects in that separate workspace (usually a directory named "runtime-workspace".) If your code is in a plugin which is then installed inside the running copy of Eclipse -- i.e., if you've manually copied it to the "plugins" directory and restarted Eclipse -- then it would run against the "real" workspace.
Note, also, that as it stands, it will count all projects, not just plugin projects. You'll need to look at each IProject and determine what kind it is.
Originally posted by Ernest Friedman-Hill: ...Note, also, that as it stands, it will count all projects, not just plugin projects. You'll need to look at each IProject and determine what kind it is.
You can possibly tell if its a plugin project by looking at the "Project Nature." In any event, you want to narrow it down a bit by looking at this. [ July 11, 2006: Message edited by: Mr. C Lamont Gilbert ]
Ur solution prompted me to ask another question too.. I was running my plugin from "run" menu. I had copied my plugin under "plugins" directory of eclipse and restarted the eclipse too. I could see my applications icon on the eclipse but whenever i click on it i am reported with an error message :
"The Chosen operation is not currently available"
Steps followed was:
1. Copied the plugin project to "plugins" directory in eclipse. 2. Right mouse key -> Export -> "Depoyable plug-in and fragments" Selected the plugin and stored it under plugins directory
Please do let me know where I have gone wrong:-(
eat bricks! HA! And here's another one! And a tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss