Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 282436 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/context/core/InteractionContextManager.java (-3 / +28 lines)
Lines 39-50 Link Here
39
import org.eclipse.mylyn.context.core.AbstractContextListener;
39
import org.eclipse.mylyn.context.core.AbstractContextListener;
40
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge;
40
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge;
41
import org.eclipse.mylyn.context.core.ContextChangeEvent;
41
import org.eclipse.mylyn.context.core.ContextChangeEvent;
42
import org.eclipse.mylyn.context.core.ContextChangeEvent.ContextChangeKind;
42
import org.eclipse.mylyn.context.core.ContextCore;
43
import org.eclipse.mylyn.context.core.ContextCore;
43
import org.eclipse.mylyn.context.core.IInteractionContext;
44
import org.eclipse.mylyn.context.core.IInteractionContext;
44
import org.eclipse.mylyn.context.core.IInteractionContextManager;
45
import org.eclipse.mylyn.context.core.IInteractionContextManager;
45
import org.eclipse.mylyn.context.core.IInteractionElement;
46
import org.eclipse.mylyn.context.core.IInteractionElement;
46
import org.eclipse.mylyn.context.core.IInteractionRelation;
47
import org.eclipse.mylyn.context.core.IInteractionRelation;
47
import org.eclipse.mylyn.context.core.ContextChangeEvent.ContextChangeKind;
48
import org.eclipse.mylyn.monitor.core.InteractionEvent;
48
import org.eclipse.mylyn.monitor.core.InteractionEvent;
49
import org.eclipse.mylyn.monitor.core.InteractionEvent.Kind;
49
import org.eclipse.mylyn.monitor.core.InteractionEvent.Kind;
50
50
Lines 804-811 Link Here
804
804
805
				if (activityMetaContext == null) {
805
				if (activityMetaContext == null) {
806
					resetActivityMetaContext();
806
					resetActivityMetaContext();
807
				} else if (!ContextCorePlugin.getDefault().getPluginPreferences().getBoolean(
807
				} else if (!ContextCorePlugin.getDefault()
808
						PREFERENCE_ATTENTION_MIGRATED)) {
808
						.getPluginPreferences()
809
						.getBoolean(PREFERENCE_ATTENTION_MIGRATED)) {
809
					activityMetaContext = migrateLegacyActivity(activityMetaContext);
810
					activityMetaContext = migrateLegacyActivity(activityMetaContext);
810
					saveActivityMetaContext();
811
					saveActivityMetaContext();
811
					ContextCorePlugin.getDefault().getPluginPreferences().setValue(PREFERENCE_ATTENTION_MIGRATED, true);
812
					ContextCorePlugin.getDefault().getPluginPreferences().setValue(PREFERENCE_ATTENTION_MIGRATED, true);
Lines 919-924 Link Here
919
	/**
920
	/**
920
	 * @return true if interest was manipulated successfully
921
	 * @return true if interest was manipulated successfully
921
	 */
922
	 */
923
	public boolean manipulateInterestForElements(List<IInteractionElement> elements, boolean increment,
924
			boolean forceLandmark, boolean preserveUninteresting, String sourceId, IInteractionContext context,
925
			boolean isExplicitManipulation) {
926
		Set<IInteractionElement> changedElements = new HashSet<IInteractionElement>();
927
		boolean manipulated = false;
928
		for (IInteractionElement element : elements) {
929
			manipulated |= manipulateInterestForElementHelper(element, increment, forceLandmark, preserveUninteresting,
930
					sourceId, context, changedElements, null, isExplicitManipulation);
931
		}
932
		if (manipulated) {
933
			if (preserveUninteresting || increment) {
934
				notifyInterestDelta(new ArrayList<IInteractionElement>(changedElements));
935
			} else {
936
				notifyElementsDeleted(context, new ArrayList<IInteractionElement>(changedElements),
937
						isExplicitManipulation);
938
			}
939
		}
940
		return manipulated;
941
	}
942
943
	/**
944
	 * @return true if interest was manipulated successfully
945
	 */
922
	public boolean manipulateInterestForElement(IInteractionElement element, boolean increment, boolean forceLandmark,
946
	public boolean manipulateInterestForElement(IInteractionElement element, boolean increment, boolean forceLandmark,
923
			boolean preserveUninteresting, String sourceId, IInteractionContext context, boolean isExplicitManipulation) {
947
			boolean preserveUninteresting, String sourceId, IInteractionContext context, boolean isExplicitManipulation) {
924
		Set<IInteractionElement> changedElements = new HashSet<IInteractionElement>();
948
		Set<IInteractionElement> changedElements = new HashSet<IInteractionElement>();
Lines 1491-1494 Link Here
1491
			}
1515
			}
1492
		}
1516
		}
