Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Opening a file in an GMF RCP application
Opening a file in an GMF RCP application [message #514594] Mon, 15 February 2010 21:40
jh vdv is currently offline jh vdvFriend
Messages: 2
Registered: February 2010
Junior Member
Dear List,



Solving this one caused me a lot of headaches, but finally I turned to freenode #eclipse and there rcjsuen helped me to solve the problem.

What was the problem? I wanted to open an editor on a file from within another editor.

It sounds simple, but RCP apps usually do not have IProjects and IFiles.

The crux of the matter was to construct the right call to IDE.openEditor (with the right editor id, which was easy in my case, as it was my own).

import org.eclipse.emf.common.ui.URIEditorInput;
import org.eclipse.emf.common.util.URI;
// not java.net.URI
[...]
  String fileName = "String from current editor or view";
  URI uri = URI.createFileURI(fileName);
  URIEditorInput uei = new URIEditorInput(uri);
  IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  try {
    IDE.openEditor(page, uei, "The EditorID");
  } catch (PartInitException e) {
    e.printStackTrace();
  }


As always it looks extremely simple when it is done.

Previous Topic:SVG figure
Next Topic:connection update
Goto Forum:
  


Current Time: Tue Mar 19 10:09:34 GMT 2024

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

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

Back to the top