Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » Extending UML2Tools diagram editor user interface
Extending UML2Tools diagram editor user interface [message #474560] Sat, 05 July 2008 12:47 Go to next message
Eclipse User
Originally posted by: marian-misc.rainer-harbach.eu

Hello!
For a specific task I need the ability to quickly and easily toggle the
isUnique property of an association in the UML2Tools diagram editor.
As far as I know this is not possible at the moment and needs to be done
in the UML2 model editor.
Because of this I would like to extend the diagram editor's user interface
for this specific task.
I would be glad if anybody had some hints regarding this (for example
where to look in the source code).

Thanks,
Marian
Re: Extending UML2Tools diagram editor user interface [message #474566 is a reply to message #474560] Tue, 08 July 2008 10:02 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hello Marian,
The problem you faced is a special case of bugzilla #174003 '[ClassD] Impossible
to edit Association link source/destination properties in diagram editor'
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=174003)
Your port is a gentle reminder for us to fix the request =).

IMHO, the quickest (but not the most elegant) fix for your problem is to
create actions in the context menu 'Make source(target) end unique/not-unique'.
Changing Aggregation kind of an association is very similar functionality
from the technical point of you, it is implemented in org.eclipse.uml2.diagram.clazz.action.ChangeAssociationKind
class.

Good luck,
Tanya.

