Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Passing the diagram filename to a model element property ??
Passing the diagram filename to a model element property ?? [message #122248] Fri, 27 April 2007 12:26 Go to next message
Eclipse UserFriend
Originally posted by: renwart.lippmann.lu

Hi everybody,

I'd like to get the filename (and if possible the full path) of a
diagram and assign it to a property ("name") of my model element...

Thanks in advance for any help.

benren.
Re: Passing the diagram filename to a model element property ?? [message #122259 is a reply to message #122248] Fri, 27 April 2007 12:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: angelo.marguglio.eng.it

Hi! You can use this code:

FileDiagramEditor editor = (FileDiagramEditor)

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePag().getActiveEditor();

editor.getEditorInput();



From this object you can find what you want!
BYE



"Ben Renwart" <renwart@lippmann.lu> ha scritto nel messaggio
news:f0sq2o$9go$1@build.eclipse.org...
> Hi everybody,
>
> I'd like to get the filename (and if possible the full path) of a diagram
> and assign it to a property ("name") of my model element...
>
> Thanks in advance for any help.
>
> benren.
Re: Passing the diagram filename to a model element property ?? [message #122271 is a reply to message #122248] Fri, 27 April 2007 12:37 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Ben,

org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile (diagram.eResource())
will give you the IFile that stores the diagram.

Best regards,
Boris


Ben Renwart wrote:
> Hi everybody,
>
> I'd like to get the filename (and if possible the full path) of a
> diagram and assign it to a property ("name") of my model element...
>
> Thanks in advance for any help.
>
> benren.
Re: Passing the diagram filename to a model element property ?? [message #122315 is a reply to message #122271] Fri, 27 April 2007 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bagnard.natacha.free.fr

Hi Boris,

I'm really interested by the tips you give here but I don't know how you
get your diagram object. I searched for it but can't find it.
Could you explain me how you get it ?

Natacha

Boris Blajer a écrit :
> Hi Ben,
>
> org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile (diagram.eResource())
> will give you the IFile that stores the diagram.
>
> Best regards,
> Boris
Re: Passing the diagram filename to a model element property ?? [message #122359 is a reply to message #122315] Fri, 27 April 2007 15:26 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Natacha,

I interpreted the question "I'd like to get the filename of a
diagram..." as an indication of the fact that the diagram is available.

If you only have an IEditorPart, you may cast it to
IDiagramWorkbenchPart and use IDiagramWorkbenchPart#getDiagram() method.

If you only have a GraphicalViewer, you may use
graphicalViewer.getContents().getModel() and cast the result to Diagram.

Otherwise, it's not so easy to give advice without knowing what you
start with :)

Best regards,
Boris


natacha bagnard wrote:
> Hi Boris,
>
> I'm really interested by the tips you give here but I don't know how you
> get your diagram object. I searched for it but can't find it.
> Could you explain me how you get it ?
>
> Natacha
>
> Boris Blajer a écrit :
>> Hi Ben,
>>
>> org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile (diagram.eResource())
>> will give you the IFile that stores the diagram.
>>
>> Best regards,
>> Boris
Re: Passing the diagram filename to a model element property ?? [message #123303 is a reply to message #122248] Wed, 02 May 2007 12:06 Go to previous message
Eclipse UserFriend
Originally posted by: evaandoli.dodo.com.au

Ben ,

I finally got around to spending too much time on this and came up with the
following solution:-
Look at class (replace YourDiagramDomain with yours)
<YourDiagramDomain>DiagramEditorUtil

It contains a method called:-
createDiagram(

Which itself contains a method called:-
protected CommandResult doExecuteWithResult(

In here you get access to the top level model created.
So you can do somthing like:-

model.setName(modelURI.path());

Anyway that is how I did it,

Stuart

"Ben Renwart" <renwart@lippmann.lu> wrote in message
news:f0sq2o$9go$1@build.eclipse.org...
> Hi everybody,
>
> I'd like to get the filename (and if possible the full path) of a diagram
> and assign it to a property ("name") of my model element...
>
> Thanks in advance for any help.
>
> benren.
Previous Topic:Opening the Diagram from code
Next Topic:GMF Filename - passing it down to model attribute.
Goto Forum:
  


Current Time: Thu Dec 26 23:50:09 GMT 2024

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

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

Back to the top