Problem using tool in view [message #221643] |
Wed, 16 August 2006 16:24 |
Eclipse User |
|
|
|
Originally posted by: guerreroderrick.gmail.com
I'm trying to use GEF with a view. In createPartControl(), I use:
viewer = new GraphicalViewerImpl();
viewer.createControl(parent);
viewer.setEditPartFactory(new MyEditPartFactory());
viewer.setContents(gameBoard);
EditDomain domain = new EditDomain();
domain.setDefaultTool(new ConnectionCreationTool());
viewer.setEditDomain(new EditDomain());
I also have several GamePieces already established that extends
NodeEditPart. In isntallEditPolicies() of GamePieceEditPart, I have:
installEditPolicy(EditPolicy.NODE_ROLE, new GamePieceEditPolicy());
and all of the functions in my GamePieceEditPolicy simply output to
System.out...
I assumed that setting a ConnectionCreationTool was all I needed for the
GEF framework to call the functions in my GamePieceEditPolicy, but
nothing is being called in my GamePieceEditPolicy. Can anybody tell me
what I am missing?
Guerrero
|
|
|
Re: Problem using tool in view [message #221651 is a reply to message #221643] |
Wed, 16 August 2006 17:59 |
Eclipse User |
|
|
|
Originally posted by: guerreroderrick.gmail.com
A small fix, I changed viewer.setEditDomain(new EditDomain()); to
viewer.setEditDomain(domain); (A stupid error on my part) but I still
can't get GEF to call the functions in GamePieceEditPolicy...?
Guerrero
Derrick N. Guerrero wrote:
> I'm trying to use GEF with a view. In createPartControl(), I use:
>
> viewer = new GraphicalViewerImpl();
> viewer.createControl(parent);
> viewer.setEditPartFactory(new MyEditPartFactory());
> viewer.setContents(gameBoard);
> EditDomain domain = new EditDomain();
> domain.setDefaultTool(new ConnectionCreationTool());
> viewer.setEditDomain(new EditDomain());
>
> I also have several GamePieces already established that extends
> NodeEditPart. In isntallEditPolicies() of GamePieceEditPart, I have:
>
> installEditPolicy(EditPolicy.NODE_ROLE, new GamePieceEditPolicy());
>
> and all of the functions in my GamePieceEditPolicy simply output to
> System.out...
>
> I assumed that setting a ConnectionCreationTool was all I needed for the
> GEF framework to call the functions in my GamePieceEditPolicy, but
> nothing is being called in my GamePieceEditPolicy. Can anybody tell me
> what I am missing?
>
> Guerrero
|
|
|
Re: Problem using tool in view [message #221667 is a reply to message #221651] |
Wed, 16 August 2006 18:53 |
Eclipse User |
|
|
|
Originally posted by: guerreroderrick.gmail.com
Got it, apparently, I needed domain.setActiveTool(...) instead of
setDefaultTool, Ooops!
Guerrero
Derrick N. Guerrero wrote:
> A small fix, I changed viewer.setEditDomain(new EditDomain()); to
> viewer.setEditDomain(domain); (A stupid error on my part) but I still
> can't get GEF to call the functions in GamePieceEditPolicy...?
>
> Guerrero
>
> Derrick N. Guerrero wrote:
>> I'm trying to use GEF with a view. In createPartControl(), I use:
>>
>> viewer = new GraphicalViewerImpl();
>> viewer.createControl(parent);
>> viewer.setEditPartFactory(new MyEditPartFactory());
>> viewer.setContents(gameBoard);
>> EditDomain domain = new EditDomain();
>> domain.setDefaultTool(new ConnectionCreationTool());
>> viewer.setEditDomain(new EditDomain());
>>
>> I also have several GamePieces already established that extends
>> NodeEditPart. In isntallEditPolicies() of GamePieceEditPart, I have:
>>
>> installEditPolicy(EditPolicy.NODE_ROLE, new GamePieceEditPolicy());
>>
>> and all of the functions in my GamePieceEditPolicy simply output to
>> System.out...
>>
>> I assumed that setting a ConnectionCreationTool was all I needed for
>> the GEF framework to call the functions in my GamePieceEditPolicy, but
>> nothing is being called in my GamePieceEditPolicy. Can anybody tell
>> me what I am missing?
>>
>> Guerrero
|
|
|
Re: Problem using tool in view [message #221675 is a reply to message #221667] |
Thu, 17 August 2006 03:18 |
Eclipse User |
|
|
|
Originally posted by: dstamkokeng.gmail.com
Hi,
I am just stuck with trying to display my GEF editor in a single view and
I saw your thread! May I know how do you embed your editor into the view?
Or did you go about it in another method? Thanks in advance!
|
|
|
Re: Problem using tool in view [message #221680 is a reply to message #221675] |
Thu, 17 August 2006 03:28 |
Eclipse User |
|
|
|
Originally posted by: dstamkokeng.gmail.com
Actually I am extending the Shapes Editor example in GEF, whose
ShapeEditor extends the GraphicalEditor.
Do I have to let it extend a viewPart etc? Thanks alot
|
|
|
Re: Problem using tool in view [message #221705 is a reply to message #221680] |
Thu, 17 August 2006 14:06 |
Eclipse User |
|
|
|
Originally posted by: guerreroderrick.gmail.com
I extend ViewPart because I was making a simple game in a view and I
didn't have any need for saving or loading. I also use new
GraphicalViewerImpl() to display the GEF part. To get it working, I
first used Draw2d to figure out how to make my display, and then used
what I learned to implement the GEF framework. The following lines
should be able to display the GEF model:
in createPartControl(Composite parent) ...
viewer = new GraphicalViewerImpl();
viewer.createControl(parent);
viewer.setEditPartFactory(new MyEditPartFactory()); // your factory
viewer.setContents(gameBoard); // your model root
viewer.setEditDomain(new EditDomain());
Guerrero
Meo Kok Eng wrote:
> Actually I am extending the Shapes Editor example in GEF, whose
> ShapeEditor extends the GraphicalEditor.
>
> Do I have to let it extend a viewPart etc? Thanks alot
>
|
|
|
Re: Problem using tool in view [message #221758 is a reply to message #221705] |
Fri, 18 August 2006 01:48 |
Eclipse User |
|
|
|
Originally posted by: dstamkokeng.gmail.com
Hi,
What if I am already using editorPart? Is it possible to embed my whole
editor into a view? I will need that for my application. Thanks
|
|
|
Re: Problem using tool in view [message #221796 is a reply to message #221758] |
Fri, 18 August 2006 15:52 |
Eclipse User |
|
|
|
Originally posted by: guerreroderrick.gmail.com
I may be wrong, but I don't think you can embed a editor into a view or
a view into an editor... What is preventing you from just using an
editor instead of a view?
Guerrero
Meo Kok Eng wrote:
> Hi,
>
> What if I am already using editorPart? Is it possible to embed my whole
> editor into a view? I will need that for my application. Thanks
>
|
|
|
Re: Problem using tool in view [message #221934 is a reply to message #221796] |
Tue, 22 August 2006 03:14 |
Eclipse User |
|
|
|
Originally posted by: meokoken.gmail.com
Hi,
Its because my module is part of a project and will require only a single
view for each module. Thanks for the help! :) I will look for other
methods. Thanks alot
|
|
|
Powered by
FUDForum. Page generated in 0.03209 seconds