Home » Eclipse Projects » Eclipse Platform » programatically deleting project : i would need some tips
programatically deleting project : i would need some tips [message #335737] |
Fri, 24 April 2009 15:54 |
Bozier jerome Messages: 2 Registered: July 2009 |
Junior Member |
|
|
I face some problems when programatically manipulating projects :
for my application, i let user have the ability to select sub-items of
things he decides to delete (so, container childs, project childs, etc...)
let's take a basic example, an empty java project :
<prj>
<bin>
<src>
<.settings>
<.project>
<.classpath>
at start, i test if prj exists, then delete all its childs, then delete
prj itself when all its childs are deleted.
first problem : when i try to delete prj, prj.exists() return false, so
physical delete on disk is not performed, only logical delete in workspace
is.
i tryed to filter some elements (not deleting .classpath and .project) but
it changes nothing. any hint ?
second problem : in case of closed project, i try to call prj.delete(...)
with flags to force delete contens on disk. project disapear from
workspace but not from disk. is there's a way to do it cleanly ?
third problem : in case of a plugin project, with several .java file
inside, i got an exception when trying to delete "MANIFEST.MF", probably
because of auto-build that have a handle on it. is there is a way to stop
auto-build programatically ?
many thanks in advance,
Jerome Bozier
TPTP project
IBM Rational
|
|
|
Re: programatically deleting project : i would need some tips [message #335741 is a reply to message #335737] |
Fri, 24 April 2009 18:56 |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Bozier jerome wrote:
> I face some problems when programatically manipulating projects :
>
> for my application, i let user have the ability to select sub-items of
> things he decides to delete (so, container childs, project childs, etc...)
>
> let's take a basic example, an empty java project :
> <prj>
> <bin>
> <src>
> <.settings>
> <.project>
> <.classpath>
> at start, i test if prj exists, then delete all its childs, then
> delete prj itself when all its childs are deleted.
Why not just delete prj from the beginning, instead of deleting children
first? That would seem to solve most, if not all, of the problem you
describe.
[more below]
>
> first problem : when i try to delete prj, prj.exists() return false, so
> physical delete on disk is not performed, only logical delete in
> workspace is.
> i tryed to filter some elements (not deleting .classpath and .project)
> but it changes nothing. any hint ?
>
> second problem : in case of closed project, i try to call
> prj.delete(...) with flags to force delete contens on disk. project
> disapear from workspace but not from disk. is there's a way to do it
> cleanly ?
I would just test for openness and if closed, open it first; then
delete. Actually, the Navigator view (from Resources perspective) allows
you to delete close projects and their disk contents, so I'd look at
what it is doing in the code.
> third problem : in case of a plugin project, with several .java file
> inside, i got an exception when trying to delete "MANIFEST.MF", probably
> because of auto-build that have a handle on it. is there is a way to
> stop auto-build programatically ?
Are you trying the delete during a build? If so, it should probably be
scheduled as a separate Job or perhaps added to the build "work queue."
You can disable/enable auto-build via the IWorkspaceDescription
interface, obtained by ResourcesPlugin.getWorkspace().getDescription().
But I still think deleting the IProject first will be the best option.
Hope this helps,
Eric
|
|
| |
Goto Forum:
Current Time: Mon Jan 13 04:53:20 GMT 2025
Powered by FUDForum. Page generated in 0.02994 seconds
|