Author: scabanovich
Date: 2011-03-11 18:21:42 -0500 (Fri, 11 Mar 2011)
New Revision: 29721
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
Log:
JBIDE-8564
https://issues.jboss.org/browse/JBIDE-8564
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2011-03-11
22:35:37 UTC (rev 29720)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2011-03-11
23:21:42 UTC (rev 29721)
@@ -717,13 +717,31 @@
protected void updateRemove(XModelObject o) throws XModelException {
boolean d = (o instanceof FolderImpl);
- FileSystemPeer peer = getFileSystem().getPeer();
- File rf = getChildIOFile(o);
+ final FileSystemPeer peer = getFileSystem().getPeer();
+ final File rf = getChildIOFile(o);
boolean c = (d && peer.containsDir(rf)) || ((!d) &&
peer.contains(rf));
if(!c) return;
int i = (!o.isModified()) ? 1 : question(o);
if(i != 0) {
o.removeFromParent();
+ } else if(i == -100) {
+ if(rf.exists()) return;
+ final XModelObject o1 = o;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ if(rf.exists()) return;
+ if(question(o1) == 0) {
+ o1.removeFromParent();
+ } else {
+ try {
+ saveChild(o1, peer, rf);
+ XActionInvoker.invoke("Open", o1, null); //$NON-NLS-1$
+ } catch (XModelException e) {
+ ModelPlugin.getDefault().logError(e);
+ }
+ }
+ }
+ });
} else {
saveChild(o, peer, rf);
XActionInvoker.invoke("Open", o, null); //$NON-NLS-1$
@@ -768,7 +786,7 @@
private static int question(XModelObject o) {
if(Display.getCurrent() == null) {
- //TODO we cannot display dialog. What should we do?
+ return -100;
}
return o.getModel().getService().showDialog("Update",
MessageFormat