Lines 9-14
Link Here
|
9 |
package org.eclipse.mylyn.internal.resources.ui; |
9 |
package org.eclipse.mylyn.internal.resources.ui; |
10 |
|
10 |
|
11 |
import java.util.ArrayList; |
11 |
import java.util.ArrayList; |
|
|
12 |
import java.util.Date; |
12 |
import java.util.List; |
13 |
import java.util.List; |
13 |
import java.util.Set; |
14 |
import java.util.Set; |
14 |
|
15 |
|
Lines 16-23
Link Here
|
16 |
import org.eclipse.core.runtime.IStatus; |
17 |
import org.eclipse.core.runtime.IStatus; |
17 |
import org.eclipse.core.runtime.Status; |
18 |
import org.eclipse.core.runtime.Status; |
18 |
import org.eclipse.mylyn.commons.core.StatusHandler; |
19 |
import org.eclipse.mylyn.commons.core.StatusHandler; |
|
|
20 |
import org.eclipse.mylyn.context.core.AbstractContextListener; |
19 |
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge; |
21 |
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge; |
20 |
import org.eclipse.mylyn.context.core.ContextCore; |
22 |
import org.eclipse.mylyn.context.core.ContextCore; |
|
|
23 |
import org.eclipse.mylyn.context.core.IInteractionContext; |
21 |
import org.eclipse.mylyn.context.core.IInteractionElement; |
24 |
import org.eclipse.mylyn.context.core.IInteractionElement; |
22 |
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin; |
25 |
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin; |
23 |
import org.eclipse.mylyn.monitor.core.InteractionEvent; |
26 |
import org.eclipse.mylyn.monitor.core.InteractionEvent; |
Lines 26-34
Link Here
|
26 |
|
29 |
|
27 |
/** |
30 |
/** |
28 |
* @author Mik Kersten |
31 |
* @author Mik Kersten |
|
|
32 |
* @author Shawn Minto |
29 |
*/ |
33 |
*/ |
30 |
public class ResourceInterestUpdater { |
34 |
public class ResourceInterestUpdater { |
31 |
|
35 |
|
|
|
36 |
private transient Date lastActivatedDate = null; |
37 |
|
38 |
private final AbstractContextListener contextActivationListener = new AbstractContextListener() { |
39 |
@Override |
40 |
public void contextActivated(IInteractionContext context) { |
41 |
lastActivatedDate = new Date(); |
42 |
} |
43 |
|
44 |
@Override |
45 |
public void contextDeactivated(IInteractionContext context) { |
46 |
lastActivatedDate = null; |
47 |
} |
48 |
}; |
49 |
|
50 |
public ResourceInterestUpdater() { |
51 |
ContextCore.getContextManager().addListener(contextActivationListener); |
52 |
} |
53 |
|
54 |
public void stop() { |
55 |
ContextCore.getContextManager().removeListener(contextActivationListener); |
56 |
} |
57 |
|
32 |
/** |
58 |
/** |
33 |
* In Mylyn 2.0 was: "org.eclipse.mylyn.ide.resource.interest.updater" |
59 |
* In Mylyn 2.0 was: "org.eclipse.mylyn.ide.resource.interest.updater" |
34 |
*/ |
60 |
*/ |
Lines 83-94
Link Here
|
83 |
} |
109 |
} |
84 |
|
110 |
|
85 |
private boolean acceptResource(IResource resource) { |
111 |
private boolean acceptResource(IResource resource) { |
86 |
if (resource.isAccessible() && !resource.isDerived() && !resource.isPhantom()) { |
112 |
if (resource.isAccessible() && !resource.isDerived() && !resource.isPhantom() |
|
|
113 |
&& modifiedWhileTaskActive(resource)) { |
87 |
return true; |
114 |
return true; |
88 |
} |
115 |
} |
89 |
return false; |
116 |
return false; |
90 |
} |
117 |
} |
91 |
|
118 |
|
|
|
119 |
private boolean modifiedWhileTaskActive(IResource resource) { |
120 |
if (lastActivatedDate == null) { |
121 |
return false; |
122 |
} |
123 |
|
124 |
long modificationStamp = resource.getLocalTimeStamp(); |
125 |
if (modificationStamp > 0 && modificationStamp != IResource.NULL_STAMP) { |
126 |
Date resourceDate = new Date(modificationStamp); |
127 |
return resourceDate.after(lastActivatedDate); |
128 |
} |
129 |
|
130 |
return false; |
131 |
} |
132 |
|
92 |
/** |
133 |
/** |
93 |
* For testing. |
134 |
* For testing. |
94 |
*/ |
135 |
*/ |