Get featureProvider from a given diagram

14 views
Skip to first unread message

Simone Di Cola

unread,
Oct 7, 2014, 8:17:45 AM10/7/14
to spray...@googlegroups.com
Hi Joerg,
 Given an object of type Diagram, is it possible to get its relative feature provider? If yes, how? 

Thank for your time
Simone

Simone Di Cola

unread,
Oct 7, 2014, 9:45:58 AM10/7/14
to spray...@googlegroups.com
Fix it.

Jörg Reichert

unread,
Oct 7, 2014, 9:49:03 AM10/7/14
to spray...@googlegroups.com
just a pattern: Wait and you find out the solution yourself ;)
--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "spray-user" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an spray-users...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.

Simone Di Cola

unread,
Oct 7, 2014, 9:56:32 AM10/7/14
to spray...@googlegroups.com
What do you mean with a pattern? Anyway I have another question. 

// Create the diagram
Diagram diagram = Graphiti.getPeCreateService().createDiagram(componentID, diagramName, true);
// Create the file
IFile diagramFile = diagramFolder.getFile(diagramName + "." + editorExtension); //$NON-NLS-1$
URI uri = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
FileService.createEmfFileForDiagram(uri, diagram);
String providerId = GraphitiUi.getExtensionManager().getDiagramTypeProviderId(diagram.getDiagramTypeId());
DiagramEditorInput editorInput = new DiagramEditorInput(EcoreUtil.getURI(diagram), providerId);

IEditorPart openedEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, editorID);
IDiagramContainer diagramContainer = (IDiagramContainer) openedEditor;
// Add the specified services
DiagramUtils.createServicesWithParameters(openedEditor,diagram, diagramContainer.getDiagramTypeProvider().getFeatureProvider(), compInst);

When I invoke DiagramUtils.createServicesWithParameters the transcation is always null. Why?

Jörg Reichert

unread,
Oct 7, 2014, 10:01:54 AM10/7/14
to spray...@googlegroups.com
Mybe you have to execute it as RecordingCommand
http://satreth.blogspot.ch/2012/04/graphiti-emf-transactions.html

Simone Di Cola

unread,
Oct 7, 2014, 10:10:35 AM10/7/14
to spray...@googlegroups.com
This is exactly what I do:

public static void createServicesWithParameters(IEditorPart ed,final Diagram diagram, final IFeatureProvider fp, final ComponentInstance compInstance) {
 
TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(diagram);
 domain
.getCommandStack().execute(new RecordingCommand(domain) {
 
@Override
 
public void doExecute() {
 
 
for (Service service : compInstance.getSelectedServices()) {


On Tuesday, October 7, 2014 3:01:54 PM UTC+1, Jörg Reichert wrote:
Myb
e you have to execute it as RecordingCommand
http://satreth.blogspot.ch/2012/04/graphiti-emf-transactions.html

Am 07.10.2014 um 15:56schrie b SimoneD i Cola:
What do you mean with a pattern?Anyway I have another question. 

// Create the diagram
Diagram diagram = Graphiti.getPeCreateService().createDiagram(componentID, diagramName, true);
// Create the file
IFile diagramFile = diagramFolder.getFile(diagramName + "." + editorExtension); //$NON-NLS-1$
urURI i = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);

Jörg Reichert

unread,
Oct 7, 2014, 10:17:27 AM10/7/14
to spray...@googlegroups.com

Jörg Reichert

unread,
Oct 7, 2014, 10:19:55 AM10/7/14
to spray...@googlegroups.com
here is another Graphiti API approach to get the editing domain:

https://gama-platform.googlecode.com/svn/branches/GAMA_CURRENT/idees.gama.graphicalmodeling/src/idees/gama/ui/commands/GenerateDiagramHandler.java
DiagramEditorFactory.createResourceSetAndEditingDomain();


Am 07.10.2014 um 16:10 schrieb Simone Di Cola:

Simone Di Cola

unread,
Oct 7, 2014, 10:38:35 AM10/7/14
to spray...@googlegroups.com
Thanks I've fix this. 
DiagramUtils.createServicesWithParameters(openedEditor,diagram, diagramContainer.getDiagramTypeProvider(.getFeatureProvider()), compInst);

When I invoke DiagramUtils.createServicesWithParameters the transcation is always null. Why?

On Tuesday, October 7, 2014 2:49:03 PM UTC+1, Jörg Reichert wrote:
just a pattern: Wait and you find out the solution yourself ;)

Am 07.10.2014 um 15:45 schrieb Simone Di Cola:
Fix it.

On Tuesday, October 7, 2014 1:17:45 PM UTC+1, Simone Di Cola wrote:
Hi Joerg,
 Given an object of type Diagram, is it possible to get its relative feature provider? If yes, how? 

Thank for your time
Simone
--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "spray-user" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an spray-users...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.

--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "spray-user" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an spray-users...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages