Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EuGENia | EOL] delete creation tool
[EuGENia | EOL] delete creation tool [message #483784] Wed, 02 September 2009 20:20 Go to next message
Mihir is currently offline Mihir
Messages: 83
Registered: July 2009
Member
Hello,

I'm trying to delete some creation tools so that they don't appear on
the tools palette.

I've tried experimenting different ways but if I delete any tool then in
gmfmap the tool property in node mapping selects some other tool
available. I want it to map to no tool. I tried deleting from gmftool
anf gmfmap as well. But no luck. Please help me with this.

var rule = ECore!EClass.all.selectOne(o|o.name = 'Rule');
ruleTool = GmfTool!CreationTool.selectOne(t|t.title = 'Rule');

var nodeMapping =
GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = rule);
--delete nodeMapping.tool;
nodeMapping.tool = ruleTool;
-- even though I do this it does not maps the same tool instead some
other tool is mapped

var r = ECore!EClass.all.selectOne(o|o.name = 'OclExp');
var nodeMapping =
GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = r);
delete nodeMapping.tool;
--this deletes the tool but in gmfmap some other random tool is selected.


Thanks,
Mihir
Re: [EuGENia | EOL] delete creation tool [message #483833 is a reply to message #483784] Thu, 03 September 2009 05:41 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

You need to unset nodeMapping.tool. An example follows:

------ notool.emf ------

@namespace(uri="notool", prefix="notool")
package notool;

@gmf.diagram
class Model {
val ModelElement[*] contents;
}

@gmf.node(label="name")
abstract class ModelElement {
attr String name;
}

class A extends ModelElement {}

class B extends ModelElement {}

class C extends ModelElement {} // We don't want a tool for this class

class D extends ModelElement {}

class E extends ModelElement {}

------ ECore2GMF.eol ------

var tool = GmfTool!CreationTool.all.selectOne(t|t.title = 'C');
var nodeMapping = GmfMap!NodeMapping.all.selectOne(nm|nm.tool = tool);

delete tool;
nodeMapping.unset('tool');
nodeMapping.tool.println();

operation Any unset(feature:String) {
var sf = self.eClass().eAllStructuralFeatures.
selectOne(sf|sf.name = feature);
self.eUnset(sf);
}

Cheers,
Dimitris

Mihir wrote:
> Hello,
>
> I'm trying to delete some creation tools so that they don't appear on
> the tools palette.
>
> I've tried experimenting different ways but if I delete any tool then in
> gmfmap the tool property in node mapping selects some other tool
> available. I want it to map to no tool. I tried deleting from gmftool
> anf gmfmap as well. But no luck. Please help me with this.
>
> var rule = ECore!EClass.all.selectOne(o|o.name = 'Rule');
> ruleTool = GmfTool!CreationTool.selectOne(t|t.title = 'Rule');
>
> var nodeMapping =
> GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = rule);
> --delete nodeMapping.tool;
> nodeMapping.tool = ruleTool;
> -- even though I do this it does not maps the same tool instead some
> other tool is mapped
>
> var r = ECore!EClass.all.selectOne(o|o.name = 'OclExp');
> var nodeMapping =
> GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = r);
> delete nodeMapping.tool;
> --this deletes the tool but in gmfmap some other random tool is selected.
>
>
> Thanks,
> Mihir


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
{solved} [EuGENia | EOL] delete creation tool [message #483865 is a reply to message #483833] Thu, 03 September 2009 08:16 Go to previous messageGo to next message
Mihir is currently offline Mihir
Messages: 83
Registered: July 2009
Member
Thanks a million Dimitris.. it solved my problem.. :)

Mihir



