|
Lines 38-43
Link Here
|
| 38 |
import org.eclipse.mylyn.context.core.IInteractionRelation; |
38 |
import org.eclipse.mylyn.context.core.IInteractionRelation; |
| 39 |
import org.eclipse.mylyn.monitor.core.InteractionEvent; |
39 |
import org.eclipse.mylyn.monitor.core.InteractionEvent; |
| 40 |
import org.eclipse.mylyn.monitor.core.StatusHandler; |
40 |
import org.eclipse.mylyn.monitor.core.StatusHandler; |
|
|
41 |
import org.eclipse.mylyn.monitor.core.InteractionEvent.Kind; |
| 41 |
|
42 |
|
| 42 |
/** |
43 |
/** |
| 43 |
* This is the core class resposible for context management. |
44 |
* This is the core class resposible for context management. |
|
Lines 137-143
Link Here
|
| 137 |
public void loadActivityMetaContext() { |
138 |
public void loadActivityMetaContext() { |
| 138 |
if (ContextCorePlugin.getDefault().getContextStore() != null) { |
139 |
if (ContextCorePlugin.getDefault().getContextStore() != null) { |
| 139 |
File contextActivityFile = getFileForContext(CONTEXT_HISTORY_FILE_NAME); |
140 |
File contextActivityFile = getFileForContext(CONTEXT_HISTORY_FILE_NAME); |
| 140 |
activityMetaContext = externalizer.readContextFromXML(CONTEXT_HISTORY_FILE_NAME, contextActivityFile, commonContextScaling); |
141 |
activityMetaContext = externalizer.readContextFromXML(CONTEXT_HISTORY_FILE_NAME, contextActivityFile, |
|
|
142 |
commonContextScaling); |
| 141 |
if (activityMetaContext == null) { |
143 |
if (activityMetaContext == null) { |
| 142 |
resetActivityHistory(); |
144 |
resetActivityHistory(); |
| 143 |
} else if (!ContextCorePlugin.getDefault().getPluginPreferences().getBoolean(PREFERENCE_ATTENTION_MIGRATED)) { |
145 |
} else if (!ContextCorePlugin.getDefault().getPluginPreferences().getBoolean(PREFERENCE_ATTENTION_MIGRATED)) { |
|
Lines 246-251
Link Here
|
| 246 |
} |
248 |
} |
| 247 |
} |
249 |
} |
| 248 |
|
250 |
|
|
|
251 |
public IInteractionElement processInteractionEvent(Kind eventKind, Object object, IInteractionContext context, |
| 252 |
String origin) { |
| 253 |
AbstractContextStructureBridge structureBridge = ContextCorePlugin.getDefault().getStructureBridge(object); |
| 254 |
if (structureBridge != null) { |
| 255 |
String structureKind = structureBridge.getContentType(); |
| 256 |
String handle = structureBridge.getHandleIdentifier(object); |
| 257 |
|
| 258 |
if (structureKind != null && handle != null) { |
| 259 |
InteractionEvent event = new InteractionEvent(eventKind, structureKind, handle, origin); |
| 260 |
List<IInteractionElement> interestDelta = internalProcessInteractionEvent(event, context, true); |
| 261 |
|
| 262 |
notifyInterestDelta(interestDelta); |
| 263 |
|
| 264 |
return context.get(event.getStructureHandle()); |
| 265 |
} |
| 266 |
} |
| 267 |
return null; |
| 268 |
|
| 269 |
} |
| 270 |
|
| 249 |
public IInteractionElement processInteractionEvent(InteractionEvent event) { |
271 |
public IInteractionElement processInteractionEvent(InteractionEvent event) { |
| 250 |
return processInteractionEvent(event, true); |
272 |
return processInteractionEvent(event, true); |
| 251 |
} |
273 |
} |
|
Lines 433-439
Link Here
|
| 433 |
previousInterest = previous.getInterest().getValue(); |
455 |
previousInterest = previous.getInterest().getValue(); |
| 434 |
} |
456 |
} |
| 435 |
IInteractionElement parentNode = addInteractionEvent(interactionContext, propagationEvent); |
457 |
IInteractionElement parentNode = addInteractionEvent(interactionContext, propagationEvent); |
| 436 |
if (kind.isUserEvent() && parentNode.getInterest().getEncodedValue() < commonContextScaling.getInteresting()) { |
458 |
if (kind.isUserEvent() |
|
|
459 |
&& parentNode.getInterest().getEncodedValue() < commonContextScaling.getInteresting()) { |
| 437 |
float parentOffset = ((-1) * parentNode.getInterest().getEncodedValue()) + 1; |
460 |
float parentOffset = ((-1) * parentNode.getInterest().getEncodedValue()) + 1; |
| 438 |
addInteractionEvent(interactionContext, new InteractionEvent(InteractionEvent.Kind.MANIPULATION, |
461 |
addInteractionEvent(interactionContext, new InteractionEvent(InteractionEvent.Kind.MANIPULATION, |
| 439 |
parentNode.getContentType(), parentNode.getHandleIdentifier(), SOURCE_ID_DECAY_CORRECTION, |
462 |
parentNode.getContentType(), parentNode.getHandleIdentifier(), SOURCE_ID_DECAY_CORRECTION, |
|
Lines 642-652
Link Here
|
| 642 |
public InteractionContext loadContext(String handleIdentifier, InteractionContextScaling contextScaling) { |
665 |
public InteractionContext loadContext(String handleIdentifier, InteractionContextScaling contextScaling) { |
| 643 |
return loadContext(handleIdentifier, getFileForContext(handleIdentifier), contextScaling); |
666 |
return loadContext(handleIdentifier, getFileForContext(handleIdentifier), contextScaling); |
| 644 |
} |
667 |
} |
| 645 |
|
668 |
|
| 646 |
public InteractionContext loadContext(String handleIdentifier, File file) { |
669 |
public InteractionContext loadContext(String handleIdentifier, File file) { |
| 647 |
return loadContext(handleIdentifier, file, InteractionContextManager.getCommonContextScaling()); |
670 |
return loadContext(handleIdentifier, file, InteractionContextManager.getCommonContextScaling()); |
| 648 |
} |
671 |
} |
| 649 |
|
672 |
|
| 650 |
private InteractionContext loadContext(String handleIdentifier, File file, InteractionContextScaling contextScaling) { |
673 |
private InteractionContext loadContext(String handleIdentifier, File file, InteractionContextScaling contextScaling) { |
| 651 |
InteractionContext loadedContext = externalizer.readContextFromXML(handleIdentifier, file, contextScaling); |
674 |
InteractionContext loadedContext = externalizer.readContextFromXML(handleIdentifier, file, contextScaling); |
| 652 |
if (loadedContext == null) { |
675 |
if (loadedContext == null) { |
|
Lines 950-959
Link Here
|
| 950 |
if (!isContextActive()) { |
973 |
if (!isContextActive()) { |
| 951 |
return false; |
974 |
return false; |
| 952 |
} else { |
975 |
} else { |
| 953 |
return manipulateInterestForElement(element, increment, forceLandmark, preserveUninteresting, sourceId, activeContext); |
976 |
return manipulateInterestForElement(element, increment, forceLandmark, preserveUninteresting, sourceId, |
|
|
977 |
activeContext); |
| 954 |
} |
978 |
} |
| 955 |
} |
979 |
} |
| 956 |
|
980 |
|
| 957 |
/** |
981 |
/** |
| 958 |
* @return true if interest was manipulated successfully |
982 |
* @return true if interest was manipulated successfully |
| 959 |
*/ |
983 |
*/ |
|
Lines 981-987
Link Here
|
| 981 |
IInteractionElement childElement = getElement(childHandle); |
1005 |
IInteractionElement childElement = getElement(childHandle); |
| 982 |
if (childElement != null && childElement.getInterest().isInteresting() |
1006 |
if (childElement != null && childElement.getInterest().isInteresting() |
| 983 |
&& !childElement.equals(element)) { |
1007 |
&& !childElement.equals(element)) { |
| 984 |
manipulateInterestForElement(childElement, increment, forceLandmark, preserveUninteresting, sourceId, context); |
1008 |
manipulateInterestForElement(childElement, increment, forceLandmark, preserveUninteresting, |
|
|
1009 |
sourceId, context); |
| 985 |
} |
1010 |
} |
| 986 |
} |
1011 |
} |
| 987 |
} |
1012 |
} |
|
Lines 990-997
Link Here
|
| 990 |
changeValue = 0; |
1015 |
changeValue = 0; |
| 991 |
} else { |
1016 |
} else { |
| 992 |
if (bridge.canBeLandmark(element.getHandleIdentifier())) { |
1017 |
if (bridge.canBeLandmark(element.getHandleIdentifier())) { |
| 993 |
changeValue = (context.getScaling().getForcedLandmark()) |
1018 |
changeValue = (context.getScaling().getForcedLandmark()) - originalValue + 1; |
| 994 |
- originalValue + 1; |
|
|
| 995 |
} else { |
1019 |
} else { |
| 996 |
return false; |
1020 |
return false; |
| 997 |
} |
1021 |
} |
|
Lines 1066-1072
Link Here
|
| 1066 |
public void delete(IInteractionElement element) { |
1090 |
public void delete(IInteractionElement element) { |
| 1067 |
delete(element, getActiveContext()); |
1091 |
delete(element, getActiveContext()); |
| 1068 |
} |
1092 |
} |
| 1069 |
|
1093 |
|
| 1070 |
private void delete(IInteractionElement element, IInteractionContext context) { |
1094 |
private void delete(IInteractionElement element, IInteractionContext context) { |
| 1071 |
if (element == null || context == null) { |
1095 |
if (element == null || context == null) { |
| 1072 |
return; |
1096 |
return; |