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

Bug 349721

Summary: [Compatibility] Compare editors cannot be opened from EGit's 'Git Staging' view
Product: [Eclipse Project] Platform Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: pwebster
Version: 4.1   
Target Milestone: 4.1.1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 331240    
Attachments:
Description Flags
LegacyHandlerService patch v1 none

Description Remy Suen CLA 2011-06-17 14:55:58 EDT
When double-clicking on files in the 'Git Staging' view, the compare editor does not open. We are returning UNDEFINED_VARIABLE when the handler tries to ask the context for a selection.

Please refer to line 803 and down.
http://egit.eclipse.org/w/?p=egit.git;a=blob;f=org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java;h=b59dcbfe9a65bb7b496c5369fc3b40d1db49f627;hb=HEAD

Thread [main] (Suspended)	
	ExpressionContext.getVariable(String) line: 116	
	EvaluationContext.getVariable(String) line: 145	
	CompareWithIndexActionHandler(RepositoryActionHandler).convertSelection(IEvaluationContext, Object) line: 327	
	CompareWithIndexActionHandler(RepositoryActionHandler).getSelection() line: 315	
	CompareWithIndexActionHandler(RepositoryActionHandler).getRepository() line: 211	
	CompareWithIndexActionHandler.isEnabled() line: 170	
	HandlerProxy.isEnabled() line: 320	
	E4HandlerProxy.canExecute(IEclipseContext, IEvaluationContext) line: 53	
	GeneratedMethodAccessor3.invoke(Object, Object[]) line: not available	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available	
	Method.invoke(Object, Object...) line: not available	
	MethodRequestor.execute() line: 56	
	InjectorImpl.invokeUsingClass(Object, Class<?>, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean) line: 226	
	InjectorImpl.invoke(Object, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 207	
	ContextInjectionFactory.invoke(Object, Class<Annotation>, IEclipseContext, IEclipseContext, Object) line: 123	
	HandlerServiceImpl.executeHandler(ParameterizedCommand, IEclipseContext) line: 138	
	LegacyHandlerService.executeCommandInContext(ParameterizedCommand, Event, IEvaluationContext) line: 487	
	StagingView.runCommand(String, IStructuredSelection) line: 830
Comment 1 Paul Webster CLA 2011-06-21 12:32:19 EDT
We need to find some way to avoid this when creating a snap shot with no selection variables.

PW
Comment 2 Remy Suen CLA 2011-06-21 14:39:14 EDT
(In reply to comment #1)
> We need to find some way to avoid this when creating a snap shot with no
> selection variables.

Does it make sense to create an ExpressionContext for createContextSnapshot(boolean)? Would it be better to make something static? It is after all just a "snapshot".
Comment 3 Paul Webster CLA 2011-06-21 15:07:50 EDT
(In reply to comment #2)
> 
> Does it make sense to create an ExpressionContext for
> createContextSnapshot(boolean)? Would it be better to make something static? It
> is after all just a "snapshot".

That's another possibility.  We just need to make sure that nothing has to extract the IEclipseContext from the ExpressionContext on the way through, then we could ignore it completely.

PW
Comment 4 Remy Suen CLA 2011-07-05 09:38:33 EDT
Created attachment 199125 [details]
LegacyHandlerService patch v1
Comment 5 Remy Suen CLA 2011-07-05 09:43:25 EDT
(In reply to comment #4)
> Created attachment 199125 [details]
> LegacyHandlerService patch v1

Patch released to CVS HEAD.
Comment 6 Remy Suen CLA 2011-07-06 08:07:02 EDT
Verified with I20110705-1340 on Windows XP.