Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 408606

Summary: Conflict Commands
Product: [Eclipse Project] Platform Reporter: Paul Webster <pwebster>
Component: UIAssignee: Paul Webster <pwebster>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: browe, john.arthorne, nsand.dev, pelder.eclipse, polomm, pwebster, shr31223, sptaszkiewicz, thatnitind
Version: 3.6.2   
Target Milestone: 4.3.1   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on: 395642    
Bug Blocks:    

Description Paul Webster CLA 2013-05-21 11:49:22 EDT
Forward port into 4.3.1

+++ This bug was initially created as a clone of Bug #395642 +++

Our editor is having conflict with some Eclipse base commands like Ctrl + C, Ctrl + V, Ctrl + X, Ctrl + Z and many others. As a result, those commands are disabled. 

This problem cannot be recreated in Eclipse as-is because it requires extenders to exposure the action handlers functionality. Apparently, Eclipse  does not make honor to those actions already overridden by extenders like Page Designer - which is totally acceptable - and Eclipse just  suddenly inserts base actions causing conflict during some of then Eclipse checkers. As a result, affected commands are disabled.

For example, org.eclipse.ui.internal.handlers.HandlerAuthority.resolveConflicts(String, SortedSet,
MultiStatus) has the following activations


[HandlerActivation(commandId=org.eclipse.ui.edit.cut,
	handler=LegacyHandlerWrapper(ActionHandler(action=com.ibm.etools.webedit.editor.internal.actions.override.HookAction@2dd3e753)),
	expression=LegacyHandlerSubmission(Shell {Java EE - DWP/WebContent/jsp12.jsp - Rational® Application Developer for WebSphere® Software},null,PartSite(id=
com.ibm.etools.webedit.editor.HTMLEditor,pluginId=com.ibm.etools.webedit.editor,registeredName=Page Designer,hashCode=1074672202)),sourcePriority=
67113984), HandlerActivation(commandId=org.eclipse.ui.edit.cut,
	handler=LegacyHandlerWrapper(ActionHandler(action=com.ibm.etools.webedit.editor.internal.actions.override.HookAction@3e664758)),
	expression=LegacyHandlerSubmission(Shell {Java EE - DWP/WebContent/jsp12.jsp - Rational® Application Developer for WebSphere® Software},null,PartSite(id=
com.ibm.etools.webedit.editor.HTMLEditor,pluginId=com.ibm.etools.webedit.editor,registeredName=Page Designer,hashCode=-1105734388)),sourcePriority=
67113984), HandlerActivation(commandId=org.eclipse.ui.edit.cut,
	handler=LegacyHandlerWrapper(ActionHandler(action=com.ibm.etools.webedit.editor.internal.actions.override.HookAction@e5264644)),
	expression=LegacyHandlerSubmission(Shell {Java EE - DWP/WebContent/jsp12.jsp - Rational® Application Developer for WebSphere® Software},null,PartSite(id=
com.ibm.etools.webedit.editor.HTMLEditor,pluginId=com.ibm.etools.webedit.editor,registeredName=Page Designer,hashCode=-1138585522)),sourcePriority=
67113984), HandlerActivation(commandId=org.eclipse.ui.edit.cut,
	handler=LegacyHandlerWrapper(ActionHandler(action=com.ibm.etools.webedit.editor.internal.actions.override.HookAction@7facf100)),
	expression=LegacyHandlerSubmission(Shell {Java EE - DWP/WebContent/jsp12.jsp - Rational® Application Developer for WebSphere® Software},null,PartSite(id=
com.ibm.etools.webedit.editor.HTMLEditor,pluginId=com.ibm.etools.webedit.editor,registeredName=Page Designer,hashCode=1050721745)),sourcePriority=
67113984), HandlerActivation(commandId=org.eclipse.ui.edit.cut,
	handler=LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.texteditor.TextOperationAction@164826bd)),
	expression=LegacyHandlerSubmission(Shell {Java EE - DWP/WebContent/jsp12.jsp - Rational® Application Developer for WebSphere® Software},null,PartSite(id=
com.ibm.etools.webedit.editor.HTMLEditor,pluginId=com.ibm.etools.webedit.editor,registeredName=Page Designer,hashCode=1074672202)),sourcePriority=
67113984), HandlerActivation(commandId=org.eclipse.ui.edit.cut,
	handler=ActionHandler(org.eclipse.ui.texteditor.TextOperationAction@164826bd),
	expression=AndExpression(LegacyEditorActionBarExpression(com.ibm.etools.webedit.editor.HTMLEditor),WorkbenchWindowExpression(
org.eclipse.ui.internal.WorkbenchWindow@987c4c29)),sourcePriority=4210689), HandlerActivation(commandId=org.eclipse.ui.edit.cut,
	handler=ActionHandler(org.eclipse.jdt.internal.ui.refactoring.reorg.CutAction@b72ba92f),
	expression=AndExpression(AndExpression(org.eclipse.ui.SubActionBars$1@40a2b05a,ActivePartExpression(com.ibm.etools.ui.navigator.SDNavigator@fea373f4)),
WorkbenchWindowExpression(org.eclipse.ui.internal.WorkbenchWindow@987c4c29)),sourcePriority=1064961), HandlerActivation(commandId=org.eclipse.ui.edit.cut
,
	handler=org.eclipse.ui.internal.handlers.WidgetMethodHandler@66fcec32,
	expression=,sourcePriority=0)]

