Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370682 - ClassCastException in SSE Outline handler. Invalid enablement.
Summary: ClassCastException in SSE Outline handler. Invalid enablement.
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 03:08 EST by Wojciech Trocki CLA
Modified: 2012-02-14 12:36 EST (History)
1 user (show)

See Also:


Attachments
patch (1.57 KB, patch)
2012-02-07 09:48 EST, Nick Sandonato CLA
no flags Details | Diff
patch (7.07 KB, patch)
2012-02-07 13:49 EST, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.