Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GEF editor in Eclipse RCP
GEF editor in Eclipse RCP [message #218780] Sat, 01 July 2006 09:57
Eclipse UserFriend
Originally posted by:

Hi Experts,

Im new to the world of RCP and also GEF.
Presently im trying to open a GEF editor inside Eclipse RCP application.
I have written an action which tries to open the gef editor in its run
I have also created my own editor input which implemnts IEditorInput
interface via IPathEditorInput interface, as it was mentioned in the RCP

But the problem is that i want to open the gef editor without this input,
as i dont have a input path to open the editor.

My question are
1)Is it mandatory to have an editor input.
2)Cant I open the gef editor without the input path? i just want to open
an editor with pallete from the run method of the action class.

If yes then how ????

Below are the snap shot of the classes used.
------------------------------------------------------------ -------
run method of the action class which open the editor.

public void run() {
IEditorInput input = new MyRCPEditorInput(); try {
window.getActivePage().openEditor(input, MyRCPEditor.ID);
} catch (PartInitException e) {

Editor Class.
------------------------------------------------------------ --
public class MyRCPEditor extends GraphicalEditorWithPalette {
public static String ID = "com.rcp.core.actions.test.MyRCPEditor";
private ContentsModel contentModel;

public MyRCPEditor() {
setEditDomain(new DefaultEditDomain(this));

protected void initializeGraphicalViewer() {
GraphicalViewer viewer = getGraphicalViewer();
ContentsModel parent = new ContentsModel();

HelloModel child1 = new HelloModel();
child1.setConstraint(new Rectangle(0, 0, -1, -1));

HelloModel child2 = new HelloModel();
child2.setConstraint(new Rectangle(30, 30, -1, -1));

HelloModel child3 = new HelloModel();
child3.setConstraint(new Rectangle(10, 80, 80, 50));


public void doSave(IProgressMonitor monitor) {

public void doSaveAs() {

public void gotoMarker(IMarker marker) {

public boolean isDirty() {
return false;

public boolean isSaveAsAllowed() {
return false;

protected void configureGraphicalViewer() {

GraphicalViewer viewer = getGraphicalViewer();
viewer.setEditPartFactory(new MyEditPartFactory());

protected PaletteRoot getPaletteRoot() {
PaletteRoot root = new PaletteRoot();
PaletteGroup toolGroup = new PaletteGroup("");

ToolEntry tool = new SelectionToolEntry();

tool = new MarqueeToolEntry();

PaletteDrawer drawer = new PaletteDrawer("Products");

ImageDescriptor descriptor =

CreationToolEntry creationEntry = new
"Adding Products", new SimpleFactory(HelloModel.class),
descriptor, descriptor);


return root;

protected void setInput(IEditorInput input) {
// TODO Auto-generated method stub

MyRCPEditorInput rcpInput = ((MyRCPEditorInput) input);
contentModel = rcpInput.getContentModel();
------------------------------------------------------------ ------

Any help/suggestion will be great.
Thanks and Regards.
Previous Topic:Unhandled event loop exception --> java.lang.NullPointerException
Next Topic:How see root figure image through transparent child
Goto Forum:

Current Time: Tue Oct 06 04:14:56 GMT 2015

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

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