Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » ClassCastException in OutlinePage(Outline conflict in integration)
ClassCastException in OutlinePage [message #716113] Tue, 16 August 2011 13:33 Go to next message
Balazs Varnai is currently offline Balazs VarnaiFriend
Messages: 21
Registered: June 2011
Junior Member
Hi All,

I am integrationg an xtext based editor with a third-party editor. While working in the third-party perspective and opening an xtext resource, an exception occurs. This happens on any updates.

Any pointers where to look? Thanks!

/Balazs

!ENTRY org.eclipse.ui.workbench 4 0 2011-08-16 15:26:34.800
!MESSAGE org.eclipse.xtext.ui.editor.outline.impl.OutlinePage cannot be cast to com.testingtech.ttworkbench.xcleditor.ou
tline.OutlinePage
!STACK 0
java.lang.ClassCastException: org.eclipse.xtext.ui.editor.outline.impl.OutlinePage cannot be cast to com.testingtech.ttw
orkbench.xcleditor.outline.OutlinePage
        at com.testingtech.ttworkbench.xcleditor.action.AbstractAction.adapt(AbstractAction.java:124)
        at com.testingtech.ttworkbench.xcleditor.action.AbstractAction.updateAction(AbstractAction.java:77)
        at com.testingtech.ttworkbench.xcleditor.action.AbstractAction.selectionChanged(AbstractAction.java:70)
        at org.eclipse.ui.internal.PluginAction.refreshEnablement(PluginAction.java:206)
        at org.eclipse.ui.internal.PluginAction.selectionChanged(PluginAction.java:277)
        at org.eclipse.ui.internal.PluginAction.selectionChanged(PluginAction.java:299)
        at org.eclipse.ui.internal.AbstractSelectionService.fireSelection(AbstractSelectionService.java:156)
        at org.eclipse.ui.internal.AbstractSelectionService.setActivePart(AbstractSelectionService.java:282)
        at org.eclipse.ui.internal.WWinPartService.updateActivePart(WWinPartService.java:132)
        at org.eclipse.ui.internal.WWinPartService.access$0(WWinPartService.java:122)
        at org.eclipse.ui.internal.WWinPartService$WWinListener.partDeactivated(WWinPartService.java:50)
        at org.eclipse.ui.internal.PartListenerList2$4.run(PartListenerList2.java:115)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.eclipse.core.runtime.Platform.run(Platform.java:888)
        at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
        at org.eclipse.ui.internal.PartListenerList2.firePartDeactivated(PartListenerList2.java:113)
        at org.eclipse.ui.internal.PartService.firePartDeactivated(PartService.java:242)
        at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:300)
        at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:57)
        at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:136)
        at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3531)
        at org.eclipse.ui.internal.WorkbenchPage.requestActivation(WorkbenchPage.java:3071)
        at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:279)
        at org.eclipse.ui.internal.EditorPane.requestActivation(EditorPane.java:98)
        at org.eclipse.ui.internal.PartPane.setFocus(PartPane.java:325)
        at org.eclipse.ui.internal.EditorPane.setFocus(EditorPane.java:127)
        at org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:846)
        at org.eclipse.ui.internal.PartStack.access$1(PartStack.java:829)
        at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:139)
        at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:133)
        at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:270)
        at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:279)
        at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1)
        at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$2.handleEvent(DefaultTabFolder.java:87)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
        at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:770)
        at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3256)
        at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2045)
        at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:323)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1311)