And here are the ones that are in conflict 

<0010.3.4.b> conflict... org...HandlerAuthority.resolveConflicts() : currentActivation = 5, HandlerActivation(commandId=org.eclipse.ui.edit.cut, 	handler=
LegacyHandlerWrapper(ActionHandler(action=org.eclipse.ui.texteditor.TextOperationAction@164826bd)), 	expression=LegacyHandlerSubmission(Shell {Java EE -
DWP/WebContent/jsp12.jsp - Rational® Application Developer for WebSphere® Software},null,PartSite(id=com.ibm.etools.webedit.editor.HTMLEditor,pluginId=
com.ibm.etools.webedit.editor,registeredName=Page Designer,hashCode=1074672202)),sourcePriority=67113984)
          <0010.3.4.c> conflict... org...HandlerAuthority.resolveConflicts() : bestActivation    = 1, HandlerActivation(commandId=org.eclipse.ui.edit.cut, 	handler=
LegacyHandlerWrapper(ActionHandler(action=com.ibm.etools.webedit.editor.internal.actions.override.HookAction@2dd3e753)), 	expression=
LegacyHandlerSubmission(Shell {Java EE - DWP/WebContent/jsp12.jsp - Rational® Application Developer for WebSphere® Software},null,PartSite(id=
com.ibm.etools.webedit.editor.HTMLEditor,pluginId=com.ibm.etools.webedit.editor,registeredName=Page Designer,hashCode=1074672202)),sourcePriority=
67113984)

One easy way to read this is that the best activation (from extender) "com.ibm.etools.webedit.editor.internal.actions.override.HookAction@2dd3e753)" is active and has conflict by one defined by Eclipse "org.eclipse.ui.texteditor.TextOperationAction@164826bd)"

Here is the execution point where this conflict occurs.


