Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Creating a node using CreateViewRequest
Creating a node using CreateViewRequest [message #107284] Tue, 27 February 2007 14:10 Go to next message
Eclipse UserFriend
Originally posted by: ganesh.mohan.hp.com

Hello,

I am facing a problem while creating a node using CreateViewRequest. I
used the following code.

--********************************************************** ***************--
ElementType "element" = GvxmlFactory.eINSTANCE.createElementType();

ContainerEditPart part = (ContainerEditPart)selectedPart.getParent();

CreateElementRequest request = new
CreateElementRequest(part.getEditingDomain(), EObject container,
GvxmlElementTypes.element);

viewRequest = CreateViewRequestFactory.getCreateShapeRequest
(GvxmlElementTypes."elementType", part.getDiagramPreferencesHint());

DiagramCommandStack stack =
part.getDiagramEditDomain().getDiagramCommandStack();

stack.execute(part.getCommand(viewRequest);

--********************************************************** *****************--

No exceptions are thrown, but the node is not created on the editor. Can
anyone please help me out in resolving this problem. Is there any other
way i can create an element on the editor programatically????

Thanx,
Ganesh
Re: Creating a node using CreateViewRequest [message #107310 is a reply to message #107284] Tue, 27 February 2007 14:44 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Ganesh,

Here's a tip on how you could debug this issue...

Stop the debugger before the command is executed. Take a look at the
command that is returned from the editpart. Put a breakpoint in the
execute method of each command. Start the debugger and see what happens
when each command is executed.

Regards,
Cherie

Ganesh Mohan wrote:
> Hello,
>
> I am facing a problem while creating a node using CreateViewRequest. I
> used the following code.
>
> --********************************************************** ***************--
>
> ElementType "element" = GvxmlFactory.eINSTANCE.createElementType();
>
> ContainerEditPart part = (ContainerEditPart)selectedPart.getParent();
>
> CreateElementRequest request = new
> CreateElementRequest(part.getEditingDomain(), EObject container,
> GvxmlElementTypes.element);
>
> viewRequest = CreateViewRequestFactory.getCreateShapeRequest
> (GvxmlElementTypes."elementType", part.getDiagramPreferencesHint());
>
> DiagramCommandStack stack =
> part.getDiagramEditDomain().getDiagramCommandStack();
>
> stack.execute(part.getCommand(viewRequest);
>
> --********************************************************** *****************--
>
>
> No exceptions are thrown, but the node is not created on the editor. Can
> anyone please help me out in resolving this problem. Is there any other
> way i can create an element on the editor programatically????
>
> Thanx,
> Ganesh
>
>
>
Re: Creating a node using CreateViewRequest [message #107397 is a reply to message #107310] Wed, 28 February 2007 06:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ganesh.mohan.hp.com

Hello Cherie,

The following exception is thrown while executing the createViewCommand.

-- ************************************************************ ***********
--
org.eclipse.core.commands.ExecutionException: While executing the
operation, an exception occurred

java.lang.IllegalStateException: Cannot activate read/write transaction in
read-only transaction context

While executing the operation, an exception occurred

-----------
*******************************************************----- ------

Thanx,
Ganesh
Re: Creating a node using CreateViewRequest [message #107466 is a reply to message #107397] Wed, 28 February 2007 08:03 Go to previous message
Eclipse UserFriend
Originally posted by: ganesh.mohan.hp.com

Hello Cherie,

Thanks for your help.The problem is resolved. :). I had to run the command
execution in a separate thread.

Thanx and regards,
Ganesh
Previous Topic:refresh all subCannonicalEditPolicies
Next Topic:Displaying List controls in PropertySheet
Goto Forum:
  


Current Time: Sat Jul 22 08:56:00 GMT 2017

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

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