Home » Modeling » UML2 Tools » Using command/request on umltools diagrams
|
Re: Using command/request on umltools diagrams [message #470345 is a reply to message #470344] |
Wed, 09 May 2007 11:52 |
Michael Golubev Messages: 383 Registered: July 2009 |
Senior Member |
|
|
Hello Philippe,
You may also take a look, e.g, at the org.eclipse.uml2.diagram.clazz.action.CreateAssociationFromP roperties
class
(src-custom root of ClassD plugin).
It makes the following:
1. Creates new association for given property end that is owned by classifier.
(semantic change)
2. Creates opposite association end owned by association (semantic change)
3. Adds Edge for association to diagram (notation)
4. Remove the property view from classifier view (notation).
Please note that for creation of single elements you can use the same requests
that are used by diagram tools.
Basically, the following code should get you the complete (semantic + notation)
command to create a class:
List types = Arrays.asList(new IElementType[] {
UMLElementTypes.Class_3007,
UMLElementTypes.Class_2001, //you can use only this one for top level
classes
UMLElementTypes.Class_3003,
UMLElementTypes.Class_3030,
});
CreateUnspecifiedTypeRequest request = new CreateUnspecifiedTypeRequest(elementTypes,
UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
Command result = getDiagramEditPart().getCommand(request);
Hope it helps,
Michael
> Hi again,
>
> I'm stuck in finding how I can programmatically modify the diagram and
> the semantic model (add a class in a class diagram for instance).
>
> is it possible using command and request as other gmf generated tools
> or not ?
>
> Thanks for any help.
> Philippe
|
|
|
Re: Using command/request on umltools diagrams [message #470721 is a reply to message #470345] |
Fri, 11 May 2007 08:16 |
Philippe Messages: 100 Registered: July 2009 |
Senior Member |
|
|
Hello Michael,
thanks for your explanations,
I have now a better understanding of all of it and I'd like to go further.
If i'm right the semantic, view and editpart are considered as 3
"layers" for working on in GMF and the editpart can act by the use of
commands on the semantic or the view but are only created when opening
the diagram editor.
My work for now is to try to implements model/diagram transformations
programmatically.
For instance I tried to directly make minor changes using UML2 API
(changing class name) and they were correctly reported in the diagram,
but as it get more complex, as creating classes (using
createOwnedClass() or the UML editor) the diagram is not updated anymore.
And i don't know how to work on diagrams...
As the diagram isn't opened in a editor, I believe that I cannot use
editparts, so is working on the view "layer" the best way (and how?) or
forcing the opening in a editor to use editparts would offer a stronger
edition possibilities ?
Many thanks for your help.
Philippe
Michael Golubev wrote:
> Hello Philippe,
>
> You may also take a look, e.g, at the
> org.eclipse.uml2.diagram.clazz.action.CreateAssociationFromP roperties
> class (src-custom root of ClassD plugin).
>
> It makes the following:
> 1. Creates new association for given property end that is owned by
> classifier. (semantic change)
> 2. Creates opposite association end owned by association (semantic change)
> 3. Adds Edge for association to diagram (notation)
> 4. Remove the property view from classifier view (notation).
>
> Please note that for creation of single elements you can use the same
> requests that are used by diagram tools.
> Basically, the following code should get you the complete (semantic +
> notation) command to create a class:
> List types = Arrays.asList(new IElementType[] {
> UMLElementTypes.Class_3007, UMLElementTypes.Class_2001, //you can
> use only this one for top level classes
> UMLElementTypes.Class_3003, UMLElementTypes.Class_3030, });
> CreateUnspecifiedTypeRequest request = new
> CreateUnspecifiedTypeRequest(elementTypes,
> UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
> Command result = getDiagramEditPart().getCommand(request);
>
> Hope it helps, Michael
>
>> Hi again,
>>
>> I'm stuck in finding how I can programmatically modify the diagram and
>> the semantic model (add a class in a class diagram for instance).
>>
>> is it possible using command and request as other gmf generated tools
>> or not ?
>>
>> Thanks for any help.
>> Philippe
>
>
|
|
|
Re: Using command/request on umltools diagrams [message #592843 is a reply to message #470344] |
Wed, 09 May 2007 11:52 |
Michael Golubev Messages: 383 Registered: July 2009 |
Senior Member |
|
|
Hello Philippe,
You may also take a look, e.g, at the org.eclipse.uml2.diagram.clazz.action.CreateAssociationFromP roperties
class
(src-custom root of ClassD plugin).
It makes the following:
1. Creates new association for given property end that is owned by classifier.
(semantic change)
2. Creates opposite association end owned by association (semantic change)
3. Adds Edge for association to diagram (notation)
4. Remove the property view from classifier view (notation).
Please note that for creation of single elements you can use the same requests
that are used by diagram tools.
Basically, the following code should get you the complete (semantic + notation)
command to create a class:
List types = Arrays.asList(new IElementType[] {
UMLElementTypes.Class_3007,
UMLElementTypes.Class_2001, //you can use only this one for top level
classes
UMLElementTypes.Class_3003,
UMLElementTypes.Class_3030,
});
CreateUnspecifiedTypeRequest request = new CreateUnspecifiedTypeRequest(elementTypes,
UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
Command result = getDiagramEditPart().getCommand(request);
Hope it helps,
Michael
> Hi again,
>
> I'm stuck in finding how I can programmatically modify the diagram and
> the semantic model (add a class in a class diagram for instance).
>
> is it possible using command and request as other gmf generated tools
> or not ?
>
> Thanks for any help.
> Philippe
|
|
|
Re: Using command/request on umltools diagrams [message #592990 is a reply to message #470345] |
Fri, 11 May 2007 08:16 |
Philippe Messages: 100 Registered: July 2009 |
Senior Member |
|
|
Hello Michael,
thanks for your explanations,
I have now a better understanding of all of it and I'd like to go further.
If i'm right the semantic, view and editpart are considered as 3
"layers" for working on in GMF and the editpart can act by the use of
commands on the semantic or the view but are only created when opening
the diagram editor.
My work for now is to try to implements model/diagram transformations
programmatically.
For instance I tried to directly make minor changes using UML2 API
(changing class name) and they were correctly reported in the diagram,
but as it get more complex, as creating classes (using
createOwnedClass() or the UML editor) the diagram is not updated anymore.
And i don't know how to work on diagrams...
As the diagram isn't opened in a editor, I believe that I cannot use
editparts, so is working on the view "layer" the best way (and how?) or
forcing the opening in a editor to use editparts would offer a stronger
edition possibilities ?
Many thanks for your help.
Philippe
Michael Golubev wrote:
> Hello Philippe,
>
> You may also take a look, e.g, at the
> org.eclipse.uml2.diagram.clazz.action.CreateAssociationFromP roperties
> class (src-custom root of ClassD plugin).
>
> It makes the following:
> 1. Creates new association for given property end that is owned by
> classifier. (semantic change)
> 2. Creates opposite association end owned by association (semantic change)
> 3. Adds Edge for association to diagram (notation)
> 4. Remove the property view from classifier view (notation).
>
> Please note that for creation of single elements you can use the same
> requests that are used by diagram tools.
> Basically, the following code should get you the complete (semantic +
> notation) command to create a class:
> List types = Arrays.asList(new IElementType[] {
> UMLElementTypes.Class_3007, UMLElementTypes.Class_2001, //you can
> use only this one for top level classes
> UMLElementTypes.Class_3003, UMLElementTypes.Class_3030, });
> CreateUnspecifiedTypeRequest request = new
> CreateUnspecifiedTypeRequest(elementTypes,
> UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
> Command result = getDiagramEditPart().getCommand(request);
>
> Hope it helps, Michael
>
>> Hi again,
>>
>> I'm stuck in finding how I can programmatically modify the diagram and
>> the semantic model (add a class in a class diagram for instance).
>>
>> is it possible using command and request as other gmf generated tools
>> or not ?
>>
>> Thanks for any help.
>> Philippe
>
>
|
|
|
Goto Forum:
Current Time: Wed Sep 25 08:51:27 GMT 2024
Powered by FUDForum. Page generated in 0.03319 seconds
|