Thread [main] (Suspended (breakpoint at line 519 in org.eclipse.ui.internal.handlers.HandlerAuthority))	
	org.eclipse.ui.internal.handlers.HandlerAuthority.resolveConflicts(java.lang.String, java.util.SortedSet, org.eclipse.core.runtime.MultiStatus) line: 519	
	org.eclipse.ui.internal.handlers.HandlerAuthority.processChangedCommands() line: 795	
	org.eclipse.ui.internal.handlers.HandlerAuthority.access$1(org.eclipse.ui.internal.handlers.HandlerAuthority) line: 757	
	org.eclipse.ui.internal.handlers.HandlerAuthority$1.propertyChange(org.eclipse.jface.util.PropertyChangeEvent) line: 177	
	org.eclipse.ui.internal.services.EvaluationAuthority$1.run() line: 252	
	org.eclipse.core.runtime.SafeRunner.run(org.eclipse.core.runtime.ISafeRunnable) line: 42	
	org.eclipse.ui.internal.services.EvaluationAuthority.fireServiceChange(java.lang.String, java.lang.Object, java.lang.Object) line: 246	
	org.eclipse.ui.internal.services.EvaluationAuthority.endSourceChange(java.lang.String[]) line: 197	
	org.eclipse.ui.internal.services.EvaluationAuthority.sourceChanged(java.lang.String[]) line: 135	
	org.eclipse.ui.internal.services.EvaluationAuthority(org.eclipse.ui.internal.services.ExpressionAuthority).sourceChanged(int, java.lang.String[]) line: 311	
	org.eclipse.ui.internal.services.EvaluationAuthority(org.eclipse.ui.internal.services.ExpressionAuthority).sourceChanged(int, java.util.Map) line: 290	
	org.eclipse.ui.internal.services.WorkbenchSourceProvider(org.eclipse.ui.AbstractSourceProvider).fireSourceChanged(int, java.util.Map) line: 99	
	org.eclipse.ui.internal.services.WorkbenchSourceProvider.checkActivePart(boolean) line: 401	
	org.eclipse.ui.internal.services.WorkbenchSourceProvider.checkActivePart() line: 300	
	org.eclipse.ui.internal.services.WorkbenchSourceProvider$1.partDeactivated(org.eclipse.ui.IWorkbenchPart) line: 247	
	org.eclipse.ui.internal.PartListenerList$4.run() line: 117	
	org.eclipse.core.runtime.SafeRunner.run(org.eclipse.core.runtime.ISafeRunnable) line: 42	
	org.eclipse.core.runtime.Platform.run(org.eclipse.core.runtime.ISafeRunnable) line: 888	
	org.eclipse.ui.internal.PartListenerList.fireEvent(org.eclipse.jface.util.SafeRunnable, org.eclipse.ui.IPartListener, org.eclipse.ui.IWorkbenchPart, java.lang.String) line: 57	
	org.eclipse.ui.internal.PartListenerList.firePartDeactivated(org.eclipse.ui.IWorkbenchPart) line: 115	
	org.eclipse.ui.internal.PartService.firePartDeactivated(org.eclipse.ui.IWorkbenchPartReference) line: 238	
	org.eclipse.ui.internal.PartService.setActivePart(org.eclipse.ui.IWorkbenchPartReference) line: 300	
	org.eclipse.ui.internal.WWinPartService.updateActivePart() line: 134	
	org.eclipse.ui.internal.WWinPartService.access$0(org.eclipse.ui.internal.WWinPartService) line: 125	
	org.eclipse.ui.internal.WWinPartService$WWinListener.partDeactivated(org.eclipse.ui.IWorkbenchPartReference) line: 50	
	org.eclipse.ui.internal.PartListenerList2$4.run() line: 115	
	org.eclipse.core.runtime.SafeRunner.run(org.eclipse.core.runtime.ISafeRunnable) line: 42	
	org.eclipse.core.runtime.Platform.run(org.eclipse.core.runtime.ISafeRunnable) line: 888	
	org.eclipse.ui.internal.PartListenerList2.fireEvent(org.eclipse.jface.util.SafeRunnable, org.eclipse.ui.IPartListener2, org.eclipse.ui.IWorkbenchPartReference,
java.lang.String) line: 55	
	org.eclipse.ui.internal.PartListenerList2.firePartDeactivated(org.eclipse.ui.IWorkbenchPartReference) line: 113	
	org.eclipse.ui.internal.PartService.firePartDeactivated(org.eclipse.ui.IWorkbenchPartReference) line: 242	
	org.eclipse.ui.internal.PartService.setActivePart(org.eclipse.ui.IWorkbenchPartReference) line: 300	
	org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(org.eclipse.ui.IWorkbenchPartReference, org.eclipse.ui.IWorkbenchPartReference) line: 57	
	org.eclipse.ui.internal.WorkbenchPagePartList(org.eclipse.ui.internal.PartList).setActivePart(org.eclipse.ui.IWorkbenchPartReference) line: 136	
	org.eclipse.ui.internal.WorkbenchPage.setActivePart(org.eclipse.ui.IWorkbenchPart, boolean) line: 3537	
	org.eclipse.ui.internal.WorkbenchPage.internalActivate(org.eclipse.ui.IWorkbenchPart, boolean) line: 617	
	org.eclipse.ui.internal.WorkbenchPage.activate(org.eclipse.ui.IWorkbenchPart) line: 589	
	org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(org.eclipse.ui.IEditorInput, java.lang.String, boolean, int, org.eclipse.ui.IMemento) line: 2875	
	org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(org.eclipse.ui.IEditorInput, java.lang.String, boolean, int, org.eclipse.ui.IMemento) line: 2768	
	org.eclipse.ui.internal.WorkbenchPage.access$11(org.eclipse.ui.internal.WorkbenchPage, org.eclipse.ui.IEditorInput, java.lang.String, boolean, int,
org.eclipse.ui.IMemento) line: 2760	
	org.eclipse.ui.internal.WorkbenchPage$10.run() line: 2711	
	org.eclipse.swt.custom.BusyIndicator.showWhile(org.eclipse.swt.widgets.Display, java.lang.Runnable) line: 70	
	org.eclipse.ui.internal.WorkbenchPage.openEditor(org.eclipse.ui.IEditorInput, java.lang.String, boolean, int, org.eclipse.ui.IMemento) line: 2707	
	org.eclipse.ui.internal.WorkbenchPage.openEditor(org.eclipse.ui.IEditorInput, java.lang.String, boolean, int) line: 2691	
	org.eclipse.ui.internal.WorkbenchPage.openEditor(org.eclipse.ui.IEditorInput, java.lang.String, boolean) line: 2682	
	org.eclipse.ui.ide.IDE.openEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.core.resources.IFile, boolean, boolean) line: 655	
	org.eclipse.ui.ide.IDE.openEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.core.resources.IFile, boolean) line: 614	
	org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(org.eclipse.core.resources.IFile, boolean) line: 355	
	org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(java.lang.Object, boolean) line: 164	
	org.eclipse.jdt.ui.actions.OpenAction.run(java.lang.Object[]) line: 249	
	org.eclipse.jdt.ui.actions.OpenAction.run(org.eclipse.jface.viewers.IStructuredSelection) line: 228	
	org.eclipse.jdt.ui.actions.OpenAction(org.eclipse.jdt.ui.actions.SelectionDispatchAction).dispatchRun(org.eclipse.jface.viewers.ISelection) line: 275	
	org.eclipse.jdt.ui.actions.OpenAction(org.eclipse.jdt.ui.actions.SelectionDispatchAction).run() line: 251	
	org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run() line: 50	
	org.eclipse.ui.actions.RetargetAction.run() line: 221	
	org.eclipse.ui.navigator.CommonNavigatorManager$3.open(org.eclipse.jface.viewers.ISelection, boolean) line: 185	
	org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(org.eclipse.jface.viewers.OpenEvent) line: 48	
	org.eclipse.jface.viewers.StructuredViewer$2.run() line: 845	
	org.eclipse.core.runtime.SafeRunner.run(org.eclipse.core.runtime.ISafeRunnable) line: 42	
	org.eclipse.ui.internal.JFaceUtil$1.run(org.eclipse.core.runtime.ISafeRunnable) line: 49	
	org.eclipse.jface.util.SafeRunnable.run(org.eclipse.core.runtime.ISafeRunnable) line: 175	
	com.ibm.etools.ui.navigator.SDFilteredTree$SDNotifyingTreeViewer(org.eclipse.jface.viewers.StructuredViewer).fireOpen(org.eclipse.jface.viewers.OpenEvent) line:
