Bug 19275 editor: context menu slow on large files
F2 it's slow, but only the first time after a change. then it's fast afain you make another change - it's slow again
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/compare/LocalHistoryActionGroup.java
Assert.isNotNull(groupName);
		fGroupName= groupName;
		fCompareWith= new JavaHistoryEditorAction(editor, new JavaCompareWithEditionAction(), CompareMessages.getString("LocalHistoryActionGroup.action.compare_with")); 
		fReplaceWithPrevious= new JavaHistoryEditorAction(editor, new JavaReplaceWithPreviousEditionAction(), CompareMessages.getString("LocalHistoryActionGroup.action.replace_with_previous")); 
		fReplaceWith= new JavaHistoryEditorAction(editor, new JavaReplaceWithEditionAction(), CompareMessages.getString("LocalHistoryActionGroup.action.replace_with")); 
		fAddFrom= new JavaHistoryEditorAction(editor, new JavaAddElementFromHistory(), CompareMessages.getString("LocalHistoryActionGroup.action.add")); 
	}
	public void fillContextMenu(IMenuManager menu) {
		super.fillContextMenu(menu);
		IMenuManager localMenu= new MenuManager(CompareMessages.getString("LocalHistoryActionGroup.menu.local_history")); 
		int added= 0;
		added+= addAction(localMenu, fCompareWith);
		added+= addAction(localMenu, fReplaceWithPrevious);
		added+= addAction(localMenu, fReplaceWith);
		added+= addAction(localMenu, fAddFrom);
		if (added > 0) {
			menu.appendToGroup(fGroupName, localMenu);
		}
	}
	
	private int addAction(IMenuManager menu, JavaHistoryEditorAction action) {
		action.update();
		if (action.isEnabled()) {
			menu.add(action);
			return 1;
		}
		return 0;
	}
}