emmetio / emmet-eclipse

Emmet for Eclipse
http://emmet.io
343 stars 74 forks source link

Do not assume getSelectedPage() returns IEditorPart #26

Closed maxandersen closed 10 years ago

maxandersen commented 11 years ago

Add check that selected page is actually an IEditorPart to avoid classcast exception.

I'm trying out emmet and noticed I hit this exception:

java.lang.ClassCastException: org.eclipse.swt.widgets.Composite cannot be cast to org.eclipse.ui.IEditorPart at io.emmet.eclipse.EclipseEmmetHelper.getTextEditor(EclipseEmmetHelper.java:53) at io.emmet.eclipse.TabKeyHandler.uninstall(TabKeyHandler.java:95) at io.emmet.eclipse.TabKeyHandler$2.partClosed(TabKeyHandler.java:216) at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:4874) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.internal.WorkbenchPage.firePartClosed(WorkbenchPage.java:4872) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart$1.handleEvent(CompatibilityPart.java:101)

This only happens when opening JBoss Tools Properties page editor which does not return IEditorPart for getPages(). I'm investigating why that is but I would say it would be good if emmet would not assume this. Here is a simple fix for this issue.
maxandersen commented 11 years ago

This actually also seem to happen when using eclipse wtp xml editor.

artlung commented 10 years ago

@maxandersen Good show! Any luck getting traction with the maintainers?

maxandersen commented 10 years ago

Nope - no response to these ;/

sergeche commented 10 years ago

Thanks! Sorry for late response, the updated version should be available via Updates