Author: scabanovich
Date: 2011-03-11 18:24:06 -0500 (Fri, 11 Mar 2011)
New Revision: 29722
Modified:
branches/jbosstools-3.2.x/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:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
===================================================================
---
branches/jbosstools-3.2.x/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)
+++
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2011-03-11
23:24:06 UTC (rev 29722)
@@ -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