use of org.obeonetwork.tools.doc.core.command.RemoveDocumentationLinkCommand 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();
}
}
}
Aggregations