GEF and RCP - Where do they meet? [message #158931] |
Sat, 20 November 2004 13:21  |
Eclipse User |
|
|
|
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 #159894 is a reply to message #158953] |
Tue, 30 November 2004 17:48   |
Eclipse User |
|
|
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.26412 seconds