Dimitris Kolovos wrote:
> Hi Mihir,
>
> You need to unset nodeMapping.tool. An example follows:
>
> ------ notool.emf ------
>
> @namespace(uri="notool", prefix="notool")
> package notool;
>
> @gmf.diagram
> class Model {
> val ModelElement[*] contents;
> }
>
> @gmf.node(label="name")
> abstract class ModelElement {
> attr String name;
> }
>
> class A extends ModelElement {}
>
> class B extends ModelElement {}
>
> class C extends ModelElement {} // We don't want a tool for this class
>
> class D extends ModelElement {}
>
> class E extends ModelElement {}
>
> ------ ECore2GMF.eol ------
>
> var tool = GmfTool!CreationTool.all.selectOne(t|t.title = 'C');
> var nodeMapping = GmfMap!NodeMapping.all.selectOne(nm|nm.tool = tool);
>
> delete tool;
> nodeMapping.unset('tool');
> nodeMapping.tool.println();
>
> operation Any unset(feature:String) {
> var sf = self.eClass().eAllStructuralFeatures.
> selectOne(sf|sf.name = feature);
> self.eUnset(sf);
> }
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hello,
>>
>> I'm trying to delete some creation tools so that they don't appear on
>> the tools palette.
>>
>> I've tried experimenting different ways but if I delete any tool then
>> in gmfmap the tool property in node mapping selects some other tool
>> available. I want it to map to no tool. I tried deleting from gmftool
>> anf gmfmap as well. But no luck. Please help me with this.
>>
>> var rule = ECore!EClass.all.selectOne(o|o.name = 'Rule');
>> ruleTool = GmfTool!CreationTool.selectOne(t|t.title = 'Rule');
>>
>> var nodeMapping =
>> GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = rule);
>> --delete nodeMapping.tool;
>> nodeMapping.tool = ruleTool;
>> -- even though I do this it does not maps the same tool instead some
>> other tool is mapped
>>
>> var r = ECore!EClass.all.selectOne(o|o.name = 'OclExp');
>> var nodeMapping =
>> GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = r);
>> delete nodeMapping.tool;
>> --this deletes the tool but in gmfmap some other random tool is selected.
>>
>>
>> Thanks,
>> Mihir
>
>
Re: [EuGENia | EOL] delete creation tool [message #580178 is a reply to message #483784] Thu, 03 September 2009 05:41 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Mihir,

You need to unset nodeMapping.tool. An example follows:

------ notool.emf ------

@namespace(uri="notool", prefix="notool")
package notool;

@gmf.diagram
class Model {
val ModelElement[*] contents;
}

@gmf.node(label="name")
abstract class ModelElement {
attr String name;
}

class A extends ModelElement {}

class B extends ModelElement {}

class C extends ModelElement {} // We don't want a tool for this class

class D extends ModelElement {}

class E extends ModelElement {}

------ ECore2GMF.eol ------

var tool = GmfTool!CreationTool.all.selectOne(t|t.title = 'C');
var nodeMapping = GmfMap!NodeMapping.all.selectOne(nm|nm.tool = tool);

delete tool;
nodeMapping.unset('tool');
nodeMapping.tool.println();

operation Any unset(feature:String) {
var sf = self.eClass().eAllStructuralFeatures.
selectOne(sf|sf.name = feature);
self.eUnset(sf);
}

Cheers,
Dimitris

Mihir wrote:
> Hello,
>
> I'm trying to delete some creation tools so that they don't appear on
> the tools palette.
>
> I've tried experimenting different ways but if I delete any tool then in
> gmfmap the tool property in node mapping selects some other tool
> available. I want it to map to no tool. I tried deleting from gmftool
> anf gmfmap as well. But no luck. Please help me with this.
>
> var rule = ECore!EClass.all.selectOne(o|o.name = 'Rule');
> ruleTool = GmfTool!CreationTool.selectOne(t|t.title = 'Rule');
>
> var nodeMapping =
> GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = rule);
> --delete nodeMapping.tool;
> nodeMapping.tool = ruleTool;
> -- even though I do this it does not maps the same tool instead some
> other tool is mapped
>
> var r = ECore!EClass.all.selectOne(o|o.name = 'OclExp');
> var nodeMapping =
> GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = r);
> delete nodeMapping.tool;
> --this deletes the tool but in gmfmap some other random tool is selected.
>
>
> Thanks,
> Mihir


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
{solved} [EuGENia | EOL] delete creation tool [message #580219 is a reply to message #483833] Thu, 03 September 2009 08:16 Go to previous messageGo to next message
Mihir is currently offline Mihir
Messages: 83
Registered: July 2009
Member
Thanks a million Dimitris.. it solved my problem.. :)

Mihir



