use of org.eclipse.mylyn.internal.wikitext.ui.editor.operations.AbstractDocumentCommand in project mylyn.docs by eclipse.
the class OutlineDropTargetListener method drop.
public void drop(DropTargetEvent event) {
List<OutlineItem> dropItems = getDropItems(event);
if (dropItems != null) {
InsertLocation location = computeInsertLocation(event);
Object targetData = event.item.getData();
final AbstractDocumentCommand command = computeCommand(targetData, dropItems, location);
if (command != null) {
if (command.isEnabled()) {
SafeRunnable.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
WikiTextUiPlugin.getDefault().log(exception);
MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.OutlineDropTargetListener_0, NLS.bind(Messages.OutlineDropTargetListener_1, new Object[] { exception.getMessage() }));
}
public void run() throws Exception {
commandManager.perform(command);
}
});
} else {
MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.OutlineDropTargetListener_2, NLS.bind(Messages.OutlineDropTargetListener_3, new Object[] { command.getProblemText() }));
}
}
}
}
Aggregations