• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Projects under workspace

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please help in finding out the Number of projects or plugins in the eclipse workspace.

Tried executing
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for(int i=0;i<projects.length;i++){
System.out.println("Project="+projects[i]+" Total Project Count="+projects.length);

It just lists out

Project=P/Servers Total Project Count=1

I think the search is not done under the workspace that is being used by the eclipse.
I need to list all the projects/plugins under the workspace.
can anyone pls help me in resolving this out.
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
deepa anandan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to know the count of plugins present in the workspace
 
author & internet detective
Posts: 39587
781
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by deepa anandan:
I need to know the count of plugins present in the workspace


Just curious why. What would you do with that information?
 
deepa anandan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:-)
Need to list it for my application. As well as create new plugin through code under the same workspace.
Hope its clear.
 
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
deepa anandan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Didnt get exactly whatz being conveyed...
What is osgi layer???
What is configurator???
Can you please provide more specific solution for the concerned problem.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
deepa anandan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My doubt was how to find the plugin projects in workspace.
If my present workspace is D:\workspace1 then all the plugin projects existing under used workspace1 needs to get listed out.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
deepa anandan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest & Gilbert...

Will try to find out the nature...

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:-(
 
Who among you feels worthy enough to be my best friend? Test 1 is to read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!