Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Open Diagram outside of Workspace
Open Diagram outside of Workspace [message #490970] Mon, 12 October 2009 15:53 Go to next message
Oliver Doerler is currently offline Oliver DoerlerFriend
Messages: 22
Registered: July 2009
Junior Member
Hi.

If i try to open a Diagram File which is not located in the Workspace (Files in Workspace work fine) and get an Error:

Cannot open input element:
Reason:
Text editor does not have a document provider


I just dont have an idea where i have to fix that problem. Sad Can somebody point onto the Functions which are responsible in this case? Under that mass of generated Code i just dont find it...

Thanks a lot!


Call Stack:
Thread [main] (Suspended (exception NullPointerException))	
	DiagramDocumentEditor$1.run(IProgressMonitor) line: 131	
	ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor) line: 464	
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 372	
	ApplicationWindow$1.run() line: 759	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchWindow(ApplicationWindow).run(boolean, boolean, IRunnableWithProgress) line: 756	
	WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 2578	
	MyDiagramEditor(DiagramDocumentEditor).init(IEditorSite, IEditorInput) line: 140	
	EditorManager.createSite(IEditorReference, IEditorPart, EditorDescriptor, IEditorInput) line: 798	
	EditorReference.createPartHelper() line: 644	
	EditorReference.createPart() line: 462	
	EditorReference(WorkbenchPartReference).getPart(boolean) line: 595	
	EditorPane(PartPane).setVisible(boolean) line: 313	
	PresentablePart.setVisible(boolean) line: 180	
	PresentablePartFolder.select(IPresentablePart) line: 270	
	LeftToRightTabOrder.select(IPresentablePart) line: 65	
	TabbedStackPresentation.selectPart(IPresentablePart) line: 473	
	EditorStack(PartStack).refreshPresentationSelection() line: 1256	
	EditorStack(PartStack).setSelection(LayoutPart) line: 1209	
	EditorStack(PartStack).showPart(LayoutPart, Object) line: 1608	
	EditorStack(PartStack).add(LayoutPart, Object) line: 499	
	EditorStack.add(LayoutPart, Object) line: 103	
	EditorStack(PartStack).add(LayoutPart) line: 485	
	EditorStack.add(LayoutPart) line: 112	
	EditorSashContainer.addEditor(EditorPane, EditorStack) line: 63	
	EditorAreaHelper.addToLayout(EditorPane, EditorStack) line: 225	
	EditorAreaHelper.addEditor(EditorReference, String, boolean) line: 213	
	EditorManager.createEditorTab(EditorReference, String) line: 778	
	EditorManager.openEditorFromDescriptor(EditorDescriptor, IEditorInput, IMemento) line: 677	
	EditorManager.openEditor(String, IEditorInput, boolean, IMemento) line: 638	
	WorkbenchPage.busyOpenEditorBatched(IEditorInput, String, boolean, int, IMemento) line: 2854	
	WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean, int, IMemento) line: 2762	
	WorkbenchPage.access$11(WorkbenchPage, IEditorInput, String, boolean, int, IMemento) line: 2754	
	WorkbenchPage$10.run() line: 2705	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int, IMemento) line: 2701	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 2685	
	WorkbenchPage.openEditor(IEditorInput, String) line: 2668	
	IDE.openEditorOnFileStore(IWorkbenchPage, IFileStore) line: 1151	
	OpenLocalFileAction.run() line: 107	
	OpenLocalFileAction.run(IAction) line: 76	
	WWinPluginAction(PluginAction).runWithEvent(Event) line: 251	
	WWinPluginAction.runWithEvent(Event) line: 229	
	PluginActionContributionItem(ActionContributionItem).handleWidgetSelection(Event, boolean) line: 584	
	ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 501	
	ActionContributionItem$5.handleEvent(Event) line: 411	
	EventTable.sendEvent(Event) line: 84	
	MenuItem(Widget).sendEvent(Event) line: 1003	
	Display.runDeferredEvents() line: 3880	
	Display.readAndDispatch() line: 3473	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2405	
	Workbench.runUI() line: 2369	
	Workbench.access$4(Workbench) line: 2221	
	Workbench$5.run() line: 500	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 493	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	Application.start(IApplicationContext) line: 20	
	EclipseAppHandle.run(Object) line: 194	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 368	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available	
	Method.invoke(Object, Object...) line: not available	
	Main.invokeFramework(String[], URL[]) line: 559	
	Main.basicRun(String[]) line: 514	
	Main.run(String[]) line: 1311	
	Main.main(String[]) line: 1287	

[Updated on: Mon, 12 October 2009 15:55]

Report message to a moderator

Re: Open Diagram outside of Workspace [message #490977 is a reply to message #490970] Mon, 12 October 2009 16:03 Go to previous messageGo to next message
Artur Kronenberg is currently offline Artur KronenbergFriend
Messages: 159
Registered: August 2009
Senior Member
Hi,

I don't know exactly if GMF supports this, but Eclipse might do that. I didn't try open diagram files but I open xml files that are located outside eclipse:

Have a look at this static method:

IDE.openEditorOnFileStor(IWorkbenchPage, IFileStore)

The IFileStore can be created with a path, so the file doesn't have to be in the workspace:

IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(file.getAbsolutePath()));

YOu could load your diagram file into that filestore and open the editor using the IDE api.

Hope that does the trick.

Artur
Re: Open Diagram outside of Workspace [message #490984 is a reply to message #490970] Mon, 12 October 2009 16:24 Go to previous messageGo to next message
Oliver Doerler is currently offline Oliver DoerlerFriend
Messages: 22
Registered: July 2009
Junior Member
Hi.

Thanks for your hint, i will check that.

What i forgot to write... i changed the Wizard to create a new Diagram that it is also possible to create the Files outside of the Workspace. As Template i used the Wizard (public class NpgmCreationWizardNewFileCreationPage extends WizardPage) which is used if you generate the RCP Application and not the Plugin. Odd is, if i use the Wizard to create a Diagram located outside of the Workspace it works! Works means, it loads the Diagram into the Editor... but if i want to save it, the Wizard for "Save As" in the Workspace displays...

I guess somewhere are Settings which binds it somehow to a... hm "Workspace" File?
Re: Open Diagram outside of Workspace [message #491485 is a reply to message #490970] Wed, 14 October 2009 18:25 Go to previous messageGo to next message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello Oliver,

Try using URIEditorInput and pass File uri there..

-----------------
Alex Shatalin
Re: Open Diagram outside of Workspace [message #491547 is a reply to message #490970] Wed, 14 October 2009 23:18 Go to previous messageGo to next message
Oliver Doerler is currently offline Oliver DoerlerFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Alex,

thank you for your answer! Maybe you can give me finger point to the area of code i should look for that? I get a little lost in the 40k loc of the generated app. Sad Or maybe to the documentation where a description is how the plugin saving interaction works?

Thank you very much!
Olli
Re: Open Diagram outside of Workspace [message #491684 is a reply to message #491547] Thu, 15 October 2009 13:25 Go to previous message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello Oliver,

Well, you are passng EditrInput object while openning new editor from your
code.
Currently I suppose you are using FileEditorInput. I'm suggesting you using
URIEditorInput instead of File one..
The rest should be done for you in GMF-generated code.

-----------------
Alex Shatalin
Previous Topic:Hook for GMF editor startup?
Next Topic:GMF event logs
Goto Forum:
  


Current Time: Sun Sep 22 15:36:11 GMT 2024

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

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

Back to the top