Search in sources :

Example 1 with DocumentationLinkDialog

use of org.obeonetwork.tools.doc.ui.dialog.DocumentationLinkDialog in project InformationSystem by ObeoNetwork.

the class EditDocumentationLink method run.

/**
 * {@inheritDoc}
 * @see org.eclipse.jface.action.Action#run()
 */
@Override
public void run() {
    EObject input = linksView.getInput();
    TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(input);
    if (editingDomain != null) {
        DocumentationLink editedLink = (DocumentationLink) linksView.getSelectedEntries().get(0);
        DocumentationLinkDialog dialog = new DocumentationLinkDialog(linksView.getSite().getShell(), editedLink);
        int open = dialog.open();
        if (open == Window.OK) {
            editingDomain.getCommandStack().execute(new EditDocumentationLinkCommand(editedLink, dialog.getName(), dialog.getValue()));
            linksView.refresh();
        }
    }
}
Also used : DocumentationLinkDialog(org.obeonetwork.tools.doc.ui.dialog.DocumentationLinkDialog) EditDocumentationLinkCommand(org.obeonetwork.tools.doc.core.command.EditDocumentationLinkCommand) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) DocumentationLink(org.obeonetwork.tools.doc.core.DocumentationLink) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with DocumentationLinkDialog

use of org.obeonetwork.tools.doc.ui.dialog.DocumentationLinkDialog in project InformationSystem by ObeoNetwork.

the class AddDocumentationLink method run.

/**
 * {@inheritDoc}
 * @see org.eclipse.jface.action.Action#run()
 */
@Override
public void run() {
    EObject input = linksView.getInput();
    TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(input);
    if (editingDomain != null) {
        DocumentationLinkDialog dialog = new DocumentationLinkDialog(linksView.getSite().getShell());
        int open = dialog.open();
        if (open == Window.OK) {
            editingDomain.getCommandStack().execute(new AddDocumentationLinkCommand(input, dialog.getName(), dialog.getValue()));
            linksView.refresh();
        }
    }
}
Also used : DocumentationLinkDialog(org.obeonetwork.tools.doc.ui.dialog.DocumentationLinkDialog) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) EObject(org.eclipse.emf.ecore.EObject) AddDocumentationLinkCommand(org.obeonetwork.tools.doc.core.command.AddDocumentationLinkCommand)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)2 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 DocumentationLinkDialog (org.obeonetwork.tools.doc.ui.dialog.DocumentationLinkDialog)2 DocumentationLink (org.obeonetwork.tools.doc.core.DocumentationLink)1 AddDocumentationLinkCommand (org.obeonetwork.tools.doc.core.command.AddDocumentationLinkCommand)1 EditDocumentationLinkCommand (org.obeonetwork.tools.doc.core.command.EditDocumentationLinkCommand)1