Search in sources :

Example 1 with InsertLocation

use of org.eclipse.mylyn.internal.wikitext.ui.editor.operations.InsertLocation 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() }));
            }
        }
    }
}
Also used : AbstractDocumentCommand(org.eclipse.mylyn.internal.wikitext.ui.editor.operations.AbstractDocumentCommand) ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) InsertLocation(org.eclipse.mylyn.internal.wikitext.ui.editor.operations.InsertLocation) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

Aggregations

ISafeRunnable (org.eclipse.core.runtime.ISafeRunnable)1 AbstractDocumentCommand (org.eclipse.mylyn.internal.wikitext.ui.editor.operations.AbstractDocumentCommand)1 InsertLocation (org.eclipse.mylyn.internal.wikitext.ui.editor.operations.InsertLocation)1 OutlineItem (org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)1