843	
	com.ibm.etools.ui.navigator.SDFilteredTree$SDNotifyingTreeViewer(org.eclipse.jface.viewers.StructuredViewer).handleOpen(org.eclipse.swt.events.SelectionEvent) line
: 1131	
	com.ibm.etools.ui.navigator.SDFilteredTree$SDNotifyingTreeViewer(org.eclipse.ui.navigator.CommonViewer).handleOpen(org.eclipse.swt.events.SelectionEvent) line:
462	
	org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(org.eclipse.swt.events.SelectionEvent) line: 1235	
	org.eclipse.jface.util.OpenStrategy.fireOpenEvent(org.eclipse.swt.events.SelectionEvent) line: 264	
	org.eclipse.jface.util.OpenStrategy.access$2(org.eclipse.jface.util.OpenStrategy, org.eclipse.swt.events.SelectionEvent) line: 258	
	org.eclipse.jface.util.OpenStrategy$1.handleEvent(org.eclipse.swt.widgets.Event) line: 298	
	org.eclipse.swt.widgets.EventTable.sendEvent(org.eclipse.swt.widgets.Event) line: 84	
	org.eclipse.swt.widgets.Tree(org.eclipse.swt.widgets.Widget).sendEvent(org.eclipse.swt.widgets.Event) line: 1258	
	org.eclipse.swt.widgets.Display.runDeferredEvents() line: 3540	
	org.eclipse.swt.widgets.Display.readAndDispatch() line: 3161	
	org.eclipse.ui.internal.Workbench.runEventLoop(org.eclipse.jface.window.Window$IExceptionHandler, org.eclipse.swt.widgets.Display) line: 2640	
	org.eclipse.ui.internal.Workbench.runUI() line: 2604	
	org.eclipse.ui.internal.Workbench.access$4(org.eclipse.ui.internal.Workbench) line: 2438	
	org.eclipse.ui.internal.Workbench$7.run() line: 671	
	org.eclipse.core.databinding.observable.Realm.runWithDefault(org.eclipse.core.databinding.observable.Realm, java.lang.Runnable) line: 332	
	org.eclipse.ui.internal.Workbench.createAndRunWorkbench(org.eclipse.swt.widgets.Display, org.eclipse.ui.application.WorkbenchAdvisor) line: 664	
	org.eclipse.ui.PlatformUI.createAndRunWorkbench(org.eclipse.swt.widgets.Display, org.eclipse.ui.application.WorkbenchAdvisor) line: 149	
	org.eclipse.ui.internal.ide.application.IDEApplication.start(org.eclipse.equinox.app.IApplicationContext) line: 115	
	org.eclipse.equinox.internal.app.EclipseAppHandle.run(java.lang.Object) line: 196	
	org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(java.lang.Object) line: 110	
	org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(java.lang.Object) line: 79	
	org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lang.Object) line: 369	
	org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lang.String[], java.lang.Runnable) line: 179	
	sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.reflect.Method, java.lang.Object, java.lang.Object[]) line: not available [native method]	
	sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 88	
	sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 55	
	java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: 613	
	org.eclipse.equinox.launcher.Main.invokeFramework(java.lang.String[], java.net.URL[]) line: 620	
	org.eclipse.equinox.launcher.Main.basicRun(java.lang.String[]) line: 575	
	org.eclipse.equinox.launcher.Main.run(java.lang.String[]) line: 1408	
	org.eclipse.equinox.launcher.Main.main(java.lang.String[]) line: 1384	


