Board index » jbuilder » About delete and add a javafile!

About delete and add a javafile!


2003-09-01 06:55:40 PM
jbuilder15
I have a "Class.java" file created by node = JBProject.getNode(URL)...
then i delete it by using
browser.closeNode(node);
node.setParent(null);
url.getFileObject().delete(); //remove the java file
.getBrowser().getProjectView().refreshTree(jservice.getJBProject());
.getBrowser().getActiveProject().refresh();
after that the the tree node will be disappeared in project tree,
but when i create "Class.java " with the same name again,
a dialog will be showed said "Change have been mage to "Class.java" in
memory and on disk,Reload from disk?"
is that i do something wrong?
 
 

Re:About delete and add a javafile!

Use VFS.delete(Url) instead of File.delete().
Also, ProjectView.refreshTree() and Project.refresh() are redundant if
the same project (and you only have to explicitly refresh the
ProjectView if the node does not have a parent). So something like
this would be more efficient:
if (node.getParent() != null) {
node.setParent(null);
}
else {
node.getProject().refresh();
}
"AndyLau" < XXXX@XXXXX.COM >wrote in message
Quote
I have a "Class.java" file created by node =
JBProject.getNode(URL)...
then i delete it by using

browser.closeNode(node);
node.setParent(null);
url.getFileObject().delete(); //remove the java file

.getBrowser().getProjectView().refreshTree(jservice.getJBProject());
.getBrowser().getActiveProject().refresh();

after that the the tree node will be disappeared in project tree,
but when i create "Class.java " with the same name again,

a dialog will be showed said "Change have been mage to "Class.java"
in
memory and on disk,Reload from disk?"

is that i do something wrong?