Skip to main content



      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 16:40
Eclipse UserFriend
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: Fri Jul 11 21:34:24 EDT 2025

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

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

Back to the top