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

Bug 370682

Summary: ClassCastException in SSE Outline handler. Invalid enablement.
Product: [WebTools] WTP Source Editing Reporter: Wojciech Trocki <wtrocki>
Component: wst.sseAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: thatnitind
Version: unspecified   
Target Milestone: 3.4 M6   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch
none
patch none

Description Wojciech Trocki CLA 2012-02-06 03:08:14 EST
Build Identifier: 

SSE CustomFilterHandler has invalid enablement. Handler is executed on other outlines. 
Execution provides exception:


!ENTRY org.eclipse.ui 4 0 2012-02-03 10:36:05.899
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.ClassCastException: com.wtrocki.ui.editors.source.outline.SourceOutlinePage cannot be cast to org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage
	at org.eclipse.wst.sse.ui.internal.handlers.CustomFilterHandler.execute(CustomFilterHandler.java:25)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at
..

Proposed change on FilterHandler:

public class CustomFilterHandler extends AbstractHandler {
	public Object execute(ExecutionEvent event) throws ExecutionException {

		IEditorPart editor = HandlerUtil.getActiveEditor(event);
		Object adapter=editor.getAdapter(IContentOutlinePage.class);
			if(adapter instanceof ConfigurableContentOutlinePage){
			ConfigurableContentOutlinePage page = (ConfigurableContentOutlinePage) adapter;
			if (page != null) {
				page.getOutlineFilterProcessor().openDialog();
			}
		}
		return null;
	}
	
}



Reproducible: Always
Comment 1 Nick Sandonato CLA 2012-02-07 09:48:05 EST
Created attachment 210644 [details]
patch
Comment 2 Nick Sandonato CLA 2012-02-07 09:48:34 EST
Adding Nitin for review since we're ramping down and will need PMC approval.
Comment 3 Wojciech Trocki CLA 2012-02-07 10:05:59 EST
This fix only class cast problem. Filter action is still visible in other outlines. I think that visiblewhen expression for this action in plugin.xml should be also changed. Thanks for quick response for this bug.
Comment 4 Nitin Dahyabhai CLA 2012-02-07 10:36:38 EST
Nick, the Plug-in Manifest editor outline might be a good stand-in test for the one reported; it does not have a Filter action (it's Outline view's local menu is empty).
Comment 5 Nick Sandonato CLA 2012-02-07 13:49:26 EST
Created attachment 210675 [details]
patch

The problem is the property tester wasn't being executed because the sse.ui plugin hadn't been activated yet. This patch forces plugin activation, but also excludes that property tester's package from the activation list.
Comment 6 Nick Sandonato CLA 2012-02-14 12:36:20 EST
Code released to HEAD.