Notes.
1. Page Designer Editor is under the split view (Design + Source) by having active the source section
2. We're seeing this problem starting 3.6.x (older released e.g. 3.4.x does seems to have this problem)
3. JSP's contains just the template e.g. (html's does have same behavior when PD is being used, split view)  
4. This problem can be recreated almost always opening between 1..10 JSP files in our editor.


<!DOCTYPE HTML><%@page language="java"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<title>jsp1</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>

</body>
</html>

Any other information you need, please let me know.
Comment 1 Paul Webster CLA 2013-05-21 11:49:47 EDT
Resolution:

It seems there's a problem in some JVMs that can cause org.eclipse.ui.internal.util.Util.compareIdentity(Object, Object) to fail (System.identityHashCode(left) - System.identityHashCode(right)).  That means that sometimes the Set of active handlers (which uses this method in its comparator) can fail to find an existing activation (so it doesn't get removed from the set) and the next time a new one is added, you get this conflict.
Comment 2 Paul Webster CLA 2013-07-31 15:56:18 EDT
Ported as https://git.eclipse.org/r/15029

Paul, could you please review this?

PW
Comment 4 Paul Elder CLA 2013-08-26 14:27:32 EDT
Verified in build 4.3.0.M20130821-0800
Comment 5 Paul Elder CLA 2013-08-28 10:04:40 EDT
Per comment 4, state should be Verified
Comment 6 Paul Elder CLA 2013-08-28 10:04:58 EDT
Verified per comment 4