Search in sources :

Example 1 with RequirementLink

use of org.obeonetwork.tools.requirement.core.RequirementLink in project InformationSystem by ObeoNetwork.

the class EditRequirementAction method run.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.jface.action.Action#run()
 */
@Override
public void run() {
    RequirementLink eObjectLink = (RequirementLink) linksView.getSelectedEntries().get(0);
    TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(linksView.getInput());
    DomainPropertiesEditionContext propertiesEditionContext = new DomainPropertiesEditionContext(null, null, editingDomain, linksView.getAdapterFactory(), eObjectLink.getRequirement());
    WizardEditingOperation operation = new RequirementEditingOperation(propertiesEditionContext);
    try {
        operation.execute(new NullProgressMonitor(), null);
        linksView.refresh();
    } catch (ExecutionException e) {
        // $NON-NLS-1$
        EEFRuntimePlugin.getDefault().logError("An error occured during wizard editing.", e);
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) RequirementEditingOperation(org.obeonetwork.tools.requirement.wizard.operation.RequirementEditingOperation) RequirementLink(org.obeonetwork.tools.requirement.core.RequirementLink) DomainPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.DomainPropertiesEditionContext) ExecutionException(org.eclipse.core.commands.ExecutionException) WizardEditingOperation(org.eclipse.emf.eef.runtime.impl.operation.WizardEditingOperation)

Example 2 with RequirementLink

use of org.obeonetwork.tools.requirement.core.RequirementLink in project InformationSystem by ObeoNetwork.

the class LinkedRequirementsView method createDoubleClickAction.

/**
 * {@inheritDoc}
 *
 * @see org.obeonetwork.tools.linker.ui.view.EObjectLinksView#createDoubleClickAction()
 */
@Override
protected Action createDoubleClickAction() {
    return new Action() {

        /**
         * {@inheritDoc}
         *
         * @see org.eclipse.jface.action.Action#run()
         */
        @Override
        public void run() {
            if (getSelectedEntries().size() > 0) {
                RequirementLink eObjectLink = (RequirementLink) getSelectedEntries().get(0);
                TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getInput());
                DomainPropertiesEditionContext propertiesEditionContext = new DomainPropertiesEditionContext(null, null, editingDomain, adapterFactory, eObjectLink.getRequirement());
                WizardEditingOperation operation = new RequirementEditingOperation(propertiesEditionContext);
                try {
                    operation.execute(new NullProgressMonitor(), null);
                    refresh();
                } catch (ExecutionException e) {
                    // $NON-NLS-1$
                    EEFRuntimePlugin.getDefault().logError("An error occured during wizard editing.", e);
                }
            }
        }
    };
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) EditRequirementAction(org.obeonetwork.tools.requirement.ui.view.action.EditRequirementAction) LinkRequirementAction(org.obeonetwork.tools.requirement.ui.view.action.LinkRequirementAction) CreateRequirementAction(org.obeonetwork.tools.requirement.ui.view.action.CreateRequirementAction) UnlinkRequirementAction(org.obeonetwork.tools.requirement.ui.view.action.UnlinkRequirementAction) Action(org.eclipse.jface.action.Action) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) RequirementEditingOperation(org.obeonetwork.tools.requirement.wizard.operation.RequirementEditingOperation) RequirementLink(org.obeonetwork.tools.requirement.core.RequirementLink) DomainPropertiesEditionContext(org.eclipse.emf.eef.runtime.context.impl.DomainPropertiesEditionContext) ExecutionException(org.eclipse.core.commands.ExecutionException) WizardEditingOperation(org.eclipse.emf.eef.runtime.impl.operation.WizardEditingOperation)

Example 3 with RequirementLink

use of org.obeonetwork.tools.requirement.core.RequirementLink in project InformationSystem by ObeoNetwork.

the class LinkedRequirementsView 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 RequirementLink;
        }
    });
    return result;
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ArrayList(java.util.ArrayList) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) RequirementLink(org.obeonetwork.tools.requirement.core.RequirementLink)

Example 4 with RequirementLink

use of org.obeonetwork.tools.requirement.core.RequirementLink in project InformationSystem by ObeoNetwork.

the class UnlinkRequirementAction method run.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.jface.action.Action#run()
 */
@Override
public void run() {
    MessageDialog dialog = new MessageDialog(linksView.getSite().getShell(), // $NON-NLS-1$
    RequirementLinkerPlugin.getInstance().getString("DeleteRequirementLinkAction_ConfirmDialog_title"), null, // $NON-NLS-1$
    RequirementLinkerPlugin.getInstance().getString("DeleteRequirementLinkAction_ConfirmDialog_msg"), MessageDialog.CONFIRM, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 1);
    boolean openConfirm = dialog.open() == Window.OK;
    if (openConfirm) {
        Session session = new EObjectQuery(linksView.getInput()).getSession();
        if (session != null) {
            TransactionalEditingDomain editingDomain = session.getTransactionalEditingDomain();
            RecordingCommand cmd = new // $NON-NLS-1$
            RecordingCommand(// $NON-NLS-1$
            editingDomain, // $NON-NLS-1$
            "UnLink Requirements") {

                protected void doExecute() {
                    for (EObjectLink link : linksView.getSelectedEntries()) {
                        if (link instanceof RequirementLink) {
                            RequirementLink reqLink = (RequirementLink) link;
                            reqLink.getRequirement().getReferencedObject().remove(linksView.getInput());
                        }
                    }
                }
            };
            editingDomain.getCommandStack().execute(cmd);
        }
        linksView.refresh();
    }
}
Also used : EObjectQuery(org.eclipse.sirius.business.api.query.EObjectQuery) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) RecordingCommand(org.eclipse.emf.transaction.RecordingCommand) EObjectLink(org.obeonetwork.tools.linker.EObjectLink) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) RequirementLink(org.obeonetwork.tools.requirement.core.RequirementLink) Session(org.eclipse.sirius.business.api.session.Session)

Aggregations

RequirementLink (org.obeonetwork.tools.requirement.core.RequirementLink)4 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)3 ExecutionException (org.eclipse.core.commands.ExecutionException)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 DomainPropertiesEditionContext (org.eclipse.emf.eef.runtime.context.impl.DomainPropertiesEditionContext)2 WizardEditingOperation (org.eclipse.emf.eef.runtime.impl.operation.WizardEditingOperation)2 RequirementEditingOperation (org.obeonetwork.tools.requirement.wizard.operation.RequirementEditingOperation)2 ArrayList (java.util.ArrayList)1 EObject (org.eclipse.emf.ecore.EObject)1 RecordingCommand (org.eclipse.emf.transaction.RecordingCommand)1 Action (org.eclipse.jface.action.Action)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 EObjectQuery (org.eclipse.sirius.business.api.query.EObjectQuery)1 Session (org.eclipse.sirius.business.api.session.Session)1 EObjectLink (org.obeonetwork.tools.linker.EObjectLink)1 CreateRequirementAction (org.obeonetwork.tools.requirement.ui.view.action.CreateRequirementAction)1 EditRequirementAction (org.obeonetwork.tools.requirement.ui.view.action.EditRequirementAction)1 LinkRequirementAction (org.obeonetwork.tools.requirement.ui.view.action.LinkRequirementAction)1