how can I set the location of the view in the editor without opening it? [message #93132] |
Tue, 16 January 2007 06:16  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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Öд´½¨£¬Õ
|
|
|
Powered by
FUDForum. Page generated in 0.03344 seconds