Search in sources :

Example 1 with DocumentationLink

use of org.obeonetwork.tools.doc.core.DocumentationLink 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 DocumentationLink

use of org.obeonetwork.tools.doc.core.DocumentationLink in project InformationSystem by ObeoNetwork.

the class RemoveDocumentationLinkCommand method undo.

/**
 * {@inheritDoc}
 * @see org.eclipse.emf.common.command.AbstractCommand#undo()
 */
@Override
public void undo() {
    DocumentationLink oldEntry = (DocumentationLink) removedLink;
    super.undo();
    ((DocumentationLink) removedLink).setName(oldEntry.getName());
    ((DocumentationLink) removedLink).setValue(oldEntry.getValue());
}
Also used : DocumentationLink(org.obeonetwork.tools.doc.core.DocumentationLink)

Example 3 with DocumentationLink

use of org.obeonetwork.tools.doc.core.DocumentationLink in project InformationSystem by ObeoNetwork.

the class DeleteDocumentationLink method run.

/**
 * {@inheritDoc}
 * @see org.eclipse.jface.action.Action#run()
 */
@Override
public void run() {
    MessageDialog dialog = new MessageDialog(linksView.getSite().getShell(), // $NON-NLS-1$
    DocBridgeUI.getInstance().getString("DeleteDocumentationLinkAction_ConfirmDialog_title"), // $NON-NLS-1$
    null, DocBridgeUI.getInstance().getString("DeleteDocumentationLinkAction_ConfirmDialog_msg"), MessageDialog.CONFIRM, new String[] { // $NON-NLS-1$
    IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 1);
    boolean openConfirm = dialog.open() == Window.OK;
    if (openConfirm) {
        List<DocumentationLink> selection = new ArrayList<DocumentationLink>();
        for (EObjectLink link : linksView.getSelectedEntries()) {
            if (link instanceof DocumentationLink) {
                selection.add((DocumentationLink) link);
            }
        }
        EObject input = linksView.getInput();
        TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(input);
        if (!selection.isEmpty() && editingDomain != null) {
            for (DocumentationLink entry : selection) {
                editingDomain.getCommandStack().execute(new RemoveDocumentationLinkCommand(input, entry));
            }
            linksView.refresh();
        }
    }
}
Also used : TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) RemoveDocumentationLinkCommand(org.obeonetwork.tools.doc.core.command.RemoveDocumentationLinkCommand) DocumentationLink(org.obeonetwork.tools.doc.core.DocumentationLink) EObjectLink(org.obeonetwork.tools.linker.EObjectLink) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 4 with DocumentationLink

use of org.obeonetwork.tools.doc.core.DocumentationLink in project InformationSystem by ObeoNetwork.

the class RelatedDocView method createFilters.

/**
 * {@inheritDoc}
 * @see org.obeonetwork.tools.linker.ui.view.EObjectLinksView#createFilters()
 */
@Override
protected List<ViewerFilter> createFilters() {
    List<ViewerFilter> result = new ArrayList<ViewerFilter>();
    result.add(new ViewerFilter() {

        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            return element instanceof DocumentationLink;
        }
    });
    return result;
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) DocumentationLink(org.obeonetwork.tools.doc.core.DocumentationLink) EditDocumentationLink(org.obeonetwork.tools.doc.ui.command.EditDocumentationLink) DeleteDocumentationLink(org.obeonetwork.tools.doc.ui.command.DeleteDocumentationLink) AddDocumentationLink(org.obeonetwork.tools.doc.ui.command.AddDocumentationLink) ArrayList(java.util.ArrayList) Viewer(org.eclipse.jface.viewers.Viewer)

Example 5 with DocumentationLink

use of org.obeonetwork.tools.doc.core.DocumentationLink in project InformationSystem by ObeoNetwork.

the class DocumentationLinkType method loadLinks.

/**
 * {@inheritDoc}
 * @see org.obeonetwork.tools.linker.LinkType#loadLinks(org.eclipse.emf.ecore.EObject)
 */
public List<EObjectLink> loadLinks(EObject source) {
    if (source instanceof ObeoDSMObject) {
        ObeoDSMObject element = (ObeoDSMObject) source;
        MetaDataContainer metadatas = element.getMetadatas();
        if (metadatas != null) {
            List<EObjectLink> result = new ArrayList<EObjectLink>();
            for (MetaData metadata : metadatas.getMetadatas()) {
                if (metadata instanceof Annotation) {
                    Annotation annotation = (Annotation) metadata;
                    if (annotation.getTitle() != null && annotation.getTitle().startsWith(DocumentationLink.DOCUMENTATION_ANNOTATION_TITLE)) {
                        DocumentationLink link = new DocumentationLinkImpl(annotation);
                        result.add(link);
                    }
                }
            }
            return result;
        }
    }
    return Collections.emptyList();
}
Also used : MetaData(org.obeonetwork.dsl.environment.MetaData) DocumentationLink(org.obeonetwork.tools.doc.core.DocumentationLink) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject) EObjectLink(org.obeonetwork.tools.linker.EObjectLink) ArrayList(java.util.ArrayList) MetaDataContainer(org.obeonetwork.dsl.environment.MetaDataContainer) Annotation(org.obeonetwork.dsl.environment.Annotation)

Aggregations

DocumentationLink (org.obeonetwork.tools.doc.core.DocumentationLink)5 ArrayList (java.util.ArrayList)3 EObject (org.eclipse.emf.ecore.EObject)2 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 EObjectLink (org.obeonetwork.tools.linker.EObjectLink)2 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 Annotation (org.obeonetwork.dsl.environment.Annotation)1 MetaData (org.obeonetwork.dsl.environment.MetaData)1 MetaDataContainer (org.obeonetwork.dsl.environment.MetaDataContainer)1 ObeoDSMObject (org.obeonetwork.dsl.environment.ObeoDSMObject)1 EditDocumentationLinkCommand (org.obeonetwork.tools.doc.core.command.EditDocumentationLinkCommand)1 RemoveDocumentationLinkCommand (org.obeonetwork.tools.doc.core.command.RemoveDocumentationLinkCommand)1 AddDocumentationLink (org.obeonetwork.tools.doc.ui.command.AddDocumentationLink)1 DeleteDocumentationLink (org.obeonetwork.tools.doc.ui.command.DeleteDocumentationLink)1 EditDocumentationLink (org.obeonetwork.tools.doc.ui.command.EditDocumentationLink)1 DocumentationLinkDialog (org.obeonetwork.tools.doc.ui.dialog.DocumentationLinkDialog)1