Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Editors + Perspectives [AGAIN]
Editors + Perspectives [AGAIN] [message #435952] Thu, 25 August 2005 23:26 Go to next message
Daniel is currently offline DanielFriend
Messages: 34
Registered: July 2009
Member
Hi !



I want to show an editor [EditorPart]
in a perspective (currently active)
calling it from a [Menu] or a [ContextMenu].
The editor isnt meant to open with a file
already openen Bt is merely a set of widgets.

Can someone help me with this ???

or point me to an example of this ???

Atentamente,

Daniel Quintero
Diana Villamil
Developers
Re: Editors + Perspectives [AGAIN] [message #435958 is a reply to message #435952] Fri, 26 August 2005 05:25 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
call
IWorkbenchWindow activeWorkbenchWindow =
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
EditorInput editorInput = ...your editorInputt ...
page.openEditor(editorInput, YourEditor.ID, true);

you have to be in ui thread
Daniel wrote:

>
> Hi !
>
>
>
> I want to show an editor [EditorPart]
> in a perspective (currently active)
> calling it from a [Menu] or a [ContextMenu].
> The editor isnt meant to open with a file
> already openen Bt is merely a set of widgets.
>
> Can someone help me with this ???
>
> or point me to an example of this ???
>
> Atentamente,
>
> Daniel Quintero
> Diana Villamil
> Developers
Re: Editors + Perspectives [AGAIN] [message #435968 is a reply to message #435958] Fri, 26 August 2005 13:47 Go to previous messageGo to next message
Daniel is currently offline DanielFriend
Messages: 34
Registered: July 2009
Member
First thanks for the first answer
but now im getting the following error

ERROR:
Unable to create this part due to an internal error. Reason for
the failure: Editor initialization failed:
empresa.CrearArticulo. Site is incorrect.

WITH THE FOLLOWING DETAILS
org.eclipse.ui.PartInitException: Editor initialization failed:

empresa.CrearArticulo. Site is incorrect.
org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:780)
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:572)
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:365)
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:552)
org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:28 3)
org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:126)
org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:268)
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:391)
org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1102)
org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1051)
org.eclipse.ui.internal.PartStack.showPart(PartStack.java:12 56)
org.eclipse.ui.internal.PartStack.add(PartStack.java:442)
org.eclipse.ui.internal.EditorStack.add(EditorStack.java:109 )
org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:60)
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:212)
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:202)
org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:753)
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:665)
org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:628)
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2323)
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2258)
org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage .java:2250)
org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2236)
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:69)
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2231)
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2212)

empresa.OpenEditorArticulo.run(OpenEditorArticulo.java:33)
org.eclipse.jface.action.Action.runWithEvent(Action.java:996 )
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)

empresa.Application.run(Application.java:18)
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

java.lang.reflect.Method.invoke(Unknown Source)
org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
org.eclipse.core.launcher.Main.basicRun(Main.java:278)
org.eclipse.core.launcher.Main.run(Main.java:973)
org.eclipse.core.launcher.Main.main(Main.java:948)

snpe wrote:
> call
> IWorkbenchWindow activeWorkbenchWindow =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow();
> IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
> EditorInput editorInput = ...your editorInputt ...
> page.openEditor(editorInput, YourEditor.ID, true);
>
> you have to be in ui thread
> Daniel wrote:
>
>
>>Hi !
>>
>>
>>
>>I want to show an editor [EditorPart]
>>in a perspective (currently active)
>>calling it from a [Menu] or a [ContextMenu].
>>The editor isnt meant to open with a file
>>already openen Bt is merely a set of widgets.
>>
>>Can someone help me with this ???
>>
>>or point me to an example of this ???
>>
>>Atentamente,
>>
>>Daniel Quintero
>>Diana Villamil
>>Developers
>
>
Re: Editors + Perspectives [AGAIN] [message #435973 is a reply to message #435968] Fri, 26 August 2005 17:48 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Daniel,
I don't sure, but I think that your editor ID isn't good

Daniel wrote:

> First thanks for the first answer
> but now im getting the following error
>
> ERROR:
> Unable to create this part due to an internal error. Reason for
> the failure: Editor initialization failed:
> empresa.CrearArticulo. Site is incorrect.
>
> WITH THE FOLLOWING DETAILS
> org.eclipse.ui.PartInitException: Editor initialization failed:
>
> empresa.CrearArticulo. Site is incorrect.
> org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:780)
>
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:572)
>
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:365)
>
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:552)
> org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:28 3)
>
org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:126)
>
org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:268)
>
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
>
org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:391)
>
org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1102)
> org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1051)
> org.eclipse.ui.internal.PartStack.showPart(PartStack.java:12 56)
> org.eclipse.ui.internal.PartStack.add(PartStack.java:442)
> org.eclipse.ui.internal.EditorStack.add(EditorStack.java:109 )
>
org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:60)
>
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:212)
>
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:202)
>
org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:753)
>
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:665)
> org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:628)
>
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2323)
>
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2258)
> org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage .java:2250)
> org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2236)
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:69)
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2231)
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2212)
>
> empresa.OpenEditorArticulo.run(OpenEditorArticulo.java:33)
> org.eclipse.jface.action.Action.runWithEvent(Action.java:996 )
>
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
> org.eclipse.jface.action.ActionContributionItem.access$
(ActionContributionItem.java:488)
>
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
> org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
> org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
>
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
>
> empresa.Application.run(Application.java:18)
>
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
>
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
>
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
> java.lang.reflect.Method.invoke(Unknown Source)
> org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
> org.eclipse.core.launcher.Main.basicRun(Main.java:278)
> org.eclipse.core.launcher.Main.run(Main.java:973)
> org.eclipse.core.launcher.Main.main(Main.java:948)
>
> snpe wrote:
>> call
>> IWorkbenchWindow activeWorkbenchWindow =
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow();
>> IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
>> EditorInput editorInput = ...your editorInputt ...
>> page.openEditor(editorInput, YourEditor.ID, true);
>>
>> you have to be in ui thread
>> Daniel wrote:
>>
>>
>>>Hi !
>>>
>>>
>>>
>>>I want to show an editor [EditorPart]
>>>in a perspective (currently active)
>>>calling it from a [Menu] or a [ContextMenu].
>>>The editor isnt meant to open with a file
>>>already openen Bt is merely a set of widgets.
>>>
>>>Can someone help me with this ???
>>>
>>>or point me to an example of this ???
>>>
>>>Atentamente,
>>>
>>>Daniel Quintero
>>>Diana Villamil
>>>Developers
>>
>>
Re: Editors + Perspectives [AGAIN] [message #436000 is a reply to message #435968] Mon, 29 August 2005 13:07 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Daniel wrote:
> First thanks for the first answer
> but now im getting the following error
>
> ERROR:
> Unable to create this part due to an internal error. Reason for
> the failure: Editor initialization failed:
> empresa.CrearArticulo. Site is incorrect.
>
> WITH THE FOLLOWING DETAILS
> org.eclipse.ui.PartInitException: Editor initialization failed:
>
> empresa.CrearArticulo. Site is incorrect.
> org.eclipse.ui.internal.EditorManager.createSite(EditorManag er.java:780)

This seems to imply your editor part is not saving the editor site anywhere.

This is checked after editorPart.init(site, input) is called. The check is:

if (part.getSite() != site || part.getEditorSite() != site)
throw new PartInitException(...)

So why does your part not return it's site?

Later,
PW


Previous Topic:Eclipse 3.1.1 - When?
Next Topic:Providing context help
Goto Forum:
  


Current Time: Sun Dec 08 15:58:04 GMT 2024

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

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

Back to the top