Re: ClassCastException in OutlinePage [message #716237 is a reply to message #716113] Tue, 16 August 2011 17:45 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3109
Registered: July 2009
Senior Member
Hi Balazs,

first of all I'd look into
com.testingtech.ttworkbench.xcleditor.action.AbstractAction.adapt(..)
and get rid of the wrong class cast. I'd assume the code adapts for
IContentOutlinePage but casts to a specific implementation class.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 16.08.11 15:33, Balazs Varnai wrote:
> Hi All,
>
> I am integrationg an xtext based editor with a third-party editor. While
> working in the third-party perspective and opening an xtext resource, an
> exception occurs. This happens on any updates.
>
> Any pointers where to look? Thanks!
>
> /Balazs
>
>
> !ENTRY org.eclipse.ui.workbench 4 0 2011-08-16 15:26:34.800
> !MESSAGE org.eclipse.xtext.ui.editor.outline.impl.OutlinePage cannot be
> cast to com.testingtech.ttworkbench.xcleditor.ou
> tline.OutlinePage
> !STACK 0
> java.lang.ClassCastException:
> org.eclipse.xtext.ui.editor.outline.impl.OutlinePage cannot be cast to
> com.testingtech.ttw
> orkbench.xcleditor.outline.OutlinePage
> at
> com.testingtech.ttworkbench.xcleditor.action.AbstractAction.adapt(AbstractAction.java:124)
>
> at
> com.testingtech.ttworkbench.xcleditor.action.AbstractAction.updateAction(AbstractAction.java:77)
>
> at
> com.testingtech.ttworkbench.xcleditor.action.AbstractAction.selectionChanged(AbstractAction.java:70)
>
> at
> org.eclipse.ui.internal.PluginAction.refreshEnablement(PluginAction.java:206)
>
> at
> org.eclipse.ui.internal.PluginAction.selectionChanged(PluginAction.java:277)
>
> at
> org.eclipse.ui.internal.PluginAction.selectionChanged(PluginAction.java:299)
>
> at
> org.eclipse.ui.internal.AbstractSelectionService.fireSelection(AbstractSelectionService.java:156)
>
> at
> org.eclipse.ui.internal.AbstractSelectionService.setActivePart(AbstractSelectionService.java:282)
>
> at
> org.eclipse.ui.internal.WWinPartService.updateActivePart(WWinPartService.java:132)
>
> at
> org.eclipse.ui.internal.WWinPartService.access$0(WWinPartService.java:122)
> at
> org.eclipse.ui.internal.WWinPartService$WWinListener.partDeactivated(WWinPartService.java:50)
>
> at
> org.eclipse.ui.internal.PartListenerList2$4.run(PartListenerList2.java:115)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.core.runtime.Platform.run(Platform.java:888)
> at
> org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
>
> at
> org.eclipse.ui.internal.PartListenerList2.firePartDeactivated(PartListenerList2.java:113)
>
> at
> org.eclipse.ui.internal.PartService.firePartDeactivated(PartService.java:242)
>
> at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:300)
> at
> org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:57)
>
> at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:136)
> at
> org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3531)
>
> at
> org.eclipse.ui.internal.WorkbenchPage.requestActivation(WorkbenchPage.java:3071)
>
> at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:279)
> at org.eclipse.ui.internal.EditorPane.requestActivation(EditorPane.java:98)
> at org.eclipse.ui.internal.PartPane.setFocus(PartPane.java:325)
> at org.eclipse.ui.internal.EditorPane.setFocus(EditorPane.java:127)
> at
> org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:846)
>
> at org.eclipse.ui.internal.PartStack.access$1(PartStack.java:829)
> at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:139)
> at
> org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:133)
>
> at
> org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:270)
>
> at
> org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:279)
>
> at
> org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1)
>
> at
> org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$2.handleEvent(DefaultTabFolder.java:87)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
> at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:770)
> at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3256)
> at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2045)
> at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:323)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
>
>
>
Re: ClassCastException in OutlinePage [message #716423 is a reply to message #716237] Wed, 17 August 2011 11:28 Go to previous messageGo to next message
Balazs Varnai is currently offline Balazs VarnaiFriend
Messages: 21
Registered: June 2011
Junior Member
Hi Sebastian,

Thanks! I wonder why does the getAdapter() returns anything? XtextEditor has no adapter for com.testingtech.ttworkbench.xcleditor.outline.OutlinePage.

/Balazs

 protected Cleditor adapt(IWorkbenchPart part)
  {
    if (part != null) {
      Cleditor theEditor = (Cleditor)part.getAdapter(Cleditor.class);
      if (theEditor != null) {
        return theEditor;
      }

      OutlinePage theOutlinePage = (OutlinePage)part.getAdapter(OutlinePage.class);
      if (theOutlinePage != null) {
        return theOutlinePage.getEditor();
      }
    }
    return null;
  }
Re: ClassCastException in OutlinePage [message #716633 is a reply to message #716423] Wed, 17 August 2011 23:29 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3109
Registered: July 2009
Senior Member
Hi Balazs,

that's probably a bug in the XtextEditor:

public Object getAdapter(Class adapter) {
if (IContentOutlinePage.class.isAssignableFrom(adapter)) {
return getContentOutlinePage();
}
return super.getAdapter(adapter);
}

Could you please file a ticket?

Thanks,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 17.08.11 13:28, Balazs Varnai wrote:
> Hi Sebastian,
>
> Thanks! I wonder why does the getAdapter() returns anything? XtextEditor
> has no adapter for
> com.testingtech.ttworkbench.xcleditor.outline.OutlinePage.
>
> /Balazs
>
>
> protected Cleditor adapt(IWorkbenchPart part)
> {
> if (part != null) {
> Cleditor theEditor = (Cleditor)part.getAdapter(Cleditor.class);
> if (theEditor != null) {
> return theEditor;
> }
>
> OutlinePage theOutlinePage =
> (OutlinePage)part.getAdapter(OutlinePage.class);
> if (theOutlinePage != null) {
> return theOutlinePage.getEditor();
> }
> }
> return null;
> }
>
Previous Topic:How to get the name of an unresolved reference
Next Topic:ZipException while running MWE2 Workflow
Goto Forum:
  


Current Time: Tue Apr 20 08:15:31 GMT 2021

Powered by FUDForum. Page generated in 0.01461 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top