Author: scabanovich
Date: 2007-09-14 07:54:20 -0400 (Fri, 14 Sep 2007)
New Revision: 3627
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java
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/impl/XModelObjectImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
JBIDE-903
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java 2007-09-14
10:59:19 UTC (rev 3626)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java 2007-09-14
11:54:20 UTC (rev 3627)
@@ -206,6 +206,11 @@
}
}
+ protected void safeChangeTimeStamp() {
+ boolean b = ("" +
getTimeStamp()).equals(get("actualBodyTimeStamp"));
+ changeTimeStamp();
+ if(b) set("actualBodyTimeStamp", "" + getTimeStamp());
+ }
protected void mergeAll(XModelObject f, boolean update) {
merge(f, !update);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java 2007-09-14
10:59:19 UTC (rev 3626)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java 2007-09-14
11:54:20 UTC (rev 3627)
@@ -26,6 +26,7 @@
public class FileSystemsImpl extends OrderedObjectImpl implements IResourceChangeListener
{
private static final long serialVersionUID = 1527918897367197051L;
+ boolean needsUpdateOverlapping = false;
protected Set<String> overlapped = null;
Ov overlapper = null;
FileSystemsRenameListener fileSystemsRenameListener = new
FileSystemsRenameListener(this);
@@ -57,14 +58,22 @@
super.removeChild_0(o);
updateOverlappedLater();
}
+
+ private static int OV_SLEEPING = 0;
+ private static int OV_STOPPED = 1;
+ private static int OV_RUNNING = 2;
class Ov implements XJob.XRunnable {
+ int status = OV_SLEEPING;
public void run() {
+
try {
Thread.sleep(200);
} catch (InterruptedException e) {
return;
}
+ if(status == OV_STOPPED) return;
+ status = OV_RUNNING;
try {
updateOverlappedInternal();
} catch (Exception e) {
@@ -81,17 +90,27 @@
private void updateOverlappedLater() {
if(isActive() && overlapper == null) {
if(EclipseResourceUtil.isProjectFragment(getModel())) return;
+ needsUpdateOverlapping = true;
XJob.addRunnable(overlapper = new Ov());
// (overlapper = new Thread(new Ov())).start();
}
}
- public void updateOverlapped() {
- if(overlapper != null) return;
+ public boolean updateOverlapped() {
+ if(overlapper != null && overlapper.status == OV_RUNNING) {
+ return false;
+ } else if(overlapper != null) {
+ overlapper.status = OV_STOPPED;
+ overlapper = null;
+ }
updateOverlappedInternal();
+ return true;
}
+
private //synchronized
void updateOverlappedInternal() {
+ if(!needsUpdateOverlapping) return;
+ needsUpdateOverlapping = false;
if(EclipseResourceUtil.isProjectFragment(getModel())) return;
if(overlapped == null) overlapped = new HashSet<String>();
Set<String> _overlapped = new HashSet<String>();
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 2007-09-14
10:59:19 UTC (rev 3626)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2007-09-14
11:54:20 UTC (rev 3627)
@@ -992,7 +992,9 @@
((FolderImpl)p).getFileSystem().getPeer().register(f);
}
ef.refreshLocal(IFile.DEPTH_INFINITE, null);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ //ignore
+ }
return true;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java 2007-09-14
10:59:19 UTC (rev 3626)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java 2007-09-14
11:54:20 UTC (rev 3627)
@@ -193,6 +193,12 @@
++timeStamp;
if(parent != null) parent.changeTimeStamp();
}
+
+ protected void safeChangeTimeStamp() {
+ changeTimeStamp();
+ }
+
+
// children
@@ -540,7 +546,7 @@
}
private void fireErrorStateChanged() {
- changeTimeStamp();
+ safeChangeTimeStamp();
String path = getPath();
if(path != null) {
fireObjectChanged(null);
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2007-09-14
10:59:19 UTC (rev 3626)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2007-09-14
11:54:20 UTC (rev 3627)
@@ -103,6 +103,7 @@
if (model != null) {
FileSystemsImpl fso = (FileSystemsImpl)model.getByPath("FileSystems");
if(fso == null) return null;
+ fso.updateOverlapped();
XModelObject[] fs = fso.getChildren("FileSystemFolder");
for (int i = 0; i < fs.length; i++) {
FileSystemImpl s = (FileSystemImpl)fs[i];
Show replies by date