Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » how can I set the location of the view in the editor without opening it?
how can I set the location of the view in the editor without opening it? [message #93132] Tue, 16 January 2007 06:16 Go to next message
Eclipse UserFriend
I use copyToImageUtil to add a view to diagram file without opening the
file, and it works, but I can not set the location of the view in the editor
without opening the editor, how can I set the location of the view in the
editor without opening it?

((Diagram)objs[0]).insertChild(view); //add the view to the diagram file
without opening it

==============the completed code I used:

final Resource modelResource = resourceSet.getResource(
URI.createPlatformResourceURI(resourcePath
.toString()), true);
if(modelResource instanceof XMIResourceImpl){
Object[] objs = getElements(modelResource);
EObjectAdapter objAdapter = new EObjectAdapter(data);

CopyToImageUtil copyToImageUtil = new CopyToImageUtil();
diagramEditPart = copyToImageUtil.createDiagramEditPart((Diagram)
objs[0],shell,NewpmbeDiagramEditorPlugin.DIAGRAM_PREFERENCES _HINT);
}

CreateViewRequest.ViewDescriptor viewDescriptor = new
CreateViewRequest.ViewDescriptor(
objAdapter, Node.class, null,
NewpmbeDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);


if(subDiagramEditPart != null){ //
Re: how can I set the location of the view in the editor without opening it? [message #93258 is a reply to message #93132] Tue, 16 January 2007 09:36 Go to previous message
Eclipse UserFriend
HI ;
Check the SetBoundsCommand; it should give you an idea on how to do it

bobywolf wrote:
> I use copyToImageUtil to add a view to diagram file without opening the
> file, and it works, but I can not set the location of the view in the editor
> without opening the editor, how can I set the location of the view in the
> editor without opening it?
>
> ((Diagram)objs[0]).insertChild(view); //add the view to the diagram file
> without opening it
>
> ==============the completed code I used:
>
> final Resource modelResource = resourceSet.getResource(
> URI.createPlatformResourceURI(resourcePath
> .toString()), true);
> if(modelResource instanceof XMIResourceImpl){
> Object[] objs = getElements(modelResource);
> EObjectAdapter objAdapter = new EObjectAdapter(data);
>
> CopyToImageUtil copyToImageUtil = new CopyToImageUtil();
> diagramEditPart = copyToImageUtil.createDiagramEditPart((Diagram)
> objs[0],shell,NewpmbeDiagramEditorPlugin.DIAGRAM_PREFERENCES _HINT);
> }
>
> CreateViewRequest.ViewDescriptor viewDescriptor = new
> CreateViewRequest.ViewDescriptor(
> objAdapter, Node.class, null,
> NewpmbeDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
>
>
> if(subDiagramEditPart != null){ //ÊÇsubDiagramµÄcmd¾ÍÔÚsubDiagramÖд´½¨£¬Õ
Previous Topic:Question about disallowing certain changes based on gmfmap file
Next Topic:Problem with RCP when opening corresponding diagram from node
Goto Forum:
  


Current Time: Thu Jul 17 19:41:09 EDT 2025

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

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

Back to the top