Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFatic] Read attribute of current selected node in canvas
[EMFatic] Read attribute of current selected node in canvas [message #760142] Thu, 01 December 2011 13:31 Go to next message
Snakebyte Missing name is currently offline Snakebyte Missing nameFriend
Messages: 130
Registered: November 2011
Senior Member
Suppose i got the following model :
(its an eugenia model)

@namespace(uri="trustcasemodel", prefix="trustcasemodel")
@gmf(foo="bar")
package trustCase;

@gmf.diagram(onefile="false")
class TrustCase {
attr String path;
val Claim[*] valclaims;
val Fact[*] facts;
}
@gmf.node(foo="bar")
class Claim {
attr String path;
}
@gmf.node(foo="bar")
class Fact {
attr String path;
}


Creating a gmf Editor out of it with Eugenia.

Now i have a new Plugin adding an action to the top menu bar.
This Plugin should now read the "path" variable from the current selected Node in canvas.
Whats the code for that ?

I simply want to open the file shown by path.

If that doesn't work, can i do it by double click on a node ?

I'm really frustrated an that.
I only need the option to make a systemcall on the mentioned path.
It's not really important which action triggers that call.....
Anybody got an idea ?

How can i get a specific known attribute ("path") from a selected node in canvas ?

With

( EditPart part = ((EditPart)((IStructuredSelection)HandlerUtil.getCurrentSelection(event)).getFirstElement());


i get the currently selected node in canvas.
This is a ClaimEditPart or a FactEditPart.

How can i get the path-attribute from that EditPart ?

If i want to cast the EditPart to a specific xxxEditPart.java like that

FactEditPart editpart = (FactEditPart) part;
editpart.resolveSemanticElement();


i always got the following error :

java.lang.NoClassDefFoundError: trustCase/diagram/edit/parts/FactEditPart

How can i fix this ?

Greeting
Snakebyte
Re: [EMFatic] Read attribute of current selected node in canvas [message #760158 is a reply to message #760142] Thu, 01 December 2011 13:49 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
It's hard to tell, but I think this is a GMF question.

On 01/12/2011 2:31 PM, Snakebyte wrote:
> Suppose i got the following model :
> (its an eugenia model)
>
>
> @namespace(uri="trustcasemodel", prefix="trustcasemodel")
> @gmf(foo="bar")
> package trustCase;
>
> @gmf.diagram(onefile="false")
> class TrustCase {
> attr String path;
> val Claim[*] valclaims;
> val Fact[*] facts;
> }
> @gmf.node(foo="bar")
> class Claim {
> attr String path;
> }
> @gmf.node(foo="bar")
> class Fact {
> attr String path;
> }
>
>
> Creating a gmf Editor out of it with Eugenia.
>
> Now i have a new Plugin adding an action to the top menu bar.
> This Plugin should now read the "path" variable from the current
> selected Node in canvas.
> Whats the code for that ?
>
> I simply want to open the file shown by path.
>
> If that doesn't work, can i do it by double click on a node ?
>
> I'm really frustrated an that.
> I only need the option to make a systemcall on the mentioned path.
> It's not really important which action triggers that call.....
> Anybody got an idea ?
>
> How can i get a specific known attribute ("path") from a selected node
> in canvas ?
>
> With
>
>
> ( EditPart part =
> ((EditPart)((IStructuredSelection)HandlerUtil.getCurrentSelection(event)).getFirstElement());
>
>
> i get the currently selected node in canvas.
> This is a ClaimEditPart or a FactEditPart.
>
> How can i get the path-attribute from that EditPart ?
>
> If i want to cast the EditPart to a specific xxxEditPart.java like that
>
>
> FactEditPart editpart = (FactEditPart) part;
> editpart.resolveSemanticElement();
>
>
> i always got the following error :
>
> java.lang.NoClassDefFoundError: trustCase/diagram/edit/parts/FactEditPart
>
> How can i fix this ?
>
> Greeting
> Snakebyte


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:ecore package with multiple namespaces
Next Topic:[EMFatic] Adding Drop Down Menu to a Node
Goto Forum:
  


Current Time: Thu Apr 25 14:40:57 GMT 2024

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

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

Back to the top