Search in sources :

Example 1 with Configuration

use of org.obeonetwork.tools.classdiagramconfiguration.Configuration in project InformationSystem by ObeoNetwork.

the class GenerateVsmHandler method execute.

/**
 * the command has been executed, so extract extract the needed information
 * from the application context.
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
    Configuration configuration = getConfiguration(activeEditor);
    EditingDomain editingDomain = getEditingDomainFromEditor(activeEditor);
    ClassDiagramGenerator generator = new ClassDiagramGenerator(configuration, editingDomain);
    Collection<RepresentationDescription> newDescriptions = generator.generate();
    if (!newDescriptions.isEmpty() && activeEditor instanceof ISelectionProvider) {
        ((ISelectionProvider) activeEditor).setSelection(new StructuredSelection(newDescriptions));
    }
    return null;
}
Also used : RepresentationDescription(org.eclipse.sirius.viewpoint.description.RepresentationDescription) Configuration(org.obeonetwork.tools.classdiagramconfiguration.Configuration) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) EditingDomain(org.eclipse.emf.edit.domain.EditingDomain)

Aggregations

EditingDomain (org.eclipse.emf.edit.domain.EditingDomain)1 ISelectionProvider (org.eclipse.jface.viewers.ISelectionProvider)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 RepresentationDescription (org.eclipse.sirius.viewpoint.description.RepresentationDescription)1 IEditorPart (org.eclipse.ui.IEditorPart)1 Configuration (org.obeonetwork.tools.classdiagramconfiguration.Configuration)1