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();
}
}
}
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());
}
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();
}
}
}
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;
}
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();
}
Aggregations