Dimitris Kolovos wrote:
> Hi Mihir,
>
> You need to unset nodeMapping.tool. An example follows:
>
> ------ notool.emf ------
>
> @namespace(uri="notool", prefix="notool")
> package notool;
>
> @gmf.diagram
> class Model {
> val ModelElement[*] contents;
> }
>
> @gmf.node(label="name")
> abstract class ModelElement {
> attr String name;
> }
>
> class A extends ModelElement {}
>
> class B extends ModelElement {}
>
> class C extends ModelElement {} // We don't want a tool for this class
>
> class D extends ModelElement {}
>
> class E extends ModelElement {}
>
> ------ ECore2GMF.eol ------
>
> var tool = GmfTool!CreationTool.all.selectOne(t|t.title = 'C');
> var nodeMapping = GmfMap!NodeMapping.all.selectOne(nm|nm.tool = tool);
>
> delete tool;
> nodeMapping.unset('tool');
> nodeMapping.tool.println();
>
> operation Any unset(feature:String) {
> var sf = self.eClass().eAllStructuralFeatures.
> selectOne(sf|sf.name = feature);
> self.eUnset(sf);
> }
>
> Cheers,
> Dimitris
>
> Mihir wrote:
>> Hello,
>>
>> I'm trying to delete some creation tools so that they don't appear on
>> the tools palette.
>>
>> I've tried experimenting different ways but if I delete any tool then
>> in gmfmap the tool property in node mapping selects some other tool
>> available. I want it to map to no tool. I tried deleting from gmftool
>> anf gmfmap as well. But no luck. Please help me with this.
>>
>> var rule = ECore!EClass.all.selectOne(o|o.name = 'Rule');
>> ruleTool = GmfTool!CreationTool.selectOne(t|t.title = 'Rule');
>>
>> var nodeMapping =
>> GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = rule);
>> --delete nodeMapping.tool;
>> nodeMapping.tool = ruleTool;
>> -- even though I do this it does not maps the same tool instead some
>> other tool is mapped
>>
>> var r = ECore!EClass.all.selectOne(o|o.name = 'OclExp');
>> var nodeMapping =
>> GmfMap!NodeMapping.all.selectOne(nm|nm.domainMetaElement = r);
>> delete nodeMapping.tool;
>> --this deletes the tool but in gmfmap some other random tool is selected.
>>
>>
>> Thanks,
>> Mihir
>
>
Re: [EuGENia | EOL] delete creation tool [message #758285 is a reply to message #483784] Tue, 22 November 2011 09:53 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Hello Dimitrios,

when i tried to use your code in ECore2GMF.eol to delete a Tool, i got the following error :

Method 'eClass' not found.

How can that be ?

Greeting
Snakebyte
Re: [EuGENia | EOL] delete creation tool [message #758312 is a reply to message #758285] Tue, 22 November 2011 12:07 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 798
Registered: July 2009
Senior Member
Hi,

It'd be really hard to guess without additional information. See http://eclipse.org/gmt/epsilon/doc/articles/minimal-examples/

Cheers,
Dimitris
Re: [EuGENia | EOL] delete creation tool [message #758317 is a reply to message #758312] Tue, 22 November 2011 12:22 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Take this example again :

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

@gmf.diagram(onefile="false")
class ArgumentModel {
   val Claim[*] claims;
   val Assumption[*] assumptions;
}

@gmf.node(label="name")
class Claim {
   attr String name;
   attr String description;
   @gmf.link(incoming="true")
   val ArgumentStrategy[*] ConnectArg;
}

@gmf.node(label="name",phantom="true")
class ArgumentStrategy {
   attr String description;
   attr String name;
   @gmf.link(incoming="true")
   ref Assumption [*] assumptions;  
}
@gmf.node(label="name")
class Assumption {
   attr String description;
   attr String name;

}


now i tried to add the following in the ECore2GMF.eol:

var tool = GmfTool!CreationTool.all.selectOne(t|t.title = 'assumptions');
var nodeMapping = GmfMap!NodeMapping.all.selectOne(nm|nm.tool = tool);

delete tool;
nodeMapping.unset('tool');
nodeMapping.tool.println();

operation Any unset(feature:String) {
var sf = self.eClass().eAllStructuralFeatures.
selectOne(sf|sf.name = feature);
self.eUnset(sf);
}



What i want to achieve is, that i dont want to see the relation "assumptions" in the connections palette.

and i get the error:

Method 'eClass' not found.

what im doing wrong ?

[Updated on: Tue, 22 November 2011 14:16]

Report message to a moderator

Re: [EuGENia | EOL] delete creation tool [message #758352 is a reply to message #758317] Tue, 22 November 2011 16:09 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 798
Registered: July 2009
Senior Member
It's not a NodeMapping, it's a LinkMapping you're looking for. The following should work:

var tool = GmfTool!CreationTool.all.selectOne(t|t.title = 'Assumptions');
var linkMapping = GmfMap!LinkMapping.all.selectOne(nm|nm.tool = tool);

delete tool;
linkMapping.unset('tool');

operation Any unset(feature:String) {
var sf = self.eClass().eAllStructuralFeatures.
selectOne(sf|sf.name = feature);
self.eUnset(sf);
}

Cheers,
Dimitris
Re: [EuGENia | EOL] delete creation tool [message #758379 is a reply to message #758352] Tue, 22 November 2011 18:17 Go to previous message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Works. Big Thanks !
Previous Topic:[Eugenia] Validation Problem
Next Topic:[Eugenia] Negation
Goto Forum:
  


Current Time: Wed Jul 30 23:29:40 EDT 2014

Powered by FUDForum. Page generated in 0.02194 seconds