Skip to main content



      Home
Home » Eclipse Projects » GEF » GEF and RCP - Where do they meet?
GEF and RCP - Where do they meet? [message #158931] Sat, 20 November 2004 13:21 Go to next message
Eclipse UserFriend
Originally posted by: k.oriordan.oceanfree.net

Okay, so far my project is in two parts pretty much. I've written the
GEF stuff and I've written RCP code that displays a simple window with
an "Open" command to load stuff in. Where's my entry point to my GEF
code. When I run my "Open" action, what class should it instantize etc.?

Kevin
Re: GEF and RCP - Where do they meet? [message #158947 is a reply to message #158931] Sat, 20 November 2004 17:45 Go to previous messageGo to next message
Eclipse UserFriend
Kevin O'Riordan wrote:

> Okay, so far my project is in two parts pretty much. I've written the
> GEF stuff and I've written RCP code that displays a simple window with
> an "Open" command to load stuff in. Where's my entry point to my GEF
> code. When I run my "Open" action, what class should it instantize etc.?

If you have files (resources API), register an editor on a file
extension. That's the easiest.

Frank.
Re: GEF and RCP - Where do they meet? [message #158953 is a reply to message #158947] Sat, 20 November 2004 18:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: boris.bokowski.de

"Frank Gerhardt" <fg@frankgerhardt.com> wrote:
> Kevin O'Riordan wrote:
>
>> Okay, so far my project is in two parts pretty much. I've written the GEF
>> stuff and I've written RCP code that displays a simple window with an
>> "Open" command to load stuff in. Where's my entry point to my GEF code.
>> When I run my "Open" action, what class should it instantize etc.?
>
> If you have files (resources API), register an editor on a file extension.
> That's the easiest.

If you don't have files, you'll have to implement IEditorInput (for an
example, see below). Then, you can open the editor like this:

MyEditorInput myEditorInput = new MyEditorInput();
myEditorInput.setModelRoot(modelRoot);
window.getActivePage().openEditor(myEditorInput, MyGraphicalEditor.ID);

In your editor's setInput method, downcast to MyEditorInput and use
getModelRoot get your top-level model object.

public class MyEditorInput implements IEditorInput {
private MyModelRoot modelRoot;
public boolean exists() {
return true;
}
public ImageDescriptor getImageDescriptor() {
return ImageDescriptor.getMissingImageDescriptor();
}
public String getName() {
return "no name yet";
}
public IPersistableElement getPersistable() {
return null;
}
public String getToolTipText() {
return "no tooltip yet";
}
public Object getAdapter(Class adapter) {
return null;
}
public MyModelRoot getModelRoot() {
return modelRoot;
}
public void setModelRoot(MyModelRoot modelRoot) {
this.modelRoot=modelRoot;
}
}
Re: GEF and RCP - Where do they meet? [message #159894 is a reply to message #158953] Tue, 30 November 2004 17:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: k.oriordan.oceanfree.net

Boris Bokowski wrote:
> "Frank Gerhardt" <fg@frankgerhardt.com> wrote:
>
>>Kevin O'Riordan wrote:
>>
>>
>>>Okay, so far my project is in two parts pretty much. I've written the GEF
>>>stuff and I've written RCP code that displays a simple window with an
>>>"Open" command to load stuff in. Where's my entry point to my GEF code.
>>>When I run my "Open" action, what class should it instantize etc.?
>>
>>If you have files (resources API), register an editor on a file extension.
>>That's the easiest.
>
>
> If you don't have files, you'll have to implement IEditorInput (for an
> example, see below). Then, you can open the editor like this:
>
> MyEditorInput myEditorInput = new MyEditorInput();
> myEditorInput.setModelRoot(modelRoot);
> window.getActivePage().openEditor(myEditorInput, MyGraphicalEditor.ID);
>
> In your editor's setInput method, downcast to MyEditorInput and use
> getModelRoot get your top-level model object.
>
> public class MyEditorInput implements IEditorInput {
> private MyModelRoot modelRoot;
> public boolean exists() {
> return true;
> }
> public ImageDescriptor getImageDescriptor() {
> return ImageDescriptor.getMissingImageDescriptor();
> }
> public String getName() {
> return "no name yet";
> }
> public IPersistableElement getPersistable() {
> return null;
> }
> public String getToolTipText() {
> return "no tooltip yet";
> }
> public Object getAdapter(Class adapter) {
> return null;
> }
> public MyModelRoot getModelRoot() {
> return modelRoot;
> }
> public void setModelRoot(MyModelRoot modelRoot) {
> this.modelRoot=modelRoot;
> }
> }
>
>
Okay I've done that.

Now I've a problem. I've written the following code in my Action command
for "Open"

try
{
OverallModel model=new OverallModel(filename);
MyEditorInput mei=new MyEditorInput();
mei.setModelRoot(model);
window.getActivePage().openEditor(mei, MyEditor.ID);
System.out.println("Opened editor");
}
catch (Exception e)
{
e.printStackTrace();
}


However I get error "Unable to create part" (no other information given).

I've gathered that the constructor of the MyEditor class is getting
called and the init method is getting called but no other method is
getting called. I figure the critical methods are the ones relating to
the Graphical Viewer but those aren't getting touched.

Have no idea where to go from here. Any ideas?

Kevin.
Re: GEF and RCP - Where do they meet? [message #160012 is a reply to message #159894] Wed, 01 December 2004 11:20 Go to previous message
Eclipse UserFriend
Originally posted by: boris.bokowski.de

"Kevin O'Riordan" <k.oriordan@oceanfree.net> wrote:
> ...
> However I get error "Unable to create part" (no other information given).
> ...

Check the log file (usually workspace/.metadata/.log) for more information
(stack trace).
Previous Topic:GEF right for block editor?
Next Topic:GEF, EMF and semantic vs. graphical model
Goto Forum:
  


Current Time: Fri Jul 18 00:33:08 EDT 2025

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

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

Back to the top