1493
	}
1517
	}
1518
1494
}
1519
}
(-)src/org/eclipse/mylyn/internal/context/ui/actions/AbstractInterestManipulationAction.java (-20 / +26 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.mylyn.internal.context.ui.actions;
12
package org.eclipse.mylyn.internal.context.ui.actions;
13
13
14
import java.util.ArrayList;
15
import java.util.List;
16
14
import org.eclipse.jface.action.IAction;
17
import org.eclipse.jface.action.IAction;
15
import org.eclipse.jface.dialogs.MessageDialog;
18
import org.eclipse.jface.dialogs.MessageDialog;
16
import org.eclipse.jface.viewers.ISelection;
19
import org.eclipse.jface.viewers.ISelection;
Lines 77-106 Link Here
77
80
78
		if (selection instanceof StructuredSelection) {
81
		if (selection instanceof StructuredSelection) {
79
			StructuredSelection structuredSelection = (StructuredSelection) selection;
82
			StructuredSelection structuredSelection = (StructuredSelection) selection;
83
			List<IInteractionElement> nodes = new ArrayList<IInteractionElement>();
80
			for (Object object : structuredSelection.toList()) {
84
			for (Object object : structuredSelection.toList()) {
81
				IInteractionElement node = convertSelectionToInteractionElement(object);
85
				IInteractionElement node = convertSelectionToInteractionElement(object);
82
				if (node != null) {
86
				nodes.add(node);
83
					if (!increment) {
87
			}
84
						try {
88
85
							// NOTE: need to set the selection null so the
89
			if (nodes != null && nodes.size() > 0) {
86
							// automatic reselection does not induce interest
90
				if (!increment) {
87
							PlatformUI.getWorkbench()
91
					try {
88
									.getActiveWorkbenchWindow()
92
						// NOTE: need to set the selection null so the
89
									.getActivePage()
93
						// automatic reselection does not induce interest
90
									.getActivePart()
94
						PlatformUI.getWorkbench()
91
									.getSite()
95
								.getActiveWorkbenchWindow()
92
									.getSelectionProvider()
96
								.getActivePage()
93
									.setSelection(null);
97
								.getActivePart()
94
						} catch (Exception e) {
98
								.getSite()
95
							// ignore
99
								.getSelectionProvider()
96
						}
100
								.setSelection(null);
97
					}
101
					} catch (Exception e) {
98
					boolean manipulated = ContextCorePlugin.getContextManager().manipulateInterestForElement(node,
102
						// ignore
99
							increment, false, preserveUninteresting, SOURCE_ID, getContext(), true);
100
					if (!manipulated) {
101
						AbstractInterestManipulationAction.displayInterestManipulationFailure();
102
					}
103
					}
103
				}
104
				}
105
				boolean manipulated = ContextCorePlugin.getContextManager().manipulateInterestForElements(nodes,
106
						increment, false, preserveUninteresting, SOURCE_ID, getContext(), true);
107
				if (!manipulated) {
108
					AbstractInterestManipulationAction.displayInterestManipulationFailure();
109
				}
104
			}
110
			}
105
		} else {
111
		} else {
106
			IInteractionElement node = ContextCore.getContextManager().getActiveElement();
112
			IInteractionElement node = ContextCore.getContextManager().getActiveElement();

Return to bug 282436