> Hello!
> For a specific task I need the ability to quickly and easily toggle
> the
> isUnique property of an association in the UML2Tools diagram editor.
> As far as I know this is not possible at the moment and needs to be
> done
> in the UML2 model editor.
> Because of this I would like to extend the diagram editor's user
> interface
> for this specific task.
> I would be glad if anybody had some hints regarding this (for example
> where to look in the source code).
> Thanks,
> Marian
Re: Extending UML2Tools diagram editor user interface [message #474682 is a reply to message #474566] Sun, 13 July 2008 15:48 Go to previous messageGo to next message
Eclipse User
Originally posted by: marian-misc.rainer-harbach.eu

Hello!
Thanks for your reply!
I checked out the ...clazz.action package from CVS. If I understand you
correctly your suggestion is to use the ChangeAssociationKind class as a
"template" to implement a new action for the context menu, is that correct?

Unfortunately I am unfamiliar yet with Eclipse plugin development. How can
I run my code? When I try to run plugin.xml as an Eclipse application I
get a launch error "BundleContext is no longer valid". I would be glad if
you could point me to a good tutorial regarding plugin development.

Thanks,
Marian
Re: Extending UML2Tools diagram editor user interface [message #474689 is a reply to message #474682] Wed, 16 July 2008 13:13 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hi Marian,

> If I understand you correctly your suggestion is to use the ChangeAssociationKind
class as
> a "template" to implement a new action for the context menu, is that correct?

Yes, you are correct.
It's usefull to know, that the action is is added to the context menu by
using ContributionItemProvider, which is registered in plugin.xml.

> How can I run my code? When I try to run plugin.xml as an Eclipse
> application I get a launch error "BundleContext is no longer valid".

'Run Eclipse Application' is a way I usually use to run my UML2 Tools. I've
never faced the problem you described, but re-installing of the platform
usually helps in similar cases.

> I would be glad if you could point me to a good tutorial regarding
> plugin development.
PDE help: http://help.eclipse.org/stable/index.jsp?nav=/4
GMF tutorial teaches how to work with GMF: http://wiki.eclipse.org/GMF_Tutorial_BPMN

Maybe other UML2 Tools users could recommend other tutorials.

Cheers,
Tanya.
Re: Extending UML2Tools diagram editor user interface [message #475290 is a reply to message #474689] Mon, 11 August 2008 15:41 Go to previous messageGo to next message
Eclipse User
Originally posted by: marian-misc.rainer-harbach.eu

Hello!
Thanks for your help, I managed to add new entries to the context menu. I
am now having problems implementing the new command. As you suggested, I
took changing association kind as a template. As far as I understand, the
action itself is implemented in ChangeAssociationKind and
ChangeAssociationKindCommand, is this correct? I adapted them to create
new classes ChangeAssociationUniqueness/..Command, but all entries in my
new context menu group are greyed out. Is there any documentation
available on how creating Commands is supposed to work?

Thanks,
Marian
Re: Extending UML2Tools diagram editor user interface [message #475292 is a reply to message #475290] Thu, 14 August 2008 03:59 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hello Marian,

Unfortunately, I don't know if any documentation on CreateCommand or SetValueCommand
exists.

However, I tried to create simple action to set to isUnique property 'true'
value:
protected Command getCommand() {
Association association = getAssociation();
if (association == null) {
return UnexecutableCommand.INSTANCE;
}
return new ICommandProxy(new SetValueCommand(new SetRequest(AssociationEndConvention.getSourceEnd(association ),
UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique(), true)));
}
It works fine.
There is no common advice for the case, if I were you at the same situation
I would have debugged the code in YourAction#getCommand() and SetValueCommand.

I hope it will help.

Best regards,
Tanya.

> Hello!
> Thanks for your help, I managed to add new entries to the context
> menu. I
> am now having problems implementing the new command. As you suggested,
> I
> took changing association kind as a template. As far as I understand,
> the
> action itself is implemented in ChangeAssociationKind and
> ChangeAssociationKindCommand, is this correct? I adapted them to
> create
> new classes ChangeAssociationUniqueness/..Command, but all entries in
> my
> new context menu group are greyed out. Is there any documentation
> available on how creating Commands is supposed to work?
> Thanks,
> Marian
Re: Extending UML2Tools diagram editor user interface [message #475294 is a reply to message #475292] Sat, 16 August 2008 16:49 Go to previous message
Eclipse User
Originally posted by: marian-misc.rainer-harbach.eu

Hi!
Thank you, you helped me a lot!
I had a small mistake in the SetValueCommand parameters, got everything
working now.

Thanks again,
Marian
Re: Extending UML2Tools diagram editor user interface [message #620478 is a reply to message #474560] Tue, 08 July 2008 10:02 Go to previous message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hello Marian,
The problem you faced is a special case of bugzilla #174003 '[ClassD] Impossible
to edit Association link source/destination properties in diagram editor'
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=174003)
Your port is a gentle reminder for us to fix the request =).

IMHO, the quickest (but not the most elegant) fix for your problem is to
create actions in the context menu 'Make source(target) end unique/not-unique'.
Changing Aggregation kind of an association is very similar functionality
from the technical point of you, it is implemented in org.eclipse.uml2.diagram.clazz.action.ChangeAssociationKind
class.

Good luck,
Tanya.

> Hello!
> For a specific task I need the ability to quickly and easily toggle
> the
> isUnique property of an association in the UML2Tools diagram editor.
> As far as I know this is not possible at the moment and needs to be
> done
> in the UML2 model editor.
> Because of this I would like to extend the diagram editor's user
> interface
> for this specific task.
> I would be glad if anybody had some hints regarding this (for example
> where to look in the source code).
> Thanks,
> Marian
Re: Extending UML2Tools diagram editor user interface [message #621258 is a reply to message #474566] Sun, 13 July 2008 15:48 Go to previous message
Eclipse User
Originally posted by: marian-misc.rainer-harbach.eu

Hello!
Thanks for your reply!
I checked out the ...clazz.action package from CVS. If I understand you
correctly your suggestion is to use the ChangeAssociationKind class as a
"template" to implement a new action for the context menu, is that correct?

Unfortunately I am unfamiliar yet with Eclipse plugin development. How can
I run my code? When I try to run plugin.xml as an Eclipse application I
get a launch error "BundleContext is no longer valid". I would be glad if
you could point me to a good tutorial regarding plugin development.

Thanks,
Marian
Re: Extending UML2Tools diagram editor user interface [message #621269 is a reply to message #474682] Wed, 16 July 2008 13:13 Go to previous message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hi Marian,

> If I understand you correctly your suggestion is to use the ChangeAssociationKind
class as
> a "template" to implement a new action for the context menu, is that correct?

Yes, you are correct.
It's usefull to know, that the action is is added to the context menu by
using ContributionItemProvider, which is registered in plugin.xml.

> How can I run my code? When I try to run plugin.xml as an Eclipse
> application I get a launch error "BundleContext is no longer valid".

'Run Eclipse Application' is a way I usually use to run my UML2 Tools. I've
never faced the problem you described, but re-installing of the platform
usually helps in similar cases.

> I would be glad if you could point me to a good tutorial regarding
> plugin development.
PDE help: http://help.eclipse.org/stable/index.jsp?nav=/4
GMF tutorial teaches how to work with GMF: http://wiki.eclipse.org/GMF_Tutorial_BPMN

Maybe other UML2 Tools users could recommend other tutorials.

Cheers,
Tanya.
Re: Extending UML2Tools diagram editor user interface [message #622602 is a reply to message #474689] Mon, 11 August 2008 15:41 Go to previous message
Eclipse User
Originally posted by: marian-misc.rainer-harbach.eu

Hello!
Thanks for your help, I managed to add new entries to the context menu. I
am now having problems implementing the new command. As you suggested, I
took changing association kind as a template. As far as I understand, the
action itself is implemented in ChangeAssociationKind and
ChangeAssociationKindCommand, is this correct? I adapted them to create
new classes ChangeAssociationUniqueness/..Command, but all entries in my
new context menu group are greyed out. Is there any documentation
available on how creating Commands is supposed to work?

Thanks,
Marian
Re: Extending UML2Tools diagram editor user interface [message #622604 is a reply to message #475290] Thu, 14 August 2008 03:59 Go to previous message
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 530
Registered: July 2009
Senior Member
Hello Marian,

Unfortunately, I don't know if any documentation on CreateCommand or SetValueCommand
exists.

However, I tried to create simple action to set to isUnique property 'true'
value:
protected Command getCommand() {
Association association = getAssociation();
if (association == null) {
return UnexecutableCommand.INSTANCE;
}
return new ICommandProxy(new SetValueCommand(new SetRequest(AssociationEndConvention.getSourceEnd(association ),
UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique(), true)));
}
It works fine.
There is no common advice for the case, if I were you at the same situation
I would have debugged the code in YourAction#getCommand() and SetValueCommand.

I hope it will help.

Best regards,
Tanya.

> Hello!
> Thanks for your help, I managed to add new entries to the context
> menu. I
> am now having problems implementing the new command. As you suggested,
> I
> took changing association kind as a template. As far as I understand,
> the
> action itself is implemented in ChangeAssociationKind and
> ChangeAssociationKindCommand, is this correct? I adapted them to
> create
> new classes ChangeAssociationUniqueness/..Command, but all entries in
> my
> new context menu group are greyed out. Is there any documentation
> available on how creating Commands is supposed to work?
> Thanks,
> Marian
Re: Extending UML2Tools diagram editor user interface [message #622606 is a reply to message #475292] Sat, 16 August 2008 16:49 Go to previous message
Eclipse User
Originally posted by: marian-misc.rainer-harbach.eu

Hi!
Thank you, you helped me a lot!
I had a small mistake in the SetValueCommand parameters, got everything
working now.

Thanks again,
Marian
Previous Topic:Getting started
Next Topic:Re: Is it possible to create a Sequence Diagram with UML2Tool?
Goto Forum:
  


Current Time: Wed Aug 27 21:27:02 EDT 2014

Powered by FUDForum. Page generated in 0.09569 seconds