Bug 128117 [Undo/Redo] Context not removed from TriggeredOperations
When I add a context to a TriggeredOperations using #addContext(IUndoContext), I cannot remove the same context using #removeContext(IUndoContext). This is because TriggeredOperations overrides #removeContext(IUndoContext) and only considers removing the context from its triggering operation or its children, but not from its own list of contexts. In my case, I have an editor that adds its undo context to operations that it wants to be able to present in its undo menu. When the editor closes, it flushes its undo context from the history. However, if the operation is a TriggeredOperations, the editor undo context is not removed, and the operation will never be flushed from the history.
bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/operations/TriggeredOperations.java
contexts = allContexts;
	}
	/*
	 * Remove all non-triggering children
	 */
	private void removeAllChildren() {
		IUndoableOperation[] nonTriggers = (IUndoableOperation[]) children
				.toArray(new IUndoableOperation[children.size()]);
		for (int i = 0; i < nonTriggers.length; i++) {
			children.remove(nonTriggers[i]);
			nonTriggers[i].dispose();
		}
	}
	/**
	 * Return the operation that triggered the other operations in this
	 * composite.
	 * 
	 * @return the IUndoableOperation that triggered the other children.
	 */
	public IUndoableOperation getTriggeringOperation() {
		return triggeringOperation;
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.commands.operations.IAdvancedModelOperation#getAffectedObjects()
	 */
	public Object [] getAffectedObjects() {
		if (triggeringOperation instanceof IAdvancedUndoableOperation) {