Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Multi Editor
Multi Editor [message #297713] Wed, 18 January 2006 18:15 Go to next message
Eclipse UserFriend
Originally posted by: awm_abu.yahoo.com

Hey,

I am trying to create a MultiEditor and I am having some difficulties.

I created an editor extension in my plugin.xml and assoicated it with the
"multi" extension name.
However when I create Test.multi and try to open it I am getting the error
listed below.

It seems that it expects an IEditorInput of type MultiEditorInput.
The question is how do I give it such an input type ?

I could try to do this programmatically and in that way create the
MultiEditorInput
but that is not what I want.

Any help would be great.

Also I have not been able to find any good documentation on how to use a
MultiEditor so if anyone
could point me in the right direction it would be great.

Cheers.


!MESSAGE Unable to create editor ID Multi: An exception was thrown during
initialization

!STACK 0

java.lang.ClassCastException: org.eclipse.ui.part.FileEditorInput

at org.eclipse.ui.part.MultiEditor.init(MultiEditor.java:107)

at org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:773)

at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:572)

at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:365)

at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:552)

at
org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)

at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2325)

at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2258)

at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage .java:2250)

at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2236)

at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:69)

at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2231)

at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2212)

at org.eclipse.ui.ide.IDE.openEditor(IDE.java:371)

at org.eclipse.ui.ide.IDE.openEditor(IDE.java:334)

at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:251)

at
org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInE ditor(EditorUtility.java:131)

at
org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Open ActionUtil.java:49)

at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:16 9)

at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:15 3)

at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchR un(SelectionDispatchAction.java:222)

at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Selec tionDispatchAction.java:198)

at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerActio nGroup.handleOpen(PackageExplorerActionGroup.java:296)

at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$ 4.open(PackageExplorerPart.java:869)

at
org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredV iewer.java:741)

at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:1044)

at org.eclipse.core.runtime.Platform.run(Platform.java:783)

at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)

at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:14 8)

at
org.eclipse.jface.viewers.StructuredViewer.fireOpen(Structur edViewer.java:739)

at
org.eclipse.jface.viewers.StructuredViewer.handleOpen(Struct uredViewer.java:968)

at
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Stru cturedViewer.java:1067)

at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrate gy.java:243)

at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.ja va:238)

at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrate gy.java:277)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)

at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)

at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)

at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)

at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:103)

at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)

at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)

at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)

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.core.launcher.Main.invokeFramework(Main.java:334 )

at org.eclipse.core.launcher.Main.basicRun(Main.java:278)

at org.eclipse.core.launcher.Main.run(Main.java:973)

at org.eclipse.core.launcher.Main.main(Main.java:948)
Re: Multi Editor [message #297756 is a reply to message #297713] Thu, 19 January 2006 13:27 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Frank Abercorn wrote:
> Hey,
>
> I am trying to create a MultiEditor and I am having some difficulties.
>
> I created an editor extension in my plugin.xml and assoicated it with the
> "multi" extension name.
> However when I create Test.multi and try to open it I am getting the error
> listed below.
>
> It seems that it expects an IEditorInput of type MultiEditorInput.
> The question is how do I give it such an input type ?

You have to do it programmatically, since the MultiEditor needs a
MultiEditorInput (that contains other IEditorInputs). Don't associate
an extension with the editor, just create an action to take the current
selection(s) and open the editor.

BTW: If you want to open multiple editors side by side, you use
MultiEditor. If you want to open a file and show different views of
it's contents (a la PDE manifest editor) you can use MultiPageEditorPart
(or the FormEditor, which is a subclass).

Later,
PW


Re: Multi Editor [message #539484 is a reply to message #297756] Thu, 10 June 2010 22:48 Go to previous messageGo to next message
Samantha Chan is currently offline Samantha ChanFriend
Messages: 60
Registered: July 2009
Member
Hi,

So, there is currently no way to use the default "Open" action to open a file with a MultiEditor?

Here's my use case:
I have a file (e.g. file.raw), that generates a file named (file.gen). When the user double clicks on the raw file, I would like to open the MultiEditor to show the raw file and the generated file side-by-side.

Looking from this posting, it seems to me that it is not possible? Should I not use the MultiEditor, and create my own editor to handle this case?

I am on Eclipse 3.6.

Thanks...
Samantha
Re: Multi Editor [message #539584 is a reply to message #539484] Fri, 11 June 2010 12:31 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You could use org.eclipse.ui.editors and provide an
org.eclipse.ui.IEditorLauncher for your editor type. That can take the
incoming path and then call IWorkbenchPage.openEditor(*) with your
MultiEditor and a generated MultiEditorInput.

You might have to convert the incoming IPath back into an IFile before
you can use it.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Multi Editor [message #541534 is a reply to message #539584] Mon, 21 June 2010 13:34 Go to previous messageGo to next message
Tomasz Zarna is currently offline Tomasz ZarnaFriend
Messages: 172
Registered: July 2009
Senior Member
Also, please note that MultiEditor is an abstract class so you'll need to subclass it or use the implementation from bug 244364.
Re: Multi Editor [message #629826 is a reply to message #539584] Wed, 29 September 2010 16:36 Go to previous messageGo to next message
Alexander   is currently offline Alexander Friend
Messages: 1
Registered: September 2010
Junior Member
The launcher approach isn't working for me. I specified a launcher in the plugin.xml for my MultiEditor plugin. The launcher generates an MultiEditorInput. Calling IWorkbenchPage.openEditor(*) with the MultiEditorInput results in a PartInitException. I tracked down the problem to EditorManager#openEditorFromDescriptor. As the editor has a launcher specified, it is treated as an external editor. For external editors the passed input must be an instance of IPathEditorInput (e.g. FileEditorInput). As this is definitely not the case, the editor initialization fails with the exception mentioned above.

I am a bit confused right now.
On one hand i need to specify a launcher to generate a MultiEditorInput from a FileEditorInput, on the other one the launcher itself restrains the editor from opening.

@Paul Webster: How did you succeed with your approach?

BTW i am using Eclipse 3.5.1.

Greets
Alex
Re: Multi Editor [message #630022 is a reply to message #629826] Thu, 30 September 2010 12:18 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You need 2 definitions:

editorA has the launcher, and is tied to your file type.

editorB is your MultiEditor, and is not tied to a type.

Then editorA launcher opens editorB with the MultiEditorInput
programmaticly.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Repopulating a table in the dialog on checkbox selection
Next Topic:Howto use my email address rather than my login ID as the author in Java templates?
Goto Forum:
  


Current Time: Fri Mar 29 10:41:43 GMT 2024

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

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

Back to the top